From a5340fa3ebecdc30b0226728eb710b24dfe57dbe Mon Sep 17 00:00:00 2001 From: helge Date: Sun, 24 Apr 2005 17:28:21 +0000 Subject: [PATCH] fixed gcc 4.0 warnings git-svn-id: http://svn.opengroupware.org/SOPE/trunk@769 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/WEExtensions/ChangeLog | 4 ++ sope-appserver/WEExtensions/Version | 2 +- .../WEExtensions/WEContextConditional.m | 51 ++++++++---------- sope-appserver/WEExtensions/WEDragContainer.m | 3 +- sope-appserver/WEExtensions/WEDropContainer.m | 5 +- sope-appserver/WEExtensions/WEMonthOverview.m | 52 +++++++++++-------- sope-appserver/WEExtensions/WEPageLink.m | 4 +- sope-appserver/WEExtensions/WEPageView.m | 9 ++-- .../WEExtensions/WEQualifierConditional.m | 2 +- .../WEExtensions/WETableCalcMatrix.m | 20 +++---- .../WETableView/WETableView+Grouping.m | 2 +- .../WEExtensions/WETreeMatrixElement.m | 2 +- 12 files changed, 84 insertions(+), 72 deletions(-) diff --git a/sope-appserver/WEExtensions/ChangeLog b/sope-appserver/WEExtensions/ChangeLog index 318e67e0..b606b702 100644 --- a/sope-appserver/WEExtensions/ChangeLog +++ b/sope-appserver/WEExtensions/ChangeLog @@ -1,3 +1,7 @@ +2005-04-24 Helge Hess + + * fixed gcc 4.0 warnings (v4.5.72) + 2005-04-12 Helge Hess * v4.5.71 diff --git a/sope-appserver/WEExtensions/Version b/sope-appserver/WEExtensions/Version index 87270879..8bd79bbb 100644 --- a/sope-appserver/WEExtensions/Version +++ b/sope-appserver/WEExtensions/Version @@ -1,5 +1,5 @@ # version file -SUBMINOR_VERSION:=71 +SUBMINOR_VERSION:=72 # v4.5.65 requires libNGObjWeb v4.5.106 diff --git a/sope-appserver/WEExtensions/WEContextConditional.m b/sope-appserver/WEExtensions/WEContextConditional.m index 64ae3327..d402c91a 100644 --- a/sope-appserver/WEExtensions/WEContextConditional.m +++ b/sope-appserver/WEExtensions/WEContextConditional.m @@ -38,19 +38,17 @@ return self; } -#if !LIB_FOUNDATION_BOEHM_GC - (void)dealloc { - RELEASE(self->template); - RELEASE(self->negate); - RELEASE(self->contextKey); - RELEASE(self->didMatch); + [self->template release]; + [self->negate release]; + [self->contextKey release]; + [self->didMatch release]; [super dealloc]; } -#endif -// accessors +/* accessors */ -- (WOElement *)template { +- (id)template { return self->template; } @@ -62,7 +60,7 @@ return nil; } -// state +/* state */ static inline BOOL _doShow(WEContextConditional *self, WOContext *_ctx) { BOOL doShow = NO; @@ -86,39 +84,36 @@ static inline BOOL _doShow(WEContextConditional *self, WOContext *_ctx) { return doShow; } -// ******************** responder ******************** +/* handling requests */ -- (void)takeValuesFromRequest:(WORequest *)_request - inContext:(WOContext *)_ctx -{ +- (void)takeValuesFromRequest:(WORequest *)_rq inContext:(WOContext *)_ctx { if (_doShow(self, _ctx)) { [_ctx appendElementIDComponent:@"1"]; - [self->template takeValuesFromRequest:_request inContext:_ctx]; + [self->template takeValuesFromRequest:_rq inContext:_ctx]; [_ctx deleteLastElementIDComponent]; } } -- (id)invokeActionForRequest:(WORequest *)_request inContext:(WOContext *)_ctx { +- (id)invokeActionForRequest:(WORequest *)_rq inContext:(WOContext *)_ctx { NSString *state; + id result; - state = [[_ctx currentElementID] stringValue]; + if ((state = [[_ctx currentElementID] stringValue]) == nil) + return nil; - if (state) { - [_ctx consumeElementID]; // consume state-id (on or off) + [_ctx consumeElementID]; // consume state-id (on or off) - if ([state isEqualToString:@"1"]) { - id result; + if (![state isEqualToString:@"1"]) + return nil; - [_ctx appendElementIDComponent:state]; - result = [self->template invokeActionForRequest:_request inContext:_ctx]; - [_ctx deleteLastElementIDComponent]; - - return result; - } - } - return nil; + [_ctx appendElementIDComponent:state]; + result = [self->template invokeActionForRequest:_rq inContext:_ctx]; + [_ctx deleteLastElementIDComponent]; + return result; } +/* generate response */ + - (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx { if (_doShow(self, _ctx)) { [_ctx appendElementIDComponent:@"1"]; diff --git a/sope-appserver/WEExtensions/WEDragContainer.m b/sope-appserver/WEExtensions/WEDragContainer.m index d102f529..3248d2a7 100644 --- a/sope-appserver/WEExtensions/WEDragContainer.m +++ b/sope-appserver/WEExtensions/WEDragContainer.m @@ -195,12 +195,13 @@ static BOOL debugTakeValues = NO; /* accessors */ -- (WOElement *)template { +- (id)template { return self->template; } @end /* WEDragContainer */ + @implementation WEDragScript + (void)appendDragScriptToResponse:(WOResponse *)_response diff --git a/sope-appserver/WEExtensions/WEDropContainer.m b/sope-appserver/WEExtensions/WEDropContainer.m index 665237fc..f480b568 100644 --- a/sope-appserver/WEExtensions/WEDropContainer.m +++ b/sope-appserver/WEExtensions/WEDropContainer.m @@ -435,14 +435,15 @@ } } -// --- accessors --- +/* accessors */ -- (WOElement *)template { +- (id)template { return self->template; } @end /* WEDropContainer */ + @implementation WEDropScript + (void)appendDropScriptToResponse:(WOResponse *)_response diff --git a/sope-appserver/WEExtensions/WEMonthOverview.m b/sope-appserver/WEExtensions/WEMonthOverview.m index 60eb9e03..6ddf7d9f 100644 --- a/sope-appserver/WEExtensions/WEMonthOverview.m +++ b/sope-appserver/WEExtensions/WEMonthOverview.m @@ -146,7 +146,7 @@ static NSString *WEMonthOverview_ContentMode = @"WEMonthOverview_ContentMode"; - (NSDictionary *)monthOverviewContext { return [self objectForKey:@"WEMonthOverview"]; } -- (NSArray *)monthOverviewQueryObjects { +- (NSMutableArray *)monthOverviewQueryObjects { return [[self monthOverviewContext] valueForKey:@"query"]; } @@ -189,7 +189,7 @@ static NSString *retStrForInt(int i) { case 10: return @"10"; // TODO: find useful count! default: { - unsigned char buf[32]; + char buf[32]; sprintf(buf, "%i", i); return [[StrClass alloc] initWithCString:buf]; } @@ -846,31 +846,31 @@ _takeValuesInCell(WEMonthOverview *self, WORequest *request, } -- (void)takeContentValues:(WORequest *)_req - inContext:(WOContext *)_ctx - index:(int)_idx +- (void)takeContentValues:(WORequest *)_req inContext:(WOContext *)_ctx + index:(int)_idx { WOComponent *comp; NSString *s; NSArray *array; - int i, idx, cnt, count; + int i, cnt, count; comp = [_ctx component]; array = [self->list valueInComponent:comp]; count = [array count]; [_ctx appendElementIDComponent:@"c"]; // append content mode - - cnt = [self->matrix[_idx] count]; - for (i=0; imatrix[_idx] count]; i < cnt; i++) { + int idx; + idx = [[self->matrix[_idx] objectAtIndex:i] intValue]; - if (self->index) + if (self->index != nil) [self->index setUnsignedIntValue:idx inComponent:comp]; - if (self->item) + if (self->item != nil) [self->item setValue:[array objectAtIndex:idx] inComponent:comp]; - s = (self->identifier) + s = (self->identifier != nil) ? [[self->identifier stringValueInComponent:comp] retain] : retStrForInt(idx); @@ -888,7 +888,7 @@ _takeValuesInCell(WEMonthOverview *self, WORequest *request, NSString *week; int i, j; unsigned int weekOfYear; - unsigned char buf[32]; + char buf[32]; [self _calcMatrixInContext:_ctx]; @@ -1018,6 +1018,7 @@ _takeValuesInCell(WEMonthOverview *self, WORequest *request, @end /* WEMonthOverview */ + @implementation WEMonthLabel - (id)initWithName:(NSString *)_name @@ -1045,6 +1046,8 @@ _takeValuesInCell(WEMonthOverview *self, WORequest *request, [super dealloc]; } +/* handle requests */ + - (void)takeValuesFromRequest:(WORequest *)_req inContext:(WOContext *)_ctx { NSDictionary *monthViewContextDict; NSString *orient; @@ -1055,16 +1058,16 @@ _takeValuesInCell(WEMonthOverview *self, WORequest *request, isEdge = ([orient rangeOfString:@"/"].length > 0); monthViewContextDict = [_ctx monthOverviewContext]; - if ((tmp = [monthViewContextDict objectForKey:orient]) != nil) { - if (!isEdge) { - [_ctx appendElementIDComponent:orient]; - [self->template takeValuesFromRequest:_req inContext:_ctx]; - [_ctx deleteLastElementIDComponent]; - } - else { - [self->template takeValuesFromRequest:_req inContext:_ctx]; - } + if ((tmp = [monthViewContextDict objectForKey:orient]) == nil) + return; + + if (!isEdge) { + [_ctx appendElementIDComponent:orient]; + [self->template takeValuesFromRequest:_req inContext:_ctx]; + [_ctx deleteLastElementIDComponent]; } + else + [self->template takeValuesFromRequest:_req inContext:_ctx]; } - (id)invokeActionForRequest:(WORequest *)_req inContext:(WOContext *)_ctx { @@ -1109,6 +1112,8 @@ _takeValuesInCell(WEMonthOverview *self, WORequest *request, return result; } +/* generate response */ + - (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx { NSDictionary *monthViewContextDict; NSMutableArray *queryContext; @@ -1182,6 +1187,7 @@ _takeValuesInCell(WEMonthOverview *self, WORequest *request, @end /* WEMonthLabel */ + @implementation WEMonthTitle - (id)initWithName:(NSString *)_name @@ -1247,6 +1253,7 @@ _takeValuesInCell(WEMonthOverview *self, WORequest *request, @end /* WEMonthTitle */ + @interface WEMonthOverviewInfoMode : WEContextConditional @end @@ -1258,6 +1265,7 @@ _takeValuesInCell(WEMonthOverview *self, WORequest *request, @end /* WEMonthOverviewInfoMode */ + @interface WEMonthOverviewContentMode : WEContextConditional @end diff --git a/sope-appserver/WEExtensions/WEPageLink.m b/sope-appserver/WEExtensions/WEPageLink.m index f059623f..184f8581 100644 --- a/sope-appserver/WEExtensions/WEPageLink.m +++ b/sope-appserver/WEExtensions/WEPageLink.m @@ -163,7 +163,7 @@ NSString *href; href = [_ctx componentActionURL]; - [_response appendContentCString:"']; [self->template appendToResponse:_response inContext:_ctx]; - [_response appendContentCString:""]; + [_response appendContentCString:(unsigned char *)""]; } @end /* WEPageLink */ diff --git a/sope-appserver/WEExtensions/WEPageView.m b/sope-appserver/WEExtensions/WEPageView.m index b72366f8..65feefce 100644 --- a/sope-appserver/WEExtensions/WEPageView.m +++ b/sope-appserver/WEExtensions/WEPageView.m @@ -532,6 +532,7 @@ static inline NSString *WEPageLabelForKey(NSString *_key, WOContext *_ctx) { cmp = [_ctx component]; + // TODO: use CSS tC = [self->fontColor stringValueInComponent:cmp]; tF = [self->fontFace stringValueInComponent:cmp]; tS = [self->fontSize stringValueInComponent:cmp]; @@ -544,8 +545,9 @@ static inline NSString *WEPageLabelForKey(NSString *_key, WOContext *_ctx) { for (i = 0, count = [keys count]; i < count; i++) { WEPageItemInfo *info; - info = [keys objectAtIndex:i]; + info = [keys objectAtIndex:i]; + // TODO: use CSS if ([info->key isEqualToString:activeKey]) { [_response appendContentString:@""]; [_response appendContentString:info->title]; @@ -553,7 +555,8 @@ static inline NSString *WEPageLabelForKey(NSString *_key, WOContext *_ctx) { break; } } - sprintf(buf, " (%d/%d)", (i + 1), count); + // TODO: use CSS + sprintf((char *)buf, " (%d/%d)", (i + 1), count); [_response appendContentCString:buf]; if (hasFont) @@ -755,7 +758,7 @@ static inline NSString *WEPageLabelForKey(NSString *_key, WOContext *_ctx) { if ((k = [self->key stringValueInComponent:[_ctx component]]) == nil) { /* auto-assign a key */ - unsigned char kb[16]; + char kb[16]; sprintf(kb, "%d", [keys count]); k = [NSString stringWithCString:kb]; } diff --git a/sope-appserver/WEExtensions/WEQualifierConditional.m b/sope-appserver/WEExtensions/WEQualifierConditional.m index 1b2633bd..ab28c067 100644 --- a/sope-appserver/WEExtensions/WEQualifierConditional.m +++ b/sope-appserver/WEExtensions/WEQualifierConditional.m @@ -106,7 +106,7 @@ /* accessors */ -- (WOElement *)template { +- (id)template { return self->template; } diff --git a/sope-appserver/WEExtensions/WETableCalcMatrix.m b/sope-appserver/WEExtensions/WETableCalcMatrix.m index 85ac9452..748ce1c1 100644 --- a/sope-appserver/WEExtensions/WETableCalcMatrix.m +++ b/sope-appserver/WEExtensions/WETableCalcMatrix.m @@ -700,12 +700,13 @@ static inline MatrixEntry *entryAt(WETableCalcMatrix *self, unsigned x, id object; stripe = [[WETableCalcMatrixStripe alloc] - initWithSize:self->height - matrix:self - delegate:self->delegate]; + initWithSize:self->height + matrix:self + delegate:self->delegate]; + stripe = [stripe autorelease]; objects = [[self objectsInColumn:_x] objectEnumerator]; - while ((object = [objects nextObject])) { + while ((object = [objects nextObject]) != nil) { WETableCalcMatrixPositionArray *pos; unsigned *indices; unsigned idxCount; @@ -719,18 +720,18 @@ static inline MatrixEntry *entryAt(WETableCalcMatrix *self, unsigned x, [stripe addObject:object atPositions:indices count:idxCount]; } - AUTORELEASE(stripe); return [stripe threadSpans]; } -- (id)spansOfRow:(unsigned)_y { +- (NSArray *)spansOfRow:(unsigned)_y { WETableCalcMatrixStripe *stripe; NSEnumerator *objects; id object; stripe = [[WETableCalcMatrixStripe alloc] - initWithSize:self->width - matrix:self - delegate:self->delegate]; + initWithSize:self->width + matrix:self + delegate:self->delegate]; + stripe = [stripe autorelease]; objects = [[self objectsInRow:_y] objectEnumerator]; while ((object = [objects nextObject])) { @@ -747,7 +748,6 @@ static inline MatrixEntry *entryAt(WETableCalcMatrix *self, unsigned x, [stripe addObject:object atPositions:indices count:idxCount]; } - AUTORELEASE(stripe); return [stripe threadSpans]; } diff --git a/sope-appserver/WEExtensions/WETableView/WETableView+Grouping.m b/sope-appserver/WEExtensions/WETableView/WETableView+Grouping.m index 51b9c4aa..7f53d9aa 100644 --- a/sope-appserver/WEExtensions/WETableView/WETableView+Grouping.m +++ b/sope-appserver/WEExtensions/WETableView/WETableView+Grouping.m @@ -68,7 +68,7 @@ isCollapsed = ![self->showGroup boolValueInComponent:comp]; [_response appendContentString:@"colspan); return [NSString stringWithCString:buf]; } -- 2.39.5