Author: rfm
Date: Tue Jul 12 10:18:35 2016
New Revision: 39977

URL: http://svn.gna.org/viewcvs/gnustep?rev=39977&view=rev
Log:
Change incorrect use of unsigned integers

Modified:
    libs/base/trunk/ChangeLog
    libs/base/trunk/Source/GSICUString.m

Modified: libs/base/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=39977&r1=39976&r2=39977&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog   (original)
+++ libs/base/trunk/ChangeLog   Tue Jul 12 10:18:35 2016
@@ -1,3 +1,9 @@
+2016-07-12  Richard Frith-Macdonald <r...@gnu.org>
+
+       * Source/GSICUString.m (UTextNSStringAccess):
+       Fix to use signed integer variables so all the comparisons with zero
+       as a boundary actually work as intended etc (spotted by Wolfgang).
+       
 2016-07-12  Wolfgang Lux  <wolfgang....@gmail.com>
 
        * Source/GSICUString.m (UTextNSStringAccess): Fix unsigned

Modified: libs/base/trunk/Source/GSICUString.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/GSICUString.m?rev=39977&r1=39976&r2=39977&view=diff
==============================================================================
--- libs/base/trunk/Source/GSICUString.m        (original)
+++ libs/base/trunk/Source/GSICUString.m        Tue Jul 12 10:18:35 2016
@@ -55,9 +55,9 @@
 UTextNSStringAccess(UText *ut, int64_t nativeIndex, UBool forward)
 {
   NSString     *str = (NSString*)ut->p;
-  NSUInteger   length = (-1 == ut->c) ? [str length] : ut->c;
-  NSUInteger    nativeStart = ut->chunkNativeStart;
-  NSUInteger    nativeLimit = ut->chunkNativeLimit;
+  NSInteger    length = (-1 == ut->c) ? (NSInteger)[str length] : ut->c;
+  NSInteger     nativeStart = ut->chunkNativeStart;
+  NSInteger     nativeLimit = ut->chunkNativeLimit;
   NSRange      r;
 
   if (forward)
@@ -118,11 +118,8 @@
         {
           nativeLimit = length;
         }
-      if (nativeLimit >= chunkSize)
-        {
-          nativeStart = nativeLimit - chunkSize;
-        }
-      else
+      nativeStart = nativeLimit - chunkSize;
+      if (nativeStart < 0)
         {
           nativeStart = 0;
         }


_______________________________________________
Gnustep-cvs mailing list
Gnustep-cvs@gna.org
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to