Skip to content

Commit

Permalink
molch_conversation_export: reorder parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
FSMaxB committed Jul 3, 2016
1 parent 854b7fb commit ccda080
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions bindings/molch.i
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,12 @@ extern return_status molch_conversation_export(
extern return_status molch_export(unsigned char ** const backup, size_t *backup_length);

extern return_status molch_conversation_import(
unsigned char * new_backup_key,
const size_t new_backup_key_length,
const unsigned char * const backup,
const size_t backup_length,
const unsigned char * backup_key,
const size_t backup_key,
unsigned char * new_backup_key,
const size_t new_backup_key_length);
const size_t backup_key);

return_status molch_import(
unsigned char * const backup,
Expand Down
8 changes: 5 additions & 3 deletions lib/molch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1328,12 +1328,14 @@ return_status molch_conversation_json_import(const unsigned char * const json, c
* if an error has occurred.
*/
return_status molch_conversation_import(
//output
unsigned char * new_backup_key, //BACKUP_KEY_SIZE, can be the same pointer as the backup key
const size_t new_backup_key_length,
//inputs
const unsigned char * const backup,
const size_t backup_length,
const unsigned char * local_backup_key, //BACKUP_KEY_SIZE
const size_t local_backup_key_length,
unsigned char * new_backup_key, //output, BACKUP_KEY_SIZE, can be the same pointer as the backup key
const size_t new_backup_key_length) {
const size_t local_backup_key_length) {
return_status status = return_status_init();

buffer_t *json = buffer_create_with_custom_allocator(backup_length, 0, sodium_malloc, sodium_free);
Expand Down
8 changes: 5 additions & 3 deletions lib/molch.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,14 @@ return_status molch_export(
* if an error has occurred.
*/
return_status molch_conversation_import(
//output
unsigned char * new_backup_key, //output, BACKUP_KEY_SIZE, can be the same pointer as the backup key
const size_t new_backup_key_length,
//inputs
const unsigned char * const backup,
const size_t backup_length,
const unsigned char * backup_key, //BACKUP_KEY_SIZE
const size_t backup_key_length,
unsigned char * new_backup_key, //output, BACKUP_KEY_SIZE, can be the same pointer as the backup key
const size_t new_backup_key_length
const size_t backup_key_length
) __attribute__((warn_unused_result));

/*
Expand Down
6 changes: 3 additions & 3 deletions test/molch-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,12 @@ int main(void) {

//import again
status = molch_conversation_import(
new_backup_key->content,
new_backup_key->content_length,
backup,
backup_length,
backup_key->content,
backup_key->content_length,
new_backup_key->content,
new_backup_key->content_length);
backup_key->content_length);
on_error(
free(backup);
throw(IMPORT_ERROR, "Failed to import Alice' conversation from backup.");
Expand Down

0 comments on commit ccda080

Please sign in to comment.