소스 검색

* 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;
 Procedure fpc_UnicodeStr_CheckRange(len,index : SizeInt);[Public,Alias : 'FPC_UNICODESTR_RANGECHECK']; compilerproc;
 begin
 begin
-  if (index>len div 2) or (Index<1) then
+  if (index>len) or (Index<1) then
     HandleErrorFrame(201,get_frame);
     HandleErrorFrame(201,get_frame);
 end;
 end;
 
 
 {$else VER2_4}
 {$else VER2_4}
 Procedure fpc_UnicodeStr_CheckRange(p: Pointer; index: SizeInt);[Public,Alias : 'FPC_UNICODESTR_RANGECHECK']; compilerproc;
 Procedure fpc_UnicodeStr_CheckRange(p: Pointer; index: SizeInt);[Public,Alias : 'FPC_UNICODESTR_RANGECHECK']; compilerproc;
 begin
 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);
     HandleErrorFrame(201,get_frame);
 end;
 end;
 {$endif VER2_4}
 {$endif VER2_4}