fix string end handling - s[Length(s)] was broken

git-svn-id: http://code.remobjects.com/svn/pascalscript@144 5c9d2617-0215-0410-a2ee-e80e04d1c6d8
This commit is contained in:
blindahl 2009-05-15 21:25:09 +00:00
parent 44f2182bf0
commit b88b9dd56f

View File

@ -8865,17 +8865,6 @@ begin
end;
case temp.aType.BaseType of
btWideString:
begin
I := Stack.GetInt(-3);
if (i<1) or (i>length(tbtUnicodeString(temp.Dta^))) then
begin
Caller.CMD_Err2(erCustomError, tbtString(RPS_OutOfStringRange));
Result := False;
exit;
end;
Stack.SetInt(-1,Ord(tbtUnicodeString(temp.Dta^)[i]));
end;
btUnicodeString:
begin
I := Stack.GetInt(-3);
if (i<1) or (i>length(tbtwidestring(temp.Dta^))) then
@ -8886,6 +8875,17 @@ begin
end;
Stack.SetInt(-1,Ord(tbtwidestring(temp.Dta^)[i]));
end;
btUnicodeString:
begin
I := Stack.GetInt(-3);
if (i<1) or (i>length(tbtUnicodeString(temp.Dta^))) then
begin
Caller.CMD_Err2(erCustomError, tbtString(RPS_OutOfStringRange));
Result := False;
exit;
end;
Stack.SetInt(-1,Ord(tbtUnicodeString(temp.Dta^)[i]));
end;
else
begin
@ -8904,18 +8904,6 @@ begin
end;
case temp.aType.BaseType of
btWideString:
begin
I := Stack.GetInt(-2);
if (i<1) or (i>length(tbtunicodestring(temp.Dta^))) then
begin
Caller.CMD_Err2(erCustomError, tbtString(RPS_OutOfStringRange));
Result := True;
exit;
end;
tbtunicodestring(temp.Dta^)[i] := WideChar(Stack.GetInt(-1));
end;
btUnicodeString:
begin
I := Stack.GetInt(-2);
if (i<1) or (i>length(tbtWidestring(temp.Dta^))) then
@ -8926,6 +8914,18 @@ begin
end;
tbtWidestring(temp.Dta^)[i] := WideChar(Stack.GetInt(-1));
end;
btUnicodeString:
begin
I := Stack.GetInt(-2);
if (i<1) or (i>length(tbtunicodestring(temp.Dta^))) then
begin
Caller.CMD_Err2(erCustomError, tbtString(RPS_OutOfStringRange));
Result := True;
exit;
end;
tbtunicodestring(temp.Dta^)[i] := WideChar(Stack.GetInt(-1));
end;
else
begin
Result := False;