You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/11/04 11:35:55 UTC

svn commit: r1405520 - /subversion/trunk/subversion/libsvn_subr/utf_width.c

Author: stefan2
Date: Sun Nov  4 10:35:54 2012
New Revision: 1405520

URL: http://svn.apache.org/viewvc?rev=1405520&view=rev
Log:
Fix signed / unsigned comparison warnings by consistently using uint32.
The data to check is uint32.

* subversion/libsvn_subr/utf_width.c
  (interval, 
   bisearch): use unsigned ints

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

Modified: subversion/trunk/subversion/libsvn_subr/utf_width.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/utf_width.c?rev=1405520&r1=1405519&r2=1405520&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/utf_width.c (original)
+++ subversion/trunk/subversion/libsvn_subr/utf_width.c Sun Nov  4 10:35:54 2012
@@ -67,16 +67,16 @@
 #include "svn_private_config.h"
 
 struct interval {
-  int first;
-  int last;
+  apr_uint32_t first;
+  apr_uint32_t last;
 };
 
 /* auxiliary function for binary search in interval table */
 static int
-bisearch(apr_uint32_t ucs, const struct interval *table, int max)
+bisearch(apr_uint32_t ucs, const struct interval *table, apr_uint32_t max)
 {
-  int min = 0;
-  int mid;
+  apr_uint32_t min = 0;
+  apr_uint32_t mid;
 
   if (ucs < table[0].first || ucs > table[max].last)
     return 0;
@@ -85,7 +85,7 @@ bisearch(apr_uint32_t ucs, const struct 
     if (ucs > table[mid].last)
       min = mid + 1;
     else if (ucs < table[mid].first)
-      max = mid - 1;
+      max = mid - 1; /* this is safe because ucs >= table[0].first */
     else
       return 1;
   }