From a41e4a84a9ba53f9546299031fc10720af43ebdb Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 25 Apr 2005 18:49:52 +0000 Subject: [PATCH] fixed parsing of bool consts (#1360) git-svn-id: http://svn.opengroupware.org/SOPE/trunk@774 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/ChangeLog | 5 ++++ sope-appserver/NGObjWeb/Templates/WODParser.m | 30 ++++++++----------- sope-appserver/NGObjWeb/Version | 2 +- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index f5f71e60..a8d8d288 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,8 @@ +2005-04-25 Helge Hess + + * Templates/WODParser.m: fixed parsing of bool constants (got broken in + v4.5.152) (OGo bug #1360) (v4.5.156) + 2005-04-24 Helge Hess * v4.5.155 diff --git a/sope-appserver/NGObjWeb/Templates/WODParser.m b/sope-appserver/NGObjWeb/Templates/WODParser.m index 153300d1..a3d3222f 100644 --- a/sope-appserver/NGObjWeb/Templates/WODParser.m +++ b/sope-appserver/NGObjWeb/Templates/WODParser.m @@ -82,13 +82,6 @@ static id _parseWodEntry(NSZone *_zone, const unichar *_buffer, unsigned *_idx, NSString **_name, NSString **_class, id self); -static NSString *_makeStringForBuffer(const unichar *_buf, unsigned _l) { - if (_l == 0) - return @""; - - return [[StrClass alloc] initWithCharacters:_buf length:_l]; -} - - (NSException *)parseDefinitionsFromBuffer:(const unichar *)_buffer length:(unsigned)_len mappings:(NSMutableDictionary *)_mappings @@ -291,8 +284,9 @@ static NSException *_makeException(NSException *_exception, if (startPos < endPos) { NSString *ll; - - ll = _makeStringForBuffer(startPos, endPos - startPos); + + ll = [[StrClass alloc] initWithCharacters:startPos + length:endPos - startPos]; [ui setObject:ll forKey:@"lastLine"]; [ll release]; } @@ -413,7 +407,8 @@ static NSString *_parseIdentifier(NSZone *_zone, } else { *_idx = pos; - return _makeStringForBuffer(&(_buffer[startPos]), len); + return [[StrClass alloc] initWithCharacters:&(_buffer[startPos]) + length:len]; } } static NSString *_parseKeyPath(NSZone *_zone, @@ -556,14 +551,15 @@ static NSString *_parseQString(NSZone *_zone, str[pos2] = 0; NSCAssert(pos2 == len, @"invalid unescape .."); - ostr = _makeStringForBuffer(str, pos2); + ostr = [[StrClass alloc] initWithCharacters:str length:pos2]; if (str != NULL) free(str); str = NULL; return ostr; } else { NSCAssert(len > 0, @"invalid length .."); - return _makeStringForBuffer(&(_buffer[startPos]), len); + return [[StrClass alloc] initWithCharacters:&(_buffer[startPos]) + length:len]; } } } @@ -992,7 +988,7 @@ static id _parseProperty(NSZone *_zone, const unichar *_buffer, unsigned *_idx, if ((_buffer[*_idx] == 'Y') || (_buffer[*_idx] == 'N')) { // parse YES and NO if ((*_idx + 4) < _len) { - if (_ucIsEqual(&(_buffer[*_idx]), "YES", 3) == 0 && + if (_ucIsEqual(&(_buffer[*_idx]), "YES", 3) && _isBreakChar(_buffer[*_idx + 3])) { result = [yesNum retain]; valueProperty = YES; @@ -1000,7 +996,7 @@ static id _parseProperty(NSZone *_zone, const unichar *_buffer, unsigned *_idx, } } if (((*_idx + 3) < _len) && !valueProperty) { - if (_ucIsEqual(&(_buffer[*_idx]), "NO", 2) == 0 && + if (_ucIsEqual(&(_buffer[*_idx]), "NO", 2) && _isBreakChar(_buffer[*_idx + 2])) { result = [noNum retain]; valueProperty = YES; @@ -1011,7 +1007,7 @@ static id _parseProperty(NSZone *_zone, const unichar *_buffer, unsigned *_idx, else if ((_buffer[*_idx] == 't') || (_buffer[*_idx] == 'f')) { // parse true and false if ((*_idx + 5) < _len) { - if (_ucIsEqual(&(_buffer[*_idx]), "true", 4) == 0 && + if (_ucIsEqual(&(_buffer[*_idx]), "true", 4) && _isBreakChar(_buffer[*_idx + 4])) { result = [yesNum retain]; valueProperty = YES; @@ -1019,7 +1015,7 @@ static id _parseProperty(NSZone *_zone, const unichar *_buffer, unsigned *_idx, } } if (((*_idx + 6) < _len) && !valueProperty) { - if (_ucIsEqual(&(_buffer[*_idx]), "false", 5) == 0 && + if (_ucIsEqual(&(_buffer[*_idx]), "false", 5) && _isBreakChar(_buffer[*_idx + 5])) { result = [noNum retain]; valueProperty = YES; @@ -1051,7 +1047,7 @@ static id _parseProperty(NSZone *_zone, const unichar *_buffer, unsigned *_idx, } NSCAssert(result, @"missing property value .."); - + if (_allowAssoc) { id old = result; diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index c3803a3a..06bdea85 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=154 +SUBMINOR_VERSION:=156 # v4.5.122 requires libNGExtensions v4.5.153 # v4.5.91 requires libNGExtensions v4.5.134 -- 2.39.2