diff --git a/src/c4group/C4Group.cpp b/src/c4group/C4Group.cpp index 480d64da3..bea987677 100644 --- a/src/c4group/C4Group.cpp +++ b/src/c4group/C4Group.cpp @@ -672,7 +672,7 @@ bool C4Group::AddEntry(C4GroupEntry::EntryStatus status, return false; return true; - case C4GroupEntry::C4GRES_InMemory: // Save buffer to file in folder + case C4GroupEntry::C4GRES_InMemory: { // Save buffer to file in folder CStdFile hFile; bool fOkay = false; if (hFile.Create(tfname, !!childgroup)) @@ -683,8 +683,9 @@ bool C4Group::AddEntry(C4GroupEntry::EntryStatus status, if (fHoldBuffer) { if (fBufferIsStdbuf) StdBuf::DeletePointer(membuf); else delete [] membuf; } return fOkay; + } - // InGrp & Deleted ignored + default: break; // InGrp & Deleted ignored } return Error("Add to folder: Invalid request"); @@ -1025,6 +1026,7 @@ void C4Group::ResetSearch(bool reload_contents) case GRPF_File: SearchPtr=FirstEntry; break; + default: break; // InGrp & Deleted ignored } } @@ -1073,6 +1075,7 @@ C4GroupEntry* C4Group::SearchNextEntry(const char *szName) } break; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + default: break; // InGrp & Deleted ignored } // No entry found: reset search pointer SearchPtr=NULL; @@ -1151,6 +1154,7 @@ bool C4Group::Read(void *pBuffer, size_t iSize) case GRPF_Folder: if (!StdFile.Read(pBuffer,iSize)) return Error("Read: Error reading from folder contents"); break; + default: break; // InGrp & Deleted ignored } return true; @@ -1412,6 +1416,7 @@ bool C4Group::DeleteEntry(const char *szFilename, bool fRecycle) break; // refresh file list ResetSearch(true); + default: break; // InGrp & Deleted ignored } return true; } @@ -1443,6 +1448,7 @@ bool C4Group::Rename(const char *szFile, const char *szNewName) // refresh file list ResetSearch(true); break; + default: break; // InGrp & Deleted ignored } return true; @@ -1570,6 +1576,7 @@ bool C4Group::ExtractEntry(const char *szFilename, const char *szExtractTo) if (!CopyItem(szPath,szTargetFName)) return Error("ExtractEntry: Cannot copy item"); break; + default: break; // InGrp & Deleted ignored } return true; } @@ -1751,13 +1758,15 @@ bool C4Group::SetFilePtr2Entry(const char *szName, bool NeedsToBeAGroup) if ((!centry) || (centry->Status != C4GroupEntry::C4GRES_InGroup)) return false; return SetFilePtr(centry->Offset); - case GRPF_Folder: + case GRPF_Folder: { StdFile.Close(); char path[_MAX_FNAME+1]; SCopy(FileName,path,_MAX_FNAME); AppendBackslash(path); SAppend(szName,path); bool fSuccess = StdFile.Open(path, NeedsToBeAGroup); return fSuccess; + } + default: break; // InGrp & Deleted ignored } return false; } @@ -1805,7 +1814,7 @@ bool C4Group::Add(const char *szName, StdBuf &pBuffer, bool fChild, bool fHoldBu szName, pBuffer.getSize(), szName, - (BYTE*) pBuffer.getData(), + (BYTE*) pBuffer.getMData(), false, fHoldBuffer, fExecutable, @@ -1822,7 +1831,7 @@ bool C4Group::Add(const char *szName, StdStrBuf &pBuffer, bool fChild, bool fHol szName, pBuffer.getLength(), szName, - (BYTE*) pBuffer.getData(), + (BYTE*) pBuffer.getMData(), false, fHoldBuffer, fExecutable, diff --git a/src/c4group/C4GroupMain.cpp b/src/c4group/C4GroupMain.cpp index 180ae8081..d9e044f7d 100644 --- a/src/c4group/C4GroupMain.cpp +++ b/src/c4group/C4GroupMain.cpp @@ -72,8 +72,8 @@ void DisplayGroup(const C4Group &grp, const char *filter = NULL) if (filter != NULL && !WildcardMatch(filter, entry->FileName)) continue; - printf("%*s %8d Bytes", - max_fn_len, + printf("%*s %8u Bytes", + int(max_fn_len), entry->FileName, entry->Size); if (entry->ChildGroup != 0) @@ -85,7 +85,7 @@ void DisplayGroup(const C4Group &grp, const char *filter = NULL) ++file_count; byte_count += entry->Size; } - printf("%d Entries, %d Bytes\n", file_count, byte_count); + printf("%lu Entries, %lu Bytes\n", file_count, byte_count); } void PrintGroupInternals(C4Group &grp, int indent_level = 0) diff --git a/src/c4group/CStdFile.cpp b/src/c4group/CStdFile.cpp index 9f73a833d..e1de19bb2 100644 --- a/src/c4group/CStdFile.cpp +++ b/src/c4group/CStdFile.cpp @@ -247,7 +247,7 @@ bool CStdFile::Write(const void *pBuffer, int iSize) int transfer; if (!pBuffer) return false; if (!ModeWrite) return false; - BYTE *bypBuffer= (BYTE*) pBuffer; + const BYTE *bypBuffer= (const BYTE*) pBuffer; while (iSize>0) { // Space in buffer: Transfer as much as possible @@ -268,10 +268,10 @@ bool CStdFile::Write(const void *pBuffer, int iSize) bool CStdFile::WriteString(const char *szStr) { thread_check.Check(); - BYTE nl[2]={0x0D,0x0A}; + BYTE nl[2]={0x0D,0x0A}; if (!szStr) return false; int size=SLen(szStr); - if (!Write((void*)szStr,size)) return false; + if (!Write((const void*)szStr,size)) return false; if (!Write(nl,2)) return false; return true; } diff --git a/src/control/C4Control.cpp b/src/control/C4Control.cpp index 7377ed30d..915c5430a 100644 --- a/src/control/C4Control.cpp +++ b/src/control/C4Control.cpp @@ -310,7 +310,6 @@ void C4ControlMsgBoardReply::CompileFunc(StdCompiler *pComp) // *** C4ControlMsgBoardCmd void C4ControlMsgBoardCmd::Execute() const { - C4Player *source_player = ::Players.Get(player); // don't handle this if the game isn't actually running if (!::Game.IsRunning) return; diff --git a/src/control/C4GameParameters.cpp b/src/control/C4GameParameters.cpp index df52298aa..29cac5293 100644 --- a/src/control/C4GameParameters.cpp +++ b/src/control/C4GameParameters.cpp @@ -479,8 +479,8 @@ void C4GameParameters::EnforceLeagueRules(C4Scenario *pScenario) if (pScenario) MaxPlayers = pScenario->Head.MaxPlayerLeague; // forced league values in custom scenario parameters size_t idx=0; const C4ScenarioParameterDef *pdef; int32_t val; - while(pdef = ::Game.ScenarioParameterDefs.GetParameterDefByIndex(idx++)) - if (val = pdef->GetLeagueValue()) + while((pdef = ::Game.ScenarioParameterDefs.GetParameterDefByIndex(idx++))) + if ((val = pdef->GetLeagueValue())) ScenarioParameters.SetValue(pdef->GetID(), val, false); } diff --git a/src/control/C4Record.cpp b/src/control/C4Record.cpp index 9ce811f50..f03cef6e3 100644 --- a/src/control/C4Record.cpp +++ b/src/control/C4Record.cpp @@ -990,7 +990,7 @@ StdStrBuf GetDbgRecPktData(C4RecordChunkType eType, const StdBuf & RawData) break; default: for (unsigned int i=0; i(RawData, i)); break; } return r; @@ -1083,7 +1083,7 @@ void C4Playback::Check(C4RecordChunkType eType, const uint8_t *pData, int iSize) DebugRecError(FormatString("Type %s != %s", GetRecordChunkTypeName(PktInReplay.getType()), GetRecordChunkTypeName(eType)).getData()); return; } - if (PktInReplay.getSize() != iSize) + if (PktInReplay.getSize() != unsigned(iSize)) { DebugRecError(FormatString("Size %d != %d", (int) PktInReplay.getSize(), (int) iSize).getData()); } diff --git a/src/editor/C4EditCursor.cpp b/src/editor/C4EditCursor.cpp index 13ef2e07a..61dd36d2b 100644 --- a/src/editor/C4EditCursor.cpp +++ b/src/editor/C4EditCursor.cpp @@ -521,7 +521,6 @@ void C4EditCursor::Draw(C4TargetFacet &cgo) cobj->ColorMod = 0xffffffff; cobj->BlitMode = C4GFXBLIT_CLRSFC_MOD2 | C4GFXBLIT_ADDITIVE; - StdMeshInstance::FaceOrdering old_fo = StdSubMeshInstance::FO_Fixed; if(cobj->pMeshInstance) cobj->pMeshInstance->SetFaceOrdering(StdSubMeshInstance::FO_NearestToFarthest); diff --git a/src/editor/C4ObjectListDlg.cpp b/src/editor/C4ObjectListDlg.cpp index be2e23369..c656baaaf 100644 --- a/src/editor/C4ObjectListDlg.cpp +++ b/src/editor/C4ObjectListDlg.cpp @@ -699,6 +699,7 @@ static void name_cell_data_func(GtkTreeViewColumn* column, GtkCellRenderer* rend enum { ICON_SIZE = 24 }; +#ifdef _UNUSED_ static void icon_cell_data_func(GtkTreeViewColumn* column, GtkCellRenderer* renderer, GtkTreeModel* model, GtkTreeIter* iter, gpointer data) { C4Object* object = c4_list_iter_get_C4Object(model, iter); @@ -755,6 +756,7 @@ static void icon_cell_data_func(GtkTreeViewColumn* column, GtkCellRenderer* rend g_object_set(G_OBJECT(renderer), "pixbuf", pixbuf, NULL); } +#endif // _UNUSED_ void C4ObjectListDlg::Open() { diff --git a/src/game/ClonkMain.cpp b/src/game/ClonkMain.cpp index a0a18c460..01c944a11 100644 --- a/src/game/ClonkMain.cpp +++ b/src/game/ClonkMain.cpp @@ -154,7 +154,7 @@ static void crash_handler(int signo, siginfo_t * si, void *) case SIGTERM: write(logfd, "SIGTERM", sizeof ("SIGTERM") - 1); break; } char hex[sizeof(void *) * 2]; - int i; intptr_t x = reinterpret_cast(si->si_addr); + intptr_t x = reinterpret_cast(si->si_addr); switch (signo) { case SIGILL: case SIGFPE: case SIGSEGV: case SIGBUS: case SIGTRAP: diff --git a/src/gamescript/C4GameScript.cpp b/src/gamescript/C4GameScript.cpp index 8d506183d..866ed85f6 100644 --- a/src/gamescript/C4GameScript.cpp +++ b/src/gamescript/C4GameScript.cpp @@ -516,7 +516,7 @@ static bool FnSoundAt(C4PropList * _this, C4String *szSound, long iX, long iY, N iX += pObj->GetX(); iY += pObj->GetY(); } - StartSoundEffectAt(FnStringPar(szSound), iX, iY, iLevel, iCustomFalloffDistance, iPitch); + StartSoundEffectAt(FnStringPar(szSound), iX, iY, iLevel, iCustomFalloffDistance, iPitch, modifier); // always return true (network safety!) return true; } @@ -2632,18 +2632,16 @@ static bool FnGainScenarioAchievement(C4PropList * _this, C4String *achievement_ // default parameter long value = avalue.IsNil() ? 1 : (long)avalue; // gain achievement - bool result = true; if (!player.IsNil() && player != NO_OWNER) { C4Player *plr = ::Players.Get(player); if (!plr) return false; - result = plr->GainScenarioAchievement(achievement_name->GetCStr(), value, for_scenario ? for_scenario->GetCStr() : NULL); + plr->GainScenarioAchievement(achievement_name->GetCStr(), value, for_scenario ? for_scenario->GetCStr() : NULL); } else { for (C4Player *plr = ::Players.First; plr; plr = plr->Next) - if (!plr->GainScenarioAchievement(achievement_name->GetCStr(), value, for_scenario ? for_scenario->GetCStr() : NULL)) - result = false; + plr->GainScenarioAchievement(achievement_name->GetCStr(), value, for_scenario ? for_scenario->GetCStr() : NULL); } return true; } diff --git a/src/graphics/Bitmap256.cpp b/src/graphics/Bitmap256.cpp index cdfeee866..78749b56b 100644 --- a/src/graphics/Bitmap256.cpp +++ b/src/graphics/Bitmap256.cpp @@ -40,7 +40,7 @@ void C4BMPInfo::Set(int iWdt, int iHgt, int iBitDepth) { Default(); // Set header - Head.bfType=*((WORD*)"BM"); + Head.bfType=*((const WORD*)"BM"); Head.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+DWordAligned(iWdt)*iHgt; Head.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER); // Set bitmap info @@ -62,7 +62,7 @@ C4BMP256Info::C4BMP256Info() bool C4BMP256Info::Valid() { - if (Head.bfType != *((WORD*)"BM") ) return false; + if (Head.bfType != *((const WORD*)"BM") ) return false; if ((Info.biBitCount!=8) || (Info.biCompression!=0)) return false; return true; } @@ -76,7 +76,7 @@ void C4BMP256Info::Set(int iWdt, int iHgt, CStdPalette *Palette) { Default(); // Set header - Head.bfType=*((WORD*)"BM"); + Head.bfType=*((const WORD*)"BM"); Head.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD)+DWordAligned(iWdt)*iHgt; Head.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD); // Set bitmap info diff --git a/src/graphics/C4FontLoader.cpp b/src/graphics/C4FontLoader.cpp index 6ec8441fd..6501092b6 100644 --- a/src/graphics/C4FontLoader.cpp +++ b/src/graphics/C4FontLoader.cpp @@ -380,9 +380,9 @@ bool CStdFont::AddRenderedChar(uint32_t dwChar, C4Facet *pfctTarget) int at_x = iCurrentSfcX + Max(slot->bitmap_left,0); // Copy to the surface if (!sfcCurrent->Lock()) return false; - for (int y = 0; y < slot->bitmap.rows + fDoShadow; ++y) + for (unsigned int y = 0; y < slot->bitmap.rows + fDoShadow; ++y) { - for (int x = 0; x < slot->bitmap.width + fDoShadow; ++x) + for (unsigned int x = 0; x < slot->bitmap.width + fDoShadow; ++x) { unsigned char bAlpha, bAlphaShadow; if (x < slot->bitmap.width && y < slot->bitmap.rows) diff --git a/src/graphics/C4Shader.cpp b/src/graphics/C4Shader.cpp index 792da939a..5d8c8dfc2 100644 --- a/src/graphics/C4Shader.cpp +++ b/src/graphics/C4Shader.cpp @@ -198,7 +198,7 @@ int C4Shader::ParsePosition(const char *szWhat, const char **ppPos) // Lookup name int iPosition = -1; - for (int i = 0; i < sizeof(C4SH_PosNames) / sizeof(*C4SH_PosNames); i++) { + for (unsigned int i = 0; i < sizeof(C4SH_PosNames) / sizeof(*C4SH_PosNames); i++) { if (SEqual(Name.getData(), C4SH_PosNames[i].Name)) { iPosition = C4SH_PosNames[i].Position; break; diff --git a/src/gui/C4GameOptions.cpp b/src/gui/C4GameOptions.cpp index 6e88abc6e..516c8a870 100644 --- a/src/gui/C4GameOptions.cpp +++ b/src/gui/C4GameOptions.cpp @@ -107,7 +107,7 @@ void C4GameOptionsList::OptionScenarioParameter::DoDropdownFill(C4GUI::ComboBox_ { // Fill dropdown menuy with known possible options for this parameter size_t idx=0; const C4ScenarioParameterDef::Option *option; - while (option = ParameterDef->GetOptionByIndex(idx++)) + while ((option = ParameterDef->GetOptionByIndex(idx++))) { pFiller->AddEntry(option->Name.getData(), option->Value); } @@ -333,7 +333,7 @@ void C4GameOptionsList::InitOptions() if (param_defs) { size_t idx = 0; const C4ScenarioParameterDef *def; - while (def = param_defs->GetParameterDefByIndex(idx++)) + while ((def = param_defs->GetParameterDefByIndex(idx++))) if (!def->IsAchievement()) // achievements are displayed in scenario selection. no need to repeat them here new OptionScenarioParameter(this, def); } @@ -354,7 +354,7 @@ void C4GameOptionsList::InitOptions() void C4GameOptionsList::ClearOptions() { C4GUI::Element *pFirst; - while (pFirst = GetFirst()) delete pFirst; + while ((pFirst = GetFirst())) delete pFirst; } void C4GameOptionsList::Update() diff --git a/src/gui/C4StartupNetDlg.cpp b/src/gui/C4StartupNetDlg.cpp index 3064aa615..e196dfd9c 100644 --- a/src/gui/C4StartupNetDlg.cpp +++ b/src/gui/C4StartupNetDlg.cpp @@ -129,7 +129,8 @@ void C4StartupNetListEntry::SetRefQuery(const char *szAddress, enum QueryType eQ // safety: clear previous ClearRef(); // setup layout - ((C4Facet &) pIcon->GetFacet()) = (const C4Facet &) C4Startup::Get()->Graphics.fctNetGetRef; + const_cast(reinterpret_cast(pIcon->GetFacet())) + = (const C4Facet &) C4Startup::Get()->Graphics.fctNetGetRef; pIcon->SetAnimated(true, 1); pIcon->SetBounds(rctIconLarge); // init a new ref client to query diff --git a/src/network/C4NetIO.cpp b/src/network/C4NetIO.cpp index 8f761801f..e6214dca9 100644 --- a/src/network/C4NetIO.cpp +++ b/src/network/C4NetIO.cpp @@ -1886,8 +1886,8 @@ bool C4NetIOUDP::InitBroadcast(addr_t *pBroadcastAddr) for (int iRetries = 1000; iRetries; iRetries--) { // create new - random - address - MCAddr.sin_addr.s_addr = MCAddr.sin_addr.s_addr = - 0x000000ef | ((rand() & 0xff) << 24) | ((rand() & 0xff) << 16) | ((rand() & 0xff) << 8); + MCAddr.sin_addr.s_addr = + 0x000000ef | ((rand() & 0xff) << 24) | ((rand() & 0xff) << 16) | ((rand() & 0xff) << 8); // init broadcast if (!C4NetIOSimpleUDP::InitBroadcast(&MCAddr)) return false; @@ -2634,7 +2634,7 @@ void C4NetIOUDP::Peer::OnRecv(const C4NetIOPacket &rPacket) // (mt-safe) } // set packet counter if (fBroadcasted) - iRIMCPacketCounter = iRIMCPacketCounter = pPkt->Nr; + iRIMCPacketCounter = iIMCPacketCounter = pPkt->Nr; else iRIPacketCounter = iIPacketCounter = pPkt->Nr; // clear incoming packets @@ -2927,9 +2927,8 @@ void C4NetIOUDP::Peer::CheckCompleteIPackets() // advance packet counter iIPacketCounter = pPkt->GetNr() + pPkt->FragmentCnt(); // remove packet from queue - int iNr = pPkt->GetNr(); IPackets.DeletePacket(pPkt); - assert(!IPackets.GetPacketFrgm(iNr)); + assert(!IPackets.GetPacketFrgm(pPkt->GetNr())); } while ((pPkt = IMCPackets.GetFirstPacketComplete())) { @@ -2941,9 +2940,8 @@ void C4NetIOUDP::Peer::CheckCompleteIPackets() // advance packet counter iIMCPacketCounter = pPkt->GetNr() + pPkt->FragmentCnt(); // remove packet from queue - int iNr = pPkt->GetNr(); IMCPackets.DeletePacket(pPkt); - assert(!IMCPackets.GetPacketFrgm(iNr)); + assert(!IMCPackets.GetPacketFrgm(pPkt->GetNr())); } } diff --git a/src/platform/C4AppGTK.cpp b/src/platform/C4AppGTK.cpp index 93ce3578c..2cea44ceb 100644 --- a/src/platform/C4AppGTK.cpp +++ b/src/platform/C4AppGTK.cpp @@ -138,12 +138,12 @@ bool C4AbstractApp::SetVideoMode(unsigned int iXRes, unsigned int iYRes, unsigne if (!fFullScreen) { RestoreVideoMode(); - if (iXRes != -1) + if (iXRes != -1u) pWindow->SetSize(iXRes, iYRes); return true; } - if (Priv->xrandr_major_version >= 0 && !(iXRes == -1 && iYRes == -1)) + if (Priv->xrandr_major_version >= 0 && !(iXRes == -1u && iYRes == -1u)) { // randr spec says to always get fresh info, so don't cache. XRRScreenConfiguration * conf = XRRGetScreenInfo (dpy, pWindow->wnd); @@ -153,7 +153,7 @@ bool C4AbstractApp::SetVideoMode(unsigned int iXRes, unsigned int iYRes, unsigne XRRScreenSize * sizes = XRRConfigSizes(conf, &n); for (int i = 0; i < n; ++i) { - if (sizes[i].width == iXRes && sizes[i].height == iYRes) + if (unsigned(sizes[i].width) == iXRes && unsigned(sizes[i].height) == iYRes) { #ifdef _DEBUG LogF("XRRSetScreenConfig %d", i); @@ -165,7 +165,7 @@ bool C4AbstractApp::SetVideoMode(unsigned int iXRes, unsigned int iYRes, unsigne XRRFreeScreenConfigInfo(conf); } gtk_window_fullscreen(GTK_WINDOW(pWindow->window)); - return fDspModeSet || (iXRes == -1 && iYRes == -1); + return fDspModeSet || (iXRes == -1u && iYRes == -1u); } void C4AbstractApp::RestoreVideoMode() @@ -204,46 +204,6 @@ bool C4AbstractApp::GetIndexedDisplayMode(int32_t iIndex, int32_t *piXRes, int32 return false; } -static XRROutputInfo* GetXRROutputInfoForWindow(Display* dpy, Window w) -{ - XRRScreenResources * r = XRRGetScreenResources(dpy, w); - if (!r) return NULL; - - XRROutputInfo * info = NULL; - RROutput output = XRRGetOutputPrimary(dpy, w); - if(output != 0) - { - info = XRRGetOutputInfo(dpy, r, output); - if (!info) - { - XRRFreeScreenResources(r); - return NULL; - } - } - - if(!info || info->connection == RR_Disconnected || info->crtc == 0) - { - // The default "primary" output does not seem to be connected - // to a piece of actual hardware. As a fallback, go through - // all outputs and choose the first active one. - XRRFreeOutputInfo(info); - info = NULL; - for(int i = 0; i < r->noutput; ++i) - { - info = XRRGetOutputInfo(dpy, r, r->outputs[i]); - if(info->connection != RR_Disconnected && info->crtc != 0) - break; - - XRRFreeOutputInfo(info); - info = NULL; - } - } - XRRFreeScreenResources(r); - if(!info) return NULL; - - return info; -} - // Copy the text to the clipboard or the primary selection bool C4AbstractApp::Copy(const StdStrBuf & text, bool fClipboard) { diff --git a/src/platform/C4FileMonitor.cpp b/src/platform/C4FileMonitor.cpp index a9a279374..227f72339 100644 --- a/src/platform/C4FileMonitor.cpp +++ b/src/platform/C4FileMonitor.cpp @@ -74,13 +74,13 @@ bool C4FileMonitor::Execute(int iTimeout, pollfd * pfd) // some other thread uint32_t mask = event->mask; C4InteractiveThread &Thread = Application.InteractiveThread; if (mask & IN_CREATE) - Thread.PushEvent(Ev_FileChange, (void*)file); + Thread.PushEvent(Ev_FileChange, const_cast(file)); if (mask & IN_MODIFY) - Thread.PushEvent(Ev_FileChange, (void*)file); + Thread.PushEvent(Ev_FileChange, const_cast(file)); if (mask & IN_MOVED_TO) - Thread.PushEvent(Ev_FileChange, (void*)file); + Thread.PushEvent(Ev_FileChange, const_cast(file)); if (mask & IN_MOVE_SELF) - Thread.PushEvent(Ev_FileChange, (void*)file); + Thread.PushEvent(Ev_FileChange, const_cast(file)); // FIXME: (*(inotify_event*)buf).name); } else diff --git a/src/script/C4AulExec.cpp b/src/script/C4AulExec.cpp index 3872c892b..8be3c3ff6 100644 --- a/src/script/C4AulExec.cpp +++ b/src/script/C4AulExec.cpp @@ -310,7 +310,7 @@ C4Value C4AulExec::Exec(C4AulBCC *pCPos, bool fPassErrors) if (!pPar2->_getInt()) throw new C4AulExecError("division by zero"); // INT_MIN/-1 cannot be represented in an int and would cause an uncaught exception - if (pPar1->_getInt()==0x80000000 && pPar2->_getInt()==-1) + if (pPar1->_getInt()==INT32_MAX && pPar2->_getInt()==-1) throw new C4AulExecError("division overflow"); pPar1->SetInt(pPar1->_getInt() / pPar2->_getInt()); PopValue(); @@ -329,7 +329,7 @@ C4Value C4AulExec::Exec(C4AulBCC *pCPos, bool fPassErrors) CheckOpPars(C4V_Int, C4V_Int, "%"); C4Value *pPar1 = pCurVal - 1, *pPar2 = pCurVal; // INT_MIN%-1 cannot be represented in an int and would cause an uncaught exception - if (pPar1->_getInt()==0x80000000 && pPar2->_getInt()==-1) + if (pPar1->_getInt()==INT32_MAX && pPar2->_getInt()==-1) throw new C4AulExecError("modulo division overflow"); if (pPar2->_getInt()) pPar1->SetInt(pPar1->_getInt() % pPar2->_getInt()); diff --git a/src/script/C4StringTable.cpp b/src/script/C4StringTable.cpp index de71f1763..f13ca4d97 100644 --- a/src/script/C4StringTable.cpp +++ b/src/script/C4StringTable.cpp @@ -57,11 +57,15 @@ C4String::C4String() C4String::~C4String() { // unreg +#ifdef _DEBUG static bool remove = false; assert(!remove); remove = true; +#endif Strings.Set.Remove(this); +#ifdef _DEBUG remove = false; +#endif } void C4String::operator=(const char * s)