IOS-1112 cleans code

IOS-1028
buff 5 years ago
parent e426fce210
commit e715b31891
  1. 46
      pantomime-lib/Framework/Pantomime/NSData+Extensions.m

@ -332,40 +332,24 @@ static const char *hexDigit = "0123456789ABCDEF";
return AUTORELEASE(aMutableData);
}
//
//
//
- (NSRange) rangeOfData: (NSData *) theData
- (NSRange)rangeOfData:(NSData *)theData
{
const char *b, *bytes, *str;
NSUInteger i, len, slen;
bytes = [self bytes];
len = [self length];
if (!theData)
{
return NSMakeRange(NSNotFound,0);
if (!theData) {
return NSMakeRange(NSNotFound,0);
}
slen = [theData length];
str = [theData bytes];
b = bytes;
// TODO: this could be optimized
i = 0;
b += i;
for (; i<= len-slen; i++, b++)
{
if (!memcmp(str,b,slen))
{
return NSMakeRange(i,slen);
}
NSUInteger slen = [theData length];
const char *str = [theData bytes];
NSUInteger len = [self length];
const char *b = [self bytes];
for (int i = 0; i <= len - slen; ++i, ++b) {
if (!memcmp(str, b, slen)) {
return NSMakeRange(i, slen);
}
}
return NSMakeRange(NSNotFound,0);
return NSMakeRange(NSNotFound,0);
}

Loading…
Cancel
Save