Browse Source

IOS-2794 Wrong approach

IOS-2794
Dirk Zimmermann 1 year ago
parent
commit
3927552521
2 changed files with 10 additions and 0 deletions
  1. +3
    -0
      PantomimeFramework/PantomimeFramework/NSData+Extensions.h
  2. +7
    -0
      pantomime-lib/Framework/Pantomime/NSData+Extensions.m

+ 3
- 0
PantomimeFramework/PantomimeFramework/NSData+Extensions.h View File

@ -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:


+ 7
- 0
pantomime-lib/Framework/Pantomime/NSData+Extensions.m View File

@ -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