subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matti...@apache.org
Subject svn commit: r1468255 - /subversion/trunk/subversion/libsvn_subr/utf_validate.c
Date Mon, 15 Apr 2013 22:22:39 GMT
Author: mattiase
Date: Mon Apr 15 22:22:39 2013
New Revision: 1468255

URL: http://svn.apache.org/r1468255
Log:
Avoid a "condition always true" warning on platforms where char
is unsigned by default, such as PowerPC and ARM.

* subversion/libsvn_subr/utf_validate.c
  (first_non_fsm_start_char, first_non_fsm_start_char_cstring):
   Add explicit cast to avoid warning when plain char is unsigned.

Approved by: Philip Martin

Modified:
    subversion/trunk/subversion/libsvn_subr/utf_validate.c

Modified: subversion/trunk/subversion/libsvn_subr/utf_validate.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/utf_validate.c?rev=1468255&r1=1468254&r2=1468255&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/utf_validate.c (original)
+++ subversion/trunk/subversion/libsvn_subr/utf_validate.c Mon Apr 15 22:22:39 2013
@@ -271,7 +271,7 @@ first_non_fsm_start_char(const char *dat
       max_len -= len;
 
       for (; len > 0; ++data, --len)
-        if (*data < 0 || *data >= 0x80)
+        if ((unsigned char)*data >= 0x80)
           return data;
     }
 
@@ -285,7 +285,7 @@ first_non_fsm_start_char(const char *dat
 
   /* The remaining odd bytes will be examined the naive way: */
   for (; max_len > 0; ++data, --max_len)
-    if (*data < 0 || *data >= 0x80)
+    if ((unsigned char)*data >= 0x80)
       break;
 
   return data;
@@ -304,7 +304,7 @@ first_non_fsm_start_char_cstring(const c
    * segfault.
    */
   for (; (apr_uintptr_t)data & (sizeof(apr_uintptr_t)-1); ++data)
-    if (*data <= 0 || *data >= 0x80)
+    if (*data == 0 || (unsigned char)*data >= 0x80)
       return data;
 
   /* Scan the input one machine word at a time. */
@@ -331,7 +331,7 @@ first_non_fsm_start_char_cstring(const c
 
   /* The remaining odd bytes will be examined the naive way: */
   for (; ; ++data)
-    if (*data <= 0 || *data >= 0x80)
+    if (*data == 0 || (unsigned char)*data >= 0x80)
       break;
 
   return data;



Mime
View raw message