Fix OCNT's alternate types. E.g. LZCT was a short for some copy/paste error reason...

This commit is contained in:
Uli Kusterer 2003-08-18 00:00:23 +02:00
parent a8cd81969e
commit da1ef4b3ab
2 changed files with 37 additions and 12 deletions

View File

@ -11,14 +11,14 @@
@interface NuTemplateOCNTElement : NuTemplateElement
{
long longValue;
unsigned long longValue;
}
+(NuTemplateOCNTElement*) lastParsedElement;
+(void) setLastParsedElement: (NuTemplateOCNTElement*)e;
-(void) setLongValue: (long)n;
-(long) longValue;
-(void) setLongValue: (unsigned long)n;
-(unsigned long) longValue;
-(NSString*) stringValue;
-(void) setStringValue: (NSString*)str;

View File

@ -56,9 +56,20 @@ static NuTemplateOCNTElement* sLastParsedElement = nil;
[stream readAmount:4 toBuffer: &longValue];
else if( [type isEqualToString: @"LZCT"] )
{
short n = -1;
[stream readAmount:sizeof(longValue) toBuffer: &longValue];
longValue += 1;
}
else if( [type isEqualToString: @"BCNT"] )
{
unsigned char n = 0;
[stream readAmount:sizeof(n) toBuffer: &n];
longValue = n +1;
longValue = n;
}
else if( [type isEqualToString: @"BZCT"] )
{
char n = 0;
[stream readAmount:sizeof(n) toBuffer: &n];
longValue = n;
}
else if( [type isEqualToString: @"ZCNT"] )
{
@ -66,9 +77,9 @@ static NuTemplateOCNTElement* sLastParsedElement = nil;
[stream readAmount:sizeof(n) toBuffer: &n];
longValue = n +1;
}
else
else // OCNT, WCNT
{
short n = 0;
unsigned short n = 0;
[stream readAmount:sizeof(n) toBuffer: &n];
longValue = n;
}
@ -81,7 +92,11 @@ static NuTemplateOCNTElement* sLastParsedElement = nil;
return 4;
else if( [type isEqualToString: @"LZCT"] )
return 4;
else
else if( [type isEqualToString: @"BZCT"] )
return 1;
else if( [type isEqualToString: @"BCNT"] )
return 1;
else // OCNT, WCNT, ZCNT
return 2;
}
@ -94,25 +109,35 @@ static NuTemplateOCNTElement* sLastParsedElement = nil;
long n = longValue -1;
[stream writeAmount:sizeof(n) fromBuffer: &n];
}
else if( [type isEqualToString: @"BZCT"] )
{
char n = longValue -1;
[stream writeAmount:sizeof(n) fromBuffer: &n];
}
else if( [type isEqualToString: @"BCNT"] )
{
unsigned char n = longValue -1;
[stream writeAmount:sizeof(n) fromBuffer: &n];
}
else if( [type isEqualToString: @"ZCNT"] )
{
short n = longValue -1;
[stream writeAmount:sizeof(n) fromBuffer: &n];
}
else
else // OCNT, WCNT
{
short n = longValue;
unsigned short n = longValue;
[stream writeAmount:sizeof(n) fromBuffer: &n];
}
}
-(void) setLongValue: (long)d
-(void) setLongValue: (unsigned long)d
{
longValue = d;
}
-(long) longValue
-(unsigned long) longValue
{
return longValue;
}