Răsfoiți Sursa

Cycle works again using unicode

git-svn-id: branches/unicode@24748 -
michael 12 ani în urmă
părinte
comite
f63cb990e1
3 a modificat fișierele cu 10 adăugiri și 6 ștergeri
  1. 1 1
      compiler/cfileutl.pas
  2. 1 1
      compiler/options.pas
  3. 8 4
      rtl/inc/ustrings.inc

+ 1 - 1
compiler/cfileutl.pas

@@ -269,7 +269,7 @@ end;
 
 
     procedure TCachedDirectory.Reload;
     procedure TCachedDirectory.Reload;
       var
       var
-        dir   : TSearchRec;
+        dir   : TRawByteSearchRec;
         entry : PCachedDirectoryEntry;
         entry : PCachedDirectoryEntry;
       begin
       begin
         FreeDirectoryEntries;
         FreeDirectoryEntries;

+ 1 - 1
compiler/options.pas

@@ -2360,7 +2360,7 @@ begin
   while paramindex<paramcount do
   while paramindex<paramcount do
    begin
    begin
      inc(paramindex);
      inc(paramindex);
-     opts:=objpas.paramstr(paramindex);
+     opts:=TCmdStr(objpas.paramstr(paramindex));
      if length(opts)>0 then
      if length(opts)>0 then
        case opts[1] of
        case opts[1] of
          '@' :
          '@' :

+ 8 - 4
rtl/inc/ustrings.inc

@@ -949,14 +949,18 @@ Procedure fpc_UnicodeStr_SetLength(Var S : UnicodeString; l : SizeInt);[Public,A
 Var
 Var
   Temp : Pointer;
   Temp : Pointer;
   movelen: SizeInt;
   movelen: SizeInt;
-  lens, lena : SizeUInt;
+  nl,lens, lena : SizeUInt;
 begin
 begin
+  nl:=l;
+{$IFDEF VER2_6}
+  nl:=nl*2;
+{$ENDIF}
    if (l>0) then
    if (l>0) then
     begin
     begin
       if Pointer(S)=nil then
       if Pointer(S)=nil then
         begin
         begin
           { Need a complete new string...}
           { Need a complete new string...}
-          Pointer(s):=NewUnicodeString(l);
+          Pointer(s):=NewUnicodeString(nl);
         end
         end
       else
       else
         if (PUnicodeRec(Pointer(S)-UnicodeFirstOff)^.Ref = 1) then
         if (PUnicodeRec(Pointer(S)-UnicodeFirstOff)^.Ref = 1) then
@@ -973,7 +977,7 @@ begin
       else
       else
         begin
         begin
           { Reallocation is needed... }
           { Reallocation is needed... }
-          Temp:=NewUnicodeString(L);
+          Temp:=NewUnicodeString(nL);
           if Length(S)>0 then
           if Length(S)>0 then
             begin
             begin
               if l < succ(length(s)) then
               if l < succ(length(s)) then
@@ -988,7 +992,7 @@ begin
         end;
         end;
       { Force nil termination in case it gets shorter }
       { Force nil termination in case it gets shorter }
       PWord(Pointer(S)+l*sizeof(UnicodeChar))^:=0;
       PWord(Pointer(S)+l*sizeof(UnicodeChar))^:=0;
-      PUnicodeRec(Pointer(S)-UnicodeFirstOff)^.Len:=l;
+      PUnicodeRec(Pointer(S)-UnicodeFirstOff)^.Len:=nl;
     end
     end
   else  { length=0, deallocate the string }
   else  { length=0, deallocate the string }
     fpc_unicodestr_decr_ref (Pointer(S));
     fpc_unicodestr_decr_ref (Pointer(S));