Don't use Str2PChar twice in a row
authorWuzzy <Wuzzy2@mail.ru>
Tue, 14 May 2019 22:42:19 +0200
changeset 14953 f27f00fabc0d
parent 14952 414924c06704
child 14954 37ae92c11a36
Don't use Str2PChar twice in a row
hedgewars/uUtils.pas
--- a/hedgewars/uUtils.pas	Tue May 14 23:25:49 2019 +0300
+++ b/hedgewars/uUtils.pas	Tue May 14 22:42:19 2019 +0200
@@ -526,7 +526,7 @@
 end;
 
 procedure AddFileLogRaw(s: pchar); cdecl;
-var tmp: shortstring;
+var msgLine: PChar;
 begin
 s:= s;
 {$IFNDEF PAS2C}
@@ -535,15 +535,15 @@
 if SDL_LockMutex(logMutex) <> 0 then
     OutError('Logging mutex could not be locked!', true);
 {$ENDIF}
-tmp:= IntToStr(GameTicks) + ': ';
+msgLine:= Str2PChar(IntToStr(GameTicks) + ': ');
 if (logFile <> nil) then
     begin
-    pfsWriteRaw(logFile, Str2PChar(tmp), StrLen(Str2PChar(tmp)));
+    pfsWriteRaw(logFile, msgLine, StrLen(msgLine));
     pfsWriteRaw(logFile, s, StrLen(s));
     end
 else
     begin
-    Write(stdout, Str2PChar(tmp));
+    Write(stdout, msgLine);
     Flush(stdout);
     end;
 {$IFDEF USE_VIDEO_RECORDING}