From d5a0fa8e85a7f5e2c47050ca6a4de5fb24151aef Mon Sep 17 00:00:00 2001 From: pionere Date: Sat, 14 Nov 2020 18:44:18 +0100 Subject: [PATCH] get rid of a few warnings --- 3rdParty/Storm/Source/storm.h | 2 +- Source/automap.cpp | 2 +- Source/encrypt.cpp | 2 +- Source/encrypt.h | 2 +- Source/engine.cpp | 6 ++-- Source/engine.h | 4 +-- Source/gendung.cpp | 3 +- Source/gmenu.cpp | 3 +- Source/interfac.cpp | 6 ++-- Source/mpqapi.cpp | 1 - Source/msg.cpp | 7 +++-- Source/multi.cpp | 7 ++--- Source/nthread.cpp | 2 +- Source/render.cpp | 2 +- Source/scrollrt.cpp | 6 ++-- Source/sha.cpp | 4 +-- Source/stores.cpp | 58 +++++++++++++++++------------------ SourceX/dvlnet/abstract_net.h | 2 +- SourceX/dvlnet/base.cpp | 2 +- SourceX/dvlnet/base.h | 2 +- SourceX/dvlnet/cdwrap.h | 4 +-- SourceX/dvlnet/loopback.cpp | 2 +- SourceX/dvlnet/loopback.h | 2 +- SourceX/storm/storm_net.cpp | 2 +- 24 files changed, 64 insertions(+), 69 deletions(-) diff --git a/3rdParty/Storm/Source/storm.h b/3rdParty/Storm/Source/storm.h index eeb01daa8..a150278ce 100644 --- a/3rdParty/Storm/Source/storm.h +++ b/3rdParty/Storm/Source/storm.h @@ -109,7 +109,7 @@ SNetGetGameInfo( BOOL STORMAPI SNetGetTurnsInTransit( - int *turns); + DWORD *turns); // Network provider structures typedef struct _client_info diff --git a/Source/automap.cpp b/Source/automap.cpp index c2e0c8f50..8c0b0dbe1 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -72,7 +72,7 @@ void InitAutomap() DWORD dwTiles; int x, y; BYTE *pAFile, *pTmp; - int i; + DWORD i; memset(automaptype, 0, sizeof(automaptype)); diff --git a/Source/encrypt.cpp b/Source/encrypt.cpp index 2abfae176..33658bc74 100644 --- a/Source/encrypt.cpp +++ b/Source/encrypt.cpp @@ -104,7 +104,7 @@ static void PkwareBufferWrite(char *buf, unsigned int *size, void *param) pInfo->destOffset += *size; } -int PkwareCompress(BYTE *srcData, int size) +DWORD PkwareCompress(BYTE *srcData, DWORD size) { BYTE *destData; char *ptr; diff --git a/Source/encrypt.h b/Source/encrypt.h index 1ea57e636..dda2b41ce 100644 --- a/Source/encrypt.h +++ b/Source/encrypt.h @@ -24,7 +24,7 @@ void Decrypt(DWORD *castBlock, DWORD size, DWORD key); void Encrypt(DWORD *castBlock, DWORD size, DWORD key); DWORD Hash(const char *s, int type); void InitHash(); -int PkwareCompress(BYTE *srcData, int size); +DWORD PkwareCompress(BYTE *srcData, DWORD size); void PkwareDecompress(BYTE *pbInBuff, int recv_size, int dwMaxBytes); #ifdef __cplusplus diff --git a/Source/engine.cpp b/Source/engine.cpp index dc6146df1..2821afe0e 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -616,7 +616,7 @@ void CelBlitWidth(BYTE *pBuff, int x, int y, int wdt, BYTE *pCelBuff, int nCel, * @param nCel CEL frame number * @param nWidth Width of sprite */ -void CelBlitOutline(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) +void CelBlitOutline(BYTE col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) { int nDataSize, w; BYTE *src, *dst, *end; @@ -1055,7 +1055,7 @@ static void Cl2BlitSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi * @param nWidth Width of sprite * @param col Color index from current palette */ -static void Cl2BlitOutlineSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, char col) +static void Cl2BlitOutlineSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, BYTE col) { int w; char width; @@ -1246,7 +1246,7 @@ void Cl2Draw(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) * @param nCel CL2 frame number * @param nWidth Width of sprite */ -void Cl2DrawOutline(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) +void Cl2DrawOutline(BYTE col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) { int nDataSize; BYTE *pRLEBytes; diff --git a/Source/engine.h b/Source/engine.h index f28c36cf1..a6b449715 100644 --- a/Source/engine.h +++ b/Source/engine.h @@ -61,7 +61,7 @@ void CelClippedDrawSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); void CelBlitLightSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, BYTE *tbl); void CelDrawLightRedSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, char light); void CelBlitWidth(BYTE *pBuff, int x, int y, int wdt, BYTE *pCelBuff, int nCel, int nWidth); -void CelBlitOutline(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); +void CelBlitOutline(BYTE col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); void ENG_set_pixel(int sx, int sy, BYTE col); void engine_draw_pixel(int sx, int sy); void DrawLine(int x0, int y0, int x1, int y1, BYTE col); @@ -77,7 +77,7 @@ BYTE *LoadFileInMem(const char *pszName, DWORD *pdwFileLen); DWORD LoadFileWithMem(const char *pszName, BYTE *p); void Cl2ApplyTrans(BYTE *p, BYTE *ttbl, int nCel); void Cl2Draw(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); -void Cl2DrawOutline(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); +void Cl2DrawOutline(BYTE col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); void Cl2DrawLightTbl(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, char light); void Cl2DrawLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); void PlayInGameMovie(const char *pszMovie); diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 6f76c4641..2eb84f0d3 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -156,9 +156,8 @@ THEME_LOC themeLoc[MAXTHEMES]; void FillSolidBlockTbls() { BYTE bv; - DWORD dwTiles; + DWORD i, dwTiles; BYTE *pSBFile, *pTmp; - int i; memset(nBlockTable, 0, sizeof(nBlockTable)); memset(nSolidTable, 0, sizeof(nSolidTable)); diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index 886de2eb3..ad65398d2 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -332,8 +332,7 @@ BOOL gmenu_on_mouse_move() BOOL gmenu_left_mouse(BOOL isDown) { TMenuItem *pItem; - DWORD i, w; - int dummy; + int i, w, dummy; if (!isDown) { if (mouseNavigation) { diff --git a/Source/interfac.cpp b/Source/interfac.cpp index 25513b2ba..833f812dc 100644 --- a/Source/interfac.cpp +++ b/Source/interfac.cpp @@ -8,7 +8,7 @@ DEVILUTION_BEGIN_NAMESPACE BYTE *sgpBackCel; -int sgdwProgress; +DWORD sgdwProgress; int progress_id; /** The colour used for the progress bar as an index into the palette. */ @@ -277,11 +277,11 @@ BOOL IncProgress() { interface_msg_pump(); sgdwProgress += 23; - if ((DWORD)sgdwProgress > 534) + if (sgdwProgress > 534) sgdwProgress = 534; if (sgpBackCel) DrawCutscene(); - return (DWORD)sgdwProgress >= 534; + return sgdwProgress >= 534; } void ShowProgress(unsigned int uMsg) diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 039f9721b..1f45ad42d 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -651,7 +651,6 @@ BOOL mpqapi_has_file(const char *pszName) BOOL OpenMPQ(const char *pszArchive, DWORD dwChar) { - DWORD dwFlagsAndAttributes; DWORD key; _FILEHEADER fhdr; diff --git a/Source/msg.cpp b/Source/msg.cpp index 8e9e36295..18e99da68 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -312,10 +312,11 @@ static void DeltaImportJunk(BYTE *src) } } -static int msg_comp_level(BYTE *buffer, BYTE *end) +static DWORD msg_comp_level(BYTE *buffer, BYTE *end) { - int size = end - buffer - 1; - int pkSize = PkwareCompress(buffer + 1, size); + DWORD size = end - buffer - 1; + DWORD pkSize = PkwareCompress(buffer + 1, size); + *buffer = size != pkSize; return pkSize + 1; diff --git a/Source/multi.cpp b/Source/multi.cpp index 63714e007..38d5b79ac 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -17,7 +17,7 @@ WORD sgwPackPlrOffsetTbl[MAX_PLRS]; PkPlayerStruct netplr[MAX_PLRS]; BOOLEAN sgbPlayerTurnBitTbl[MAX_PLRS]; BOOLEAN sgbPlayerLeftGameTbl[MAX_PLRS]; -int sgbSentThisCycle; +DWORD sgbSentThisCycle; BOOL gbShouldValidatePackage; BYTE gbActivePlayers; BOOLEAN gbGameDestroyed; @@ -77,7 +77,7 @@ static void multi_copy_packet(TBuffer *buf, void *packet, BYTE size) p[size] = 0; } -static BYTE *multi_recv_packet(TBuffer *pBuf, BYTE *body, int *size) +static BYTE *multi_recv_packet(TBuffer *pBuf, BYTE *body, DWORD *size) { BYTE *src_ptr; size_t chunk_size; @@ -147,9 +147,8 @@ void NetSendHiPri(BYTE *pbMsg, BYTE bLen) { BYTE *hipri_body; BYTE *lowpri_body; - DWORD len; + DWORD size, len; TPkt pkt; - int size; if (pbMsg && bLen) { multi_copy_packet(&sgHiPriBuf, pbMsg, bLen); diff --git a/Source/nthread.cpp b/Source/nthread.cpp index 7871fd4aa..f75a6362d 100644 --- a/Source/nthread.cpp +++ b/Source/nthread.cpp @@ -48,7 +48,7 @@ DWORD nthread_send_and_recv_turn(DWORD cur_turn, int turn_delta) { DWORD new_cur_turn; int turn, turn_tmp; - int curTurnsInTransit; + DWORD curTurnsInTransit; new_cur_turn = cur_turn; if (!SNetGetTurnsInTransit(&curTurnsInTransit)) { diff --git a/Source/render.cpp b/Source/render.cpp index e28d067af..962f16939 100644 --- a/Source/render.cpp +++ b/Source/render.cpp @@ -579,7 +579,7 @@ RenderTile(BYTE *pBuff) */ void world_draw_black_tile(int sx, int sy) { - int i, j, k; + int i, j; BYTE *dst; if (sx >= SCREEN_X + SCREEN_WIDTH || sy >= SCREEN_Y + VIEWPORT_HEIGHT + TILE_WIDTH / 2) diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 62a7782fb..8ac154416 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -142,8 +142,9 @@ static void scrollrt_draw_cursor_back_buffer() */ static void scrollrt_draw_cursor_item() { - int i, mx, my, col; + int i, mx, my; BYTE *src, *dst; + BYTE col; assert(!sgdwCursWdt); @@ -1339,7 +1340,6 @@ static void DrawFPS() { DWORD tc, frames; char String[12]; - HDC hdc; if (frameflag && gbActive && pPanelText) { frameend++; @@ -1392,8 +1392,6 @@ static void DoBlitScreen(DWORD dwX, DWORD dwY, DWORD dwWdt, DWORD dwHgt) static void DrawMain(int dwHgt, BOOL draw_desc, BOOL draw_hp, BOOL draw_mana, BOOL draw_sbar, BOOL draw_btn) { int ysize; - DWORD dwTicks; - BOOL retry; ysize = dwHgt; diff --git a/Source/sha.cpp b/Source/sha.cpp index d3594e7b1..eab7edc0b 100644 --- a/Source/sha.cpp +++ b/Source/sha.cpp @@ -109,9 +109,9 @@ static void SHA1ProcessMessageBlock(SHA1Context *context) context->state[4] += E; } -static void SHA1Input(SHA1Context *context, const char *message_array, int len) +static void SHA1Input(SHA1Context *context, const char *message_array, DWORD len) { - int i, count; + DWORD i, count; count = context->count[0] + 8 * len; if (count < context->count[0]) diff --git a/Source/stores.cpp b/Source/stores.cpp index 0d2c85eb0..467c0f531 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -2428,37 +2428,37 @@ void HealerBuyItem() void S_BBuyEnter() { - BOOL done; - int i; - - if (stextsel == 10) { - stextshold = STORE_BBOY; - stextvhold = stextsval; - stextlhold = 10; - int price = boyitem._iIvalue; - if (gbIsHellfire) - price -= boyitem._iIvalue >> 2; - else - price += boyitem._iIvalue >> 1; - if (plr[myplr]._pGold < price) { - StartStore(STORE_NOMONEY); - } else { - plr[myplr].HoldItem = boyitem; - plr[myplr].HoldItem._iIvalue = price; - SetCursor_(plr[myplr].HoldItem._iCurs + CURSOR_FIRSTITEM); - done = FALSE; - for (i = 0; i < NUM_INV_GRID_ELEM && !done; i++) { - done = AutoPlace(myplr, i, cursW / 28, cursH / 28, FALSE); - } - if (done) - StartStore(STORE_CONFIRM); - else - StartStore(STORE_NOROOM); - SetCursor_(CURSOR_HAND); - } - } else { + if (stextsel != 10) { stextflag = STORE_NONE; + return; } + + stextshold = STORE_BBOY; + stextvhold = stextsval; + stextlhold = 10; + int price = boyitem._iIvalue; + if (gbIsHellfire) + price -= boyitem._iIvalue >> 2; + else + price += boyitem._iIvalue >> 1; + + if (plr[myplr]._pGold < price) { + StartStore(STORE_NOMONEY); + return; + } + + plr[myplr].HoldItem = boyitem; + plr[myplr].HoldItem._iIvalue = price; + SetCursor_(plr[myplr].HoldItem._iCurs + CURSOR_FIRSTITEM); + + bool done = false; + for (int i = 0; i < NUM_INV_GRID_ELEM && !done; i++) { + done = AutoPlace(myplr, i, cursW / 28, cursH / 28, false); + } + + StartStore(done ? STORE_CONFIRM : STORE_NOROOM); + + SetCursor_(CURSOR_HAND); } void StoryIdItem() diff --git a/SourceX/dvlnet/abstract_net.h b/SourceX/dvlnet/abstract_net.h index 9ae76ca62..c482ed320 100644 --- a/SourceX/dvlnet/abstract_net.h +++ b/SourceX/dvlnet/abstract_net.h @@ -45,7 +45,7 @@ public: virtual bool SNetLeaveGame(int type) = 0; virtual bool SNetDropPlayer(int playerid, DWORD flags) = 0; virtual bool SNetGetOwnerTurnsWaiting(DWORD *turns) = 0; - virtual bool SNetGetTurnsInTransit(int *turns) = 0; + virtual bool SNetGetTurnsInTransit(DWORD *turns) = 0; virtual void setup_gameinfo(buffer_t info) = 0; virtual ~abstract_net() = default; diff --git a/SourceX/dvlnet/base.cpp b/SourceX/dvlnet/base.cpp index e1cf9e938..ff79b892d 100644 --- a/SourceX/dvlnet/base.cpp +++ b/SourceX/dvlnet/base.cpp @@ -249,7 +249,7 @@ bool base::SNetGetOwnerTurnsWaiting(DWORD *turns) return true; } -bool base::SNetGetTurnsInTransit(int *turns) +bool base::SNetGetTurnsInTransit(DWORD *turns) { *turns = turn_queue[plr_self].size(); return true; diff --git a/SourceX/dvlnet/base.h b/SourceX/dvlnet/base.h index 878804067..69f548933 100644 --- a/SourceX/dvlnet/base.h +++ b/SourceX/dvlnet/base.h @@ -32,7 +32,7 @@ public: virtual bool SNetLeaveGame(int type); virtual bool SNetDropPlayer(int playerid, DWORD flags); virtual bool SNetGetOwnerTurnsWaiting(DWORD *turns); - virtual bool SNetGetTurnsInTransit(int *turns); + virtual bool SNetGetTurnsInTransit(DWORD *turns); virtual void poll() = 0; virtual void send(packet &pkt) = 0; diff --git a/SourceX/dvlnet/cdwrap.h b/SourceX/dvlnet/cdwrap.h index d6a57c772..66cc5b444 100644 --- a/SourceX/dvlnet/cdwrap.h +++ b/SourceX/dvlnet/cdwrap.h @@ -39,7 +39,7 @@ public: virtual bool SNetLeaveGame(int type); virtual bool SNetDropPlayer(int playerid, DWORD flags); virtual bool SNetGetOwnerTurnsWaiting(DWORD *turns); - virtual bool SNetGetTurnsInTransit(int *turns); + virtual bool SNetGetTurnsInTransit(DWORD *turns); virtual void setup_gameinfo(buffer_t info); virtual ~cdwrap() = default; @@ -146,7 +146,7 @@ bool cdwrap::SNetGetOwnerTurnsWaiting(DWORD *turns) } template -bool cdwrap::SNetGetTurnsInTransit(int *turns) +bool cdwrap::SNetGetTurnsInTransit(DWORD *turns) { return dvlnet_wrap->SNetGetTurnsInTransit(turns); } diff --git a/SourceX/dvlnet/loopback.cpp b/SourceX/dvlnet/loopback.cpp index d7b970013..cbcfc4b65 100644 --- a/SourceX/dvlnet/loopback.cpp +++ b/SourceX/dvlnet/loopback.cpp @@ -99,7 +99,7 @@ bool loopback::SNetGetOwnerTurnsWaiting(DWORD *turns) return true; } -bool loopback::SNetGetTurnsInTransit(int *turns) +bool loopback::SNetGetTurnsInTransit(DWORD *turns) { *turns = 0; return true; diff --git a/SourceX/dvlnet/loopback.h b/SourceX/dvlnet/loopback.h index d09da2705..2de8209bc 100644 --- a/SourceX/dvlnet/loopback.h +++ b/SourceX/dvlnet/loopback.h @@ -37,7 +37,7 @@ public: virtual bool SNetLeaveGame(int type); virtual bool SNetDropPlayer(int playerid, DWORD flags); virtual bool SNetGetOwnerTurnsWaiting(DWORD *turns); - virtual bool SNetGetTurnsInTransit(int *turns); + virtual bool SNetGetTurnsInTransit(DWORD *turns); virtual void setup_gameinfo(buffer_t info); }; diff --git a/SourceX/storm/storm_net.cpp b/SourceX/storm/storm_net.cpp index 049aeda8e..3faeb4f50 100644 --- a/SourceX/storm/storm_net.cpp +++ b/SourceX/storm/storm_net.cpp @@ -143,7 +143,7 @@ BOOL SNetGetOwnerTurnsWaiting(DWORD *turns) return dvlnet_inst->SNetGetOwnerTurnsWaiting(turns); } -BOOL SNetGetTurnsInTransit(int *turns) +BOOL SNetGetTurnsInTransit(DWORD *turns) { return dvlnet_inst->SNetGetTurnsInTransit(turns); }