From: helge Date: Fri, 25 Mar 2005 18:21:52 +0000 (+0000) Subject: minor code cleanups X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aca6f9e18a0f11fc69f5fdaa4f0068e5395805d7;p=sope minor code cleanups git-svn-id: http://svn.opengroupware.org/SOPE/trunk@700 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index 516b958a..b4177f9f 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,8 @@ +2005-03-25 Helge Hess + + * SoObjects/SoObject+Traversal.m, WebDAV/SoObjectWebDAVDispatcher.m: + minor code cleanups (v4.5.142) + 2005-03-23 Marcus Mueller * OWResourceManager.m, WOResourceManager.m: changed table name for diff --git a/sope-appserver/NGObjWeb/SoObjects/SoObject+Traversal.m b/sope-appserver/NGObjWeb/SoObjects/SoObject+Traversal.m index 8eee4fcd..9e03a01c 100644 --- a/sope-appserver/NGObjWeb/SoObjects/SoObject+Traversal.m +++ b/sope-appserver/NGObjWeb/SoObjects/SoObject+Traversal.m @@ -95,9 +95,10 @@ static BOOL _isDebugOn(void) { /* lookup in object (and acquire from strict parents) */ sm = [_ctx soSecurityManager]; - if ((obj = [self traverseKey:_name inContext:_ctx])) { - *_error = [sm validateValue:obj forName:_name ofObject:self inContext:_ctx]; - if (*_error) { + if ((obj = [self traverseKey:_name inContext:_ctx]) != nil) { + *_error = [sm validateValue:obj forName:_name ofObject:self + inContext:_ctx]; + if (*_error != nil) { /* not allowed ! */ if (debugTraversal) [self debugWithFormat:@" value of key '%@' did not validate !",_name]; @@ -112,7 +113,7 @@ static BOOL _isDebugOn(void) { if (_acquire) { /* now try to acquire from parents in URL path */ NSEnumerator *e; - + if (debugTraversal) { [self debugWithFormat:@" try to acquire key '%@' from traversal stack", _name]; @@ -170,13 +171,13 @@ static BOOL _isDebugOn(void) { } /* reset error */ - if (_error) *_error = nil; + if (_error != NULL) *_error = nil; - if ((rq = [(id )_ctx request])) { + if ((rq = [(id )_ctx request]) != nil) { /* isn't that somewhat hackish, directly accessing the HTTP method? */ NSString *m; - if ((m = [rq method])) { + if ((m = [rq method]) != nil) { if ([m isEqualToString:@"PUT"]) isCreateIfMissingMethod = YES; else if ([m isEqualToString:@"PROPPATCH"]) @@ -258,7 +259,7 @@ static BOOL _isDebugOn(void) { if (doDebug) [self logWithFormat:@" miss is last object."]; } - if (error) { + if (error != nil) { if (doDebug) [self logWithFormat:@" handle miss error: %@", error]; currentObject = [currentObject handleValidationError:error duringTraveralOfKey:name @@ -291,6 +292,7 @@ static BOOL _isDebugOn(void) { r.length = (count - i); piArray = [traversalPath subarrayWithRange:r]; if (doDebug) [self logWithFormat:@"PATH_INFO: %@", piArray]; + // TODO: what about escaping? [_ctx setPathInfo:[piArray componentsJoinedByString:@"/"]]; break; } @@ -320,7 +322,7 @@ static BOOL _isDebugOn(void) { else clientObject = currentObject; - if (clientObject) { + if (clientObject != nil) { if (doDebug) [self logWithFormat:@"set clientObject: %@", clientObject]; [_ctx setClientObject:clientObject]; diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index 01d0ad8f..11115ec3 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=141 +SUBMINOR_VERSION:=142 # v4.5.122 requires libNGExtensions v4.5.153 # v4.5.91 requires libNGExtensions v4.5.134 diff --git a/sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m b/sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m index e057c8c0..496d9746 100644 --- a/sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m +++ b/sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m @@ -807,8 +807,9 @@ static NSTimeZone *gmt = nil; srvURL = [_ctx serverURL]; - [self debugWithFormat:@"move/copy:\n to: %@\n server: %@)", - [destURL absoluteString], [srvURL absoluteString]]; + [self debugWithFormat:@"move/copy:\n to: %@ (%@)\n server: %@)", + [destURL absoluteString], absDestURL, + [srvURL absoluteString]]; /* check whether URL is on the same server ... */ if (![[srvURL host] isEqualToString:[destURL host]] || @@ -874,14 +875,16 @@ static NSTimeZone *gmt = nil; inContext:_ctx error:&error acquire:NO]; - if (error) { + if ([*target_ isKindOfClass:[NSException class]]) + error = *target_; + if (error != nil) { [self logWithFormat:@"could not resolve destination object (%@): %@", [targetPath componentsJoinedByString:@" => "], error]; return error; } - - if (name_) *name_ = [[[_ctx pathInfo] copy] autorelease]; + + if (name_ != NULL) *name_ = [[[_ctx pathInfo] copy] autorelease]; if (*target_ == nil) { [self debugWithFormat:@"MOVE/COPY destination could not be found."]; @@ -890,7 +893,8 @@ static NSTimeZone *gmt = nil; } [self debugWithFormat:@"SOURCE: %@", self->object]; - [self debugWithFormat:@"TARGET: %@ (PI %@)", *target_, [_ctx pathInfo]]; + [self debugWithFormat:@"TARGET: %@ (pathinfo %@)", + *target_, [_ctx pathInfo]]; return nil; }