mirror of
https://github.com/nickshanks/ResKnife.git
synced 2024-06-06 20:29:29 +00:00
Fix OCNT's alternate types. E.g. LZCT was a short for some copy/paste error reason...
This commit is contained in:
parent
a8cd81969e
commit
da1ef4b3ab
|
@ -11,14 +11,14 @@
|
||||||
|
|
||||||
@interface NuTemplateOCNTElement : NuTemplateElement
|
@interface NuTemplateOCNTElement : NuTemplateElement
|
||||||
{
|
{
|
||||||
long longValue;
|
unsigned long longValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
+(NuTemplateOCNTElement*) lastParsedElement;
|
+(NuTemplateOCNTElement*) lastParsedElement;
|
||||||
+(void) setLastParsedElement: (NuTemplateOCNTElement*)e;
|
+(void) setLastParsedElement: (NuTemplateOCNTElement*)e;
|
||||||
|
|
||||||
-(void) setLongValue: (long)n;
|
-(void) setLongValue: (unsigned long)n;
|
||||||
-(long) longValue;
|
-(unsigned long) longValue;
|
||||||
|
|
||||||
-(NSString*) stringValue;
|
-(NSString*) stringValue;
|
||||||
-(void) setStringValue: (NSString*)str;
|
-(void) setStringValue: (NSString*)str;
|
||||||
|
|
|
@ -56,9 +56,20 @@ static NuTemplateOCNTElement* sLastParsedElement = nil;
|
||||||
[stream readAmount:4 toBuffer: &longValue];
|
[stream readAmount:4 toBuffer: &longValue];
|
||||||
else if( [type isEqualToString: @"LZCT"] )
|
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];
|
[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"] )
|
else if( [type isEqualToString: @"ZCNT"] )
|
||||||
{
|
{
|
||||||
|
@ -66,9 +77,9 @@ static NuTemplateOCNTElement* sLastParsedElement = nil;
|
||||||
[stream readAmount:sizeof(n) toBuffer: &n];
|
[stream readAmount:sizeof(n) toBuffer: &n];
|
||||||
longValue = n +1;
|
longValue = n +1;
|
||||||
}
|
}
|
||||||
else
|
else // OCNT, WCNT
|
||||||
{
|
{
|
||||||
short n = 0;
|
unsigned short n = 0;
|
||||||
[stream readAmount:sizeof(n) toBuffer: &n];
|
[stream readAmount:sizeof(n) toBuffer: &n];
|
||||||
longValue = n;
|
longValue = n;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +92,11 @@ static NuTemplateOCNTElement* sLastParsedElement = nil;
|
||||||
return 4;
|
return 4;
|
||||||
else if( [type isEqualToString: @"LZCT"] )
|
else if( [type isEqualToString: @"LZCT"] )
|
||||||
return 4;
|
return 4;
|
||||||
else
|
else if( [type isEqualToString: @"BZCT"] )
|
||||||
|
return 1;
|
||||||
|
else if( [type isEqualToString: @"BCNT"] )
|
||||||
|
return 1;
|
||||||
|
else // OCNT, WCNT, ZCNT
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,25 +109,35 @@ static NuTemplateOCNTElement* sLastParsedElement = nil;
|
||||||
long n = longValue -1;
|
long n = longValue -1;
|
||||||
[stream writeAmount:sizeof(n) fromBuffer: &n];
|
[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"] )
|
else if( [type isEqualToString: @"ZCNT"] )
|
||||||
{
|
{
|
||||||
short n = longValue -1;
|
short n = longValue -1;
|
||||||
[stream writeAmount:sizeof(n) fromBuffer: &n];
|
[stream writeAmount:sizeof(n) fromBuffer: &n];
|
||||||
}
|
}
|
||||||
else
|
else // OCNT, WCNT
|
||||||
{
|
{
|
||||||
short n = longValue;
|
unsigned short n = longValue;
|
||||||
[stream writeAmount:sizeof(n) fromBuffer: &n];
|
[stream writeAmount:sizeof(n) fromBuffer: &n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-(void) setLongValue: (long)d
|
-(void) setLongValue: (unsigned long)d
|
||||||
{
|
{
|
||||||
longValue = d;
|
longValue = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(long) longValue
|
-(unsigned long) longValue
|
||||||
{
|
{
|
||||||
return longValue;
|
return longValue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user