pas2c does not like setlength called with a shortstring apparently
authorsheepluva
Sun, 01 Mar 2015 15:04:31 +0100
changeset 10837 1b7a4d3111ea
parent 10836 0b415bc2e0eb
child 10838 2abe883c9c21
pas2c does not like setlength called with a shortstring apparently
hedgewars/uChat.pas
--- a/hedgewars/uChat.pas	Sun Mar 01 04:15:11 2015 +0100
+++ b/hedgewars/uChat.pas	Sun Mar 01 15:04:31 2015 +0100
@@ -113,7 +113,8 @@
     font:= CheckCJKFont(ansistring(str), fnt16);
 
     // get only substring before cursor to determine length
-    SetLength(str, Length(InputLinePrefix) + cursorPos);
+    // SetLength(str, Length(InputLinePrefix) + cursorPos); // makes pas2c unhappy
+    str[0]:= char(Length(InputLinePrefix) + cursorPos);
     // get render size of text
     TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(str), @coff, nil);
 
@@ -124,7 +125,8 @@
         begin
         if selectedPos > cursorPos then
             str:= InputLinePrefix + InputStr.s;
-        SetLength(str, Length(InputLinePrefix) + selectedPos);
+        // SetLength(str, Length(InputLinePrefix) + selectedPos); // makes pas2c unhappy
+        str[0]:= char(Length(InputLinePrefix) + selectedPos);
         TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(str), @soff, nil);
         selectionDx:= soff - coff;
         end