From 3f69477b44cd6adfd916962f240bef714f522f11 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 14 Aug 2010 22:25:56 +0000 Subject: SWORD25: Portability fixes. Now compiles and runs under Linux. svn-id: r53240 --- engines/sword25/kernel/log.cpp | 14 +++++++------- engines/sword25/kernel/persistenceservice.cpp | 4 ++-- engines/sword25/util/lua/lbaselib.c | 4 ---- 3 files changed, 9 insertions(+), 13 deletions(-) (limited to 'engines/sword25') diff --git a/engines/sword25/kernel/log.cpp b/engines/sword25/kernel/log.cpp index 07c57e9931..259c02449f 100644 --- a/engines/sword25/kernel/log.cpp +++ b/engines/sword25/kernel/log.cpp @@ -85,7 +85,7 @@ void BS_Log::Log(const char *Format, ...) { // Create the message va_list ArgList; va_start(ArgList, Format); - _vsnprintf(Message, sizeof(Message), Format, ArgList); + vsnprintf(Message, sizeof(Message), Format, ArgList); // Log the message _WriteLog(Message); @@ -100,19 +100,19 @@ void BS_Log::LogPrefix(const char *Prefix, const char *Format, ...) { // If the issue has ceased at the beginning of a new line, the new issue to begin with the prefix ExtFormat[0] = 0; if (_LineBegin) { - _snprintf(ExtFormat, sizeof(ExtFormat), "%s%s: ", ExtFormat, Prefix); + snprintf(ExtFormat, sizeof(ExtFormat), "%s%s: ", ExtFormat, Prefix); _LineBegin = false; } // Format String pass line by line and each line with the initial prefix for (;;) { const char *NextLine = strstr(Format, "\n"); if (!NextLine || *(NextLine + strlen("\n")) == 0) { - _snprintf(ExtFormat, sizeof(ExtFormat), "%s%s", ExtFormat, Format); + snprintf(ExtFormat, sizeof(ExtFormat), "%s%s", ExtFormat, Format); if (NextLine) _LineBegin = true; break; } else { strncat(ExtFormat, Format, (NextLine - Format) + strlen("\n")); - _snprintf(ExtFormat, sizeof(ExtFormat), "%s%s: ", ExtFormat, Prefix); + snprintf(ExtFormat, sizeof(ExtFormat), "%s%s: ", ExtFormat, Prefix); } Format = NextLine + strlen("\n"); @@ -121,7 +121,7 @@ void BS_Log::LogPrefix(const char *Prefix, const char *Format, ...) { // Create message va_list ArgList; va_start(ArgList, Format); - _vsnprintf(Message, sizeof(Message), ExtFormat, ArgList); + vsnprintf(Message, sizeof(Message), ExtFormat, ArgList); // Log the message _WriteLog(Message); @@ -134,12 +134,12 @@ void BS_Log::LogDecorated(const char *Format, ...) { char Message[LOG_BUFFERSIZE]; va_list ArgList; va_start(ArgList, Format); - _vsnprintf(Message, sizeof(Message), Format, ArgList); + vsnprintf(Message, sizeof(Message), Format, ArgList); // Zweiten Prefix erzeugen, falls gewünscht char SecondaryPrefix[1024]; if (_File && _Line) - _snprintf(SecondaryPrefix, sizeof(SecondaryPrefix), "(file: %s, line: %d) - ", _File, _Line); + snprintf(SecondaryPrefix, sizeof(SecondaryPrefix), "(file: %s, line: %d) - ", _File, _Line); // Nachricht zeilenweise ausgeben und an jeden Zeilenanfang das Präfix setzen char *MessageWalker = Message; diff --git a/engines/sword25/kernel/persistenceservice.cpp b/engines/sword25/kernel/persistenceservice.cpp index e3f3347799..aeadc2fe9d 100644 --- a/engines/sword25/kernel/persistenceservice.cpp +++ b/engines/sword25/kernel/persistenceservice.cpp @@ -339,10 +339,10 @@ bool BS_PersistenceService::SaveGame(unsigned int SlotID, const Common::String & // Länge der komprimierten Daten und der unkomprimierten Daten in die Datei schreiben. char sBuffer[10]; - ltoa(CompressedLength, sBuffer, 10); + snprintf(sBuffer, 10, "%ld", CompressedLength); File->writeString(sBuffer); File->writeByte(' '); - ltoa(Writer.GetDataSize(), sBuffer, 10); + snprintf(sBuffer, 10, "%uld", Writer.GetDataSize()); File->writeString(sBuffer); File->writeByte(' '); diff --git a/engines/sword25/util/lua/lbaselib.c b/engines/sword25/util/lua/lbaselib.c index 8b461d998b..8f97a1c246 100644 --- a/engines/sword25/util/lua/lbaselib.c +++ b/engines/sword25/util/lua/lbaselib.c @@ -27,10 +27,6 @@ ** model but changing `fputs' to put the strings at a proper place ** (a console window or a log file, for instance). */ -// ----------------------------------------------------------------------------- -// BS25 -// Aufruf der BS25 Log-Funktion -// ----------------------------------------------------------------------------- static int luaB_print (lua_State *L) { int n = lua_gettop(L); /* number of arguments */ int i; -- cgit v1.2.3