word size fixups

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34468 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2012-01-09 08:28:27 +00:00
parent 9cb78b1fa9
commit b143b3fabf
15 changed files with 63 additions and 36 deletions

View file

@ -1,3 +1,22 @@
2012-01-09 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSConcretePointerFunctions.m:
* Source/NSSocketPort.m:
* Source/unix/NSStream.m:
* Source/NSKeyedUnarchiver.m:
* Source/NSZone.m:
* Source/NSMessagePort.m:
* Source/win32/GSFileHandle.m:
* Source/NSInvocation.m:
* Source/NSURLProtocol.m:
* Source/Additions/GSMime.m:
* Source/Additions/GSXML.m:
* Source/NSData.m:
* Source/GSAvahiNetService.m:
* Source/NSTextCheckingResult.m:
Use PRIdPTR and PRIuPTR rather than ld and lu for printf formatting
of NSInteger and NSUInteger values.
2012-01-08 Richard Frith-Macdonald <rfm@gnu.org> 2012-01-08 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/ObjectiveC2/objc/capabilities.h: * Headers/ObjectiveC2/objc/capabilities.h:

View file

@ -3789,8 +3789,8 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
} }
if (offset > fold) if (offset > fold)
{ {
NSLog(@"Name '%@' too long for folding at %lu in header", NSLog(@"Name '%@' too long for folding at %"PRIuPTR" in header",
n, (unsigned long)fold); n, fold);
} }
offset = appendBytes(md, offset, fold, ":", 1); offset = appendBytes(md, offset, fold, ":", 1);

View file

@ -4696,8 +4696,13 @@ static void indentation(unsigned level, NSMutableString *str)
INDENT(indent); INDENT(indent);
if (strchr("cCsSiIlL", *t) != 0) if (strchr("cCsSiIlL", *t) != 0)
{ {
long i = [self longValue]; int64_t i = [self longLongValue];
if ((i & 0xffffffff) != i)
{
[NSException raise: NSInternalInconsistencyException
format: @"Can't encode %"PRId64" as i4"];
}
if ((i == 0 || i == 1) && (*t == 'c' || *t == 'C')) if ((i == 0 || i == 1) && (*t == 'c' || *t == 'C'))
{ {
if (i == 0) if (i == 0)
@ -4711,7 +4716,7 @@ static void indentation(unsigned level, NSMutableString *str)
} }
else else
{ {
[str appendFormat: @"<i4>%ld</i4>", i]; [str appendFormat: @"<i4>%"PRId32"</i4>", (int32_t)i];
} }
} }
else else

View file

@ -235,7 +235,8 @@ NSDataFromAvahiStringList(AvahiStringList* list)
if (buffer == NULL) if (buffer == NULL)
{ {
// Should we raise an exception? // Should we raise an exception?
NSDebugLog(@"Couldn't allocate %lu bytes for txt record", len); NSDebugLog(@"Couldn't allocate %"PRIuPTR" bytes for txt record",,
(uintptr_t)len);
return nil; return nil;
} }

View file

@ -68,7 +68,7 @@ describeString(const void *item)
static NSString* static NSString*
describeInteger(const void *item) describeInteger(const void *item)
{ {
return [NSString stringWithFormat: @"%ld", (long)(intptr_t)item]; return [NSString stringWithFormat: @"%"PRIdPTR, (intptr_t)item];
} }
static NSString* static NSString*

View file

@ -3111,8 +3111,8 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
shmid = shmget(IPC_PRIVATE, bufferSize, IPC_CREAT|VM_RDONLY); shmid = shmget(IPC_PRIVATE, bufferSize, IPC_CREAT|VM_RDONLY);
if (shmid == -1) /* Created memory? */ if (shmid == -1) /* Created memory? */
{ {
NSLog(@"[-initWithBytes:length:] shared mem get failed for %lu - %@", NSLog(@"[-initWithBytes:length:] shared mem get failed for %"
bufferSize, [NSError _last]); PRIuPTR" - %@", bufferSize, [NSError _last]);
DESTROY(self); DESTROY(self);
self = [dataMalloc allocWithZone: NSDefaultMallocZone()]; self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
return [self initWithBytes: aBuffer length: bufferSize]; return [self initWithBytes: aBuffer length: bufferSize];
@ -3121,8 +3121,8 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
bytes = shmat(shmid, 0, 0); bytes = shmat(shmid, 0, 0);
if (bytes == (void*)-1) if (bytes == (void*)-1)
{ {
NSLog(@"[-initWithBytes:length:] shared mem attach failed for %lu - %@", NSLog(@"[-initWithBytes:length:] shared mem attach failed for %"
bufferSize, [NSError _last]); PRIuPTR" - %@", bufferSize, [NSError _last]);
bytes = 0; bytes = 0;
DESTROY(self); DESTROY(self);
self = [dataMalloc allocWithZone: NSDefaultMallocZone()]; self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
@ -3301,7 +3301,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (bytes == 0) if (bytes == 0)
{ {
NSLog(@"[NSMutableDataMalloc -initWithCapacity:] out of memory " NSLog(@"[NSMutableDataMalloc -initWithCapacity:] out of memory "
@"for %lu bytes - %@", size, [NSError _last]); @"for %"PRIuPTR" bytes - %@", size, [NSError _last]);
DESTROY(self); DESTROY(self);
return nil; return nil;
} }
@ -3845,7 +3845,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (shmid == -1) /* Created memory? */ if (shmid == -1) /* Created memory? */
{ {
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory " NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory "
@"get failed for %lu - %@", bufferSize, [NSError _last]); @"get failed for %"PRIuPTR" - %@", bufferSize, [NSError _last]);
DESTROY(self); DESTROY(self);
self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()]; self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
return [self initWithCapacity: bufferSize]; return [self initWithCapacity: bufferSize];
@ -3855,7 +3855,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (bytes == (void*)-1) if (bytes == (void*)-1)
{ {
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory " NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory "
@"attach failed for %lu - %@", bufferSize, [NSError _last]); @"attach failed for %"PRIuPTR" - %@", bufferSize, [NSError _last]);
bytes = 0; bytes = 0;
DESTROY(self); DESTROY(self);
self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()]; self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];

View file

@ -114,7 +114,8 @@
if (buffer == (void*)0) if (buffer == (void*)0)
{ {
NSLog(@"Failed to map %lu bytes for execute: %@", _size, [NSError _last]); NSLog(@"Failed to map %"PRIuPTR
" bytes for execute: %@", _size, [NSError _last]);
buffer = 0; buffer = 0;
[self dealloc]; [self dealloc];
self = nil; self = nil;

View file

@ -501,8 +501,8 @@ static NSMapTable *globalClassMap = 0;
if (i > INT_MAX || i < INT_MIN) if (i > INT_MAX || i < INT_MIN)
{ {
[NSException raise: NSRangeException [NSException raise: NSRangeException
format: @"[%@ +%@]: value %ld for key(%@) is out of range", format: @"[%@ +%@]: value %"PRIu64" for key(%@) is out of range",
NSStringFromClass([self class]), NSStringFromSelector(_cmd), i, aKey]; NSStringFromClass([self class]), NSStringFromSelector(_cmd), i, aKey];
} }
#endif #endif
return (int)i; return (int)i;
@ -534,8 +534,8 @@ static NSMapTable *globalClassMap = 0;
if (i > INT32_MAX || i < INT32_MIN) if (i > INT32_MAX || i < INT32_MIN)
{ {
[NSException raise: NSRangeException [NSException raise: NSRangeException
format: @"[%@ +%@]: value for key(%@) is out of range", format: @"[%@ +%@]: value %"PRIu64" for key(%@) is out of range",
NSStringFromClass([self class]), NSStringFromSelector(_cmd), aKey]; NSStringFromClass([self class]), NSStringFromSelector(_cmd), i, aKey];
} }
return (int32_t)i; return (int32_t)i;
} }

View file

@ -1792,7 +1792,7 @@ typedef struct {
rl = [self reservedSpaceLength]; rl = [self reservedSpaceLength];
if (length != 0 && length != rl) if (length != 0 && length != rl)
{ {
NSLog(@"bad reserved length - %lu", length); NSLog(@"bad reserved length - %"PRIuPTR, length);
return NO; return NO;
} }
if ([receivingPort isKindOfClass: messagePortClass] == NO) if ([receivingPort isKindOfClass: messagePortClass] == NO)

View file

@ -2289,7 +2289,7 @@ static Class tcpPortClass;
rl = [self reservedSpaceLength]; rl = [self reservedSpaceLength];
if (length != 0 && length != rl) if (length != 0 && length != rl)
{ {
NSLog(@"bad reserved length - %lu", length); NSLog(@"bad reserved length - %"PRIuPTR, length);
return NO; return NO;
} }
if ([receivingPort isKindOfClass: tcpPortClass] == NO) if ([receivingPort isKindOfClass: tcpPortClass] == NO)

View file

@ -83,7 +83,7 @@
if (idx >= [self numberOfRanges]) if (idx >= [self numberOfRanges])
{ {
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"index %lu out of range", (unsigned long)idx]; format: @"index %"PRIuPTR" out of range", (unsigned long)idx];
} }
return [self range]; return [self range];
} }
@ -121,7 +121,7 @@
if (idx >= rangeCount) if (idx >= rangeCount)
{ {
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"index %lu out of range", (unsigned long)idx]; format: @"index %"PRIuPTR" out of range", (unsigned long)idx];
} }
return ranges[idx]; return ranges[idx];
} }
@ -151,8 +151,8 @@
(offset < 0 && r.location < -offset)) (offset < 0 && r.location < -offset))
{ {
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"Invalid offset %ld for range: %@", format: @"Invalid offset %"PRIdPTR" for range: %@",
(long)offset, NSStringFromRange(r)]; offset, NSStringFromRange(r)];
} }
r.location += offset; r.location += offset;
result->ranges[i] = r; result->ranges[i] = r;

View file

@ -1535,7 +1535,8 @@ static NSURLProtocol *placeholder = nil;
} }
else else
{ {
NSLog(@"Unexpected event %lu occurred on stream %@ not being used by %@", NSLog(@"Unexpected event %"PRIuPTR
" occurred on stream %@ not being used by %@",
event, stream, self); event, stream, self);
} }
if (event == NSStreamEventErrorOccurred) if (event == NSStreamEventErrorOccurred)
@ -1547,7 +1548,7 @@ static NSURLProtocol *placeholder = nil;
} }
else else
{ {
NSLog(@"Unexpected event %lu ignored on stream %@ of %@", NSLog(@"Unexpected event %"PRIuPTR" ignored on stream %@ of %@",
event, stream, self); event, stream, self);
} }
} }
@ -1681,7 +1682,8 @@ static NSURLProtocol *placeholder = nil;
} }
else else
{ {
NSLog(@"Unexpected event %lu occurred on stream %@ not being used by %@", NSLog(@"Unexpected event %"PRIuPTR
" occurred on stream %@ not being used by %@",
event, stream, self); event, stream, self);
} }
if (event == NSStreamEventErrorOccurred) if (event == NSStreamEventErrorOccurred)
@ -1693,7 +1695,7 @@ static NSURLProtocol *placeholder = nil;
} }
else else
{ {
NSLog(@"Unexpected event %lu ignored on stream %@ of %@", NSLog(@"Unexpected event %"PRIuPTR" ignored on stream %@ of %@",
event, stream, self); event, stream, self);
} }
} }

View file

@ -102,8 +102,7 @@
void * void *
GSOutOfMemory(NSUInteger size, BOOL retry) GSOutOfMemory(NSUInteger size, BOOL retry)
{ {
fprintf(stderr, "GSOutOfMemory ... wanting %lu bytes.\n", fprintf(stderr, "GSOutOfMemory ... wanting %"PRIuPTR" bytes.\n", size);
(unsigned long)size);
return 0; return 0;
} }

View file

@ -192,8 +192,7 @@
} }
else else
{ {
NSLog(@"_dispatch with unexpected status %lu", NSLog(@"_dispatch with unexpected status %"PRIuPTR, [self streamStatus]);
(unsigned long)[self streamStatus]);
} }
} }
@end @end
@ -322,8 +321,7 @@
} }
else else
{ {
NSLog(@"_dispatch with unexpected status %lu", NSLog(@"_dispatch with unexpected status %"PRIuPTR, [self streamStatus]);
(unsigned long)[self streamStatus]);
} }
} }
@end @end

View file

@ -2201,7 +2201,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
extra: (void*)extra extra: (void*)extra
forMode: (NSString*)mode forMode: (NSString*)mode
{ {
NSDebugMLLog(@"NSFileHandle", @"%@ event: %lu type: %lu extra: %lu mode: %@", NSDebugMLLog(@"NSFileHandle", @"%@ event: %"PRIuPTR" type: %"PRIuPTR
" extra: %"PRIuPTR" mode: %@",
self, (uintptr_t)data, (uintptr_t)type, (uintptr_t)extra, mode); self, (uintptr_t)data, (uintptr_t)type, (uintptr_t)extra, mode);
if (isNonBlocking == NO) if (isNonBlocking == NO)
@ -2214,7 +2215,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (type != ET_HANDLE) if (type != ET_HANDLE)
{ {
NSLog(@"Argh, TRIGGER on socket %lu %lu %@ with event %u desc %u", NSLog(@"Argh, TRIGGER on socket %"PRIuPTR" %"PRIuPTR
" %@ with event %u desc %u",
(uintptr_t)data, (uintptr_t)extra, mode, (uintptr_t)event, (uintptr_t)data, (uintptr_t)extra, mode, (uintptr_t)event,
(uintptr_t)descriptor); (uintptr_t)descriptor);
/* /*