From 3329c549e6dc33abb2fa20cd909bed61d80e8956 Mon Sep 17 00:00:00 2001 From: oy Date: Thu, 20 Dec 2012 16:30:16 +0100 Subject: [PATCH] fixed couple of warnings --- src/engine/external/json-parser/json.c | 3 +++ src/game/client/components/countryflags.cpp | 7 ++++--- src/game/client/components/menus_browser.cpp | 2 +- src/game/client/components/menus_settings.cpp | 3 ++- src/game/client/components/skins.cpp | 2 +- src/game/client/localization.cpp | 3 ++- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/engine/external/json-parser/json.c b/src/engine/external/json-parser/json.c index 38b2d9710..2c15e903b 100644 --- a/src/engine/external/json-parser/json.c +++ b/src/engine/external/json-parser/json.c @@ -201,6 +201,7 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch long num_digits, num_fraction, num_e; error[0] = '\0'; + num_digits = num_fraction = num_e = 0; memset (&state, 0, sizeof (json_state)); memcpy (&state.settings, settings, sizeof (json_settings)); @@ -220,6 +221,8 @@ json_value * json_parse_ex (json_settings * settings, const json_char * json, ch top = root = 0; flags = flag_seek_value; + string_length = 0; + string = 0; cur_line = 1; cur_line_begin = json; diff --git a/src/game/client/components/countryflags.cpp b/src/game/client/components/countryflags.cpp index 68ba9b83d..fc96ac136 100644 --- a/src/game/client/components/countryflags.cpp +++ b/src/game/client/components/countryflags.cpp @@ -47,13 +47,13 @@ void CCountryFlags::LoadCountryflagsIndexfile() { NUM_INDICES = 2, }; - char *paIndices[NUM_INDICES] = {"custom", "ISO 3166-1"}; + const char *paIndices[NUM_INDICES] = {"custom", "ISO 3166-1"}; for(int Index = 0; Index < NUM_INDICES; ++Index) { - const json_value &rStart = rInit[paIndices[Index]]; + const json_value &rStart = rInit[(const char *)paIndices[Index]]; if(rStart.type == json_array) { - for(int i = 0; i < rStart.u.array.length; ++i) + for(unsigned i = 0; i < rStart.u.array.length; ++i) { char aBuf[64]; @@ -101,6 +101,7 @@ void CCountryFlags::LoadCountryflagsIndexfile() // clean up json_value_free(pJsonData); + mem_free(pFileData); m_aCountryFlags.sort_range(); // find index of default item diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index 18c5dbc9b..8c562c45e 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -1615,7 +1615,7 @@ void CMenus::RenderServerbrowser(CUIRect MainView) +------+ +------------+ */ - CUIRect ServerList, ToolBox, BottomBox; + CUIRect ServerList, BottomBox; MainView.HSplitTop(20.0f, 0, &MainView); MainView.HSplitBottom(80.0f, &ServerList, &MainView); diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index d56a5a3e6..4a0dc1288 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -505,7 +505,7 @@ void LoadLanguageIndexfile(IStorage *pStorage, IConsole *pConsole, sorted_array< const json_value &rStart = (*pJsonData)["language indices"]; if(rStart.type == json_array) { - for(int i = 0; i < rStart.u.array.length; ++i) + for(unsigned i = 0; i < rStart.u.array.length; ++i) { char aFileName[128]; str_format(aFileName, sizeof(aFileName), "languages/%s.json", (const char *)rStart[i]["file"]); @@ -515,6 +515,7 @@ void LoadLanguageIndexfile(IStorage *pStorage, IConsole *pConsole, sorted_array< // clean up json_value_free(pJsonData); + mem_free(pFileData); } void CMenus::RenderLanguageSelection(CUIRect MainView, bool Header) diff --git a/src/game/client/components/skins.cpp b/src/game/client/components/skins.cpp index e958b6a48..741efbcab 100644 --- a/src/game/client/components/skins.cpp +++ b/src/game/client/components/skins.cpp @@ -114,7 +114,7 @@ int CSkins::SkinScan(const char *pName, int IsDir, int DirType, void *pUser) return 0; CSkin Skin = pSelf->m_DummySkin; - bool SpecialSkin = pName[0] == 'x' & pName[1] == '_'; + bool SpecialSkin = pName[0] == 'x' && pName[1] == '_'; CLineReader LineReader; LineReader.Init(File); diff --git a/src/game/client/localization.cpp b/src/game/client/localization.cpp index 3adaffe2d..d286c8587 100644 --- a/src/game/client/localization.cpp +++ b/src/game/client/localization.cpp @@ -85,12 +85,13 @@ bool CLocalizationDatabase::Load(const char *pFilename, IStorage *pStorage, ICon const json_value &rStart = (*pJsonData)["translated strings"]; if(rStart.type == json_array) { - for(int i = 0; i < rStart.u.array.length; ++i) + for(unsigned i = 0; i < rStart.u.array.length; ++i) AddString((const char *)rStart[i]["or"], (const char *)rStart[i]["tr"]); } // clean up json_value_free(pJsonData); + mem_free(pFileData); m_CurrentVersion = ++m_VersionCounter; return true; }