]> diplodocus.org Git - nmh/commitdiff
On some platforms, -D_FORTIFY_SOURCE=2 warns about ignoring the
authorDavid Levine <levinedl@acm.org>
Sun, 7 Sep 2014 14:56:21 +0000 (09:56 -0500)
committerDavid Levine <levinedl@acm.org>
Sun, 7 Sep 2014 14:56:21 +0000 (09:56 -0500)
return value from mbtowc() even when it is called to reset the
shift state.  So wrap that in an if statement with a null body.

sbr/charstring.c
sbr/fmt_scan.c
test/getcwidth.c

index cc2e907e284c32c731f5dbe3bd65af9ba501357d..d007e7b59c11740267104850cf929c2bf52396bc 100644 (file)
@@ -161,7 +161,7 @@ charstring_last_char_len (const charstring_t s) {
     const char *sp = charstring_buffer (s);
     size_t remaining = charstring_bytes (s);
 
     const char *sp = charstring_buffer (s);
     size_t remaining = charstring_bytes (s);
 
-    (void) mbtowc (NULL, NULL, 0); /* reset shift state */
+    if (mbtowc (NULL, NULL, 0)) {} /* reset shift state */
 
     while (*sp  &&  remaining > 0) {
         wchar_t wide_char;
 
     while (*sp  &&  remaining > 0) {
         wchar_t wide_char;
index 47a5fe87ecb83ddc890617fc4ef979b0bba024a0..cc5c192d3904b86520bb37f1e22c3fdcd30c8534 100644 (file)
@@ -144,7 +144,7 @@ cptrimmed(charstring_t dest, char *str, int wid, char fill, size_t max) {
 
     if ((sp = str)) {
 #ifdef MULTIBYTE_SUPPORT
 
     if ((sp = str)) {
 #ifdef MULTIBYTE_SUPPORT
-       mbtowc(NULL, NULL, 0); /* reset shift state */
+       if (mbtowc(NULL, NULL, 0)) {} /* reset shift state */
 #endif
        end = strlen(str);
        while (*sp && remaining > 0 && end > 0) {
 #endif
        end = strlen(str);
        while (*sp && remaining > 0 && end > 0) {
@@ -252,7 +252,7 @@ cpstripped (charstring_t dest, size_t max, char *str)
     len = strlen(str);
 
 #ifdef MULTIBYTE_SUPPORT
     len = strlen(str);
 
 #ifdef MULTIBYTE_SUPPORT
-    mbtowc(NULL, NULL, 0);  /* Reset shift state */
+    if (mbtowc(NULL, NULL, 0)) {}  /* Reset shift state */
 #endif /* MULTIBYTE_SUPPORT */
 
     /*
 #endif /* MULTIBYTE_SUPPORT */
 
     /*
index 2c4755b1c924d5a60f223c54ae62efeec571c888..c1717e17f58334976e3358503f8809fee52a735a 100644 (file)
@@ -114,7 +114,7 @@ getwidth(const char *string)
         * at a time.
         */
 
         * at a time.
         */
 
-       mbtowc(NULL, NULL, 0);
+       if (mbtowc(NULL, NULL, 0)) {}
 
        while (charleft > 0) {
                int clen;
 
        while (charleft > 0) {
                int clen;