[fpc-pascal] Bug in AnsiCompareText of cwstring

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Nov 27 13:05:29 CET 2013


Hi all,

When using the cwstring widestringmanager the function AnsiCompareText
seems to have a bug.

For example:

{$mode objfpc}{$H+}

uses
  Classes, SysUtils, cwstring;
begin
  writeln('o   and .   gives ',AnsiCompareText('o','.'));
  writeln('oc  and .o  gives ',AnsiCompareText('oc','.o'));
  writeln('oce and .ou gives ',AnsiCompareText('oce','.ou'));
end.

Result:

o   and .   gives 1
oc  and .o  gives 1
oce and .ou gives -18

I tested on Linux 64bit with fpc 2.6.2 and 2.7.1 (rev 25875).

See bug report
http://bugs.freepascal.org/view.php?id=25378

What is the state of the cwstring manager?

Mattias



More information about the fpc-pascal mailing list