Remove warnings from NDS build.

svn-id: r35172
This commit is contained in:
Robin Watts 2008-11-29 18:01:16 +00:00
parent 362bdf87d7
commit 8f3b2e9b4d
23 changed files with 97 additions and 84 deletions

View File

@ -588,7 +588,7 @@ size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) {
return bytes / size;
}
if ((size_t)(handle->pos + size * numItems) > handle->size) {
if ((int)(handle->pos + size * numItems) > handle->size) {
numItems = (handle->size - handle->pos) / size;
if (numItems < 0) numItems = 0;
}

View File

@ -85,6 +85,7 @@
#define fseek(handle, offset, whence) DS::std_fseek(handle, offset, whence)
#define clearerr(handle) DS::std_clearerr(handle)
#define fflush(file) DS::std_fflush(file)
#undef ferror
#define ferror(handle) DS::std_ferror(handle)
#endif

View File

@ -5,7 +5,7 @@
uniformed io-interface to work with Chishm's FAT library
Written by MightyMax
Modified by Chishm:
2005-11-06
* Added WAIT_CR modifications for NDS
@ -28,13 +28,13 @@
* Added EFA2 support
*/
#include "disc_io.h"
#include "scummconsole.h"
#ifdef NDS
#include <nds.h>
#endif
#include "disc_io.h"
#include "scummconsole.h"
// Include known io-interfaces:
#ifdef SUPPORT_MPCF
@ -87,7 +87,7 @@ LPIO_INTERFACE active_interface = 0;
Disc Cache functions
2006-02-03:
Added by www.neoflash.com
Added by www.neoflash.com
*/
int discDetect = 0;
@ -99,7 +99,7 @@ int dldiFound = FALSE;
#include <string.h>
#define CACHE_FREE 0xFFFFFFFF
static u8 cacheBuffer[ DISC_CACHE_COUNT * 512 ];
static struct {
@ -112,20 +112,20 @@ FATDevice currentDevice;
static u32 disc_CacheFind(u32 sector) {
u32 i;
for( i = 0; i < DISC_CACHE_COUNT; i++ ) {
if( cache[ i ].sector == sector )
return i;
}
return CACHE_FREE;
}
static u32 disc_CacheFindFree(void) {
u32 i = 0, j;
u32 count = -1;
for( j = 0; j < DISC_CACHE_COUNT; j++ ) {
if( cache[ j ].sector == CACHE_FREE ) {
@ -142,7 +142,7 @@ static u32 disc_CacheFindFree(void) {
if( cache[ i ].sector != CACHE_FREE && cache[i].dirty != 0 ) {
active_interface->fn_WriteSectors( cache[ i ].sector, 1, &cacheBuffer[ i * 512 ] );
/* todo: handle write error here
// todo: handle write error here
cache[ i ].sector = CACHE_FREE;
cache[ i ].dirty = 0;
@ -368,7 +368,7 @@ bool disc_setDsSlotInterface (void)
active_interface = DLDI_GetInterface();
if (stricmp(&_dldi_driver_name, "Default (No interface)")) {
if (stricmp((char *)(&_dldi_driver_name), "Default (No interface)")) {
char name[48];
memcpy(name, &_dldi_driver_name, 48);
name[47] = '\0';
@ -431,7 +431,7 @@ bool disc_setDsSlotInterface (void)
#endif
bool disc_Init(void)
bool disc_Init(void)
{
#ifdef DISC_CACHE
disc_CacheInit();
@ -455,15 +455,15 @@ bool disc_Init(void)
// could not find a working IO Interface
active_interface = 0 ;
return false ;
}
}
bool disc_IsInserted(void)
bool disc_IsInserted(void)
{
if (active_interface) return active_interface->fn_IsInserted() ;
return false ;
}
}
bool disc_ReadSectors(u32 sector, u8 numSecs, void* buffer)
bool disc_ReadSectors(u32 sector, u8 numSecs, void* buffer)
{
#ifdef DISC_CACHE
u8 *p=(u8*)buffer;
@ -480,9 +480,9 @@ bool disc_ReadSectors(u32 sector, u8 numSecs, void* buffer)
if (active_interface) return active_interface->fn_ReadSectors(sector,numSecs,buffer) ;
return false ;
#endif
}
}
bool disc_WriteSectors(u32 sector, u8 numSecs, void* buffer)
bool disc_WriteSectors(u32 sector, u8 numSecs, void* buffer)
{
/*#ifdef DISC_CACHE
u8 *p=(u8*)buffer;
@ -513,32 +513,32 @@ bool disc_WriteSectors(u32 sector, u8 numSecs, void* buffer)
int r;
for (r = 0; r < numSecs; r++) {
memcpy(sectorBuffer, &buffer[r * 512], 512);
memcpy(sectorBuffer, &((char *)buffer)[r * 512], 512);
if (!active_interface->fn_WriteSectors(sector + r, 1, sectorBuffer))
{
return false;
}
}
return true;
}
#else
if (active_interface) return active_interface->fn_WriteSectors(sector,numSecs,buffer) ;
return false ;
#endif
//#endif
}
return false ;
}
bool disc_ClearStatus(void)
bool disc_ClearStatus(void)
{
if (active_interface) return active_interface->fn_ClearStatus() ;
return false ;
}
}
bool disc_Shutdown(void)
bool disc_Shutdown(void)
{
#ifdef DISC_CACHE
disc_CacheFlush();
@ -546,7 +546,7 @@ bool disc_Shutdown(void)
if (active_interface) active_interface->fn_Shutdown() ;
active_interface = 0 ;
return true ;
}
}
u32 disc_HostType (void)
{

View File

@ -70,7 +70,6 @@ void sortAutoCompleteWordList() {
// Sends the current available words to the virtual keyboard code for display
bool findWordCompletions(char* input)
{
char testWord[32];
int min = 0;
int max = wordBufferPtrPos - 1;
char* word;
@ -136,7 +135,7 @@ bool findWordCompletions(char* input)
bool match = true;
for (int r = 0; r < strlen(partialWord); r++) {
for (int r = 0; partialWord[r] != 0; r++) {
if (word[r] != partialWord[r]) {
match = false;
break;
@ -155,7 +154,7 @@ bool findWordCompletions(char* input)
do {
for (int r = 0; r < strlen(partialWord); r++) {
for (int r = 0; partialWord[r] != 0; r++) {
if (word[r] != partialWord[r]) {
match = false;
break;

View File

@ -80,8 +80,8 @@ int AgiEngine::saveGame(const char *fileName, const char *description) {
tm curTime;
_system->getTimeAndDate(curTime);
uint32 saveDate = (curTime.tm_mday & 0xFF) << 24 | ((curTime.tm_mon + 1) & 0xFF) << 16 | (curTime.tm_year + 1900) & 0xFFFF;
uint16 saveTime = (curTime.tm_hour & 0xFF) << 8 | (curTime.tm_min) & 0xFF;
uint32 saveDate = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF);
uint16 saveTime = ((curTime.tm_hour & 0xFF) << 8) | ((curTime.tm_min) & 0xFF);
out->writeUint32BE(saveDate);
debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing save date (%d)", saveDate);

View File

@ -481,7 +481,7 @@ void AGOSEngine_Simon1::os1_getPathPosn() {
}
x_diff += y_diff /= 4;
if (x_diff < best_dist || x_diff == best_dist && prev_i == i) {
if ((x_diff < best_dist) || ((x_diff == best_dist) && (prev_i == i))) {
best_dist = x_diff;
best_i = maxPath + 1 - i;
best_j = j;

View File

@ -197,9 +197,9 @@ void AGOSEngine_Feeble::checkZonePtrs() {
uint count = ARRAYSIZE(_vgaBufferPointers);
VgaPointersEntry *vpe = _vgaBufferPointers;
do {
if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block ||
vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block ||
vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
if (((vpe->vgaFile1 < _blockEnd) && (vpe->vgaFile1End > _block)) ||
((vpe->vgaFile2 < _blockEnd) && (vpe->vgaFile2End > _block)) ||
((vpe->sfxFile < _blockEnd) && (vpe->sfxFileEnd > _block))) {
vpe->vgaFile1 = NULL;
vpe->vgaFile1End = NULL;
vpe->vgaFile2 = NULL;
@ -218,8 +218,8 @@ void AGOSEngine::checkNoOverWrite() {
vpe = &_vgaBufferPointers[_noOverWrite];
if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
_vgaMemPtr <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
if (((_block <= vpe->vgaFile1) && (_blockEnd >= vpe->vgaFile1)) ||
((_vgaMemPtr <= vpe->vgaFile2) && (_blockEnd >= vpe->vgaFile2))) {
_rejectBlock = true;
_vgaMemPtr = vpe->vgaFile1 + 0x5000;
} else {
@ -232,8 +232,8 @@ void AGOSEngine::checkAnims(uint a) {
vpe = &_vgaBufferPointers[a];
if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
_block <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
if (((_block <= vpe->vgaFile1) && (_blockEnd >= vpe->vgaFile1)) ||
((_block <= vpe->vgaFile2) && (_blockEnd >= vpe->vgaFile2))) {
_rejectBlock = true;
_vgaMemPtr = vpe->vgaFile1 + 0x5000;
} else {
@ -245,8 +245,8 @@ void AGOSEngine::checkZonePtrs() {
uint count = ARRAYSIZE(_vgaBufferPointers);
VgaPointersEntry *vpe = _vgaBufferPointers;
do {
if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
_block <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
if (((_block <= vpe->vgaFile1) && (_blockEnd >= vpe->vgaFile1)) ||
((_block <= vpe->vgaFile2) && (_blockEnd >= vpe->vgaFile2))) {
vpe->vgaFile1 = NULL;
vpe->vgaFile2 = NULL;
}

View File

@ -165,8 +165,8 @@ void AdLib::reset() {
for (int i = 0; i < 9; i++) {
writeOPL(0xA0 | i, 0);
writeOPL(0xB0 | i, 0);
writeOPL(0xE0 | _operators[i] , 0);
writeOPL(0xE0 | _operators[i] + 3, 0);
writeOPL(0xE0 | _operators[i] , 0);
writeOPL(0xE0 |(_operators[i] + 3), 0);
}
// Authorize the control of the waveformes

View File

@ -728,7 +728,7 @@ void Hotspot::updateMovement2(CharacterMode value) {
}
void Hotspot::resetPosition() {
setPosition(x() & 0xf8 | 5, y());
setPosition((x() & 0xf8) | 5, y());
setDirection(direction());
}

View File

@ -480,10 +480,10 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) {
byte whiteColour = isEGA ? EGA_DIALOG_WHITE_COLOUR : VGA_DIALOG_WHITE_COLOUR;
uint16 oldX = mouse.x();
uint16 oldY = mouse.y();
const uint16 yMiddle = FULL_SCREEN_HEIGHT / 2;
#ifndef LURE_CLICKABLE_MENUS
uint16 oldX = mouse.x();
uint16 oldY = mouse.y();
mouse.cursorOff();
mouse.setPosition(FULL_SCREEN_WIDTH / 2, yMiddle);

View File

@ -925,8 +925,8 @@ uint16 Actor::hitTest(const Point &testPoint, bool skipProtagonist) {
CommonObjectOrderList::iterator drawOrderIterator;
CommonObjectDataPointer drawObject;
int frameNumber;
SpriteList *spriteList;
int frameNumber = 0;
SpriteList *spriteList = NULL;
createDrawOrderList();
@ -1044,8 +1044,8 @@ void Actor::drawActors() {
CommonObjectOrderList::iterator drawOrderIterator;
CommonObjectDataPointer drawObject;
int frameNumber;
SpriteList *spriteList;
int frameNumber = 0;
SpriteList *spriteList = NULL;
Surface *backBuffer;

View File

@ -1243,7 +1243,7 @@ bool Interface::processTextInput(Common::KeyState keystate) {
_textInputPos = _textInputStringLength + 1;
break;
default:
if (keystate.ascii <= 255 && isalnum(keystate.ascii) || (keystate.ascii == ' ') ||
if (((keystate.ascii <= 255) && (isalnum(keystate.ascii))) || (keystate.ascii == ' ') ||
(keystate.ascii == '-') || (keystate.ascii == '_')) {
if (_textInputStringLength < save_title_size - 1) {
ch[0] = keystate.ascii;

View File

@ -139,7 +139,9 @@ DigitalMusicInputStream::~DigitalMusicInputStream() {
}
void DigitalMusicInputStream::createCompressedStream() {
#if defined(USE_MAD) || defined(USE_VORBIS) || defined(USE_FLAC)
uint numLoops = _looping ? 0 : 1;
#endif
_memoryStream = _file->readStream(resourceData->size - 9);
switch (soundType) {

View File

@ -190,8 +190,8 @@ void SagaEngine::save(const char *fileName, const char *saveName) {
tm curTime;
_system->getTimeAndDate(curTime);
uint32 saveDate = (curTime.tm_mday & 0xFF) << 24 | ((curTime.tm_mon + 1) & 0xFF) << 16 | (curTime.tm_year + 1900) & 0xFFFF;
uint16 saveTime = (curTime.tm_hour & 0xFF) << 8 | (curTime.tm_min) & 0xFF;
uint32 saveDate = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF);
uint16 saveTime = ((curTime.tm_hour & 0xFF) << 8) | ((curTime.tm_min) & 0xFF);
out->writeUint32BE(saveDate);
out->writeUint16BE(saveTime);

View File

@ -92,7 +92,9 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int
buffer.size, buffer.frequency, flags, -1, volume);
} else {
Audio::AudioStream *stream = NULL;
#if defined(USE_MAD) || defined(USE_VORBIS) || defined(USE_FLAC)
MemoryReadStream *tmp = NULL;
#endif
switch (buffer.soundType) {
#ifdef USE_MAD

View File

@ -254,11 +254,11 @@ void Sprite::drawClip(Surface *ds, const Rect &clipRect, const Point &spritePoin
}
void Sprite::draw(Surface *ds, const Rect &clipRect, SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale) {
const byte *spriteBuffer;
int width;
int height;
int xAlign;
int yAlign;
const byte *spriteBuffer = NULL;
int width = 0;
int height = 0;
int xAlign = 0;
int yAlign = 0;
Point spritePointer;
getScaledSpriteBuffer(spriteList, spriteNumber, scale, width, height, xAlign, yAlign, spriteBuffer);
@ -270,11 +270,13 @@ void Sprite::draw(Surface *ds, const Rect &clipRect, SpriteList &spriteList, int
}
void Sprite::draw(Surface *ds, const Rect &clipRect, SpriteList &spriteList, int32 spriteNumber, const Rect &screenRect, int scale) {
const byte *spriteBuffer;
int width;
int height;
int xAlign, spw;
int yAlign, sph;
const byte *spriteBuffer = NULL;
int width = 0;
int height = 0;
int xAlign = 0;
int spw;
int yAlign = 0;
int sph;
Point spritePointer;
getScaledSpriteBuffer(spriteList, spriteNumber, scale, width, height, xAlign, yAlign, spriteBuffer);
@ -292,13 +294,13 @@ void Sprite::draw(Surface *ds, const Rect &clipRect, SpriteList &spriteList, int
}
bool Sprite::hitTest(SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, const Point &testPoint) {
const byte *spriteBuffer;
const byte *spriteBuffer = NULL;
int i, j;
const byte *srcRowPointer;
int width;
int height;
int xAlign;
int yAlign;
int width = 0;
int height = 0;
int xAlign = 0;
int yAlign = 0;
Point spritePointer;
getScaledSpriteBuffer(spriteList, spriteNumber, scale, width, height, xAlign, yAlign, spriteBuffer);
@ -319,17 +321,17 @@ bool Sprite::hitTest(SpriteList &spriteList, int spriteNumber, const Point &scre
}
void Sprite::drawOccluded(Surface *ds, const Rect &clipRect, SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, int depth) {
const byte *spriteBuffer;
const byte *spriteBuffer = NULL;
int x, y;
byte *destRowPointer;
const byte *sourceRowPointer;
const byte *sourcePointer;
byte *destPointer;
byte *maskPointer;
int width;
int height;
int xAlign;
int yAlign;
int width = NULL;
int height = 0;
int xAlign = 0;
int yAlign = 0;
ClipData clipData;

View File

@ -194,10 +194,11 @@ void ScummEngine_v2::readIndexFile() {
break;
case 0x132:
printf("C64 V1 game detected\n");
if (_game.id == GID_MANIAC)
if (_game.id == GID_MANIAC) {
assert(_game.version == 0);
else
} else {
assert(_game.version == 1);
}
readClassicIndexFile();
break;
case 0x032:

View File

@ -644,8 +644,8 @@ void ScummEngine::saveInfos(Common::WriteStream* file) {
tm curTime;
_system->getTimeAndDate(curTime);
section.date = (curTime.tm_mday & 0xFF) << 24 | ((curTime.tm_mon + 1) & 0xFF) << 16 | (curTime.tm_year + 1900) & 0xFFFF;
section.time = (curTime.tm_hour & 0xFF) << 8 | (curTime.tm_min) & 0xFF;
section.date = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF);
section.time = ((curTime.tm_hour & 0xFF) << 8) | ((curTime.tm_min) & 0xFF);
file->writeUint32BE(section.type);
file->writeUint32BE(section.version);

View File

@ -376,12 +376,12 @@ void Text::makeGameCharacter(uint8 textChar, uint8 *charSetPtr, uint8 *&dest, ui
dataBit = (data & 0x8000) != 0; //check data
data <<= 1;
if (maskBit)
if (maskBit) {
if (dataBit)
*curPos = color;
else
*curPos = 240; //black edge
}
curPos++;
}
//advance a line

View File

@ -127,6 +127,12 @@ void DestroyScalers(){
*/
void Normal1x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
int width, int height) {
/* Spot the case when it can all be done in 1 hit */
if (((int)srcPitch == 2*width) && ((int)dstPitch == 2*width))
{
width *= height;
height = 1;
}
while (height--) {
memcpy(dstPtr, srcPtr, 2 * width);
srcPtr += srcPitch;

View File

@ -131,7 +131,7 @@ static void scale2x(void* void_dst, unsigned dst_slice, const void* void_src, un
}
/**
* Apply the Scale32x effect on a bitmap.
* Apply the Scale3x effect on a bitmap.
* The destination bitmap is filled with the scaled version of the source bitmap.
* The source bitmap isn't modified.
* The destination bitmap must be manually allocated before calling the function,

View File

@ -44,7 +44,7 @@ MidiDriver *MidiChannel_MPU401::device() {
}
void MidiChannel_MPU401::send(uint32 b) {
_owner->send(b & 0xFFFFFFF0 | (_channel & 0xF));
_owner->send((b & 0xFFFFFFF0) | (_channel & 0xF));
}
void MidiChannel_MPU401::noteOff(byte note) {

View File

@ -716,7 +716,7 @@ void MidiDriver_YM2612::createLookupTables() {
int f10 = (fnum[i] >> 9) & 1;
int f11 = (fnum[i] >> 10) & 1;
int n4 = f11;
int n3 = f11&(f10|f9|f8) | (~f11&f10&f9&f8);
int n3 = (f11&(f10|f9|f8)) | (~f11&f10&f9&f8);
int note = n4*2 + n3;
// see p.207
keycodeTable[(block+1)*12+i] = block*4 + note;