diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2020-09-19 15:55:09 +0100 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2020-09-28 14:11:26 +0100 |
commit | 129c9844a6c40d5dee658151c2ff2c461a5a1365 (patch) | |
tree | d2b7a36b4a8ca9647b2d53714b0b38fca6add1a5 | |
parent | 3bb579a43c09d18217a19035054817591eb8d870 (diff) | |
download | newlib-129c9844a6c40d5dee658151c2ff2c461a5a1365.zip newlib-129c9844a6c40d5dee658151c2ff2c461a5a1365.tar.gz newlib-129c9844a6c40d5dee658151c2ff2c461a5a1365.tar.bz2 |
Cygwin: avoid GCC 10 error with -Werror=narrowing
../../../../src/winsup/cygwin/fhandler_console.cc: In member function 'const unsigned char* fhandler_console::write_normal(const unsigned char*, const unsigned char*)':
../../../../src/winsup/cygwin/fhandler_console.cc:2782:8: error: narrowing conversion of '-2' from 'int' to 'long unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/fhandler_console.cc:2786:8: error: narrowing conversion of '-1' from 'int' to 'long unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/fhandler_console.cc:2836:8: error: narrowing conversion of '-2' from 'int' to 'long unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/fhandler_console.cc:2840:8: error: narrowing conversion of '-1' from 'int' to 'long unsigned int' [-Wnarrowing]
A mbtowc_p function returns an int, so that seems the correct type to use here.
-rw-r--r-- | winsup/cygwin/fhandler_console.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 33e40a9..41cac37 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -2759,7 +2759,7 @@ fhandler_console::write_normal (const unsigned char *src, DWORD done; DWORD buf_len; const unsigned char *found = src; - size_t ret; + int ret; mbstate_t ps; mbtowc_p f_mbtowc; @@ -2938,7 +2938,7 @@ do_print: { ret = __utf8_mbtowc (_REENT, NULL, (const char *) found + 1, end - found - 1, &ps); - if (ret != (size_t) -1) + if (ret != -1) while (ret-- > 0) { WCHAR w = *(found + 1); |