From 0c119ba99bdf78c3c0a0a9562abe7e139e97e530 Mon Sep 17 00:00:00 2001 From: oy Date: Thu, 10 Feb 2011 12:07:00 +0100 Subject: fixed possible problem with localisations if the linereader flushes its memory between reading the origin and the replacement string --- src/game/localization.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/game/localization.cpp') diff --git a/src/game/localization.cpp b/src/game/localization.cpp index ad025100..69896300 100644 --- a/src/game/localization.cpp +++ b/src/game/localization.cpp @@ -63,6 +63,7 @@ bool CLocalizationDatabase::Load(const char *pFilename, IStorage *pStorage, ICon pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "localization", aBuf); m_Strings.clear(); + char aOrigin[512]; CLineReader LineReader; LineReader.Init(IoHandle); char *pLine; @@ -74,6 +75,7 @@ bool CLocalizationDatabase::Load(const char *pFilename, IStorage *pStorage, ICon if(pLine[0] == '#') // skip comments continue; + str_copy(aOrigin, pLine, sizeof(aOrigin)); char *pReplacement = LineReader.Get(); if(!pReplacement) { @@ -83,13 +85,13 @@ bool CLocalizationDatabase::Load(const char *pFilename, IStorage *pStorage, ICon if(pReplacement[0] != '=' || pReplacement[1] != '=' || pReplacement[2] != ' ') { - str_format(aBuf, sizeof(aBuf), "malform replacement line for '%s'", pLine); + str_format(aBuf, sizeof(aBuf), "malform replacement line for '%s'", aOrigin); pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "localization", aBuf); continue; } pReplacement += 3; - AddString(pLine, pReplacement); + AddString(aOrigin, pReplacement); } io_close(IoHandle); -- cgit 1.4.1