IOS-1704 Duh, subdataWithRange. IOS-1704
authorDirk Zimmermann <dz@pep.security>
Mon, 08 Jul 2019 16:42:56 +0200
branchIOS-1704
changeset 10564f1b93272a76
parent 1055 99c6a1474e4e
child 1059 5425ae4168e6
IOS-1704 Duh, subdataWithRange.
pEpObjCAdapter/PEPAttachment.m
     1.1 --- a/pEpObjCAdapter/PEPAttachment.m	Mon Jul 08 16:42:56 2019 +0200
     1.2 +++ b/pEpObjCAdapter/PEPAttachment.m	Mon Jul 08 16:42:56 2019 +0200
     1.3 @@ -6,6 +6,8 @@
     1.4  //  Copyright © 2018 p≡p. All rights reserved.
     1.5  //
     1.6  
     1.7 +#import <Foundation/Foundation.h>
     1.8 +
     1.9  #import "PEPAttachment.h"
    1.10  
    1.11  #import "bloblist.h"
    1.12 @@ -39,10 +41,7 @@
    1.13  
    1.14  - (NSData *)dataWithoutZeroTerminator
    1.15  {
    1.16 -    // Maybe we can avoid this with `initWithBytesNoCopy`?
    1.17 -    // But then we have to take care of memory management without
    1.18 -    // creating ownership cycles.
    1.19 -    return [NSData dataWithBytes:self.data.bytes length:self.size];
    1.20 +    return [self.data subdataWithRange:NSMakeRange(0, self.size)];
    1.21  }
    1.22  
    1.23  - (NSString *)description