Change incorrect use of unsigned integers

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39977 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2016-07-12 08:18:35 +00:00
parent fc436a1ea4
commit d05eee4fda
2 changed files with 11 additions and 8 deletions

View file

@ -1,3 +1,9 @@
2016-07-12 Richard Frith-Macdonald <rfm@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.lux@gmail.com>
* Source/GSICUString.m (UTextNSStringAccess): Fix unsigned

View file

@ -55,9 +55,9 @@ UBool
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 @@ UTextNSStringAccess(UText *ut, int64_t nativeIndex, UBool forward)
{
nativeLimit = length;
}
if (nativeLimit >= chunkSize)
{
nativeStart = nativeLimit - chunkSize;
}
else
nativeStart = nativeLimit - chunkSize;
if (nativeStart < 0)
{
nativeStart = 0;
}