Fix some variable may be used uninitialized warnings.

svn-id: r40528
This commit is contained in:
Johannes Schickel 2009-05-13 18:12:17 +00:00
parent b9ac179b2e
commit f0182121f7
5 changed files with 8 additions and 2 deletions

View file

@ -141,6 +141,7 @@ bool AgiEngine::predictiveDialog(void) {
// show the predictive dialog. // show the predictive dialog.
// if another window is already in display, save its state into tmpwindow // if another window is already in display, save its state into tmpwindow
memset(&tmpwindow, 0, sizeof(tmpwindow));
tmpwindow.active = false; tmpwindow.active = false;
if (_game.window.active) if (_game.window.active)
memcpy(&tmpwindow, &(_game.window), sizeof(AgiBlock)); memcpy(&tmpwindow, &(_game.window), sizeof(AgiBlock));

View file

@ -53,6 +53,9 @@ void decodeGfxUnified(dataFileEntry *pCurrentFileEntry, int16 format) {
case 5: case 5:
spriteSize = pCurrentFileEntry->height * pCurrentFileEntry->widthInColumn; spriteSize = pCurrentFileEntry->height * pCurrentFileEntry->widthInColumn;
break; break;
default:
error("Unkown gfx format %d", format);
} }
uint8 *buffer = (uint8 *)malloc(spriteSize); uint8 *buffer = (uint8 *)malloc(spriteSize);
@ -66,7 +69,7 @@ void decodeGfxUnified(dataFileEntry *pCurrentFileEntry, int16 format) {
uint8 c; uint8 c;
uint16 p0; uint16 p0;
// Format 4 // Format 4
uint16 p1, p2, p3; uint16 p1 = 0, p2 = 0, p3 = 0;
p0 = (dataPtr[0] << 8) | dataPtr[1]; p0 = (dataPtr[0] << 8) | dataPtr[1];

View file

@ -1155,7 +1155,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size,
int pos = 0; int pos = 0;
int x, y; int x, y;
int oldx, oldy; int oldx, oldy;
int pal, index; int pal = 0, index = 0;
int temp; int temp;
int line_mode = style->line_mode; int line_mode = style->line_mode;
// NOTE: here, it is assumed that the titlebar size is always 10. This may differ depending on // NOTE: here, it is assumed that the titlebar size is always 10. This may differ depending on

View file

@ -339,6 +339,7 @@ DisplayedText Text::displayText(char *textPtr, uint8 *dest, bool centre, uint16
} while (textChar >= 10); } while (textChar >= 10);
DisplayedText ret; DisplayedText ret;
memset(&ret, 0, sizeof(ret));
ret.textData = dest; ret.textData = dest;
ret.textWidth = dtLastWidth; ret.textWidth = dtLastWidth;
return ret; return ret;

View file

@ -285,6 +285,7 @@ void Screen::buildDisplay() {
byte *file = _vm->_resman->openResource(_thisScreen.background_layer_id); byte *file = _vm->_resman->openResource(_thisScreen.background_layer_id);
MultiScreenHeader screenLayerTable; MultiScreenHeader screenLayerTable;
memset(&screenLayerTable, 0, sizeof(screenLayerTable));
if (!Sword2Engine::isPsx()) // On PSX version, there would be nothing to read here if (!Sword2Engine::isPsx()) // On PSX version, there would be nothing to read here
screenLayerTable.read(file + ResHeader::size()); screenLayerTable.read(file + ResHeader::size());