Browse Source

* fixed fpc_UnicodeStr_CheckRange() now that apparently the length in
unicodestring record is stored as the number of widechars rather than
the number of bytes

git-svn-id: trunk@19198 -

Jonas Maebe 14 years ago
parent
commit
fadf8bf2a5
1 changed files with 2 additions and 2 deletions
  1. 2 2
      rtl/inc/ustrings.inc

+ 2 - 2
rtl/inc/ustrings.inc

@@ -1356,14 +1356,14 @@ end;
 
 Procedure fpc_UnicodeStr_CheckRange(len,index : SizeInt);[Public,Alias : 'FPC_UNICODESTR_RANGECHECK']; compilerproc;
 begin
-  if (index>len div 2) or (Index<1) then
+  if (index>len) or (Index<1) then
     HandleErrorFrame(201,get_frame);
 end;
 
 {$else VER2_4}
 Procedure fpc_UnicodeStr_CheckRange(p: Pointer; index: SizeInt);[Public,Alias : 'FPC_UNICODESTR_RANGECHECK']; compilerproc;
 begin
-  if (p=nil) or (index>PUnicodeRec(p-UnicodeFirstOff)^.len div 2) or (Index<1) then
+  if (p=nil) or (index>PUnicodeRec(p-UnicodeFirstOff)^.len) or (Index<1) then
     HandleErrorFrame(201,get_frame);
 end;
 {$endif VER2_4}