IOS-1704 PEPAttachment.dataWithout0Terminator. IOS-1704
authorDirk Zimmermann <dz@pep.security>
Fri, 05 Jul 2019 14:10:21 +0200
branchIOS-1704
changeset 1049b6dd6a632e03
parent 1048 6b93eb69aa75
child 1050 27b602c274a1
IOS-1704 PEPAttachment.dataWithout0Terminator.
pEpObjCAdapter/PEPAttachment.m
pEpObjCAdapterFramework/PEPAttachment.h
     1.1 --- a/pEpObjCAdapter/PEPAttachment.m	Fri Jul 05 14:10:21 2019 +0200
     1.2 +++ b/pEpObjCAdapter/PEPAttachment.m	Fri Jul 05 14:10:21 2019 +0200
     1.3 @@ -12,6 +12,7 @@
     1.4  
     1.5  @interface PEPAttachment ()
     1.6  
     1.7 +/** Blob (binary data) _with_ 0-terminator. */
     1.8  @property (nonatomic, nonnull) NSData *data;
     1.9  
    1.10  @end
    1.11 @@ -36,6 +37,11 @@
    1.12      return self.data;
    1.13  }
    1.14  
    1.15 +- (NSData *)dataWithout0Terminator
    1.16 +{
    1.17 +    return [NSData dataWithBytes:self.data.bytes length:self.size];
    1.18 +}
    1.19 +
    1.20  - (NSString *)description
    1.21  {
    1.22      NSMutableString *str =
     2.1 --- a/pEpObjCAdapterFramework/PEPAttachment.h	Fri Jul 05 14:10:21 2019 +0200
     2.2 +++ b/pEpObjCAdapterFramework/PEPAttachment.h	Fri Jul 05 14:10:21 2019 +0200
     2.3 @@ -18,6 +18,11 @@
     2.4  @property (readonly, nonnull) NSData *dataWith0Terminator;
     2.5  
     2.6  /**
     2.7 + The blob (binary data) of this attachment, _without_ \0 terminator.
     2.8 + */
     2.9 +@property (readonly, nonnull) NSData *dataWithout0Terminator;
    2.10 +
    2.11 +/**
    2.12   The size (length in bytes) of the binary blob _without_ the trailing \0,
    2.13   in other words, the size of the raw data.
    2.14   */