IOSAD-172 Back out: Less casting IOSAD-172
authorDirk Zimmermann <dz@pep.security>
Sat, 27 Jun 2020 14:37:54 +0200
branchIOSAD-172
changeset 1511a4d7dc99ec1d
parent 1510 32a247365edb
child 1512 3fe651c26d40
IOSAD-172 Back out: Less casting
pEpObjCAdapter/PEPInternalSession+PassphraseCache.h
pEpObjCAdapter/PEPInternalSession+PassphraseCache.m
pEpObjCAdapter/PEPInternalSession.m
     1.1 --- a/pEpObjCAdapter/PEPInternalSession+PassphraseCache.h	Sat Jun 27 14:35:15 2020 +0200
     1.2 +++ b/pEpObjCAdapter/PEPInternalSession+PassphraseCache.h	Sat Jun 27 14:37:54 2020 +0200
     1.3 @@ -21,7 +21,7 @@
     1.4  /// until it returns something else other than PEP_PASSPHRASE_REQUIRED
     1.5  /// or PEP_WRONG_PASSPHRASE, or there are no passwords anymore.
     1.6  /// @param block The status-returning block to execute against different passwords
     1.7 -- (PEPStatus)runWithPasswords:(PEP_STATUS (^)(PEP_SESSION session))block;
     1.8 +- (PEP_STATUS)runWithPasswords:(PEP_STATUS (^)(PEP_SESSION session))block;
     1.9  
    1.10  @end
    1.11  
     2.1 --- a/pEpObjCAdapter/PEPInternalSession+PassphraseCache.m	Sat Jun 27 14:35:15 2020 +0200
     2.2 +++ b/pEpObjCAdapter/PEPInternalSession+PassphraseCache.m	Sat Jun 27 14:37:54 2020 +0200
     2.3 @@ -14,7 +14,7 @@
     2.4  
     2.5  @implementation PEPInternalSession (PassphraseCache)
     2.6  
     2.7 -- (PEPStatus)runWithPasswords:(PEP_STATUS (^)(PEP_SESSION session))block
     2.8 +- (PEP_STATUS)runWithPasswords:(PEP_STATUS (^)(PEP_SESSION session))block
     2.9  {
    2.10      PEP_STATUS lastStatus = PEP_UNKNOWN_ERROR;
    2.11  
    2.12 @@ -23,19 +23,19 @@
    2.13          PEP_STATUS status = config_passphrase(self.session, [passphrase UTF8String]);
    2.14  
    2.15          if (status != PEPStatusOK) {
    2.16 -            return (PEPStatus) status;
    2.17 +            return status;
    2.18          }
    2.19  
    2.20          lastStatus = block(self.session);
    2.21  
    2.22          if (lastStatus != PEP_PASSPHRASE_REQUIRED && lastStatus != PEP_WRONG_PASSPHRASE) {
    2.23 -            return (PEPStatus) lastStatus;
    2.24 +            return lastStatus;
    2.25          }
    2.26      }
    2.27  
    2.28      // If execution lands here, it means we ran out of passwords to set while
    2.29      // receiving password-related error codes.
    2.30 -    return (PEPStatus) lastStatus;
    2.31 +    return lastStatus;
    2.32  }
    2.33  
    2.34  @end
     3.1 --- a/pEpObjCAdapter/PEPInternalSession.m	Sat Jun 27 14:35:15 2020 +0200
     3.2 +++ b/pEpObjCAdapter/PEPInternalSession.m	Sat Jun 27 14:37:54 2020 +0200
     3.3 @@ -259,20 +259,18 @@
     3.4                                     status:(PEPStatus * _Nullable)status
     3.5                                      error:(NSError * _Nullable * _Nullable)error
     3.6  {
     3.7 -    __block PEP_encrypt_flags_t flags = 0;
     3.8 +    PEP_encrypt_flags_t flags = 0;
     3.9  
    3.10 -    __block message *_src = PEP_messageDictToStruct([self removeEmptyRecipients:messageDict]);
    3.11 -    __block message *_dst = NULL;
    3.12 -    __block stringlist_t *_keys = PEP_arrayToStringlist(extraKeys);
    3.13 +    message *_src = PEP_messageDictToStruct([self removeEmptyRecipients:messageDict]);
    3.14 +    message *_dst = NULL;
    3.15 +    stringlist_t *_keys = PEP_arrayToStringlist(extraKeys);
    3.16  
    3.17 -    PEPStatus theStatus = [self runWithPasswords:^PEP_STATUS(PEP_SESSION session) {
    3.18 -        return encrypt_message(session,
    3.19 -                               _src,
    3.20 -                               _keys,
    3.21 -                               &_dst,
    3.22 -                               (PEP_enc_format) encFormat,
    3.23 -                               flags);
    3.24 -    }];
    3.25 +    PEPStatus theStatus = (PEPStatus) encrypt_message(_session,
    3.26 +                                                      _src,
    3.27 +                                                      _keys,
    3.28 +                                                      &_dst,
    3.29 +                                                      (PEP_enc_format) encFormat,
    3.30 +                                                      flags);
    3.31  
    3.32      if (status) {
    3.33          *status = theStatus;