#31 Assert exception in CString::TrimLeft() and TrimRight()

Version 7.3
closed-fixed
David
Win32++ (25)
5
2014-01-17
2012-10-25
Claudio Nicora
No

Suppose we have a CString string filled with "русский" ("russian" in russian language).

If you try to right trim the string you'll get an assert exception due to the fact it calls isspace() for each char while scanning the string.
LeftTrim() does the same, but with my sample string works because forst char is <128.

Since the CString contains Unicode chars, we need to call iswspace(), otherwise isspace() fails assert on the last char (й).

Cheers
Claudio

Discussion

  • David
    David
    2014-01-17

    • status: open --> closed-fixed
    • assigned_to: David
     
  • David
    David
    2014-01-17

    Hi Claudio,

    Thanks for bringing this to my attention.
    I replaced isspace with its tchar equivalent: _istspace.

    Fixed in SVN revision 1711

    Best regards,
    David