mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
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:
parent
cfe8d9e881
commit
e5bba705a3
6 changed files with 50 additions and 34 deletions
|
@ -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 <greg_casamento@yahoo.com> &
|
||||
Alexander Malmberg <alexander@malmberg.org>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -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"];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue