From 911168ec6fdb9bd9bda1ff71180cdb56c4093a62 Mon Sep 17 00:00:00 2001 From: helge Date: Sun, 24 Apr 2005 18:43:44 +0000 Subject: [PATCH] fixed gcc 4.0 warnings git-svn-id: http://svn.opengroupware.org/SOPE/trunk@771 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-core/NGExtensions/ChangeLog | 4 ++++ .../NGExtensions/FdExt.subproj/NSNull+misc.m | 2 +- .../FdExt.subproj/NSProcessInfo+misc.m | 2 +- .../FdExt.subproj/NSString+HTMLEscaping.m | 4 ++-- .../FdExt.subproj/NSString+URLEscaping.m | 16 ++++++++-------- .../FdExt.subproj/NSString+XMLEscaping.m | 2 +- sope-core/NGExtensions/NGDirectoryEnumerator.m | 8 +++++--- .../NGLogEventDetailedFormatter.m | 12 ++++++------ sope-core/NGExtensions/NGObjCRuntime.m | 3 ++- sope-core/NGExtensions/Version | 2 +- 10 files changed, 31 insertions(+), 24 deletions(-) diff --git a/sope-core/NGExtensions/ChangeLog b/sope-core/NGExtensions/ChangeLog index e63f6a11..f7fcd50e 100644 --- a/sope-core/NGExtensions/ChangeLog +++ b/sope-core/NGExtensions/ChangeLog @@ -1,3 +1,7 @@ +2005-04-24 Helge Hess + + * fixed gcc 4.0 warnings (v4.5.158) + 2005-04-04 Marcus Mueller * FdExt.subproj/NSObject+Logs.m: fixed previously broken implementation diff --git a/sope-core/NGExtensions/FdExt.subproj/NSNull+misc.m b/sope-core/NGExtensions/FdExt.subproj/NSNull+misc.m index f74b968b..15846eb4 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSNull+misc.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSNull+misc.m @@ -169,7 +169,7 @@ static inline BOOL doAbort(void) { if (doAbort()) abort(); if ((sig = [_invocation methodSignature])) { - const unsigned char *ret; + const char *ret; if ((ret = [sig methodReturnType])) { switch (*ret) { diff --git a/sope-core/NGExtensions/FdExt.subproj/NSProcessInfo+misc.m b/sope-core/NGExtensions/FdExt.subproj/NSProcessInfo+misc.m index 6230ecc7..0c7bc1bb 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSProcessInfo+misc.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSProcessInfo+misc.m @@ -228,7 +228,7 @@ static NSNumber *_uint(unsigned int i) { dict = [NSMutableDictionary dictionaryWithCapacity:res]; if (res > 0) [dict setObject:_int(pid) forKey:@"pid"]; - if (res > 1) [dict setObject:[NSString stringWithCString:comm] + if (res > 1) [dict setObject:[NSString stringWithCString:(char *)comm] forKey:@"comm"]; if (res > 2) [dict setObject:[NSString stringWithCString:&state length:1] forKey:@"state"]; diff --git a/sope-core/NGExtensions/FdExt.subproj/NSString+HTMLEscaping.m b/sope-core/NGExtensions/FdExt.subproj/NSString+HTMLEscaping.m index c61377f8..9595bdb8 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSString+HTMLEscaping.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSString+HTMLEscaping.m @@ -109,7 +109,7 @@ unsigned char nbuf[16]; unsigned int k; - sprintf(nbuf, "&#%i;", (int)chars[i]); + sprintf((char *)nbuf, "&#%i;", (int)chars[i]); for (k = 0; nbuf[k] != '\0'; k++) { buf[j] = nbuf[k]; j++; @@ -205,7 +205,7 @@ unsigned char nbuf[16]; unsigned int k; - sprintf(nbuf, "&#%i;", (int)chars[i]); + sprintf((char *)nbuf, "&#%i;", (int)chars[i]); for (k = 0; nbuf[k] != '\0'; k++) { buf[j] = nbuf[k]; j++; diff --git a/sope-core/NGExtensions/FdExt.subproj/NSString+URLEscaping.m b/sope-core/NGExtensions/FdExt.subproj/NSString+URLEscaping.m index eb385924..acd88786 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSString+URLEscaping.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSString+URLEscaping.m @@ -131,7 +131,7 @@ NGEscapeUrlBuffer(const unsigned char *_source, unsigned char *_dest, } else { // any other char is escaped .. *_dest = '%'; _dest++; - sprintf(_dest, "%02X", (unsigned)*src); + sprintf((char *)_dest, "%02X", (unsigned)*src); _dest += 2; } } @@ -236,7 +236,7 @@ NGUnescapeUrlBuffer(const unsigned char *_source, unsigned char *_dest) - (NSString *)stringByUnescapingURL { /* - input is a URL string - per definition ASCII(?!), like "hello%98%88.txt" + Input is a URL string - per definition ASCII(?!), like "hello%98%88.txt" output is a unicode string (never longer than the input) Note that the input itself is in some encoding! That is, the input is @@ -258,12 +258,12 @@ NGUnescapeUrlBuffer(const unsigned char *_source, unsigned char *_dest) cstr[len] = '\0'; buffer = malloc(len + 4); - NGUnescapeUrlBuffer(cstr, buffer); + NGUnescapeUrlBuffer((unsigned char *)cstr, (unsigned char *)buffer); if (doUseUTF8Encoding()) { /* OK, the input is considered UTF-8 encoded in a string */ s = [[NSString alloc] initWithUTF8String:buffer]; - if (buffer) free(buffer); + if (buffer != NULL) free(buffer); buffer = NULL; } else { s = [[NSString alloc] @@ -271,7 +271,7 @@ NGUnescapeUrlBuffer(const unsigned char *_source, unsigned char *_dest) length:strlen(buffer) freeWhenDone:YES]; } - if (cstr) free(cstr); + if (cstr != NULL) free(cstr); cstr = NULL; return [s autorelease]; } @@ -298,18 +298,18 @@ NGUnescapeUrlBuffer(const unsigned char *_source, unsigned char *_dest) return @""; buffer = malloc(len * 3 + 2); - NGEscapeUrlBuffer([data bytes], buffer, len); + NGEscapeUrlBuffer([data bytes], (unsigned char *)buffer, len); } else { unsigned char *cstr; len = [self cStringLength]; cstr = malloc(len + 4); - [self getCString:cstr]; // Unicode! + [self getCString:(char *)cstr]; // Unicode! cstr[len] = '\0'; buffer = malloc(len * 3 + 2); - NGEscapeUrlBuffer(cstr, buffer, len); + NGEscapeUrlBuffer(cstr, (unsigned char *)buffer, len); if (cstr) free(cstr); } diff --git a/sope-core/NGExtensions/FdExt.subproj/NSString+XMLEscaping.m b/sope-core/NGExtensions/FdExt.subproj/NSString+XMLEscaping.m index fa877b30..cc4e229e 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSString+XMLEscaping.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSString+XMLEscaping.m @@ -80,7 +80,7 @@ unsigned char nbuf[16]; unsigned int k; - sprintf(nbuf, "&#%i;", (int)chars[i]); + sprintf((char *)nbuf, "&#%i;", (int)chars[i]); for (k = 0; nbuf[k] != '\0'; k++) { buf[j] = nbuf[k]; j++; diff --git a/sope-core/NGExtensions/NGDirectoryEnumerator.m b/sope-core/NGExtensions/NGDirectoryEnumerator.m index f3e48d3e..5462cc9f 100644 --- a/sope-core/NGExtensions/NGDirectoryEnumerator.m +++ b/sope-core/NGExtensions/NGDirectoryEnumerator.m @@ -267,9 +267,9 @@ @implementation NGDirEntry -- (id)initWithFileManager:(id)_fm path:(NSString *)_path { +- (id)initWithFileManager:(id)_fm path:(NSString *)_p{ self->fileManager = [_fm retain]; - self->path = [_path copy]; + self->path = [_p copy]; return self; } @@ -280,6 +280,8 @@ [super dealloc]; } +/* operations */ + - (NSString *)readdir { NSString *s; @@ -292,7 +294,7 @@ } s = [self->e nextObject]; - //NSLog(@"readdir: %@", s); + // [self logWithFormat:@"readdir: %@", s]; return s; } diff --git a/sope-core/NGExtensions/NGLogging.subproj/NGLogEventDetailedFormatter.m b/sope-core/NGExtensions/NGLogging.subproj/NGLogEventDetailedFormatter.m index 5a4da75f..0d51ad14 100644 --- a/sope-core/NGExtensions/NGLogging.subproj/NGLogEventDetailedFormatter.m +++ b/sope-core/NGExtensions/NGLogging.subproj/NGLogEventDetailedFormatter.m @@ -65,15 +65,15 @@ static char *monthNames[14] = { pn = [processInfo processName]; len = [pn cStringLength]; processName = malloc(len + 4); - [pn getCString:processName]; + [pn getCString:(char *)processName]; } -static __inline__ unsigned char * levelPrefixForEvent(NGLogEvent *_event) { +static __inline__ unsigned char *levelPrefixForEvent(NGLogEvent *_event) { switch ([_event level]) { - case NGLogLevelWarn: return "[WARN] "; - case NGLogLevelError: return "[ERROR] "; - case NGLogLevelFatal: return "[FATAL] "; - default: return ""; + case NGLogLevelWarn: return (unsigned char *)"[WARN] "; + case NGLogLevelError: return (unsigned char *)"[ERROR] "; + case NGLogLevelFatal: return (unsigned char *)"[FATAL] "; + default: return (unsigned char *)""; } } diff --git a/sope-core/NGExtensions/NGObjCRuntime.m b/sope-core/NGExtensions/NGObjCRuntime.m index c95c7b2d..5c577f0d 100644 --- a/sope-core/NGExtensions/NGObjCRuntime.m +++ b/sope-core/NGExtensions/NGObjCRuntime.m @@ -679,7 +679,8 @@ fillMethodListWithSpecs(MethodList_t methods, SEL _selector, va_list *va) #if !LIB_FOUNDATION_LIBRARY names[i] = [NSString stringWithCString:ivarName]; #else - names[i] = [NSString stringWithCStringNoCopy:ivarName freeWhenDone:NO]; + names[i] = [NSString stringWithCStringNoCopy:(char *)ivarName + freeWhenDone:NO]; #endif } diff --git a/sope-core/NGExtensions/Version b/sope-core/NGExtensions/Version index d4e24680..55539210 100644 --- a/sope-core/NGExtensions/Version +++ b/sope-core/NGExtensions/Version @@ -1,6 +1,6 @@ # version -SUBMINOR_VERSION:=157 +SUBMINOR_VERSION:=158 # v4.3.115 requires libFoundation v1.0.59 # v4.2.72 requires libEOControl v4.2.39 -- 2.39.5