further tweaks

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32058 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2011-02-11 11:45:07 +00:00
parent d935a085f8
commit d81ac8a945
4 changed files with 10 additions and 5 deletions

View file

@ -3,6 +3,9 @@
* Source/NSArray.m:
* Source/NSString.m:
* Source/NSPointerArray.m:
* Source/NSAttributedString.m:
* Source/Additions/GSXML.m:
* Source/NSData.m:
* Tools/AGSParser.m:
Tweaks to try to avoid clang analyser warnings.
* Source/NSPropertyList.m:

View file

@ -122,7 +122,7 @@ inline static NSString*
UTF8Str(const unsigned char *bytes)
{
// stringWithUTF8String: raises on OSX if you feed it with a NULL string.
if ((bytes == NULL)) {
if (NULL == bytes) {
return nil;
}
return (*usImp)(NSString_class, usSel, bytes);

View file

@ -460,7 +460,7 @@ appendUIntData(NSMutableData *d, NSUInteger i)
NSRange tmpRange;
IMP getImp;
if (rangeLimit.location < 0 || NSMaxRange(rangeLimit) > [self length])
if (NSMaxRange(rangeLimit) > [self length])
{
[NSException raise: NSRangeException
format: @"RangeError in method -attributesAtIndex:longestEffectiveRange:inRange: in class NSAttributedString"];
@ -548,7 +548,7 @@ appendUIntData(NSMutableData *d, NSUInteger i)
BOOL (*eImp)(id,SEL,id);
IMP getImp;
if (rangeLimit.location < 0 || NSMaxRange(rangeLimit) > [self length])
if (NSMaxRange(rangeLimit) > [self length])
{
[NSException raise: NSRangeException
format: @"RangeError in method -attribute:atIndex:longestEffectiveRange:inRange: in class NSAttributedString"];

View file

@ -3006,6 +3006,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
*/
- (id) initWithContentsOfMappedFile: (NSString*)path
{
off_t off;
int fd;
#if defined(__MINGW__)
@ -3033,14 +3034,15 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
return nil;
}
/* Find size of file to be mapped. */
length = lseek(fd, 0, SEEK_END);
if (length < 0)
off = lseek(fd, 0, SEEK_END);
if (off < 0)
{
NSWarnMLog(@"unable to seek to eof %@ - %@", path, [NSError _last]);
close(fd);
DESTROY(self);
return nil;
}
length = off;
/* Position at start of file. */
if (lseek(fd, 0, SEEK_SET) != 0)
{