diff --git a/ChangeLog b/ChangeLog index 203a77d62..57e4d2ace 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,12 @@ test node type. * Source/Additions/GSMime.m: Add convenience method for putting a new header in a document. + * Source/NSCalendarDate.m: Tweak to avoid useless compiler warning. + * Source/NSRunLoop.m: ditto + * Source/NSURL.m: ditto + * Source/Additions/GSMime.m: ditto + * Source/Additions/Unicode.m: ditto + 2003-07-27 Gregory John Casamento & Alexander Malmberg diff --git a/Source/Additions/GSMime.m b/Source/Additions/GSMime.m index 4b8d52f32..c96d4fc45 100644 --- a/Source/Additions/GSMime.m +++ b/Source/Additions/GSMime.m @@ -779,7 +779,7 @@ wordData(NSString *word) unsigned char *dst; const char *src; const char *end; - const char *footers = src; + const char *footers; ctxt = (GSMimeChunkedDecoderContext*)con; @@ -787,6 +787,7 @@ wordData(NSString *word) * Get pointers into source data buffer. */ src = (const char *)[sData bytes]; + footers = src; src += aRange.location; end = src + aRange.length; beg = 0; @@ -3850,7 +3851,7 @@ static NSCharacterSet *tokenSet = nil; GSMimeHeader *type; GSMimeHeader *enc; GSMimeHeader *hdr; - NSData *boundary; + NSData *boundary = 0; BOOL contentIsBinary = NO; BOOL contentIs7bit = YES; unsigned int count; diff --git a/Source/Additions/Unicode.m b/Source/Additions/Unicode.m index de0f151c1..e471c774f 100644 --- a/Source/Additions/Unicode.m +++ b/Source/Additions/Unicode.m @@ -447,23 +447,24 @@ GSEncodingForRegistry (NSString *registry, NSString *encoding) NSStringEncoding GSEncodingFromLocale(const char *clocale) { - NSStringEncoding encoding; - NSString *encodstr; + NSStringEncoding encoding = GSUndefinedEncoding; + NSString *encodstr; if (clocale == NULL || strcmp(clocale, "C") == 0 || strcmp(clocale, "POSIX") == 0) { /* Don't make any assumptions. Let caller handle that */ - return GSUndefinedEncoding; + return encoding; } if (strchr (clocale, '.') != NULL) { /* Locale contains the 'codeset' section. Parse it and see if we know what encoding this cooresponds to */ - NSString *registry; - NSArray *array; - char *s; + NSString *registry; + NSArray *array; + char *s; + s = strchr (clocale, '.'); registry = [[NSString stringWithCString: s+1] lowercaseString]; array = [registry componentsSeparatedByString: @"-"]; @@ -491,7 +492,7 @@ GSEncodingFromLocale(const char *clocale) inDirectory: @"Languages"]; if (table != nil) { - int count; + unsigned count; NSDictionary *dict; dict = [NSDictionary dictionaryWithContentsOfFile: table]; @@ -503,8 +504,7 @@ GSEncodingFromLocale(const char *clocale) /* Find the matching encoding */ count = 0; while (str_encoding_table[count].enc - && strcmp(str_encoding_table[count].ename, - [encodstr lossyCString])) + && strcmp(str_encoding_table[count].ename, [encodstr lossyCString])) { count++; } @@ -1240,8 +1240,8 @@ tables: default: #ifdef HAVE_ICONV { - char *inbuf; - char *outbuf; + unsigned char *inbuf; + unsigned char *outbuf; size_t inbytesleft; size_t outbytesleft; size_t rval; @@ -1271,21 +1271,21 @@ tables: break; } - inbuf = (char*)src; + inbuf = (unsigned char*)src; inbytesleft = slen; - outbuf = (char*)ptr; + outbuf = (unsigned char*)ptr; outbytesleft = bsize * sizeof(unichar); do { if (inbytesleft == 0) { done = YES; // Flush iconv - rval = iconv(cd, 0, 0, &outbuf, &outbytesleft); + rval = iconv(cd, 0, 0, (void*)&outbuf, &outbytesleft); } else { rval = iconv(cd, - &inbuf, &inbytesleft, &outbuf, &outbytesleft); + (void*)&inbuf, &inbytesleft, (void*)&outbuf, &outbytesleft); } dpos = (bsize * sizeof(unichar) - outbytesleft) / sizeof(unichar); if (rval == (size_t)-1) @@ -1295,7 +1295,7 @@ tables: unsigned old = bsize; GROW(); - outbuf = (char*)&ptr[dpos]; + outbuf = (unsigned char*)&ptr[dpos]; outbytesleft += (bsize - old) * sizeof(unichar); } else @@ -1671,7 +1671,7 @@ bases: } if (u < base) { - ptr[dpos++] = (char)u; + ptr[dpos++] = (unsigned char)u; } else { @@ -1695,7 +1695,7 @@ bases: } if (u < base) { - ptr[dpos++] = (char)u; + ptr[dpos++] = (unsigned char)u; } else { @@ -1782,7 +1782,7 @@ tables: * The character set has a lower section whose contents * are identical to unicode, so no mapping is needed. */ - ptr[dpos++] = (char)u; + ptr[dpos++] = (unsigned char)u; } else if (table != 0 && (i = chop(u, table, tsize)) >= 0) { @@ -1835,8 +1835,8 @@ tables: #ifdef HAVE_ICONV { iconv_t cd; - char *inbuf; - char *outbuf; + unsigned char *inbuf; + unsigned char *outbuf; size_t inbytesleft; size_t outbytesleft; size_t rval; @@ -1865,21 +1865,21 @@ tables: break; } - inbuf = (char*)src; + inbuf = (unsigned char*)src; inbytesleft = slen * sizeof(unichar); - outbuf = (char*)ptr; + outbuf = (unsigned char*)ptr; outbytesleft = bsize; do { if (inbytesleft == 0) { done = YES; // Flush buffer - rval = iconv(cd, 0, 0, &outbuf, &outbytesleft); + rval = iconv(cd, 0, 0, (void*)&outbuf, &outbytesleft); } else { rval = iconv(cd, - &inbuf, &inbytesleft, &outbuf, &outbytesleft); + (void*)&inbuf, &inbytesleft, (void*)&outbuf, &outbytesleft); } dpos = bsize - outbytesleft; if (rval != 0) @@ -1891,7 +1891,7 @@ tables: unsigned old = bsize; GROW(); - outbuf = (char*)&ptr[dpos]; + outbuf = (unsigned char*)&ptr[dpos]; outbytesleft += (bsize - old); } else if (errno == EILSEQ) diff --git a/Source/NSCalendarDate.m b/Source/NSCalendarDate.m index 898d306a9..5cfe97e7f 100644 --- a/Source/NSCalendarDate.m +++ b/Source/NSCalendarDate.m @@ -2178,13 +2178,21 @@ static inline int getDigits(const char *from, char *to, int limit) How about daylight savings time? */ if ([date isKindOfClass: [NSCalendarDate class]]) - tmp = (NSCalendarDate*)RETAIN(date); + { + tmp = (NSCalendarDate*)RETAIN(date); + } else if ([date isKindOfClass: [NSDate class]]) - tmp = [[NSCalendarDate alloc] initWithTimeIntervalSinceReferenceDate: - [date timeIntervalSinceReferenceDate]]; + { + tmp = [[NSCalendarDate alloc] initWithTimeIntervalSinceReferenceDate: + [date timeIntervalSinceReferenceDate]]; + } else - [NSException raise: NSInvalidArgumentException - format: @"%@ invalid date given - %@", NSStringFromSelector(_cmd), date]; + { + tmp = nil; // Avoid compiler warning + [NSException raise: NSInvalidArgumentException + format: @"%@ invalid date given - %@", + NSStringFromSelector(_cmd), date]; + } end = (NSCalendarDate*)[self laterDate: tmp]; if (end == self) diff --git a/Source/NSRunLoop.m b/Source/NSRunLoop.m index 125867fbc..196cc8fa5 100644 --- a/Source/NSRunLoop.m +++ b/Source/NSRunLoop.m @@ -1529,7 +1529,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt) info = [self _getWatcher: data type: type forMode: mode]; - if (info != nil && info->receiver == (id)watcher) + if (info != nil && (id)info->receiver == (id)watcher) { /* Increment usage count for this watcher. */ info->count++; diff --git a/Source/NSURL.m b/Source/NSURL.m index 6ad0fbf9b..a961bfa0e 100644 --- a/Source/NSURL.m +++ b/Source/NSURL.m @@ -424,6 +424,7 @@ static void unescape(const char *from, char * to) } else { + c = 0; // Avoid compiler warning [NSException raise: NSGenericException format: @"Bad percent escape sequence in URL string"]; }