Enforce conversion formatting on pointer casts in the DEV code.

svn-id: r49068
This commit is contained in:
Johannes Schickel 2010-05-17 22:46:53 +00:00
parent 01070d72d3
commit cbbb78d9f2
20 changed files with 68 additions and 68 deletions

View File

@ -105,17 +105,17 @@ uint32 DataStream::read(void *dataPtr, uint32 dataSize) {
return _stream->read(dataPtr, dataSize);
if (!_io->isDataFileChunk(_handle))
return _io->file_getHandle(_handle)->read((byte *) dataPtr, dataSize);
return _io->file_getHandle(_handle)->read((byte *)dataPtr, dataSize);
byte *data = (byte *) dataPtr;
byte *data = (byte *)dataPtr;
uint32 haveRead = 0;
while (dataSize > 0x3FFF) {
_io->readChunk(_handle, (byte *) data, 0x3FFF);
_io->readChunk(_handle, (byte *)data, 0x3FFF);
dataSize -= 0x3FFF;
data += 0x3FFF;
haveRead += 0x3FFF;
}
_io->readChunk(_handle, (byte *) data, dataSize);
_io->readChunk(_handle, (byte *)data, dataSize);
return haveRead + dataSize;
}

View File

@ -94,7 +94,7 @@ bool DemoPlayer::play(uint32 index) {
case kScriptSourceDirect:
{
Common::MemoryReadStream stream((const byte *) script.script, strlen(script.script));
Common::MemoryReadStream stream((const byte *)script.script, strlen(script.script));
init();
return playStream(stream);

View File

@ -178,7 +178,7 @@ public:
}
void adjustCoords(char adjust, int16 *coord1, int16 *coord2);
void adjustCoords(char adjust, uint16 *coord1, uint16 *coord2) {
adjustCoords(adjust, (int16 *) coord1, (int16 *) coord2);
adjustCoords(adjust, (int16 *)coord1, (int16 *)coord2);
}
int stringLength(const char *str, int16 fontIndex);
void drawString(const char *str, int16 x, int16 y, int16 color1, int16 color2,

View File

@ -77,10 +77,10 @@ int32 Expression::encodePtr(byte *ptr, int type) {
offset = _vm->_game->_script->getOffset(ptr);
break;
case kInterVar:
offset = ptr - ((byte *) _vm->_inter->_variables->getAddressOff8(0));
offset = ptr - ((byte *)_vm->_inter->_variables->getAddressOff8(0));
break;
case kResStr:
offset = ptr - ((byte *) _resultStr);
offset = ptr - ((byte *)_resultStr);
break;
default:
error("Expression::encodePtr(): Unknown pointer type");
@ -96,10 +96,10 @@ byte *Expression::decodePtr(int32 n) {
case kExecPtr:
return _vm->_game->_script->getData((n & 0x0FFFFFFF));
case kInterVar:
ptr = (byte *) _vm->_inter->_variables->getAddressOff8(0);
ptr = (byte *)_vm->_inter->_variables->getAddressOff8(0);
break;
case kResStr:
ptr = (byte *) _resultStr;
ptr = (byte *)_resultStr;
break;
default:
error("Expression::decodePtr(): Unknown pointer type");
@ -495,7 +495,7 @@ int Expression::cmpHelper(const StackFrame &stackFrame) {
} else if (type == OP_LOAD_IMM_STR) {
if ((char *)decodePtr(stackFrame.values[-3]) != _resultStr) {
strcpy(_resultStr, (char *)decodePtr(stackFrame.values[-3]));
stackFrame.values[-3] = encodePtr((byte *) _resultStr, kResStr);
stackFrame.values[-3] = encodePtr((byte *)_resultStr, kResStr);
}
cmpTemp = strcmp(_resultStr, (char *)decodePtr(stackFrame.values[-1]));
}
@ -727,7 +727,7 @@ void Expression::loadValue(byte operation, uint32 varBase, const StackFrame &sta
case OP_LOAD_IMM_STR:
*stackFrame.opers = OP_LOAD_IMM_STR;
*stackFrame.values = encodePtr((byte *) _vm->_game->_script->readString(), kExecPtr);
*stackFrame.values = encodePtr((byte *)_vm->_game->_script->readString(), kExecPtr);
break;
case OP_LOAD_VAR_INT32:
@ -797,11 +797,11 @@ void Expression::simpleArithmetic1(StackFrame &stackFrame) {
switch (stackFrame.opers[-1]) {
case OP_ADD:
if (stackFrame.opers[-2] == OP_LOAD_IMM_STR) {
if ((char *) decodePtr(stackFrame.values[-2]) != _resultStr) {
strcpy(_resultStr, (char *) decodePtr(stackFrame.values[-2]));
stackFrame.values[-2] = encodePtr((byte *) _resultStr, kResStr);
if ((char *)decodePtr(stackFrame.values[-2]) != _resultStr) {
strcpy(_resultStr, (char *)decodePtr(stackFrame.values[-2]));
stackFrame.values[-2] = encodePtr((byte *)_resultStr, kResStr);
}
strcat(_resultStr, (char *) decodePtr(stackFrame.values[0]));
strcat(_resultStr, (char *)decodePtr(stackFrame.values[0]));
stackFrame.pop(2);
}
break;
@ -873,12 +873,12 @@ bool Expression::complexArithmetic(Stack &stack, StackFrame &stackFrame, int16 b
if (stack.opers[brackStart] == OP_LOAD_IMM_INT16) {
stack.values[brackStart] += stackFrame.values[-1];
} else if (stack.opers[brackStart] == OP_LOAD_IMM_STR) {
if ((char *) decodePtr(stack.values[brackStart]) != _resultStr) {
strcpy(_resultStr, (char *) decodePtr(stack.values[brackStart]));
if ((char *)decodePtr(stack.values[brackStart]) != _resultStr) {
strcpy(_resultStr, (char *)decodePtr(stack.values[brackStart]));
stack.values[brackStart] =
encodePtr((byte *) _resultStr, kResStr);
encodePtr((byte *)_resultStr, kResStr);
}
strcat(_resultStr, (char *) decodePtr(stackFrame.values[-1]));
strcat(_resultStr, (char *)decodePtr(stackFrame.values[-1]));
}
stackFrame.pop(2);
break;
@ -982,8 +982,8 @@ void Expression::getResult(byte operation, int32 value, byte *type) {
break;
case OP_LOAD_IMM_STR:
if ((char *) decodePtr(value) != _resultStr)
strcpy(_resultStr, (char *) decodePtr(value));
if ((char *)decodePtr(value) != _resultStr)
strcpy(_resultStr, (char *)decodePtr(value));
break;
case OP_LOAD_VAR_INT32:
@ -1113,11 +1113,11 @@ int16 Expression::parseExpr(byte stopToken, byte *type) {
if (stackFrame.opers[-3] == OP_LOAD_IMM_INT16) {
stackFrame.values[-3] += stackFrame.values[-1];
} else if (stackFrame.opers[-3] == OP_LOAD_IMM_STR) {
if ((char *) decodePtr(stackFrame.values[-3]) != _resultStr) {
strcpy(_resultStr, (char *) decodePtr(stackFrame.values[-3]));
stackFrame.values[-3] = encodePtr((byte *) _resultStr, kResStr);
if ((char *)decodePtr(stackFrame.values[-3]) != _resultStr) {
strcpy(_resultStr, (char *)decodePtr(stackFrame.values[-3]));
stackFrame.values[-3] = encodePtr((byte *)_resultStr, kResStr);
}
strcat(_resultStr, (char *) decodePtr(stackFrame.values[-1]));
strcat(_resultStr, (char *)decodePtr(stackFrame.values[-1]));
}
stackFrame.pop(2);

View File

@ -149,7 +149,7 @@ int16 Goblin::peekGoblin(Gob_Object *_curGob) {
ptr = _objList->pHead;
index = 0;
while (ptr != 0) {
desc = (Gob_Object *) ptr->pData;
desc = (Gob_Object *)ptr->pData;
if (desc != _curGob) {
for (i = 0; i < 3; i++) {
if (desc != _goblins[i])
@ -220,7 +220,7 @@ void Goblin::drawObjects() {
ptr = _objList->pHead;
for (ptr = _objList->pHead; ptr != 0; ptr = ptr->pNext) {
objDesc = (Gob_Object *) ptr->pData;
objDesc = (Gob_Object *)ptr->pData;
if (objDesc->type == 3)
objDesc->toRedraw = 1;
@ -229,7 +229,7 @@ void Goblin::drawObjects() {
}
for (ptr = _objList->pHead; ptr != 0; ptr = ptr->pNext) {
objDesc = (Gob_Object *) ptr->pData;
objDesc = (Gob_Object *)ptr->pData;
if (objDesc->toRedraw == 0)
continue;
@ -273,7 +273,7 @@ void Goblin::drawObjects() {
sortByOrder(_objList);
for (ptr = _objList->pHead; ptr != 0; ptr = ptr->pNext) {
objDesc = (Gob_Object *) ptr->pData;
objDesc = (Gob_Object *)ptr->pData;
if (objDesc->toRedraw) {
layer =
objDesc->stateMach[objDesc->state][objDesc->
@ -321,7 +321,7 @@ void Goblin::drawObjects() {
if ((objDesc->type == 0) && (objDesc->visible != 0)) {
for (ptr2 = _objList->pHead; ptr2 != 0; ptr2 = ptr2->pNext) {
gobDesc2 = (Gob_Object *) ptr2->pData;
gobDesc2 = (Gob_Object *)ptr2->pData;
if (gobDesc2->toRedraw == 0)
continue;
@ -357,7 +357,7 @@ void Goblin::drawObjects() {
}
for (ptr = _objList->pHead; ptr != 0; ptr = ptr->pNext) {
objDesc = (Gob_Object *) ptr->pData;
objDesc = (Gob_Object *)ptr->pData;
if ((objDesc->toRedraw == 0) || (objDesc->type == 1))
continue;
@ -417,7 +417,7 @@ void Goblin::animateObjects() {
int16 layer;
for (node = _objList->pHead; node != 0; node = node->pNext) {
objDesc = (Gob_Object *) node->pData;
objDesc = (Gob_Object *)node->pData;
if ((objDesc->doAnim != 1) || (objDesc->type != 0))
continue;

View File

@ -1352,7 +1352,7 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs,
uint16 length = _vm->_game->_script->readUint16();
inputs[inputCount].str =
(const char *) (_vm->_game->_script->getData() + _vm->_game->_script->pos());
(const char *)(_vm->_game->_script->getData() + _vm->_game->_script->pos());
_vm->_game->_script->skip(length);
}

View File

@ -136,9 +136,9 @@ void Init::initGame() {
} else {
infBuf = _vm->_dataIO->getData("intro.inf");
infPtr = (char *) infBuf;
infPtr = (char *)infBuf;
infEnd = (char *) (infBuf + _vm->_dataIO->getDataSize("intro.inf"));
infEnd = (char *)(infBuf + _vm->_dataIO->getDataSize("intro.inf"));
for (int i = 0; i < 8; i++, infPtr++) {
int j;
@ -185,7 +185,7 @@ void Init::initGame() {
_vm->_util->clearPalette();
DataStream *stream = _vm->_dataIO->getDataStream("coktel.clt");
stream->read((byte *) _vm->_draw->_vgaPalette, 768);
stream->read((byte *)_vm->_draw->_vgaPalette, 768);
delete stream;
if (_vm->_dataIO->existData("coktel.ims")) {

View File

@ -111,7 +111,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams &params) {
_vm->shouldQuit()) {
_vm->_palAnim->fade(0, -2, 0);
_vm->_video->clearSurf(*_vm->_draw->_frontSurface);
memset((char *) _vm->_draw->_vgaPalette, 0, 768);
memset((char *)_vm->_draw->_vgaPalette, 0, 768);
WRITE_VAR(4, buttons);
WRITE_VAR(0, kKeyEscape);
WRITE_VAR(57, (uint32) -1);
@ -154,7 +154,7 @@ void Inter_Bargon::oBargon_intro3(OpGobParams &params) {
_vm->_sound->blasterPlayComposition(comp, 0, samples, 2);
for (int i = 0; i < 20; i++) {
for (int j = 0; j < 4; j++) {
_vm->_global->_pPaletteDesc->vgaPal = (Video::Color *) palettes[j];
_vm->_global->_pPaletteDesc->vgaPal = (Video::Color *)palettes[j];
_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
_vm->_util->longDelay(_vm->_util->getRandom(200));
}

View File

@ -468,7 +468,7 @@ void Inter_v1::o1_initMult() {
_vm->_mult->_objects[i].pPosY = new VariableReference(*_variables, offPosY);
_vm->_mult->_objects[i].pAnimData =
(Mult::Mult_AnimData *) _variables->getAddressOff8(offAnim);
(Mult::Mult_AnimData *)_variables->getAddressOff8(offAnim);
_vm->_mult->_objects[i].pAnimData->isStatic = 1;
_vm->_mult->_objects[i].tick = 0;
@ -526,7 +526,7 @@ void Inter_v1::o1_loadMultObject() {
debugC(4, kDebugGameFlow, "Loading mult object %d", objIndex);
multData = (byte *) _vm->_mult->_objects[objIndex].pAnimData;
multData = (byte *)_vm->_mult->_objects[objIndex].pAnimData;
for (int i = 0; i < 11; i++) {
if (_vm->_game->_script->peekUint16() != 99) {
_vm->_game->_script->evalExpr(&val);
@ -1119,12 +1119,12 @@ bool Inter_v1::o1_palLoad(OpFuncParams &params) {
if (!resource)
break;
memcpy((char *) _vm->_draw->_vgaPalette, resource->getData(), MIN<int>(768, resource->getSize()));
memcpy((char *)_vm->_draw->_vgaPalette, resource->getData(), MIN<int>(768, resource->getSize()));
delete resource;
break;
case 54:
memset((char *) _vm->_draw->_vgaPalette, 0, 768);
memset((char *)_vm->_draw->_vgaPalette, 0, 768);
break;
case 61:
@ -1135,7 +1135,7 @@ bool Inter_v1::o1_palLoad(OpFuncParams &params) {
if (!resource)
break;
memcpy((char *) _vm->_draw->_vgaPalette + index1 * 3,
memcpy((char *)_vm->_draw->_vgaPalette + index1 * 3,
resource->getData() + index1 * 3, index2);
delete resource;
@ -1778,7 +1778,7 @@ bool Inter_v1::o1_readData(OpFuncParams &params) {
if (((dataVar >> 2) == 59) && (size == 4))
WRITE_VAR(59, stream->readUint32LE());
else
retSize = stream->read((byte *) _variables->getAddressOff8(dataVar), size);
retSize = stream->read((byte *)_variables->getAddressOff8(dataVar), size);
if (retSize == size)
WRITE_VAR(1, 0);

View File

@ -344,7 +344,7 @@ void Inter_v2::o2_initMult() {
_vm->_mult->_objects[i].pPosY = new VariableReference(*_vm->_inter->_variables, offPosY);
_vm->_mult->_objects[i].pAnimData =
(Mult::Mult_AnimData *) _variables->getAddressOff8(offAnim);
(Mult::Mult_AnimData *)_variables->getAddressOff8(offAnim);
_vm->_mult->_objects[i].pAnimData->isStatic = 1;
_vm->_mult->_objects[i].tick = 0;
@ -409,7 +409,7 @@ void Inter_v2::o2_loadMultObject() {
debugC(4, kDebugGameFlow, "Loading mult object %d", objIndex);
multData = (byte *) _vm->_mult->_objects[objIndex].pAnimData;
multData = (byte *)_vm->_mult->_objects[objIndex].pAnimData;
for (int i = 0; i < 11; i++) {
if (_vm->_game->_script->peekByte() != 99)
multData[i] = _vm->_game->_script->readValExpr();

View File

@ -357,7 +357,7 @@ bool Inter_v6::o6_palLoad(OpFuncParams &params) {
o1_palLoad(params);
if (_gotFirstPalette)
_vm->_video->_palLUT->setPalette((const byte *) _vm->_global->_pPaletteDesc->vgaPal,
_vm->_video->_palLUT->setPalette((const byte *)_vm->_global->_pPaletteDesc->vgaPal,
Graphics::PaletteLUT::kPaletteRGB, 6, 0);
_gotFirstPalette = true;

View File

@ -85,7 +85,7 @@ void Map_v2::loadMapObjects(const char *avjFile) {
_mapUnknownBool = READ_VARO_UINT8(var + 4) ? true : false;
break;
case 65535:
_passMap = (int8 *) _vm->_inter->_variables->getAddressOff8(var);
_passMap = (int8 *)_vm->_inter->_variables->getAddressOff8(var);
break;
default:
warning("Map_v2::loadMapObjects(): ID == %d", (uint16) id);
@ -156,7 +156,7 @@ void Map_v2::loadMapObjects(const char *avjFile) {
if ((variables != 0) &&
(variables != _vm->_inter->_variables->getAddressOff8(0))) {
_passMap = (int8 *) variables;
_passMap = (int8 *)variables;
mapHeight = _screenHeight / _tilesHeight;
mapWidth = _screenWidth / _tilesWidth;

View File

@ -295,8 +295,8 @@ void Mult::prepPalAnim(bool &stop) {
_multData->palAnimIndices[2] = 0;
_multData->palAnimIndices[3] = 0;
memcpy((char *) _palAnimPalette,
(char *) _vm->_global->_pPaletteDesc->vgaPal, 768);
memcpy((char *)_palAnimPalette,
(char *)_vm->_global->_pPaletteDesc->vgaPal, 768);
_vm->_global->_pPaletteDesc->vgaPal = _palAnimPalette;
}
}

View File

@ -257,7 +257,7 @@ bool TempSpriteHandler::load(int16 dataVar, int32 size, int32 offset) {
// Handle palette
if (usesPalette(size)) {
if (!_sprite->writePalette((byte *) _vm->_global->_pPaletteDesc->vgaPal))
if (!_sprite->writePalette((byte *)_vm->_global->_pPaletteDesc->vgaPal))
return false;
_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
@ -289,7 +289,7 @@ bool TempSpriteHandler::save(int16 dataVar, int32 size, int32 offset) {
// Handle palette
if (usesPalette(size)) {
if (!_sprite->readPalette((const byte *) _vm->_global->_pPaletteDesc->vgaPal))
if (!_sprite->readPalette((const byte *)_vm->_global->_pPaletteDesc->vgaPal))
return false;
}

View File

@ -210,7 +210,7 @@ char *Script::readString(int32 length) {
while (_totPtr[length++] != '\0') { }
}
char *string = (char *) _totPtr;
char *string = (char *)_totPtr;
_totPtr += length;
@ -262,7 +262,7 @@ int32 Script::peekInt32(int32 offset) {
}
char *Script::peekString(int32 offset) {
return (char *) (_totPtr + offset);
return (char *)(_totPtr + offset);
}
int16 Script::readVarIndex(uint16 *size, uint16 *type) {

View File

@ -187,7 +187,7 @@ byte *CDROM::getTrackBuffer(const char *trackName) const {
byte *curPtr = _LICbuffer;
for (int i = 0; i < _numTracks; i++) {
if (!scumm_stricmp((char *) curPtr, trackName)) {
if (!scumm_stricmp((char *)curPtr, trackName)) {
matchPtr = curPtr;
break;
}

View File

@ -122,7 +122,7 @@ bool Sound::sampleLoad(SoundDesc *sndDesc, SoundType type, const char *fileName,
byte *data;
uint32 size;
data = (byte *) _vm->_dataIO->getData(fileName);
data = (byte *)_vm->_dataIO->getData(fileName);
if (!data)
return false;

View File

@ -80,7 +80,7 @@ void Variables::writeOff32(uint32 offset, uint32 value) {
}
void Variables::writeOffString(uint32 offset, const char *value) {
strcpy((char *) (_vars + offset), value);
strcpy((char *)(_vars + offset), value);
}
uint8 Variables::readVar8(uint32 var) const {
@ -112,7 +112,7 @@ uint32 Variables::readOff32(uint32 offset) const {
}
void Variables::readOffString(uint32 offset, char *value, uint32 length) {
strncpy0(value, (const char *) (_vars + offset), length - 1);
strncpy0(value, (const char *)(_vars + offset), length - 1);
}
const uint8 *Variables::getAddressVar8(uint32 var) const {
@ -132,19 +132,19 @@ char *Variables::getAddressVarString(uint32 var) {
}
const uint8 *Variables::getAddressOff8(uint32 offset) const {
return ((const uint8 *) (_vars + offset));
return ((const uint8 *)(_vars + offset));
}
uint8 *Variables::getAddressOff8(uint32 offset) {
return ((uint8 *) (_vars + offset));
return ((uint8 *)(_vars + offset));
}
const char *Variables::getAddressOffString(uint32 offset) const {
return ((const char *) (_vars + offset));
return ((const char *)(_vars + offset));
}
char *Variables::getAddressOffString(uint32 offset) {
return ((char *) (_vars + offset));
return ((char *)(_vars + offset));
}
bool Variables::copyTo(uint32 offset, byte *variables, uint32 n) const {

View File

@ -39,8 +39,8 @@ Video_v6::Video_v6(GobEngine *vm) : Video_v2(vm) {
}
void Video_v6::setPrePalette() {
byte *tpal = (byte *) _vm->_draw->_vgaPalette;
const byte *fpal = (const byte *) _ditherPalette;
byte *tpal = (byte *)_vm->_draw->_vgaPalette;
const byte *fpal = (const byte *)_ditherPalette;
for (int i = 0; i < 256; i++) {
byte r, g, b;

View File

@ -374,7 +374,7 @@ bool VideoPlayer::primaryPlay(int16 startFrame, int16 lastFrame, int16 breakKey,
if (b) {
_vm->_palAnim->fade(0, -2, 0);
memset((char *) _vm->_draw->_vgaPalette, 0, 768);
memset((char *)_vm->_draw->_vgaPalette, 0, 768);
}
if (!_noCursorSwitch)
@ -759,7 +759,7 @@ void VideoPlayer::copyPalette(Graphics::CoktelVideo &video, int16 palStart, int1
if (palEnd < 0)
palEnd = 255;
memcpy(((char *) (_vm->_global->_pPaletteDesc->vgaPal)) + palStart * 3,
memcpy(((char *)(_vm->_global->_pPaletteDesc->vgaPal)) + palStart * 3,
video.getPalette() + palStart * 3,
(palEnd - palStart + 1) * 3);
}