mirror of
https://github.com/CTCaer/hidapi.git
synced 2024-11-23 10:09:46 +00:00
linux: Fix bug on mbstowcs() usage
In case of error mbstowcs() returns (size_t) -1 It is not a negative value since mbstowcs() returns a size_t (unsigned) Fix compiler warning: hid.c: In function 'utf8_to_wchar_t': hid.c:105:3: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
This commit is contained in:
parent
ee808f9dfc
commit
367fc3f3aa
@ -102,7 +102,7 @@ static wchar_t *utf8_to_wchar_t(const char *utf8)
|
||||
|
||||
if (utf8) {
|
||||
size_t wlen = mbstowcs(NULL, utf8, 0);
|
||||
if (wlen < 0) {
|
||||
if ((size_t) -1 == wlen) {
|
||||
return wcsdup(L"");
|
||||
}
|
||||
ret = calloc(wlen+1, sizeof(wchar_t));
|
||||
|
Loading…
Reference in New Issue
Block a user