IOS-2794 Wrong approach

IOS-2794
Dirk Zimmermann 2 years ago
parent 6f90df8cf7
commit 3927552521

@ -158,6 +158,9 @@
*/
- (NSData *) subdataToIndex: (NSUInteger) theIndex;
/// Like `subDataWithRange`, but doesn't copy bytes, and instead points to the bytes from the original.
- (NSData *)subdataUncopiedWithRange:(NSRange)range;
/**
@discussion Simple method to trim the leading and trailing whitespaces (characters with no visible
representation). Cahracters currently taken into accout are:

@ -437,6 +437,13 @@ static const char *hexDigit = "0123456789ABCDEF";
return [self subdataWithRange: NSMakeRange(0, theIndex)];
}
- (NSData *)subdataUncopiedWithRange:(NSRange)range
{
const char *theBytes = [self bytes];
const char *newBytes = theBytes + range.location;
return [NSData dataWithBytesNoCopy:(void *) newBytes length:range.length];
}
- (NSData *)dataByTrimmingWhiteSpaces
{
const char *bytes = [self bytes];

Loading…
Cancel
Save