diff --git a/src/c_console.cpp b/src/c_console.cpp index 8292624cb..3064abb0d 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -282,7 +282,7 @@ struct FCommandBuffer void CursorEnd() { - CursorPos = Text.Len(); + CursorPos = (unsigned)Text.Len(); StartPos = 0; MakeStartPosGood(); } @@ -358,7 +358,7 @@ struct FCommandBuffer { Text.Insert(CursorPos, clip); } - CursorPos += clip.Len(); + CursorPos += (unsigned)clip.Len(); MakeStartPosGood(); } } @@ -366,7 +366,7 @@ struct FCommandBuffer void SetString(FString str) { Text = str; - CursorPos = Text.Len(); + CursorPos = (unsigned)Text.Len(); MakeStartPosGood(); } }; @@ -404,9 +404,9 @@ private: }; static FNotifyBuffer NotifyStrings; -CUSTOM_CVAR(Int, con_numnotify, NUMNOTIFIES, CVAR_GLOBALCONFIG | CVAR_ARCHIVE) +CUSTOM_CVAR(Int, con_notifylines, NUMNOTIFIES, CVAR_GLOBALCONFIG | CVAR_ARCHIVE) { - NotifyStrings.Shift(con_numnotify); + NotifyStrings.Shift(self); } @@ -613,7 +613,7 @@ void C_DeinitConsole () while (hist != NULL) { History *next = hist->Newer; - free (hist); + delete hist; hist = next; } HistTail = HistHead = HistPos = NULL; @@ -711,7 +711,7 @@ void FNotifyBuffer::AddString(int printlevel, FString source) source.IsEmpty() || gamestate == GS_FULLCONSOLE || gamestate == GS_DEMOSCREEN || - con_numnotify == 0) + con_notifylines == 0) return; if (ConsoleDrawing) @@ -755,9 +755,9 @@ void FNotifyBuffer::AddString(int printlevel, FString source) newline.PrintLevel = printlevel; if (AddType == NEWLINE || Text.Size() == 0) { - if (con_numnotify > 0) + if (con_notifylines > 0) { - Shift(con_numnotify - 1); + Shift(con_notifylines - 1); } Text.Push(newline); } @@ -1659,7 +1659,7 @@ CCMD (history) while (hist) { - Printf (" %s\n", hist->String); + Printf (" %s\n", hist->String.GetChars()); hist = hist->Newer; } } @@ -1862,7 +1862,7 @@ static void C_TabComplete (bool goForward) } TabStart = i; - TabSize = CmdLine.Text.Len() - TabStart; + TabSize = (int)CmdLine.Text.Len() - TabStart; if (!FindTabCommand(&CmdLine.Text[TabStart], &TabPos, TabSize)) return; // No initial matches @@ -1922,7 +1922,7 @@ static void C_TabComplete (bool goForward) CmdLine.Text << TabCommands[TabPos].TabName << ' '; } } - CmdLine.CursorPos = CmdLine.Text.Len(); + CmdLine.CursorPos = (unsigned)CmdLine.Text.Len(); CmdLine.MakeStartPosGood(); } @@ -1996,7 +1996,7 @@ static bool C_TabCompleteList () TabSize = commonsize; CmdLine.Text.Truncate(TabStart); CmdLine.Text.AppendCStrPart(TabCommands[TabPos].TabName.GetChars(), commonsize); - CmdLine.CursorPos = CmdLine.Text.Len(); + CmdLine.CursorPos = (unsigned)CmdLine.Text.Len(); } return false; } diff --git a/src/resourcefiles/resourcefile.cpp b/src/resourcefiles/resourcefile.cpp index 912998d9a..603606341 100644 --- a/src/resourcefiles/resourcefile.cpp +++ b/src/resourcefiles/resourcefile.cpp @@ -95,7 +95,8 @@ void FResourceLump::LumpNameSetup(FString iname) { long slash = iname.LastIndexOf('/'); FString base = (slash >= 0) ? iname.Mid(slash + 1) : iname; - base.Truncate(base.LastIndexOf('.')); + auto dot = base.LastIndexOf('.'); + if (dot >= 0) base.Truncate(dot); uppercopy(Name, base); Name[8] = 0; FullName = iname; diff --git a/src/serializer.cpp b/src/serializer.cpp index d0d052be6..5f0e6dfce 100644 --- a/src/serializer.cpp +++ b/src/serializer.cpp @@ -163,7 +163,7 @@ static const char *StringToUnicode(const char *cc, int size = -1) int count = 0; int count1 = 0; out.Clear(); - while (ch = (*c++) & 255) + while ((ch = (*c++) & 255)) { count1++; if (ch >= 128) @@ -181,7 +181,7 @@ static const char *StringToUnicode(const char *cc, int size = -1) out.Last() = 0; c = cc; int i = 0; - while (ch = (*c++) & 255) + while ((ch = (*c++) & 255)) { utf8_encode(ch, &out[i], &count1); i += count1; diff --git a/src/zstring.cpp b/src/zstring.cpp index 3c819e4ef..e2ec93e1d 100644 --- a/src/zstring.cpp +++ b/src/zstring.cpp @@ -397,7 +397,7 @@ void FString::Remove(size_t index, size_t remlen) if (Data()->RefCount == 1) { // Can do this in place memmove(Chars + index, Chars + index + remlen, Len() - index - remlen); - Data()->Len -= remlen; + Data()->Len -= (unsigned)remlen; } else { // Must do it in a copy