* fixed strpos() in case source or target is nil

+ added test for this

git-svn-id: trunk@1907 -
This commit is contained in:
Jonas Maebe 2005-12-09 14:57:10 +00:00
parent 830d9956a9
commit 9b9dd342c5
3 changed files with 16 additions and 0 deletions

1
.gitattributes vendored
View File

@ -5422,6 +5422,7 @@ tests/test/tstring4.pp svneol=native#text/plain
tests/test/tstring5.pp svneol=native#text/plain
tests/test/tstring6.pp svneol=native#text/plain
tests/test/tstring7.pp svneol=native#text/plain
tests/test/tstring8.pp svneol=native#text/plain
tests/test/tstrreal1.pp svneol=native#text/plain
tests/test/tstrreal2.pp svneol=native#text/plain
tests/test/tsubdecl.pp svneol=native#text/plain

View File

@ -47,6 +47,8 @@
lstr2 : SizeInt;
begin
strpos:=nil;
if (str1 = nil) or (str2 = nil) then
exit;
p:=strscan(str1,str2^);
if p=nil then
exit;

13
tests/test/tstring8.pp Normal file
View File

@ -0,0 +1,13 @@
uses strings;
var
a, b: pchar;
begin
a := nil;
b := 'abc';
if (strpos(a,b) <> nil) or
(strpos(b,a) <> nil) or
(strpos(a,a) <> nil) then
halt(1);
end.