diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index a02ec947f..cc096ed60 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -497,7 +497,7 @@ DFsSection *FParser::looping_section() if(!best || (current->start_index > best->start_index)) best = current; // save it } - current = current->next; + current = current->next; } } diff --git a/src/m_random.cpp b/src/m_random.cpp index e0a55d095..60ce12fd6 100644 --- a/src/m_random.cpp +++ b/src/m_random.cpp @@ -331,6 +331,10 @@ void FRandom::StaticReadRNGState(FSerializer &arc) FRandom *rng; arc("rngseed", rngseed); + + // Call StaticClearRandom in order to ensure that SFMT is initialized + FRandom::StaticClearRandom (); + if (arc.BeginArray("rngs")) { int count = arc.ArraySize(); diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 71ef65f22..fcbff904a 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1616,7 +1616,7 @@ void FBehavior::StaticSerializeModuleStates (FSerializer &arc) { if (arc.isReading()) { - int modnum = arc.ArraySize(); + auto modnum = arc.ArraySize(); if (modnum != StaticModules.Size()) { I_Error("Level was saved with a different number of ACS modules. (Have %d, save has %d)", StaticModules.Size(), modnum); @@ -2933,7 +2933,7 @@ void DACSThinker::Serialize(FSerializer &arc) if (arc.BeginArray("runningscripts")) { auto cnt = arc.ArraySize(); - for (int i = 0; i < cnt; i++) + for (unsigned i = 0; i < cnt; i++) { SavingRunningscript srs; arc(nullptr, srs); diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index e90dd2096..29b0c5095 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -184,7 +184,7 @@ void DCeiling::Tick () case DCeiling::ceilLowerAndCrush: if (m_CrushMode == ECrushMode::crushSlowdown) m_Speed = 1. / 8; - break; + break; default: break; diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 24e5ff9ee..ce5b6a74a 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -890,10 +890,10 @@ void G_SerializeLevel(FSerializer &arc, bool hubload) // deep down in the deserializer or just a crash if the few insufficient safeguards were not triggered. BYTE chk[16] = { 0 }; arc.Array("checksum", chk, 16); - if (arc.GetSize("linedefs") != numlines || - arc.GetSize("sidedefs") != numsides || - arc.GetSize("sectors") != numsectors || - arc.GetSize("polyobjs") != po_NumPolyobjs || + if (arc.GetSize("linedefs") != (unsigned)numlines || + arc.GetSize("sidedefs") != (unsigned)numsides || + arc.GetSize("sectors") != (unsigned)numsectors || + arc.GetSize("polyobjs") != (unsigned)po_NumPolyobjs || memcmp(chk, level.md5, 16)) { I_Error("Savegame is from a different level"); diff --git a/src/resourcefiles/file_zip.cpp b/src/resourcefiles/file_zip.cpp index 73193062c..8713fe554 100644 --- a/src/resourcefiles/file_zip.cpp +++ b/src/resourcefiles/file_zip.cpp @@ -392,7 +392,8 @@ int FZipLump::FillCache() int FZipLump::GetFileOffset() { if (Method != METHOD_STORED) return -1; - if (Flags & LUMPFZIP_NEEDFILESTART) SetLumpAddress(); return Position; + if (Flags & LUMPFZIP_NEEDFILESTART) SetLumpAddress(); + return Position; } //========================================================================== diff --git a/src/serializer.cpp b/src/serializer.cpp index 3a66a8397..49226ce80 100644 --- a/src/serializer.cpp +++ b/src/serializer.cpp @@ -381,7 +381,7 @@ void FSerializer::Close() // //========================================================================== -int FSerializer::ArraySize() +unsigned FSerializer::ArraySize() { if (r != nullptr && r->mObjects.Last().mObject->IsArray()) { @@ -709,7 +709,7 @@ FSerializer &FSerializer::Sprite(const char *key, int32_t &spritenum, int32_t *d { if (val->IsString()) { - int name = *reinterpret_cast(val->GetString()); + uint32_t name = *reinterpret_cast(val->GetString()); for (auto hint = NumStdSprites; hint-- != 0; ) { if (sprites[hint].dwName == name) diff --git a/src/serializer.h b/src/serializer.h index a3e1f531e..4797a4bce 100644 --- a/src/serializer.h +++ b/src/serializer.h @@ -60,7 +60,7 @@ public: FWriter *w = nullptr; FReader *r = nullptr; - int ArraySize(); + unsigned ArraySize(); void WriteKey(const char *key); void WriteObjects(); diff --git a/src/sound/music_hmi_midiout.cpp b/src/sound/music_hmi_midiout.cpp index 7d9d36926..691970765 100644 --- a/src/sound/music_hmi_midiout.cpp +++ b/src/sound/music_hmi_midiout.cpp @@ -145,8 +145,8 @@ HMISong::HMISong (FileReader &reader, EMidiDevice type, const char *args) MusHeader = new BYTE[len]; SongLen = len; NumTracks = 0; - if (reader.Read(MusHeader, len) != len) - return; + if (reader.Read(MusHeader, len) != len) + return; // Do some validation of the MIDI file if (memcmp(MusHeader, HMI_SONG_MAGIC, sizeof(HMI_SONG_MAGIC)) == 0) diff --git a/src/sound/music_smf_midiout.cpp b/src/sound/music_smf_midiout.cpp index a045998a8..ae0c47e80 100644 --- a/src/sound/music_smf_midiout.cpp +++ b/src/sound/music_smf_midiout.cpp @@ -114,10 +114,10 @@ MIDISong2::MIDISong2 (FileReader &reader, EMidiDevice type, const char *args) return; } #endif - SongLen = reader.GetLength(); + SongLen = reader.GetLength(); MusHeader = new BYTE[SongLen]; - if (reader.Read(MusHeader, SongLen) != SongLen) - return; + if (reader.Read(MusHeader, SongLen) != SongLen) + return; // Do some validation of the MIDI file if (MusHeader[4] != 0 || MusHeader[5] != 0 || MusHeader[6] != 0 || MusHeader[7] != 6) diff --git a/src/sound/music_xmi_midiout.cpp b/src/sound/music_xmi_midiout.cpp index b56e8f6f8..c9a2e9c46 100644 --- a/src/sound/music_xmi_midiout.cpp +++ b/src/sound/music_xmi_midiout.cpp @@ -117,10 +117,10 @@ XMISong::XMISong (FileReader &reader, EMidiDevice type, const char *args) return; } #endif - SongLen = reader.GetLength(); + SongLen = reader.GetLength(); MusHeader = new BYTE[SongLen]; - if (reader.Read(MusHeader, SongLen) != SongLen) - return; + if (reader.Read(MusHeader, SongLen) != SongLen) + return; // Find all the songs in this file. NumSongs = FindXMIDforms(MusHeader, SongLen, NULL); diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index c2b2d25e6..7c55e5286 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -91,7 +91,7 @@ static const FLOP FxFlops[] = // //========================================================================== -FCompileContext::FCompileContext(PClassActor *cls, PPrototype *ret) : Class(cls), ReturnProto(ret) +FCompileContext::FCompileContext(PClassActor *cls, PPrototype *ret) : ReturnProto(ret), Class(cls) { } @@ -959,7 +959,7 @@ ExpEmit FxUnaryNotBoolean::Emit(VMFunctionBuilder *build) //========================================================================== FxPreIncrDecr::FxPreIncrDecr(FxExpression *base, int token) -: FxExpression(base->ScriptPosition), Base(base), Token(token) +: FxExpression(base->ScriptPosition), Token(token), Base(base) { AddressRequested = false; AddressWritable = false; @@ -1045,7 +1045,7 @@ ExpEmit FxPreIncrDecr::Emit(VMFunctionBuilder *build) //========================================================================== FxPostIncrDecr::FxPostIncrDecr(FxExpression *base, int token) -: FxExpression(base->ScriptPosition), Base(base), Token(token) +: FxExpression(base->ScriptPosition), Token(token), Base(base) { }