From cd9b00c69b31db910555ea80301e5498af528114 Mon Sep 17 00:00:00 2001 From: helge Date: Sun, 24 Apr 2005 14:59:58 +0000 Subject: [PATCH] fixed gcc 4.0 warnings git-svn-id: http://svn.opengroupware.org/SOPE/trunk@767 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/ChangeLog | 2 ++ sope-appserver/NGObjWeb/Version | 2 +- .../WOHttpAdaptor/WOHttpTransaction.m | 26 ++++++++++--------- .../NGObjWeb/WOHttpAdaptor/WORequestParser.m | 6 ++--- .../NGObjWeb/WebDAV/SoDAVSQLParser.h | 2 +- .../NGObjWeb/WebDAV/SoDAVSQLParser.m | 6 ++--- .../NGObjWeb/WebDAV/SoObject+SoDAV.h | 2 +- .../WebDAV/SoObjectWebDAVDispatcher.m | 1 + .../NGObjWeb/WebDAV/SoWebDAVRenderer.m | 21 ++++++++++----- 9 files changed, 40 insertions(+), 28 deletions(-) diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index d0eef499..2d0016b9 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,5 +1,7 @@ 2005-04-24 Helge Hess + * WOHttpAdaptor, WebDAV: fixed gcc 4.0 warnings (v4.5.154) + * v4.5.153 * Templates/WOHTMLParser.m: rewrote parser to use unichar diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index ae5132fa..c3803a3a 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=153 +SUBMINOR_VERSION:=154 # v4.5.122 requires libNGExtensions v4.5.153 # v4.5.91 requires libNGExtensions v4.5.134 diff --git a/sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m b/sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m index 12d4531d..91c3823d 100644 --- a/sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m +++ b/sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m @@ -330,7 +330,7 @@ static int logCounter = 0; accept = [woRequest headerForKey:@"accept"]; if ([accept rangeOfString:@"text/html"].length > 0) { - const unsigned char *txt = "could not perform request !
"; + const char *txt = "could not perform request !
"; [mr setHeader:@"text/html" forKey:@"content-type"]; [mr setContent:[NSData dataWithBytes:txt length:strlen(txt)]]; } @@ -629,7 +629,7 @@ static int logCounter = 0; } - (const unsigned char *)_reasonForStatus:(unsigned int)_status { - const unsigned char *reason; + const char *reason; switch (_status) { case 200: reason = "Ok"; break; @@ -658,7 +658,7 @@ static int logCounter = 0; reason = "Request failed"; break; } - return reason; + return (const unsigned char *) reason; } - (void)_httpValidateResponse:(WOResponse *)_response { @@ -709,16 +709,18 @@ static int logCounter = 0; if (isok) { unsigned int slen, rlen; const unsigned char *r; - int s = [_response status]; + int s; + + s = [_response status]; t1 = [_response httpVersion]; r = [self _reasonForStatus:s]; slen = [t1 cStringLength]; - rlen = strlen(r); + rlen = strlen((const char *)r); if ((slen + rlen + 8) < 1000) { - [t1 getCString:buf]; - sprintf(&(buf[slen]), " %i %s\r\n", s, r); - isok = [_out safeWriteBytes:buf count:strlen(buf)]; + [t1 getCString:(char *)buf]; + sprintf((char *)&(buf[slen]), " %i %s\r\n", s, r); + isok = [_out safeWriteBytes:buf count:strlen((char *)buf)]; } else isok = [out writeFormat:@"%@ %i %s\r\n", t, s, r]; @@ -732,8 +734,8 @@ static int logCounter = 0; /* add content length header */ - sprintf(buf, "%d", [body length]); - t1 = [[NSString alloc] initWithCString:buf]; + sprintf((char *)buf, "%d", [body length]); + t1 = [[NSString alloc] initWithCString:(char *)buf]; [_response setHeader:t1 forKey:@"content-length"]; [t1 release]; t1 = nil; @@ -796,7 +798,7 @@ static int logCounter = 0; if (clen > 1000) isok = [out writeString:t1]; else { - [t1 getCString:buf]; + [t1 getCString:(char *)buf]; [_out safeWriteBytes:buf count:clen]; } } @@ -856,7 +858,7 @@ static int logCounter = 0; [out release]; out = nil; // the buffer will be flushed .. } -static __inline__ const unsigned char *monthAbbr(int m) { +static __inline__ const char *monthAbbr(int m) { switch (m) { case 1: return "Jan"; case 2: return "Feb"; case 3: return "Mar"; case 4: return "Apr"; case 5: return "May"; case 6: return "Jun"; diff --git a/sope-appserver/NGObjWeb/WOHttpAdaptor/WORequestParser.m b/sope-appserver/NGObjWeb/WOHttpAdaptor/WORequestParser.m index f5a5d0b2..bf1b9b63 100644 --- a/sope-appserver/NGObjWeb/WOHttpAdaptor/WORequestParser.m +++ b/sope-appserver/NGObjWeb/WOHttpAdaptor/WORequestParser.m @@ -148,7 +148,7 @@ static inline BOOL skipSpaces(WORequestParser *self) { return nil; } - return [NSString stringWithCString:m length:count]; + return [NSString stringWithCString:(char *)m length:count]; } - (NSString *)parseURI { @@ -179,7 +179,7 @@ static inline BOOL skipSpaces(WORequestParser *self) { /* feed last char to next parsing step */ self->pushBack = c; - s = [NSString stringWithCString:uri length:count]; + s = [NSString stringWithCString:(char *)uri length:count]; if (uri) free(uri); return s; } @@ -213,7 +213,7 @@ static inline BOOL skipSpaces(WORequestParser *self) { return @"HTTP/0.9"; } - return [NSString stringWithCString:m length:count]; + return [NSString stringWithCString:(char *)m length:count]; } /* headers */ diff --git a/sope-appserver/NGObjWeb/WebDAV/SoDAVSQLParser.h b/sope-appserver/NGObjWeb/WebDAV/SoDAVSQLParser.h index 274ed1ad..93204630 100644 --- a/sope-appserver/NGObjWeb/WebDAV/SoDAVSQLParser.h +++ b/sope-appserver/NGObjWeb/WebDAV/SoDAVSQLParser.h @@ -56,7 +56,7 @@ - (BOOL)parseSQL:(id *)result from:(unichar **)pos length:(unsigned *)len strict:(BOOL)beStrict; -- (BOOL)parseToken:(const unsigned char *)tk +- (BOOL)parseToken:(const char *)tk from:(unichar **)pos length:(unsigned *)len consume:(BOOL)consume; - (BOOL)parseIdentifier:(NSString **)result diff --git a/sope-appserver/NGObjWeb/WebDAV/SoDAVSQLParser.m b/sope-appserver/NGObjWeb/WebDAV/SoDAVSQLParser.m index 83b8c504..fa72fcbf 100644 --- a/sope-appserver/NGObjWeb/WebDAV/SoDAVSQLParser.m +++ b/sope-appserver/NGObjWeb/WebDAV/SoDAVSQLParser.m @@ -105,12 +105,12 @@ /* parsing parts (exported for overloading in subclasses) */ static inline BOOL -uniIsCEq(unichar *haystack, const unsigned char *needle, unsigned len) +uniIsCEq(unichar *haystack, const char *needle, unsigned len) { register unsigned idx; for (idx = 0; idx < len; idx++) { if (*needle == '\0') return YES; - if (toupper(haystack[idx]) != needle[idx]) return NO; + if (toupper(haystack[idx]) != (unsigned char)needle[idx]) return NO; } return YES; } @@ -140,7 +140,7 @@ static inline BOOL isTokStopChar(unichar c) { } } -- (BOOL)parseToken:(const unsigned char *)tk +- (BOOL)parseToken:(const char *)tk from:(unichar **)pos length:(unsigned *)len consume:(BOOL)consume { diff --git a/sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAV.h b/sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAV.h index 9f18f9f6..5f7504f9 100644 --- a/sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAV.h +++ b/sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAV.h @@ -46,7 +46,7 @@ - (id)performWebDAVBulkQuery:(EOFetchSpecification *)_fs inContext:(id)_ctx; - (NSEnumerator *)davChildKeysInContext:(id)_ctx; - (EODataSource *)contentDataSourceInContext:(id)_ctx; -- (id)davQueryOnSelf:(EOFetchSpecification *)_fs inContext:(id)_ctx; +- (NSArray *)davQueryOnSelf:(EOFetchSpecification *)_fs inContext:(id)_ctx; - (NSArray *)defaultWebDAVPropertyNamesInContext:(id)_ctx; diff --git a/sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m b/sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m index a269949d..f18c1e2a 100644 --- a/sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m +++ b/sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m @@ -30,6 +30,7 @@ #include "SoDAVLockManager.h" #include "EOFetchSpecification+SoDAV.h" #include "WOContext+SoObjects.h" +#include #include #include #include diff --git a/sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.m b/sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.m index 6e4ee60d..c053f499 100644 --- a/sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.m +++ b/sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.m @@ -170,24 +170,31 @@ static BOOL formatOutput = NO; } if ([_object isKindOfClass:[NSData class]]) { + NSString *s; + [r setHeader:[self mimeTypeForData:_object inContext:_ctx] forKey:@"content-type"]; - sprintf(buf, "%d", [_object length]); - [r setHeader:[NSString stringWithCString:buf] forKey:@"content-length"]; + sprintf((char *)buf, "%d", [_object length]); + s = [[NSString alloc] initWithCString:(const char *)buf]; + if (s != nil) [r setHeader:s forKey:@"content-length"]; + [s release]; if (!_onlyHead) [r setContent:_object]; return YES; } if ([_object isKindOfClass:[NSString class]]) { - NSData *data; + NSData *data; + NSString *s; [r setHeader:[self mimeTypeForString:_object inContext:_ctx] forKey:@"content-type"]; data = [_object dataUsingEncoding:NSUTF8StringEncoding]; - sprintf(buf, "%d", [data length]); - [r setHeader:[NSString stringWithCString:buf] forKey:@"content-length"]; + sprintf((char *)buf, "%d", [data length]); + s = [[NSString alloc] initWithCString:(const char *)buf]; + [r setHeader:s forKey:@"content-length"]; + [s release]; [r setContent:data]; return YES; } @@ -1109,8 +1116,8 @@ static BOOL formatOutput = NO; if ([_object isKindOfClass:[NSDictionary class]]) { NSArray *pending, *inactive; - pending = [_object objectForKey:@"pending"]; - inactive = [_object objectForKey:@"inactive"]; + pending = [(NSDictionary *)_object objectForKey:@"pending"]; + inactive = [(NSDictionary *)_object objectForKey:@"inactive"]; [r setStatus:207 /* Multi-Status */]; [r setContentEncoding:NSUTF8StringEncoding]; -- 2.39.5