2
0
Эх сурвалжийг харах

* cwstring.pp, Wide2AnsiMove: moved SetCodePage to the end, so it comes after the last SetLength. Necessary after r20209, because SetLength has been modified to always set the code page of its argument. Here it sets code page of 'dest' to CP_NONE, because dest is RawByteString.
(Before r20209, SetLength was preserving code page when the string was resized in place and had refcount=1)

git-svn-id: trunk@20214 -

sergei 13 жил өмнө
parent
commit
c862aec17c

+ 1 - 1
rtl/unix/cwstring.pp

@@ -302,7 +302,6 @@ procedure Wide2AnsiMove(source:pwidechar; var dest:RawByteString; cp:TSystemCode
     my0:=0;
     my0:=0;
     { rought estimation }
     { rought estimation }
     setlength(dest,len*3);
     setlength(dest,len*3);
-    SetCodePage(dest,cp,false);
     outlength:=len*3;
     outlength:=len*3;
     srclen:=len*2;
     srclen:=len*2;
     srcpos:=source;
     srcpos:=source;
@@ -344,6 +343,7 @@ procedure Wide2AnsiMove(source:pwidechar; var dest:RawByteString; cp:TSystemCode
       end;
       end;
     // truncate string
     // truncate string
     setlength(dest,length(dest)-outleft);
     setlength(dest,length(dest)-outleft);
+    SetCodePage(dest,cp,false);
     if free_iconv then
     if free_iconv then
       iconv_close(use_iconv);
       iconv_close(use_iconv);
   end;
   end;