potentially uninitialized variable warnings
src/mkroom.c(1068) : warning C4701: potentially uninitialized local variable 'insidex' used src/mkroom.c(1070) : warning C4701: potentially uninitialized local variable 'insidey' used The warning is because the insidex and insidey variables only get assigned a value conditionally within a for-loop, but contain random values if that for-loop is not executed, and they are used unconditionaly later on in the code. Initializing them changes that from containing random values to containing zeros, whether that is appropriate or not. In this particular case, insidex and insidey look to be riding on the coat tails of insidect and there is a check for invalid insidect in the code, so that should catch the situation.
This commit is contained in:
@@ -1041,7 +1041,7 @@ invalid_shop_shape(struct mkroom *sroom)
|
||||
coordxy x, y;
|
||||
coordxy doorx = g.doors[sroom->fdoor].x;
|
||||
coordxy doory = g.doors[sroom->fdoor].y;
|
||||
coordxy insidex, insidey, insidect = 0;
|
||||
coordxy insidex = 0, insidey = 0, insidect = 0;
|
||||
|
||||
/* First, identify squares inside the room and next to the door. */
|
||||
for (x = max(doorx - 1, sroom->lx);
|
||||
|
||||
Reference in New Issue
Block a user