瀏覽代碼

* 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 年之前
父節點
當前提交
fadf8bf2a5
共有 1 個文件被更改,包括 2 次插入2 次删除
  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}