Tweaks to avoid compiler warnings.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17383 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2003-07-28 16:44:24 +00:00
parent 02aace51b0
commit 77ab6be142
6 changed files with 50 additions and 34 deletions

View file

@ -6,6 +6,12 @@
test node type. test node type.
* Source/Additions/GSMime.m: Add convenience method for putting * Source/Additions/GSMime.m: Add convenience method for putting
a new header in a document. 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 <greg_casamento@yahoo.com> & 2003-07-27 Gregory John Casamento <greg_casamento@yahoo.com> &
Alexander Malmberg <alexander@malmberg.org> Alexander Malmberg <alexander@malmberg.org>

View file

@ -779,7 +779,7 @@ wordData(NSString *word)
unsigned char *dst; unsigned char *dst;
const char *src; const char *src;
const char *end; const char *end;
const char *footers = src; const char *footers;
ctxt = (GSMimeChunkedDecoderContext*)con; ctxt = (GSMimeChunkedDecoderContext*)con;
@ -787,6 +787,7 @@ wordData(NSString *word)
* Get pointers into source data buffer. * Get pointers into source data buffer.
*/ */
src = (const char *)[sData bytes]; src = (const char *)[sData bytes];
footers = src;
src += aRange.location; src += aRange.location;
end = src + aRange.length; end = src + aRange.length;
beg = 0; beg = 0;
@ -3850,7 +3851,7 @@ static NSCharacterSet *tokenSet = nil;
GSMimeHeader *type; GSMimeHeader *type;
GSMimeHeader *enc; GSMimeHeader *enc;
GSMimeHeader *hdr; GSMimeHeader *hdr;
NSData *boundary; NSData *boundary = 0;
BOOL contentIsBinary = NO; BOOL contentIsBinary = NO;
BOOL contentIs7bit = YES; BOOL contentIs7bit = YES;
unsigned int count; unsigned int count;

View file

@ -447,23 +447,24 @@ GSEncodingForRegistry (NSString *registry, NSString *encoding)
NSStringEncoding NSStringEncoding
GSEncodingFromLocale(const char *clocale) GSEncodingFromLocale(const char *clocale)
{ {
NSStringEncoding encoding; NSStringEncoding encoding = GSUndefinedEncoding;
NSString *encodstr; NSString *encodstr;
if (clocale == NULL || strcmp(clocale, "C") == 0 if (clocale == NULL || strcmp(clocale, "C") == 0
|| strcmp(clocale, "POSIX") == 0) || strcmp(clocale, "POSIX") == 0)
{ {
/* Don't make any assumptions. Let caller handle that */ /* Don't make any assumptions. Let caller handle that */
return GSUndefinedEncoding; return encoding;
} }
if (strchr (clocale, '.') != NULL) if (strchr (clocale, '.') != NULL)
{ {
/* Locale contains the 'codeset' section. Parse it and see /* Locale contains the 'codeset' section. Parse it and see
if we know what encoding this cooresponds to */ if we know what encoding this cooresponds to */
NSString *registry; NSString *registry;
NSArray *array; NSArray *array;
char *s; char *s;
s = strchr (clocale, '.'); s = strchr (clocale, '.');
registry = [[NSString stringWithCString: s+1] lowercaseString]; registry = [[NSString stringWithCString: s+1] lowercaseString];
array = [registry componentsSeparatedByString: @"-"]; array = [registry componentsSeparatedByString: @"-"];
@ -491,7 +492,7 @@ GSEncodingFromLocale(const char *clocale)
inDirectory: @"Languages"]; inDirectory: @"Languages"];
if (table != nil) if (table != nil)
{ {
int count; unsigned count;
NSDictionary *dict; NSDictionary *dict;
dict = [NSDictionary dictionaryWithContentsOfFile: table]; dict = [NSDictionary dictionaryWithContentsOfFile: table];
@ -503,8 +504,7 @@ GSEncodingFromLocale(const char *clocale)
/* Find the matching encoding */ /* Find the matching encoding */
count = 0; count = 0;
while (str_encoding_table[count].enc while (str_encoding_table[count].enc
&& strcmp(str_encoding_table[count].ename, && strcmp(str_encoding_table[count].ename, [encodstr lossyCString]))
[encodstr lossyCString]))
{ {
count++; count++;
} }
@ -1240,8 +1240,8 @@ tables:
default: default:
#ifdef HAVE_ICONV #ifdef HAVE_ICONV
{ {
char *inbuf; unsigned char *inbuf;
char *outbuf; unsigned char *outbuf;
size_t inbytesleft; size_t inbytesleft;
size_t outbytesleft; size_t outbytesleft;
size_t rval; size_t rval;
@ -1271,21 +1271,21 @@ tables:
break; break;
} }
inbuf = (char*)src; inbuf = (unsigned char*)src;
inbytesleft = slen; inbytesleft = slen;
outbuf = (char*)ptr; outbuf = (unsigned char*)ptr;
outbytesleft = bsize * sizeof(unichar); outbytesleft = bsize * sizeof(unichar);
do do
{ {
if (inbytesleft == 0) if (inbytesleft == 0)
{ {
done = YES; // Flush iconv done = YES; // Flush iconv
rval = iconv(cd, 0, 0, &outbuf, &outbytesleft); rval = iconv(cd, 0, 0, (void*)&outbuf, &outbytesleft);
} }
else else
{ {
rval = iconv(cd, rval = iconv(cd,
&inbuf, &inbytesleft, &outbuf, &outbytesleft); (void*)&inbuf, &inbytesleft, (void*)&outbuf, &outbytesleft);
} }
dpos = (bsize * sizeof(unichar) - outbytesleft) / sizeof(unichar); dpos = (bsize * sizeof(unichar) - outbytesleft) / sizeof(unichar);
if (rval == (size_t)-1) if (rval == (size_t)-1)
@ -1295,7 +1295,7 @@ tables:
unsigned old = bsize; unsigned old = bsize;
GROW(); GROW();
outbuf = (char*)&ptr[dpos]; outbuf = (unsigned char*)&ptr[dpos];
outbytesleft += (bsize - old) * sizeof(unichar); outbytesleft += (bsize - old) * sizeof(unichar);
} }
else else
@ -1671,7 +1671,7 @@ bases:
} }
if (u < base) if (u < base)
{ {
ptr[dpos++] = (char)u; ptr[dpos++] = (unsigned char)u;
} }
else else
{ {
@ -1695,7 +1695,7 @@ bases:
} }
if (u < base) if (u < base)
{ {
ptr[dpos++] = (char)u; ptr[dpos++] = (unsigned char)u;
} }
else else
{ {
@ -1782,7 +1782,7 @@ tables:
* The character set has a lower section whose contents * The character set has a lower section whose contents
* are identical to unicode, so no mapping is needed. * 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) else if (table != 0 && (i = chop(u, table, tsize)) >= 0)
{ {
@ -1835,8 +1835,8 @@ tables:
#ifdef HAVE_ICONV #ifdef HAVE_ICONV
{ {
iconv_t cd; iconv_t cd;
char *inbuf; unsigned char *inbuf;
char *outbuf; unsigned char *outbuf;
size_t inbytesleft; size_t inbytesleft;
size_t outbytesleft; size_t outbytesleft;
size_t rval; size_t rval;
@ -1865,21 +1865,21 @@ tables:
break; break;
} }
inbuf = (char*)src; inbuf = (unsigned char*)src;
inbytesleft = slen * sizeof(unichar); inbytesleft = slen * sizeof(unichar);
outbuf = (char*)ptr; outbuf = (unsigned char*)ptr;
outbytesleft = bsize; outbytesleft = bsize;
do do
{ {
if (inbytesleft == 0) if (inbytesleft == 0)
{ {
done = YES; // Flush buffer done = YES; // Flush buffer
rval = iconv(cd, 0, 0, &outbuf, &outbytesleft); rval = iconv(cd, 0, 0, (void*)&outbuf, &outbytesleft);
} }
else else
{ {
rval = iconv(cd, rval = iconv(cd,
&inbuf, &inbytesleft, &outbuf, &outbytesleft); (void*)&inbuf, &inbytesleft, (void*)&outbuf, &outbytesleft);
} }
dpos = bsize - outbytesleft; dpos = bsize - outbytesleft;
if (rval != 0) if (rval != 0)
@ -1891,7 +1891,7 @@ tables:
unsigned old = bsize; unsigned old = bsize;
GROW(); GROW();
outbuf = (char*)&ptr[dpos]; outbuf = (unsigned char*)&ptr[dpos];
outbytesleft += (bsize - old); outbytesleft += (bsize - old);
} }
else if (errno == EILSEQ) else if (errno == EILSEQ)

View file

@ -2178,13 +2178,21 @@ static inline int getDigits(const char *from, char *to, int limit)
How about daylight savings time? How about daylight savings time?
*/ */
if ([date isKindOfClass: [NSCalendarDate class]]) if ([date isKindOfClass: [NSCalendarDate class]])
tmp = (NSCalendarDate*)RETAIN(date); {
tmp = (NSCalendarDate*)RETAIN(date);
}
else if ([date isKindOfClass: [NSDate class]]) else if ([date isKindOfClass: [NSDate class]])
tmp = [[NSCalendarDate alloc] initWithTimeIntervalSinceReferenceDate: {
[date timeIntervalSinceReferenceDate]]; tmp = [[NSCalendarDate alloc] initWithTimeIntervalSinceReferenceDate:
[date timeIntervalSinceReferenceDate]];
}
else 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]; end = (NSCalendarDate*)[self laterDate: tmp];
if (end == self) if (end == self)

View file

@ -1529,7 +1529,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
info = [self _getWatcher: data type: type forMode: mode]; 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. */ /* Increment usage count for this watcher. */
info->count++; info->count++;

View file

@ -424,6 +424,7 @@ static void unescape(const char *from, char * to)
} }
else else
{ {
c = 0; // Avoid compiler warning
[NSException raise: NSGenericException [NSException raise: NSGenericException
format: @"Bad percent escape sequence in URL string"]; format: @"Bad percent escape sequence in URL string"];
} }