#414 closed defect (fixed)
wcscasecmp does not exist on OS X
Reported by: | Philip Taylor | Owned by: | |
---|---|---|---|
Priority: | Should Have | Milestone: | |
Component: | Core engine | Keywords: | simple |
Cc: | Patch: |
Description
We use wcscasecmp but it does not exist on OS X, causing errors. We should either define that function ourselves on OS X (possibly a bad idea since it might conflict with a system version in the future, and we would not bother with the locale support that the standard expects), or define a similar function with a new name (probably in lib/wchar.cpp
, just doing ASCII-case-insensitive comparisons) and use that on all platforms.
Attachments (2)
Change History (10)
comment:1 by , 14 years ago
Keywords: | simple added |
---|
by , 14 years ago
Attachment: | wcscasecmpOSX.patch added |
---|
comment:2 by , 14 years ago
Keywords: | review added |
---|
comment:4 by , 14 years ago
Thanks! I see a couple of problems:
wcscpy
copies the string's null terminator, but wcslen
returns the length without the terminator, so the allocated buffers are too small (it should be sizeof(wchar_t) * (wcslen(s1)+1)
etc).
It would be better not to do any dynamic memory allocation at all (since that can be expensive) - rather than creating strings for wcscmp
, I think it should just loop over both input strings at the same time, and return positive/negative values if the towlower()
ed characters differ.
by , 14 years ago
Attachment: | wcscasecmpOSX-2.patch added |
---|
comment:6 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:8 by , 8 years ago
Keywords: | review removed |
---|
wcscasecmp