[fpc-devel] How to check why WideStringCompare fails?

ko paka kopaka4 at gmail.com
Thu Oct 10 10:04:11 CEST 2013


I had similar issue when use fpc 2.7.1 r25610. I have application on linux
with cwstring manager, but same error was aswell on windows. When I used
ANSICompareStr and as parameters sent 2 unicode strings, result was always
0. What I observed -  because parameters of ANSICompareStr are ansi
strings, 2 calls of fpc_UnicodeStr_To_AnsiStr was made before enter into
ANSICompareStr. In first call was Result of fpc_UnicodeStr_To_AnsiStr on
begin nil - OK. But in second call was Result of fpc_UnicodeStr_To_AnsiStr
on begin not nil - which is not OK and caused free of previously translated
string and create second string on its place. Because of this,
ANSICompareStr both parameters pointed to one memory location and so result
of ANSICompareStr was always 0.
In fpc 2.7.1 r25725 this problem exists never more.

tomas


On Wed, Oct 9, 2013 at 8:51 PM, Martin <lazarus at mfriebe.de> wrote:

> It seems for some people using 2.7.1
>     FCurrentString: string;
>
>         if 0 = WideCompareText(UTF8Decode(**fCurrentString),
>                        UTF8Decode(Copy(ItemList[i], 1,
> Length(fCurrentString))))
>
> does not compare correct.
> http://bugs.freepascal.org/**view.php?id=25156<http://bugs.freepascal.org/view.php?id=25156>
>
>
> How can they best check if this is:
> - an issue with their setup, maybe widestringmanager failing.
> - an issue with UTF8Decode
> -- maybe because the encoding of FCurrentString?
>
> Though I wonder which encoding FCurrentString could have an their system,
> to fail latin a-z letters from being correctly converted?
>
>
> ______________________________**_________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/**mailman/listinfo/fpc-devel<http://lists.freepascal.org/mailman/listinfo/fpc-devel>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20131010/19f99328/attachment.html>


More information about the fpc-devel mailing list