From: helge Date: Sat, 23 Apr 2005 22:31:31 +0000 (+0000) Subject: fixed gcc 4.0 warnings X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=725776f0b41856548cdff4808b2e0701c067aaeb;p=sope fixed gcc 4.0 warnings git-svn-id: http://svn.opengroupware.org/SOPE/trunk@764 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-core/EOControl/ChangeLog b/sope-core/EOControl/ChangeLog index 52662fd4..b439189b 100644 --- a/sope-core/EOControl/ChangeLog +++ b/sope-core/EOControl/ChangeLog @@ -1,3 +1,7 @@ +2005-04-24 Helge Hess + + * fixed gcc 4.0 signed/unsigned warnings (v4.5.51) + 2005-01-14 Helge Hess * EOFetchSpecification.m: minor code cleanups (v4.5.50) diff --git a/sope-core/EOControl/EOGenericRecord.m b/sope-core/EOControl/EOGenericRecord.m index 31fc71f8..d1343c05 100644 --- a/sope-core/EOControl/EOGenericRecord.m +++ b/sope-core/EOControl/EOGenericRecord.m @@ -149,7 +149,7 @@ static inline void _willChange(EOGenericRecord *self) { [self willChange]; } -- (void)takeValue:(id)_value forKey:(id)_key { +- (void)takeValue:(id)_value forKey:(NSString *)_key { id value; if (_value == nil) _value = null; @@ -169,7 +169,7 @@ static inline void _willChange(EOGenericRecord *self) { eoInsert(self, _key, _value); } } -- (id)valueForKey:(id)_key { +- (id)valueForKey:(NSString *)_key { id v; if ((v = eoGet(self, _key)) == nil) { diff --git a/sope-core/EOControl/EOKeyValueCoding.m b/sope-core/EOControl/EOKeyValueCoding.m index 273717fc..02976c4f 100644 --- a/sope-core/EOControl/EOKeyValueCoding.m +++ b/sope-core/EOControl/EOKeyValueCoding.m @@ -807,8 +807,8 @@ static inline BOOL setValue(NSString* key, id instance, id value) if (StringClass == Nil) StringClass = [NSString class]; value = self; - buf = [_keyPath cString]; - if (index(buf, '.') == NULL) + buf = (const unsigned char *)[_keyPath cString]; + if (index((const char *)buf, '.') == NULL) /* no point contained .. */ return [self valueForKey:_keyPath]; @@ -818,7 +818,8 @@ static inline BOOL setValue(NSString* key, id instance, id value) NSString *key; key = (start < i) - ? [StringClass stringWithCString:&(buf[start]) length:(i - start)] + ? [StringClass stringWithCString:(const char *) + &(buf[start]) length:(i - start)] : @""; if ((value = [value valueForKey:key]) == nil) @@ -832,7 +833,8 @@ static inline BOOL setValue(NSString* key, id instance, id value) NSString *key; key = (start < i) - ? [StringClass stringWithCString:&(buf[start]) length:(i - start)] + ? [StringClass stringWithCString:(const char *) + &(buf[start]) length:(i - start)] : @""; return [value valueForKey:key]; } @@ -1034,7 +1036,7 @@ static inline BOOL setValue(NSString* key, id instance, id value) //[self handleTakeValue:_value forUnboundKey:_key]; } -- (id)valueForKey:(id)_key { +- (id)valueForKey:(NSString *)_key { id obj; if (_key == nil) // TODO: warn about nil key? @@ -1057,7 +1059,7 @@ static inline BOOL setValue(NSString* key, id instance, id value) [self addEntriesFromDictionary:dictionary]; } -- (void)takeValue:(id)_value forKey:(id)_key { +- (void)takeValue:(id)_value forKey:(NSString *)_key { if (_value == nil) _value = [NSNull null]; [self setObject:_value forKey:_key]; } diff --git a/sope-core/EOControl/EONull.m b/sope-core/EOControl/EONull.m index fc57df15..c7c51a4a 100644 --- a/sope-core/EOControl/EONull.m +++ b/sope-core/EOControl/EONull.m @@ -35,7 +35,7 @@ return [NSNull allocWithZone:_zone]; } -+ (id)null { ++ (NSNull *)null { return [NSNull null]; } diff --git a/sope-core/EOControl/EOQualifierParser.m b/sope-core/EOControl/EOQualifierParser.m index 37894d4a..1860bc8d 100644 --- a/sope-core/EOControl/EOQualifierParser.m +++ b/sope-core/EOControl/EOQualifierParser.m @@ -42,13 +42,13 @@ typedef struct { } EOQPTokEntry; static EOQPTokEntry toks[] = { - { "NULL", nil, 0 }, - { "nil", nil, 1 }, - { "YES", nil, 0 }, - { "NO", nil, 0 }, - { "TRUE", nil, 0 }, - { "FALSE", nil, 0 }, - { NULL, nil, 0 } + { (const unsigned char *)"NULL", nil, 0 }, + { (const unsigned char *)"nil", nil, 1 }, + { (const unsigned char *)"YES", nil, 0 }, + { (const unsigned char *)"NO", nil, 0 }, + { (const unsigned char *)"TRUE", nil, 0 }, + { (const unsigned char *)"FALSE", nil, 0 }, + { (const unsigned char *)NULL, nil, 0 } }; static inline void _setupLiterals(void) { @@ -944,14 +944,14 @@ static id _parseValue(id _ctx, const char *_buf, unsigned _bufLen, int rc; tok = toks[i].token; - toklen = strlen(tok); + toklen = strlen((const char *)tok); if ((_bufLen - pos) < toklen) /* remaining string not long enough */ continue; rc = toks[i].scase - ? strncmp(&(_buf[pos]), tok, toklen) - : strncasecmp(&(_buf[pos]), tok, toklen); + ? strncmp(&(_buf[pos]), (const char *)tok, toklen) + : strncasecmp(&(_buf[pos]), (const char *)tok, toklen); if (rc != 0) /* does not match */ continue; @@ -1027,12 +1027,12 @@ static id _parseValue(id _ctx, const char *_buf, unsigned _bufLen, //printf("POS: '%s'\n", &(_buf[pos])); pos++; - cs = &(_buf[pos]); - ce = index(cs, '\''); - cast = [NSString stringWithCString:cs length:(ce - cs)]; + cs = (const unsigned char *)&(_buf[pos]); + ce = (const unsigned char *)index((const char *)cs, '\''); + cast = [NSString stringWithCString:(const char*)cs length:(ce - cs)]; if (qDebug) { - NSLog(@"%s: parsed complex cast: '%@' to '%@'", __PRETTY_FUNCTION__, - obj, cast); + NSLog(@"%s: parsed complex cast: '%@' to '%@'", + __PRETTY_FUNCTION__, obj, cast); } pos += (ce - cs); pos++; // skip ' diff --git a/sope-core/EOControl/EOSQLParser.m b/sope-core/EOControl/EOSQLParser.m index c84f4a28..b8fc2e16 100644 --- a/sope-core/EOControl/EOSQLParser.m +++ b/sope-core/EOControl/EOSQLParser.m @@ -145,7 +145,7 @@ static inline BOOL isTokStopChar(unichar c) { unichar *scur; unsigned slen, tlen; - tlen = strlen(tk); + tlen = strlen((const char *)tk); scur=*pos; slen=*len; // begin transaction skipSpaces(&scur, &slen); @@ -216,12 +216,14 @@ static inline BOOL isTokStopChar(unichar c) { if (slen < 1) return NO; - if ([self parseToken:"FROM" from:&scur length:&slen consume:NO]) { + if ([self parseToken:(const unsigned char *)"FROM" + from:&scur length:&slen consume:NO]) { /* not an attribute, the from starts ... */ // printf("rejected unquoted attr, is a FROM\n"); return NO; } - if ([self parseToken:"WHERE" from:&scur length:&slen consume:NO]) { + if ([self parseToken:(const unsigned char *)"WHERE" + from:&scur length:&slen consume:NO]) { /* not an attribute, the where starts ... */ // printf("rejected unquoted attr, is a WHERE\n"); return NO; @@ -321,16 +323,19 @@ static inline BOOL isTokStopChar(unichar c) { if (slen < 12) return NO; // not enough chars - if (![self parseToken:"CONTAINS" from:pos length:len consume:YES]) + if (![self parseToken:(const unsigned char *)"CONTAINS" + from:pos length:len consume:YES]) return NO; skipSpaces(&scur, &slen); - [self parseToken:"('" from:&scur length:&slen consume:YES]; + [self parseToken:(const unsigned char *)"('" + from:&scur length:&slen consume:YES]; if (![self parseIdentifier:&s from:&scur length:&slen consume:YES]) return NO; skipSpaces(&scur, &slen); - [self parseToken:"')" from:&scur length:&slen consume:YES]; + [self parseToken:(const unsigned char *)"')" + from:&scur length:&slen consume:YES]; *q_ = [[EOQualifier qualifierWithQualifierFormat: @"contentAsString doesContain: %@", s] retain]; @@ -360,13 +365,15 @@ static inline BOOL isTokStopChar(unichar c) { while (slen > 0) { if (*scur == 'O' || *scur == 'o') { - if ([self parseToken:"ORDER" from:&scur length:&slen consume:NO]) { + if ([self parseToken:(const unsigned char *)"ORDER" + from:&scur length:&slen consume:NO]) { //printf("FOUND ORDER TOKEN ...\n"); break; } } else if (*scur == 'G' || *scur == 'g') { - if ([self parseToken:"GROUP" from:&scur length:&slen consume:NO]) { + if ([self parseToken:(const unsigned char *)"GROUP" + from:&scur length:&slen consume:NO]) { //printf("FOUND GROUP TOKEN ...\n"); break; } @@ -425,19 +432,24 @@ static inline BOOL isTokStopChar(unichar c) { /* next the depth */ - if ([self parseToken:"SHALLOW" from:&scur length:&slen consume:YES]) + if ([self parseToken:(const unsigned char *)"SHALLOW" + from:&scur length:&slen consume:YES]) isShallow = YES; - else if ([self parseToken:"HIERARCHICAL" from:&scur length:&slen consume:YES]) + else if ([self parseToken:(const unsigned char *)"HIERARCHICAL" + from:&scur length:&slen consume:YES]) isDeep = YES; - else if ([self parseToken:"DEEP" from:&scur length:&slen consume:YES]) + else if ([self parseToken:(const unsigned char *)"DEEP" + from:&scur length:&slen consume:YES]) isDeep = YES; else /* unknown traveral key */ return NO; /* some syntactic sugar (not strict about that ...) */ - [self parseToken:"TRAVERSAL" from:&scur length:&slen consume:YES]; - [self parseToken:"OF" from:&scur length:&slen consume:YES]; + [self parseToken:(const unsigned char *)"TRAVERSAL" + from:&scur length:&slen consume:YES]; + [self parseToken:(const unsigned char *)"OF" + from:&scur length:&slen consume:YES]; if (slen < 1) return NO; // not enough chars /* now the entity */ @@ -480,7 +492,8 @@ static inline BOOL isTokStopChar(unichar c) { *result = nil; - if (![self parseToken:"SELECT" from:pos length:len consume:YES]) { + if (![self parseToken:(const unsigned char *)"SELECT" + from:pos length:len consume:YES]) { /* must begin with SELECT */ if (beStrict) return NO; } @@ -495,14 +508,16 @@ static inline BOOL isTokStopChar(unichar c) { //[self debugWithFormat:@"parsed attrs (%i): %@", [attrs count], attrs]; /* now a from is expected */ - if ([self parseToken:"FROM" from:pos length:len consume:YES]) + if ([self parseToken:(const unsigned char *)"FROM" + from:pos length:len consume:YES]) hasFrom = YES; else { if (beStrict) return NO; } /* check whether it's followed by a scope */ - if ([self parseToken:"SCOPE" from:pos length:len consume:YES]) { + if ([self parseToken:(const unsigned char *)"SCOPE" + from:pos length:len consume:YES]) { NSString *scopeEntity = nil; if (![self parseScope:&scope:&scopeEntity from:pos length:len]) { @@ -530,10 +545,12 @@ static inline BOOL isTokStopChar(unichar c) { } /* check where */ - if ([self parseToken:"WHERE" from:pos length:len consume:YES]) { + if ([self parseToken:(const unsigned char *)"WHERE" + from:pos length:len consume:YES]) { /* parse qualifier ... */ - if ([self parseToken:"CONTAINS" from:pos length:len consume:NO]) { + if ([self parseToken:(const unsigned char *)"CONTAINS" + from:pos length:len consume:NO]) { if (![self parseContainsQualifier:&q from:pos length:len]) { if (beStrict) return NO; } @@ -547,8 +564,10 @@ static inline BOOL isTokStopChar(unichar c) { } /* check order-by */ - if ([self parseToken:"ORDER" from:pos length:len consume:YES]) { - if (![self parseToken:"BY" from:pos length:len consume:YES]) { + if ([self parseToken:(const unsigned char *)"ORDER" + from:pos length:len consume:YES]) { + if (![self parseToken:(const unsigned char *)"BY" + from:pos length:len consume:YES]) { if (beStrict) return NO; missingByOfOrder = YES; } @@ -563,8 +582,10 @@ static inline BOOL isTokStopChar(unichar c) { } /* check group-by */ - if ([self parseToken:"GROUP" from:pos length:len consume:YES]) { - if (![self parseToken:"BY" from:pos length:len consume:YES]) { + if ([self parseToken:(const unsigned char *)"GROUP" + from:pos length:len consume:YES]) { + if (![self parseToken:(const unsigned char *)"BY" + from:pos length:len consume:YES]) { if (beStrict) return NO; missingByOfGroup = YES; } @@ -624,7 +645,8 @@ static inline BOOL isTokStopChar(unichar c) { { if (*len < 1) return NO; - if ([self parseToken:"SELECT" from:pos length:len consume:NO]) + if ([self parseToken:(const unsigned char *)"SELECT" + from:pos length:len consume:NO]) return [self parseSELECT:result from:pos length:len strict:beStrict]; //if ([self parseToken:"UPDATE" from:pos length:len consume:NO]) diff --git a/sope-core/EOControl/GNUmakefile.preamble b/sope-core/EOControl/GNUmakefile.preamble index 623b0612..d4cdb0f9 100644 --- a/sope-core/EOControl/GNUmakefile.preamble +++ b/sope-core/EOControl/GNUmakefile.preamble @@ -2,7 +2,7 @@ libEOControl_INCLUDE_DIRS += -I.. -ADDITIONAL_CPPFLAGS += -Wall +ADDITIONAL_CPPFLAGS += -Wall -funsigned-char SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib diff --git a/sope-core/EOControl/NSObject+EOQualifierOps.m b/sope-core/EOControl/NSObject+EOQualifierOps.m index 82702466..99da1af3 100644 --- a/sope-core/EOControl/NSObject+EOQualifierOps.m +++ b/sope-core/EOControl/NSObject+EOQualifierOps.m @@ -57,10 +57,10 @@ static EONull *null = nil; return NO; } -- (BOOL)isLike:(NSString *)_object { +- (BOOL)isLike:(id)_object { return NO; } -- (BOOL)isCaseInsensitiveLike:(NSString *)_object { +- (BOOL)isCaseInsensitiveLike:(id)_object { return NO; } @@ -76,7 +76,7 @@ static EONull *null = nil; @implementation NSString(ImplementedQualifierComparisons) -- (BOOL)isLike:(NSString *)_pattern { +- (BOOL)isLike:(id)_pattern { NSArray *cs; unsigned count; #if 0 @@ -154,7 +154,7 @@ static EONull *null = nil; return NO; } -- (BOOL)isCaseInsensitiveLike:(NSString *)_pattern { +- (BOOL)isCaseInsensitiveLike:(id)_pattern { return [[self lowercaseString] isLike:[_pattern lowercaseString]]; } diff --git a/sope-core/EOControl/Version b/sope-core/EOControl/Version index f7227d67..b8f0fed5 100644 --- a/sope-core/EOControl/Version +++ b/sope-core/EOControl/Version @@ -1,3 +1,3 @@ # version file -SUBMINOR_VERSION:=50 +SUBMINOR_VERSION:=51 diff --git a/sope-core/EOControl/fhs.make b/sope-core/EOControl/fhs.make index a9b01e40..20db66d2 100644 --- a/sope-core/EOControl/fhs.make +++ b/sope-core/EOControl/fhs.make @@ -13,7 +13,7 @@ fhs-header-dirs :: move-headers-to-fhs :: fhs-header-dirs @echo "moving headers to $(FHS_INCLUDE_DIR) .." - mv $(GNUSTEP_HEADERS)$(libEOControl_HEADER_FILES_INSTALL_DIR)/*.h \ + mv -f $(GNUSTEP_HEADERS)$(libEOControl_HEADER_FILES_INSTALL_DIR)/*.h \ $(FHS_INCLUDE_DIR)$(libEOControl_HEADER_FILES_INSTALL_DIR)/ NONFHS_LIBDIR="$(GNUSTEP_LIBRARIES)/$(GNUSTEP_TARGET_LDIR)/" @@ -21,7 +21,7 @@ NONFHS_LIBNAME="$(LIBRARY_NAME)$(LIBRARY_NAME_SUFFIX)$(SHARED_LIBEXT)" move-libs-to-fhs :: @echo "moving libs to $(FHS_LIB_DIR) .." - mv $(NONFHS_LIBDIR)/$(NONFHS_LIBNAME)* $(FHS_LIB_DIR)/ + mv -f $(NONFHS_LIBDIR)/$(NONFHS_LIBNAME)* $(FHS_LIB_DIR)/ move-to-fhs :: move-headers-to-fhs move-libs-to-fhs