Sfoglia il codice sorgente

* fixed shortstring version of setstring

Jonas Maebe 22 anni fa
parent
commit
eee67f89ea
1 ha cambiato i file con 5 aggiunte e 7 eliminazioni
  1. 5 7
      rtl/inc/sstrings.inc

+ 5 - 7
rtl/inc/sstrings.inc

@@ -671,24 +671,22 @@ end;
 
 
 Procedure SetString (Var S : Shortstring; Buf : PChar; Len : Longint);
-var
-  BufLen: Longint;
 begin
-  S[0]:=chr(Len);
   If Len > High(S) then
     Len := High(S);
+  SetLength(S,Len);
   If Buf<>Nil then
     begin
-      BufLen := StrLen(Buf);
-      if BufLen < Len then
-        Len := BufLen;
       Move (Buf[0],S[1],Len);
     end;
 end;
 
 {
   $Log$
-  Revision 1.26  2002-10-21 19:52:47  jonas
+  Revision 1.27  2003-02-26 20:04:47  jonas
+    * fixed shortstring version of setstring
+
+  Revision 1.26  2002/10/21 19:52:47  jonas
     * fixed some buffer overflow errors in SetString (both short and
       ansistring versions) (merged)