Permalink
Browse files

Added scanDataOfLength:intoPointer: less NSData = good.

  • Loading branch information...
1 parent 6416929 commit c41dcd241cfd7aefd541dfc1c6ff68e57ef8d620 @schwa schwa committed Jul 11, 2011
Showing with 18 additions and 3 deletions.
  1. +1 −0 Source/CDataScanner.h
  2. +17 −3 Source/CDataScanner.m
View
@@ -61,6 +61,7 @@
- (BOOL)scanNumber:(NSNumber **)outValue;
- (BOOL)scanDecimalNumber:(NSDecimalNumber **)outValue;
+- (BOOL)scanDataOfLength:(NSUInteger)inLength intoPointer:(void **)outPointer;
- (BOOL)scanDataOfLength:(NSUInteger)inLength intoData:(NSData **)outData;
- (void)skipWhitespace;
View
@@ -29,8 +29,6 @@
#import "CDataScanner.h"
-#import "CDataScanner_Extensions.h"
-
@interface CDataScanner ()
@end
@@ -296,6 +294,22 @@ - (BOOL)scanDecimalNumber:(NSDecimalNumber **)outValue;
return(NO);
}
+- (BOOL)scanDataOfLength:(NSUInteger)inLength intoPointer:(void **)outPointer
+ {
+ if (self.bytesRemaining < inLength)
+ {
+ return(NO);
+ }
+
+ if (outPointer)
+ {
+ *outPointer = current;
+ }
+
+ current += inLength;
+ return(YES);
+ }
+
- (BOOL)scanDataOfLength:(NSUInteger)inLength intoData:(NSData **)outData;
{
if (self.bytesRemaining < inLength)
@@ -335,4 +349,4 @@ - (NSData *)remainingData;
return(theRemainingData);
}
- @end
+@end

0 comments on commit c41dcd2

Please sign in to comment.