Add explicit C++ casts when assigning from void*

C++ requires explicit casts when assign void * return
types like from `malloc`, to a more specific pointer.
This commit is contained in:
Helge Heß 2020-04-10 17:26:34 +02:00
parent 1e5910a681
commit 8deccb9c51
No known key found for this signature in database
GPG key ID: 0A3825768D88C07D
4 changed files with 7 additions and 6 deletions

View file

@ -83,7 +83,7 @@
/** public identity keys */
- (NSDictionary*) identityKeys {
size_t identityKeysLength = olm_account_identity_keys_length(_account);
uint8_t *identityKeysBytes = malloc(identityKeysLength);
uint8_t *identityKeysBytes = (uint8_t *)malloc(identityKeysLength);
if (!identityKeysBytes) {
return nil;
}
@ -124,7 +124,7 @@
- (NSDictionary*) oneTimeKeys {
size_t otkLength = olm_account_one_time_keys_length(_account);
uint8_t *otkBytes = malloc(otkLength);
uint8_t *otkBytes = (uint8_t *)malloc(otkLength);
if (!otkBytes) {
return nil;
}

View file

@ -38,7 +38,8 @@
self = [super init];
if (self)
{
session = malloc(olm_inbound_group_session_size());
session = (OlmInboundGroupSession *)
malloc(olm_inbound_group_session_size());
if (session) {
session = olm_inbound_group_session(session);
}

View file

@ -31,7 +31,7 @@
- (BOOL) initializeSessionMemory {
size_t size = olm_session_size();
_session = malloc(size);
_session = (OlmSession *)malloc(size);
NSParameterAssert(_session != nil);
if (!_session) {
return NO;
@ -235,7 +235,7 @@
return nil;
}
NSString *ciphertextString = [[NSString alloc] initWithData:ciphertext encoding:NSUTF8StringEncoding];
OLMMessage *encryptedMessage = [[OLMMessage alloc] initWithCiphertext:ciphertextString type:messageType];
OLMMessage *encryptedMessage = [[OLMMessage alloc] initWithCiphertext:ciphertextString type:OLMMessageType(messageType)];
return encryptedMessage;
}

View file

@ -37,7 +37,7 @@ NSString *const OLMErrorDomain = @"org.matrix.olm";
- (BOOL) initializeUtilityMemory {
size_t utilitySize = olm_utility_size();
_utility = malloc(utilitySize);
_utility = (OlmUtility *)malloc(utilitySize);
NSParameterAssert(_utility != nil);
if (!_utility) {
return NO;