[Scummvm-cvs-logs] CVS: scummvm/saga actionmap.cpp,1.34,1.35 actor.cpp,1.67,1.68 animation.cpp,1.34,1.35 events.cpp,1.40,1.41 font.cpp,1.22,1.23 game.cpp,1.45,1.46 isomap.cpp,1.24,1.25 ite_introproc.cpp,1.40,1.41 objectmap.cpp,1.32,1.33 rscfile.cpp,1.16,1.17 scene.cpp,1.68,1.69 script.cpp,1.40,1.41 sprite.cpp,1.35,1.36 sthread.cpp,1.51,1.52
Torbjörn Andersson
eriktorbjorn at users.sourceforge.net
Sun Jan 2 06:53:06 CET 2005
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20953
Modified Files:
actionmap.cpp actor.cpp animation.cpp events.cpp font.cpp
game.cpp isomap.cpp ite_introproc.cpp objectmap.cpp
rscfile.cpp scene.cpp script.cpp sprite.cpp sthread.cpp
Log Message:
Changed "sizeof x" to "sizeof(x)" for consistency with the rest of ScummVM,
and used ARRAYSIZE() instead in two cases.
Index: actionmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actionmap.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- actionmap.cpp 1 Jan 2005 16:18:36 -0000 1.34
+++ actionmap.cpp 2 Jan 2005 14:51:59 -0000 1.35
@@ -50,7 +50,7 @@
if (_stepZoneList)
error("ActionMap::load _stepZoneList != NULL");
- _stepZoneList = (HitZone **) malloc(_stepZoneListCount * sizeof (HitZone *));
+ _stepZoneList = (HitZone **) malloc(_stepZoneListCount * sizeof(HitZone *));
if (_stepZoneList == NULL) {
error("ActionMap::load Memory allocation failure");
}
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- actor.cpp 1 Jan 2005 16:18:36 -0000 1.67
+++ actor.cpp 2 Jan 2005 14:51:59 -0000 1.68
@@ -124,7 +124,7 @@
_xCellCount = _vm->getDisplayWidth() / 2;
_pathCellCount = _yCellCount * _xCellCount;
- _pathCell = (int*)malloc(_pathCellCount * sizeof *_pathCell);
+ _pathCell = (int*)malloc(_pathCellCount * sizeof(*_pathCell));
_pathRect.left = 0;
Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/animation.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- animation.cpp 1 Jan 2005 16:18:36 -0000 1.34
+++ animation.cpp 2 Jan 2005 14:52:00 -0000 1.35
@@ -79,7 +79,7 @@
return FAILURE;
}
- new_anim = (ANIMATION *)malloc(sizeof *new_anim);
+ new_anim = (ANIMATION *)malloc(sizeof(*new_anim));
if (new_anim == NULL) {
warning("Anim::load Allocation failure");
return MEM;
@@ -96,7 +96,7 @@
if (_vm->_gameType == GType_ITE) {
// Cache frame offsets
- new_anim->frame_offsets = (size_t *)malloc(new_anim->n_frames * sizeof *new_anim->frame_offsets);
+ new_anim->frame_offsets = (size_t *)malloc(new_anim->n_frames * sizeof(*new_anim->frame_offsets));
if (new_anim->frame_offsets == NULL) {
warning("Anim::load Allocation failure");
return MEM;
Index: events.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/events.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- events.cpp 2 Jan 2005 14:36:00 -0000 1.40
+++ events.cpp 2 Jan 2005 14:52:00 -0000 1.41
@@ -106,7 +106,7 @@
// and reprocess the event */
delta_time = event_p->time;
EVENT *from_chain=event_p->chain;
- memcpy(event_p, from_chain,sizeof *event_p);
+ memcpy(event_p, from_chain,sizeof(*event_p));
free(from_chain);
event_p->time += delta_time;
@@ -435,7 +435,7 @@
EVENT *new_event;
// Allocate space for new event
- new_event = (EVENT *)malloc(sizeof *new_event);
+ new_event = (EVENT *)malloc(sizeof(*new_event));
if (new_event == NULL) {
return NULL;
}
Index: font.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/font.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- font.cpp 1 Jan 2005 16:18:36 -0000 1.22
+++ font.cpp 2 Jan 2005 14:52:00 -0000 1.23
@@ -47,7 +47,7 @@
assert(_nFonts > 0);
- _fonts = (FONT **)malloc(_nFonts * sizeof *_fonts);
+ _fonts = (FONT **)malloc(_nFonts * sizeof(*_fonts));
if (_fonts == NULL) {
error("Font::Font(): Memory allocation failure.");
}
@@ -109,7 +109,7 @@
MemoryReadStreamEndian readS(fontres_p, fontres_len, IS_BIG_ENDIAN);
// Create new font structure
- font = (FONT *)malloc(sizeof *font);
+ font = (FONT *)malloc(sizeof(*font));
if (font == NULL) {
error("Font:loadFont(): Memory allocation error.");
return MEM;
@@ -127,7 +127,7 @@
debug(2, "Row padding: %d", fh.row_length);
// Create normal font style
- normal_font = (FONT_STYLE *)malloc(sizeof *normal_font);
+ normal_font = (FONT_STYLE *)malloc(sizeof(*normal_font));
if (normal_font == NULL) {
error("Font::loadFont(): Memory allocation error.");
free(font);
@@ -215,14 +215,14 @@
unsigned char c_rep;
// Create new font style structure
- new_font = (FONT_STYLE *)malloc(sizeof *new_font);
+ new_font = (FONT_STYLE *)malloc(sizeof(*new_font));
if (new_font == NULL) {
error("Font::createOutline(): Memory allocation error.");
return NULL;
}
- memset(new_font, 0, sizeof *new_font);
+ memset(new_font, 0, sizeof(*new_font));
// Populate new font style character data
for (i = 0; i < FONT_CHARCOUNT; i++) {
Index: game.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/game.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- game.cpp 1 Jan 2005 16:18:36 -0000 1.45
+++ game.cpp 2 Jan 2005 14:52:00 -0000 1.46
@@ -759,7 +759,7 @@
game_filect = GameDescs[game_n].gd_filect;
- GameModule.gfile_data = (GAME_FILEDATA *)malloc(game_filect * sizeof *GameModule.gfile_data);
+ GameModule.gfile_data = (GAME_FILEDATA *)malloc(game_filect * sizeof(*GameModule.gfile_data));
if (GameModule.gfile_data == NULL) {
return MEM;
}
Index: isomap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/isomap.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- isomap.cpp 1 Jan 2005 16:18:36 -0000 1.24
+++ isomap.cpp 2 Jan 2005 14:52:01 -0000 1.25
@@ -55,7 +55,7 @@
readS.seek(0);
- tile_tbl = (ISOTILE_ENTRY *)malloc(_tile_ct * sizeof *tile_tbl);
+ tile_tbl = (ISOTILE_ENTRY *)malloc(_tile_ct * sizeof(*tile_tbl));
if (tile_tbl == NULL) {
return MEM;
}
@@ -88,7 +88,7 @@
MemoryReadStreamEndian readS(mtileres_p, mtileres_len, IS_BIG_ENDIAN);
mtile_ct = mtileres_len / SAGA_METATILE_ENTRY_LEN;
- mtile_tbl = (ISO_METATILE_ENTRY *)malloc(mtile_ct * sizeof *mtile_tbl);
+ mtile_tbl = (ISO_METATILE_ENTRY *)malloc(mtile_ct * sizeof(*mtile_tbl));
if (mtile_tbl == NULL) {
return MEM;
}
Index: ite_introproc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/ite_introproc.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- ite_introproc.cpp 1 Jan 2005 16:18:36 -0000 1.40
+++ ite_introproc.cpp 2 Jan 2005 14:52:01 -0000 1.41
@@ -654,7 +654,7 @@
"Jon Van Caneghem", MEDIUM_FONT_ID}
};
- int n_credits = sizeof credits / sizeof credits[0];
+ int n_credits = ARRAYSIZE(credits);
int event_delay = 3000;
switch (param) {
@@ -926,7 +926,7 @@
MEDIUM_FONT_ID}
};
- int n_credits = sizeof credits / sizeof credits[0];
+ int n_credits = ARRAYSIZE(credits);
switch (param) {
case SCENE_BEGIN:
Index: objectmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/objectmap.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- objectmap.cpp 1 Jan 2005 16:18:36 -0000 1.32
+++ objectmap.cpp 2 Jan 2005 14:52:01 -0000 1.33
@@ -48,7 +48,7 @@
_nameNumber = readStream->readUint16();
_scriptNumber = readStream->readUint16();
- _clickAreas = (HitZone::ClickArea *)malloc(_clickAreasCount * sizeof *_clickAreas);
+ _clickAreas = (HitZone::ClickArea *)malloc(_clickAreasCount * sizeof(*_clickAreas));
if (_clickAreas == NULL) {
error("HitZone::HitZone Memory allocation failed");
@@ -60,7 +60,7 @@
assert(clickArea->pointsCount);
- clickArea->points = (Point *)malloc(clickArea->pointsCount * sizeof *(clickArea->points));
+ clickArea->points = (Point *)malloc(clickArea->pointsCount * sizeof(*(clickArea->points)));
if (clickArea->points == NULL) {
error("HitZone::HitZone Memory allocation failed");
}
@@ -163,7 +163,7 @@
// Obtain object count N and allocate space for N objects
_nObjects = readS.readUint16();
- _objectMaps = (OBJECTMAP_ENTRY *)malloc(_nObjects * sizeof *_objectMaps);
+ _objectMaps = (OBJECTMAP_ENTRY *)malloc(_nObjects * sizeof(*_objectMaps));
if (_objectMaps == NULL) {
warning("Error: Memory allocation failed");
@@ -179,7 +179,7 @@
readS.readByte();
object_map->objectNum = readS.readUint16();
object_map->scriptNum = readS.readUint16();
- object_map->clickareas = (CLICKAREA *)malloc(object_map->nClickareas * sizeof *(object_map->clickareas));
+ object_map->clickareas = (CLICKAREA *)malloc(object_map->nClickareas * sizeof(*(object_map->clickareas)));
if (object_map->clickareas == NULL) {
warning("Error: Memory allocation failed");
@@ -192,7 +192,7 @@
clickarea->n_points = readS.readUint16LE();
assert(clickarea->n_points != 0);
- clickarea->points = (Point *)malloc(clickarea->n_points * sizeof *(clickarea->points));
+ clickarea->points = (Point *)malloc(clickarea->n_points * sizeof(*(clickarea->points)));
if (clickarea->points == NULL) {
warning("Error: Memory allocation failed");
return MEM;
@@ -263,7 +263,7 @@
_nNames = n_names;
debug(2, "ObjectMap::loadNames: Loading %d object names.", n_names);
- _names = (const char **)malloc(n_names * sizeof *_names);
+ _names = (const char **)malloc(n_names * sizeof(*_names));
if (_names == NULL) {
warning("Error: Memory allocation failed");
@@ -369,7 +369,7 @@
for (i = 0; i < _nObjects; i++) {
draw_color = color;
if (hitObject && (objectNum == _objectMaps[i].objectNum)) {
- snprintf(txt_buf, sizeof txt_buf, "obj %d: v %d, f %X",
+ snprintf(txt_buf, sizeof(txt_buf), "obj %d: v %d, f %X",
_objectMaps[i].objectNum,
_objectMaps[i].defaultVerb,
_objectMaps[i].flags);
Index: rscfile.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/rscfile.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- rscfile.cpp 1 Jan 2005 16:18:36 -0000 1.16
+++ rscfile.cpp 2 Jan 2005 14:52:02 -0000 1.17
@@ -39,7 +39,7 @@
empty_context.rc_file = new File();
RSCFILE_CONTEXT *new_context;
- new_context = (RSCFILE_CONTEXT *)malloc(sizeof *new_context);
+ new_context = (RSCFILE_CONTEXT *)malloc(sizeof(*new_context));
if (new_context == NULL) {
return NULL;
}
@@ -141,7 +141,7 @@
return FAILURE;
}
- rsc_restbl = (RSCFILE_RESOURCE *)malloc(res_tbl_ct * sizeof *rsc_restbl);
+ rsc_restbl = (RSCFILE_RESOURCE *)malloc(res_tbl_ct * sizeof(*rsc_restbl));
if (rsc_restbl == NULL) {
free(tbl_buf);
return FAILURE;
Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- scene.cpp 1 Jan 2005 16:18:36 -0000 1.68
+++ scene.cpp 2 Jan 2005 14:52:02 -0000 1.69
@@ -77,7 +77,7 @@
}
_sceneCount = scene_lut_len / 2;
_sceneMax = _sceneCount - 1;
- _sceneLUT = (int *)malloc(_sceneMax * sizeof *_sceneLUT);
+ _sceneLUT = (int *)malloc(_sceneMax * sizeof(*_sceneLUT));
if (_sceneLUT == NULL) {
warning("Scene::Scene(): Memory allocation failed");
return;
@@ -708,7 +708,7 @@
// Allocate memory for scene resource list
_resListEntries = resource_list_len / SAGA_RESLIST_ENTRY_LEN;
debug(0, "Scene resource list contains %d entries.", _resListEntries);
- _resList = (SCENE_RESLIST *)calloc(_resListEntries, sizeof *_resList);
+ _resList = (SCENE_RESLIST *)calloc(_resListEntries, sizeof(*_resList));
if (_resList == NULL) {
warning("Scene::loadSceneResourceList(): Error: Memory allocation failed");
@@ -764,7 +764,7 @@
}
pal_p = _vm->getImagePal(_bg.res_buf, _bg.res_len);
- memcpy(_bg.pal, pal_p, sizeof _bg.pal);
+ memcpy(_bg.pal, pal_p, sizeof(_bg.pal));
_sceneMode = SCENE_MODE_NORMAL;
break;
case SAGA_BG_MASK: // Scene background mask resource
Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- script.cpp 2 Jan 2005 14:30:50 -0000 1.40
+++ script.cpp 2 Jan 2005 14:52:02 -0000 1.41
@@ -266,7 +266,7 @@
// Initialize script data structure
debug(0, "Loading script data for script #%d", script_num);
- script_data = (SCRIPTDATA *)malloc(sizeof *script_data);
+ script_data = (SCRIPTDATA *)malloc(sizeof(*script_data));
if (script_data == NULL) {
error("Memory allocation failed");
}
@@ -402,13 +402,13 @@
// Allocate a new bytecode resource information structure and table of
// entrypoints
- bc_new_data = (SCRIPT_BYTECODE *)malloc(sizeof *bc_new_data);
+ bc_new_data = (SCRIPT_BYTECODE *)malloc(sizeof(*bc_new_data));
if (bc_new_data == NULL) {
warning("Memory allocation failure loading script bytecode");
return NULL;
}
- bc_ep_tbl = (PROC_TBLENTRY *)malloc(n_entrypoints * sizeof *bc_ep_tbl);
+ bc_ep_tbl = (PROC_TBLENTRY *)malloc(n_entrypoints * sizeof(*bc_ep_tbl));
if (bc_ep_tbl == NULL) {
warning("Memory allocation failure creating script entrypoint table");
free(bc_new_data);
@@ -462,7 +462,7 @@
debug(9, "Loading strings list...");
// Allocate dialogue list structure
- strings = (StringsList *)malloc(sizeof *strings);
+ strings = (StringsList *)malloc(sizeof(*strings));
if (strings == NULL) {
error("No enough memory for strings list");
}
@@ -503,7 +503,7 @@
uint16 i;
- voice_lut = (VOICE_LUT *)malloc(sizeof *voice_lut);
+ voice_lut = (VOICE_LUT *)malloc(sizeof(*voice_lut));
if (voice_lut == NULL) {
return NULL;
}
@@ -514,7 +514,7 @@
return NULL;
}
- voice_lut->voices = (int *)malloc(voice_lut->n_voices * sizeof *voice_lut->voices);
+ voice_lut->voices = (int *)malloc(voice_lut->n_voices * sizeof(*voice_lut->voices));
if (voice_lut->voices == NULL) {
return NULL;
Index: sprite.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sprite.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- sprite.cpp 1 Jan 2005 16:18:36 -0000 1.35
+++ sprite.cpp 2 Jan 2005 14:52:02 -0000 1.36
@@ -83,14 +83,14 @@
sprite_count = readS.readUint16();
- new_slist = (SPRITELIST *)malloc(sizeof *new_slist);
+ new_slist = (SPRITELIST *)malloc(sizeof(*new_slist));
if (new_slist == NULL) {
return MEM;
}
new_slist->sprite_count = sprite_count;
- new_slist->offset_list = (SPRITELIST_OFFSET *)malloc(sprite_count * sizeof *new_slist->offset_list);
+ new_slist->offset_list = (SPRITELIST_OFFSET *)malloc(sprite_count * sizeof(*new_slist->offset_list));
if (new_slist->offset_list == NULL) {
free(new_slist);
return MEM;
@@ -134,7 +134,7 @@
old_sprite_count = spritelist->sprite_count;
new_sprite_count = spritelist->sprite_count + sprite_count;
- test_p = realloc(spritelist->offset_list, new_sprite_count * sizeof *spritelist->offset_list);
+ test_p = realloc(spritelist->offset_list, new_sprite_count * sizeof(*spritelist->offset_list));
if (test_p == NULL) {
return MEM;
}
Index: sthread.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sthread.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- sthread.cpp 1 Jan 2005 16:18:36 -0000 1.51
+++ sthread.cpp 2 Jan 2005 14:52:11 -0000 1.52
@@ -666,7 +666,7 @@
param1 = thread->pop();
iparam2 = (long)param2;
// Preserve most significant bit
- data = (0x01 << ((sizeof param1 * CHAR_BIT) - 1)) & param1;
+ data = (0x01 << ((sizeof(param1) * CHAR_BIT) - 1)) & param1;
for (i = 0; i < (int)iparam2; i++) {
param1 >>= 1;
param1 |= data;
More information about the Scummvm-git-logs
mailing list