[fpc-devel] StrPos giving a access violation

Graeme Geldenhuys graeme at mastermaths.co.za
Thu Dec 8 13:34:34 CET 2005


Hi

Forgot to mention, I ran this using:
Free Pascal Compiler version 2.0.1 [2005/10/02] for i386 on Windows 2000

G.


-------- Original Message --------
Subject: StrPos giving a access violation
Date: Thu, 08 Dec 2005 14:26:14 +0200
From: Graeme Geldenhuys <graeme at mastermaths.co.za>
Organization: Master Maths (Pty) Ltd
To: FPC developers' list <fpc-devel at lists.freepascal.org>

Hi,

The 3rd unit test fails due to StrPos giving a access violation.  I ran
this same unit test under Delphi 7 and it passed as StrPos returned a
nil value when passing two '' param values.

Has this been reported as a bug yet?


-----------------  CUT  -------------------
var
   lFrom: string;
   lSearch: string;
   lResult: PChar;
begin
   lFrom   := 'abc';
   lSearch := 'b';
   lResult := StrPos(Pointer(lFrom), Pointer(lSearch));
   AssertEquals('Failing on 1', 'bc', string(lResult));

   lSearch := 'x';
   lResult := StrPos(Pointer(lFrom), Pointer(lSearch));
   AssertEquals('Failing on 2', '', string(lResult));

   lFrom   := '';
   lSearch := '';
   lResult := StrPos(Pointer(lFrom), Pointer(lSearch));
   AssertEquals('Failing on 3', '', string(lResult));

-----------------  END  -------------------


Regards,
   - Graeme -










More information about the fpc-devel mailing list