Add remaining explicit C++ void casts necessary
OLMKit now compiles fine.
This commit is contained in:
parent
29d3bc749b
commit
f4ab61fa46
4 changed files with 18 additions and 15 deletions
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
- (BOOL) initializeAccountMemory {
|
- (BOOL) initializeAccountMemory {
|
||||||
size_t accountSize = olm_account_size();
|
size_t accountSize = olm_account_size();
|
||||||
_account = malloc(accountSize);
|
_account = (OlmAccount *)malloc(accountSize);
|
||||||
NSParameterAssert(_account != nil);
|
NSParameterAssert(_account != nil);
|
||||||
if (!_account) {
|
if (!_account) {
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
|
|
||||||
- (NSString *)signMessage:(NSData *)messageData {
|
- (NSString *)signMessage:(NSData *)messageData {
|
||||||
size_t signatureLength = olm_account_signature_length(_account);
|
size_t signatureLength = olm_account_signature_length(_account);
|
||||||
uint8_t *signatureBytes = malloc(signatureLength);
|
uint8_t *signatureBytes = (uint8_t *)malloc(signatureLength);
|
||||||
if (!signatureBytes) {
|
if (!signatureBytes) {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
self = [self init];
|
self = [self init];
|
||||||
if (self) {
|
if (self) {
|
||||||
NSData *sessionKeyData = [sessionKey dataUsingEncoding:NSUTF8StringEncoding];
|
NSData *sessionKeyData = [sessionKey dataUsingEncoding:NSUTF8StringEncoding];
|
||||||
size_t result = olm_init_inbound_group_session(session, sessionKeyData.bytes, sessionKeyData.length);
|
size_t result = olm_init_inbound_group_session(session, (const uint8_t *)sessionKeyData.bytes, sessionKeyData.length);
|
||||||
if (result == olm_error()) {
|
if (result == olm_error()) {
|
||||||
const char *olm_error = olm_inbound_group_session_last_error(session);
|
const char *olm_error = olm_inbound_group_session_last_error(session);
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
self = [self init];
|
self = [self init];
|
||||||
if (self) {
|
if (self) {
|
||||||
NSData *sessionKeyData = [sessionKey dataUsingEncoding:NSUTF8StringEncoding];
|
NSData *sessionKeyData = [sessionKey dataUsingEncoding:NSUTF8StringEncoding];
|
||||||
size_t result = olm_import_inbound_group_session(session, sessionKeyData.bytes, sessionKeyData.length);
|
size_t result = olm_import_inbound_group_session(session, (const uint8_t *)sessionKeyData.bytes, sessionKeyData.length);
|
||||||
if (result == olm_error()) {
|
if (result == olm_error()) {
|
||||||
const char *olm_error = olm_inbound_group_session_last_error(session);
|
const char *olm_error = olm_inbound_group_session_last_error(session);
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
if (!idData) {
|
if (!idData) {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
size_t result = olm_inbound_group_session_id(session, idData.mutableBytes, idData.length);
|
size_t result = olm_inbound_group_session_id(session, (uint8_t *)idData.mutableBytes, idData.length);
|
||||||
if (result == olm_error()) {
|
if (result == olm_error()) {
|
||||||
const char *error = olm_inbound_group_session_last_error(session);
|
const char *error = olm_inbound_group_session_last_error(session);
|
||||||
NSLog(@"olm_inbound_group_session_id error: %s", error);
|
NSLog(@"olm_inbound_group_session_id error: %s", error);
|
||||||
|
@ -128,7 +128,7 @@
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
NSMutableData *mutMessage = messageData.mutableCopy;
|
NSMutableData *mutMessage = messageData.mutableCopy;
|
||||||
size_t maxPlaintextLength = olm_group_decrypt_max_plaintext_length(session, mutMessage.mutableBytes, mutMessage.length);
|
size_t maxPlaintextLength = olm_group_decrypt_max_plaintext_length(session, (uint8_t *)mutMessage.mutableBytes, mutMessage.length);
|
||||||
if (maxPlaintextLength == olm_error()) {
|
if (maxPlaintextLength == olm_error()) {
|
||||||
const char *olm_error = olm_inbound_group_session_last_error(session);
|
const char *olm_error = olm_inbound_group_session_last_error(session);
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
NSMutableData *plaintextData = [NSMutableData dataWithLength:maxPlaintextLength];
|
NSMutableData *plaintextData = [NSMutableData dataWithLength:maxPlaintextLength];
|
||||||
|
|
||||||
uint32_t message_index;
|
uint32_t message_index;
|
||||||
size_t plaintextLength = olm_group_decrypt(session, mutMessage.mutableBytes, mutMessage.length, plaintextData.mutableBytes, plaintextData.length, &message_index);
|
size_t plaintextLength = olm_group_decrypt(session, (uint8_t *)mutMessage.mutableBytes, mutMessage.length, (uint8_t *)plaintextData.mutableBytes, plaintextData.length, &message_index);
|
||||||
if (plaintextLength == olm_error()) {
|
if (plaintextLength == olm_error()) {
|
||||||
const char *olm_error = olm_inbound_group_session_last_error(session);
|
const char *olm_error = olm_inbound_group_session_last_error(session);
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@
|
||||||
{
|
{
|
||||||
size_t length = olm_export_inbound_group_session_length(session);
|
size_t length = olm_export_inbound_group_session_length(session);
|
||||||
NSMutableData *key = [NSMutableData dataWithLength:length];
|
NSMutableData *key = [NSMutableData dataWithLength:length];
|
||||||
size_t result = olm_export_inbound_group_session(session, key.mutableBytes, key.length, (uint32_t)messageIndex);
|
size_t result = olm_export_inbound_group_session(session, (uint8_t *)key.mutableBytes, key.length, (uint32_t)messageIndex);
|
||||||
if (result == olm_error()) {
|
if (result == olm_error()) {
|
||||||
const char *olm_error = olm_inbound_group_session_last_error(session);
|
const char *olm_error = olm_inbound_group_session_last_error(session);
|
||||||
NSString *errorString = [NSString stringWithUTF8String:olm_error];
|
NSString *errorString = [NSString stringWithUTF8String:olm_error];
|
||||||
|
|
|
@ -37,7 +37,8 @@
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self)
|
if (self)
|
||||||
{
|
{
|
||||||
session = malloc(olm_outbound_group_session_size());
|
session = (OlmOutboundGroupSession *)
|
||||||
|
malloc(olm_outbound_group_session_size());
|
||||||
if (session) {
|
if (session) {
|
||||||
session = olm_outbound_group_session(session);
|
session = olm_outbound_group_session(session);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +55,7 @@
|
||||||
if (self) {
|
if (self) {
|
||||||
NSMutableData *random = [OLMUtility randomBytesOfLength:olm_init_outbound_group_session_random_length(session)];
|
NSMutableData *random = [OLMUtility randomBytesOfLength:olm_init_outbound_group_session_random_length(session)];
|
||||||
|
|
||||||
size_t result = olm_init_outbound_group_session(session, random.mutableBytes, random.length);
|
size_t result = olm_init_outbound_group_session(session, (uint8_t *)random.mutableBytes, random.length);
|
||||||
[random resetBytesInRange:NSMakeRange(0, random.length)];
|
[random resetBytesInRange:NSMakeRange(0, random.length)];
|
||||||
if (result == olm_error()) {
|
if (result == olm_error()) {
|
||||||
const char *error = olm_outbound_group_session_last_error(session);
|
const char *error = olm_outbound_group_session_last_error(session);
|
||||||
|
@ -71,7 +72,7 @@
|
||||||
if (!idData) {
|
if (!idData) {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
size_t result = olm_outbound_group_session_id(session, idData.mutableBytes, idData.length);
|
size_t result = olm_outbound_group_session_id(session, (uint8_t *)idData.mutableBytes, idData.length);
|
||||||
if (result == olm_error()) {
|
if (result == olm_error()) {
|
||||||
const char *error = olm_outbound_group_session_last_error(session);
|
const char *error = olm_outbound_group_session_last_error(session);
|
||||||
NSLog(@"olm_outbound_group_session_id error: %s", error);
|
NSLog(@"olm_outbound_group_session_id error: %s", error);
|
||||||
|
@ -91,7 +92,7 @@
|
||||||
if (!sessionKeyData) {
|
if (!sessionKeyData) {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
size_t result = olm_outbound_group_session_key(session, sessionKeyData.mutableBytes, sessionKeyData.length);
|
size_t result = olm_outbound_group_session_key(session, (uint8_t *)sessionKeyData.mutableBytes, sessionKeyData.length);
|
||||||
if (result == olm_error()) {
|
if (result == olm_error()) {
|
||||||
const char *error = olm_outbound_group_session_last_error(session);
|
const char *error = olm_outbound_group_session_last_error(session);
|
||||||
NSLog(@"olm_outbound_group_session_key error: %s", error);
|
NSLog(@"olm_outbound_group_session_key error: %s", error);
|
||||||
|
@ -109,7 +110,7 @@
|
||||||
if (!ciphertext) {
|
if (!ciphertext) {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
size_t result = olm_group_encrypt(session, plaintextData.bytes, plaintextData.length, ciphertext.mutableBytes, ciphertext.length);
|
size_t result = olm_group_encrypt(session, (const uint8_t *)plaintextData.bytes, plaintextData.length, (uint8_t *)ciphertext.mutableBytes, ciphertext.length);
|
||||||
if (result == olm_error()) {
|
if (result == olm_error()) {
|
||||||
const char *olm_error = olm_outbound_group_session_last_error(session);
|
const char *olm_error = olm_outbound_group_session_last_error(session);
|
||||||
|
|
||||||
|
|
|
@ -88,8 +88,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t result = olm_pk_sign(sign,
|
size_t result = olm_pk_sign(sign,
|
||||||
messageData.bytes, messageData.length,
|
(uint8_t const *)messageData.bytes,
|
||||||
signatureData.mutableBytes, signatureLength);
|
messageData.length,
|
||||||
|
(uint8_t *)signatureData.mutableBytes,
|
||||||
|
signatureLength);
|
||||||
if (result == olm_error()) {
|
if (result == olm_error()) {
|
||||||
const char *olm_error = olm_pk_signing_last_error(sign);
|
const char *olm_error = olm_pk_signing_last_error(sign);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue