Skip to content
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.

Commit

Permalink
Fix callbacks signature
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyklay committed Jul 25, 2021
1 parent 92099c4 commit 53eb6e5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/pclcli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,19 +213,19 @@ static void status_change(pstatus_t* status) {
clib::pclcli::get_lib().status_callback_((int)status->status, status2string(status->status));
}

int clib::pclcli::start_crypto (const char *pass, void *rep) {
int clib::pclcli::start_crypto(const char *pass, void **rep) {
get_lib().crypto_pass_ = pass;
return lib_setup_crypto();
}

int clib::pclcli::stop_crypto (const char* path, void * rep) {
int clib::pclcli::stop_crypto(const char* path, void **rep) {
get_lib().crypto_on_ = false;
return psync_crypto_stop();
}

int clib::pclcli::list_sync_folders (const char *path, void *rep) {
int clib::pclcli::list_sync_folders(const char *path, void **rep) {
psync_folder_list_t *folders = psync_get_sync_list();
rep = psync_malloc(sizeof(folders));
*rep = psync_malloc(sizeof(folders));
memcpy(rep, folders, sizeof(folders));
return 0;
}
Expand Down
5 changes: 3 additions & 2 deletions src/psync/poverlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,13 @@ void get_answer_to_request(message *request, message *response) {
message *rep = NULL;

if (callbacks[ind]) {
if ((ret = callbacks[ind](request->value, rep)) == 0) {
if ((ret = callbacks[ind](request->value, &rep)) == 0) {
if (rep) {
psync_free(response);
response = rep;
} else
} else {
response->type = 0;
}
} else {
response->type = ret;
memcpy(response->value, "No.", 4);
Expand Down
2 changes: 1 addition & 1 deletion src/psync/poverlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ typedef struct message_ {
*
* Callback to be registered to be called from file manager extension.
*/
typedef int (*poverlay_callback)(const char *path, void *rep);
typedef int (*poverlay_callback)(const char *path, void **rep);

/*! \brief The main overlay loop.
*
Expand Down

0 comments on commit 53eb6e5

Please sign in to comment.