From d3b44a41724156e78b62fe1bb3aaa0aa41996e2b Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 29 Mar 2011 05:20:33 +0000 Subject: [PATCH] - Fix errors/warnings from MinGW 4.5.0 (tdm-1). - Disable the missing field initializers warnings that -Wextra produces from GCC. SVN r3173 (trunk) --- src/CMakeLists.txt | 2 +- src/am_map.cpp | 4 ++++ src/d_dehacked.cpp | 2 +- src/dobject.cpp | 2 +- src/p_acs.cpp | 4 +--- src/p_buildmap.cpp | 4 ++-- src/p_mobj.cpp | 2 +- src/p_writemap.cpp | 4 ++-- src/r_segs.cpp | 2 +- src/r_things.cpp | 2 +- src/s_sndseq.cpp | 2 +- src/sound/music_midistream.cpp | 2 +- src/stats.h | 2 +- src/textures/texture.cpp | 2 +- src/thingdef/thingdef_codeptr.cpp | 4 ++-- src/v_font.cpp | 2 +- src/win32/i_dijoy.cpp | 2 +- src/win32/i_rawps2.cpp | 2 +- src/win32/i_system.cpp | 2 +- 19 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cc6ec67d8..31bf2e6fc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -394,7 +394,7 @@ if( CMAKE_COMPILER_IS_GNUCXX ) set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${REL_CXX_FLAGS}" ) set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${REL_CXX_FLAGS}" ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused -Wextra" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused -Wextra -Wno-missing-field-initializers" ) # Remove extra warnings when using the official DirectX headers. # Also, TDM-GCC 4.4.0 no longer accepts glibc-style printf formats as valid, diff --git a/src/am_map.cpp b/src/am_map.cpp index d90735842..40a2f8e93 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -1248,6 +1248,10 @@ void AM_changeWindowScale () { mtof_zoommul = int(M_ZOOMOUT); } + else + { + mtof_zoommul = MAPUNIT; + } am_zoomdir = 0; // Change the scaling multipliers diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index e1260c014..c5da6a0ed 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -1712,7 +1712,7 @@ static int PatchMisc (int dummy) { "IDKFA Armor", myoffsetof(struct DehInfo,KFAArmor) }, { "IDKFA Armor Class", myoffsetof(struct DehInfo,KFAAC) }, { "No Autofreeze", myoffsetof(struct DehInfo,NoAutofreeze) }, - { NULL, NULL } + { NULL, 0 } }; int result; diff --git a/src/dobject.cpp b/src/dobject.cpp index 2dd6aa1ed..0440b7694 100644 --- a/src/dobject.cpp +++ b/src/dobject.cpp @@ -538,7 +538,7 @@ void DObject::SerializeUserVars(FArchive &arc) PSymbolTable *symt; FName varname; DWORD count, j; - int *varloc; + int *varloc = NULL; symt = &GetClass()->Symbols; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 83740009a..8598c9aeb 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -3511,8 +3511,6 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args) { TActorIterator srciter (args[0]); - if (args[1] == 0) dest = (AActor *) activator; - while ( (source = srciter.Next ()) ) { if (args[1] != 0) @@ -3525,7 +3523,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args) } else { - if (P_CheckSight(source, dest, flags)) return 1; + if (P_CheckSight(source, activator, flags)) return 1; } } } diff --git a/src/p_buildmap.cpp b/src/p_buildmap.cpp index 90180b0c2..cde9cdb2f 100644 --- a/src/p_buildmap.cpp +++ b/src/p_buildmap.cpp @@ -767,8 +767,8 @@ static void CreateStartSpot (fixed_t *pos, FMapThing *start) 0, (LittleLong(pos[0])<<12), ((-LittleLong(pos[1]))<<12), 0,// tid, x, y, z short(Scale ((2048-angle)&2047, 360, 2048)), 1, // angle, type 0, 0, // Skillfilter, Classfilter - 7|MTF_SINGLE|224, // flags - 0, {NULL}, NULL // special is 0, args and Conversation are NULL + 7|MTF_SINGLE|224, // flags + 0, {0}, 0 // special is 0, args and Conversation are 0 }; *start = mt; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 1cb5c9571..bc751e475 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -5218,7 +5218,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, { static const int angdiff[3] = { -1<<26, 1<<26, 0 }; int i; - angle_t an; + angle_t an = angle; angle_t pitch; AActor *linetarget; int vrange = nofreeaim? ANGLE_1*35 : 0; diff --git a/src/p_writemap.cpp b/src/p_writemap.cpp index a4e445118..83ed40b5b 100644 --- a/src/p_writemap.cpp +++ b/src/p_writemap.cpp @@ -64,7 +64,7 @@ CCMD (dumpmap) } wadinfo_t header = { PWAD_ID, 12, 0 }; - wadlump_t lumps[12] = { {0, 0, {NULL}} }; + wadlump_t lumps[12] = { {0, 0, {0}} }; fseek (file, 12, SEEK_SET); @@ -95,7 +95,7 @@ CCMD (dumpmap) static int WriteTHINGS (FILE *file) { - mapthinghexen_t mt = { 0, 0, 0, 0, 0, 0, 0, 0, {NULL} }; + mapthinghexen_t mt = { 0, 0, 0, 0, 0, 0, 0, 0, {0} }; AActor *mo = players[consoleplayer].mo; mt.x = LittleShort(short(mo->x >> FRACBITS)); diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 0f1eec676..abe7b8670 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -592,7 +592,7 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2) { FTexture *const DONT_DRAW = ((FTexture*)(intptr_t)-1); int i,j; - F3DFloor *rover, *fover; + F3DFloor *rover, *fover = NULL; int passed, last; fixed_t floorheight; fixed_t ceilingheight; diff --git a/src/r_things.cpp b/src/r_things.cpp index b1ceed7a2..a94873597 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -1695,7 +1695,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor fixed_t tx, tx2; fixed_t tz; - fixed_t xscale, yscale; + fixed_t xscale = FRACUNIT, yscale = FRACUNIT; int x1; int x2; diff --git a/src/s_sndseq.cpp b/src/s_sndseq.cpp index f01d8c29d..2a1924684 100644 --- a/src/s_sndseq.cpp +++ b/src/s_sndseq.cpp @@ -268,7 +268,7 @@ static const hexenseq_t HexenSequences[] = { { NAME_DoorCreak, { HexenDoorSeq(3), HexenLastSeq } }, { NAME_DoorMetal2, { HexenDoorSeq(9), HexenLastSeq } }, { NAME_Wind, { HexenEnvSeq(10), HexenLastSeq } }, - { NAME_None, {NULL} } + { NAME_None, {0} } }; static int SeqTrans[64*3]; diff --git a/src/sound/music_midistream.cpp b/src/sound/music_midistream.cpp index d9008fe0f..f9c2d4f28 100644 --- a/src/sound/music_midistream.cpp +++ b/src/sound/music_midistream.cpp @@ -725,7 +725,7 @@ void MIDIStreamer::Update() CloseHandle(PlayerThread); PlayerThread = NULL; Printf ("MIDI playback failure: "); - if (code >= 0 && code < countof(MMErrorCodes)) + if (code < countof(MMErrorCodes)) { Printf("%s\n", MMErrorCodes[code]); } diff --git a/src/stats.h b/src/stats.h index 13608f750..65eb73926 100644 --- a/src/stats.h +++ b/src/stats.h @@ -124,7 +124,7 @@ inline unsigned __int64 rdtsc() return 0; } #else -inline volatile unsigned long long rdtsc() +inline unsigned long long rdtsc() { #ifndef __amd64__ if (CPU.bRDTSC) diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index 4a649e061..848fffa35 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -498,7 +498,7 @@ void FTexture::FillBuffer(BYTE *buff, int pitch, int height, FTextureFormat fmt) case TEX_RGB: { - FCopyInfo inf = {OP_OVERWRITE, BLEND_NONE, {NULL}, 0, 0}; + FCopyInfo inf = {OP_OVERWRITE, BLEND_NONE, {0}, 0, 0}; FBitmap bmp(buff, pitch, pitch/4, height); CopyTrueColorPixels(&bmp, 0, 0, 0, &inf); break; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index a29d56723..de160ce73 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -1115,7 +1115,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack) int i; int bangle; - int bslope; + int bslope = 0; if (self->target || (Flags & CBAF_AIMFACING)) { @@ -1288,7 +1288,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireBullets) int i; int bangle; - int bslope; + int bslope = 0; if ((Flags & FBF_USEAMMO) && weapon) { diff --git a/src/v_font.cpp b/src/v_font.cpp index 04ea9f978..1bb4753ee 100644 --- a/src/v_font.cpp +++ b/src/v_font.cpp @@ -2037,7 +2037,7 @@ void V_InitFontColors () { TArray names; int lump, lastlump = 0; - TranslationParm tparm = { 0, 0, {NULL}, {NULL} }; // Silence GCC (for real with -Wextra ) + TranslationParm tparm = { 0, 0, {0}, {0} }; // Silence GCC (for real with -Wextra ) TArray parms; TArray parminfo; TArray colorinfo; diff --git a/src/win32/i_dijoy.cpp b/src/win32/i_dijoy.cpp index b78fea64e..ccbc7ecdc 100644 --- a/src/win32/i_dijoy.cpp +++ b/src/win32/i_dijoy.cpp @@ -1287,7 +1287,7 @@ bool FDInputJoystickManager::IsXInputDeviceFast(const GUID *guid) UINT cbSize; cbSize = rdi.cbSize = sizeof(rdi); - if (MyGetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICEINFO, &rdi, &cbSize) >= 0) + if ((INT)MyGetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICEINFO, &rdi, &cbSize) >= 0) { if(MAKELONG(rdi.hid.dwVendorId, rdi.hid.dwProductId) == (LONG)guid->Data1) { diff --git a/src/win32/i_rawps2.cpp b/src/win32/i_rawps2.cpp index cab2844a6..84fb605c6 100644 --- a/src/win32/i_rawps2.cpp +++ b/src/win32/i_rawps2.cpp @@ -1017,7 +1017,7 @@ FRawPS2Controller *FRawPS2Manager::EnumDevices() UINT cbSize; cbSize = rdi.cbSize = sizeof(rdi); - if (MyGetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICEINFO, &rdi, &cbSize) >= 0) + if ((INT)MyGetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICEINFO, &rdi, &cbSize) >= 0) { // All the PS2 adapters report themselves as joysticks. // (By comparison, the 360 controller reports itself as a gamepad.) diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 1da4855cc..aa5945011 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -1108,7 +1108,7 @@ BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa filepart = WadList[i].Path; else filepart++; - work.Format("%s (%s)", WadList[i].Name, filepart); + work.Format("%s (%s)", WadList[i].Name.GetChars(), filepart); SendMessage(ctrl, LB_ADDSTRING, 0, (LPARAM)work.GetChars()); SendMessage(ctrl, LB_SETITEMDATA, i, (LPARAM)i); }