Browse Source

--- Merging r13826 into '.':
U rtl/inc/ustrings.inc
U rtl/inc/wustring22.inc
U rtl/inc/wstrings.inc
A tests/webtbs/tw14740.pp
--- Merging r13828 into '.':
G rtl/inc/ustrings.inc
G rtl/inc/wstrings.inc
U tests/webtbs/tw14740.pp
--- Merging r14053 into '.':
G rtl/inc/wustring22.inc

git-svn-id: branches/fixes_2_4@15186 -

Jonas Maebe 15 years ago
parent
commit
23143b8537
5 changed files with 35 additions and 50 deletions
  1. 1 0
      .gitattributes
  2. 2 16
      rtl/inc/ustrings.inc
  3. 2 18
      rtl/inc/wstrings.inc
  4. 2 16
      rtl/inc/wustring22.inc
  5. 28 0
      tests/webtbs/tw14740.pp

+ 1 - 0
.gitattributes

@@ -9450,6 +9450,7 @@ tests/webtbs/tw14553.pp svneol=native#text/pascal
 tests/webtbs/tw14617.pp svneol=native#text/plain
 tests/webtbs/tw14617.pp svneol=native#text/plain
 tests/webtbs/tw1470.pp svneol=native#text/plain
 tests/webtbs/tw1470.pp svneol=native#text/plain
 tests/webtbs/tw1472.pp svneol=native#text/plain
 tests/webtbs/tw1472.pp svneol=native#text/plain
+tests/webtbs/tw14740.pp svneol=native#text/plain
 tests/webtbs/tw14743.pp svneol=native#text/pascal
 tests/webtbs/tw14743.pp svneol=native#text/pascal
 tests/webtbs/tw1477.pp svneol=native#text/plain
 tests/webtbs/tw1477.pp svneol=native#text/plain
 tests/webtbs/tw1479.pp svneol=native#text/plain
 tests/webtbs/tw1479.pp svneol=native#text/plain

+ 2 - 16
rtl/inc/ustrings.inc

@@ -1647,18 +1647,10 @@ end;
 
 
 
 
 Procedure SetString (Out S : UnicodeString; Buf : PUnicodeChar; Len : SizeInt);
 Procedure SetString (Out S : UnicodeString; Buf : PUnicodeChar; Len : SizeInt);
-var
-  BufLen: SizeInt;
 begin
 begin
   SetLength(S,Len);
   SetLength(S,Len);
   If (Buf<>Nil) and (Len>0) then
   If (Buf<>Nil) and (Len>0) then
-    begin
-      BufLen := IndexWord(Buf^, Len+1, 0);
-      If (BufLen>0) and (BufLen < Len) then
-        Len := BufLen;
-      Move (Buf[0],S[1],Len*sizeof(UnicodeChar));
-      PUnicodeChar(Pointer(S)+Len*sizeof(UnicodeChar))^:=#0;
-    end;
+    Move (Buf[0],S[1],Len*sizeof(UnicodeChar));
 end;
 end;
 
 
 
 
@@ -1668,13 +1660,7 @@ var
 begin
 begin
   SetLength(S,Len);
   SetLength(S,Len);
   If (Buf<>Nil) and (Len>0) then
   If (Buf<>Nil) and (Len>0) then
-    begin
-      BufLen := IndexByte(Buf^, Len+1, 0);
-      If (BufLen>0) and (BufLen < Len) then
-        Len := BufLen;
-      widestringmanager.Ansi2UnicodeMoveProc(Buf,S,Len);
-      //PUnicodeChar(Pointer(S)+Len*sizeof(UnicodeChar))^:=#0;
-    end;
+    widestringmanager.Ansi2UnicodeMoveProc(Buf,S,Len);
 end;
 end;
 
 
 
 

+ 2 - 18
rtl/inc/wstrings.inc

@@ -1017,34 +1017,18 @@ end;
 
 
 
 
 Procedure SetString (Out S : WideString; Buf : PWideChar; Len : SizeInt);
 Procedure SetString (Out S : WideString; Buf : PWideChar; Len : SizeInt);
-var
-  BufLen: SizeInt;
 begin
 begin
   SetLength(S,Len);
   SetLength(S,Len);
   If (Buf<>Nil) and (Len>0) then
   If (Buf<>Nil) and (Len>0) then
-    begin
-      BufLen := IndexWord(Buf^, Len+1, 0);
-      If (BufLen>0) and (BufLen < Len) then
-        Len := BufLen;
-      Move (Buf[0],S[1],Len*sizeof(WideChar));
-      PWideChar(Pointer(S)+Len*sizeof(WideChar))^:=#0;
-    end;
+    Move (Buf[0],S[1],Len*sizeof(WideChar));
 end;
 end;
 
 
 
 
 Procedure SetString (Out S : WideString; Buf : PChar; Len : SizeInt);
 Procedure SetString (Out S : WideString; Buf : PChar; Len : SizeInt);
-var
-  BufLen: SizeInt;
 begin
 begin
   SetLength(S,Len);
   SetLength(S,Len);
   If (Buf<>Nil) and (Len>0) then
   If (Buf<>Nil) and (Len>0) then
-    begin
-      BufLen := IndexByte(Buf^, Len+1, 0);
-      If (BufLen>0) and (BufLen < Len) then
-        Len := BufLen;
-      widestringmanager.Ansi2WideMoveProc(Buf,S,Len);
-      //PWideChar(Pointer(S)+Len*sizeof(WideChar))^:=#0;
-    end;
+    widestringmanager.Ansi2WideMoveProc(Buf,S,Len);
 end;
 end;
 
 
 
 

+ 2 - 16
rtl/inc/wustring22.inc

@@ -1434,18 +1434,10 @@ end;
 
 
 
 
 Procedure SetString (Out S : WideString; Buf : PWideChar; Len : SizeInt);
 Procedure SetString (Out S : WideString; Buf : PWideChar; Len : SizeInt);
-var
-  BufLen: SizeInt;
 begin
 begin
   SetLength(S,Len);
   SetLength(S,Len);
   If (Buf<>Nil) and (Len>0) then
   If (Buf<>Nil) and (Len>0) then
-    begin
-      BufLen := IndexWord(Buf^, Len+1, 0);
-      If (BufLen>0) and (BufLen < Len) then
-        Len := BufLen;
-      Move (Buf[0],S[1],Len*sizeof(WideChar));
-      PWideChar(Pointer(S)+Len*sizeof(WideChar))^:=#0;
-    end;
+    Move (Buf[0],S[1],Len*sizeof(WideChar));
 end;
 end;
 
 
 
 
@@ -1455,13 +1447,7 @@ var
 begin
 begin
   SetLength(S,Len);
   SetLength(S,Len);
   If (Buf<>Nil) and (Len>0) then
   If (Buf<>Nil) and (Len>0) then
-    begin
-      BufLen := IndexByte(Buf^, Len+1, 0);
-      If (BufLen>0) and (BufLen < Len) then
-        Len := BufLen;
-      widestringmanager.Ansi2WideMoveProc(Buf,S,Len);
-      //PWideChar(Pointer(S)+Len*sizeof(WideChar))^:=#0;
-    end;
+    widestringmanager.Ansi2WideMoveProc(Buf,S,Len);
 end;
 end;
 
 
 
 

+ 28 - 0
tests/webtbs/tw14740.pp

@@ -0,0 +1,28 @@
+var
+  w: widestring;
+  u: unicodestring;
+  pw: pwidechar;
+  pu: punicodechar;
+  p: pchar;
+begin
+  pw:='abc'#0'def';
+  setstring(w,pw,7);
+  if w<>'abc'#0'def' then
+    halt(1);
+  w:='';
+
+  pu:='abc'#0'def';
+  setstring(u,pu,7);
+  if u<>'abc'#0'def' then
+    halt(2);
+  u:='';
+
+  p:='abc'#0'def';
+  setstring(w,p,7);
+  if w<>'abc'#0'def' then
+    halt(3);
+
+  setstring(u,p,7);
+  if u<>'abc'#0'def' then
+    halt(4);
+end.