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:
Richard Frith-MacDonald 2012-01-09 08:28:27 +00:00
parent f339497d46
commit 3fcd9f7d04
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>
* Headers/ObjectiveC2/objc/capabilities.h:

View file

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

View file

@ -4696,8 +4696,13 @@ static void indentation(unsigned level, NSMutableString *str)
INDENT(indent);
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)
@ -4711,7 +4716,7 @@ static void indentation(unsigned level, NSMutableString *str)
}
else
{
[str appendFormat: @"<i4>%ld</i4>", i];
[str appendFormat: @"<i4>%"PRId32"</i4>", (int32_t)i];
}
}
else

View file

@ -235,7 +235,8 @@ NSDataFromAvahiStringList(AvahiStringList* list)
if (buffer == NULL)
{
// 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;
}

View file

@ -68,7 +68,7 @@ describeString(const void *item)
static NSString*
describeInteger(const void *item)
{
return [NSString stringWithFormat: @"%ld", (long)(intptr_t)item];
return [NSString stringWithFormat: @"%"PRIdPTR, (intptr_t)item];
}
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);
if (shmid == -1) /* Created memory? */
{
NSLog(@"[-initWithBytes:length:] shared mem get failed for %lu - %@",
bufferSize, [NSError _last]);
NSLog(@"[-initWithBytes:length:] shared mem get failed for %"
PRIuPTR" - %@", bufferSize, [NSError _last]);
DESTROY(self);
self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
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);
if (bytes == (void*)-1)
{
NSLog(@"[-initWithBytes:length:] shared mem attach failed for %lu - %@",
bufferSize, [NSError _last]);
NSLog(@"[-initWithBytes:length:] shared mem attach failed for %"
PRIuPTR" - %@", bufferSize, [NSError _last]);
bytes = 0;
DESTROY(self);
self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
@ -3301,7 +3301,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (bytes == 0)
{
NSLog(@"[NSMutableDataMalloc -initWithCapacity:] out of memory "
@"for %lu bytes - %@", size, [NSError _last]);
@"for %"PRIuPTR" bytes - %@", size, [NSError _last]);
DESTROY(self);
return nil;
}
@ -3845,7 +3845,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (shmid == -1) /* Created memory? */
{
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory "
@"get failed for %lu - %@", bufferSize, [NSError _last]);
@"get failed for %"PRIuPTR" - %@", bufferSize, [NSError _last]);
DESTROY(self);
self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
return [self initWithCapacity: bufferSize];
@ -3855,7 +3855,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (bytes == (void*)-1)
{
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory "
@"attach failed for %lu - %@", bufferSize, [NSError _last]);
@"attach failed for %"PRIuPTR" - %@", bufferSize, [NSError _last]);
bytes = 0;
DESTROY(self);
self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];

View file

@ -114,7 +114,8 @@
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;
[self dealloc];
self = nil;

View file

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

View file

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

View file

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

View file

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

View file

@ -1535,7 +1535,8 @@ static NSURLProtocol *placeholder = nil;
}
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);
}
if (event == NSStreamEventErrorOccurred)
@ -1547,7 +1548,7 @@ static NSURLProtocol *placeholder = nil;
}
else
{
NSLog(@"Unexpected event %lu ignored on stream %@ of %@",
NSLog(@"Unexpected event %"PRIuPTR" ignored on stream %@ of %@",
event, stream, self);
}
}
@ -1681,7 +1682,8 @@ static NSURLProtocol *placeholder = nil;
}
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);
}
if (event == NSStreamEventErrorOccurred)
@ -1693,7 +1695,7 @@ static NSURLProtocol *placeholder = nil;
}
else
{
NSLog(@"Unexpected event %lu ignored on stream %@ of %@",
NSLog(@"Unexpected event %"PRIuPTR" ignored on stream %@ of %@",
event, stream, self);
}
}

View file

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

View file

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

View file

@ -2201,7 +2201,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
extra: (void*)extra
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);
if (isNonBlocking == NO)
@ -2214,7 +2215,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
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)descriptor);
/*