From 53eb6e567ae83a015921522f429af5772eb0e23d Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 25 Jul 2021 09:32:03 +0300 Subject: [PATCH] Fix callbacks signature --- src/pclcli.cpp | 8 ++++---- src/psync/poverlay.c | 5 +++-- src/psync/poverlay.h | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/pclcli.cpp b/src/pclcli.cpp index 34c19dee..0c708494 100644 --- a/src/pclcli.cpp +++ b/src/pclcli.cpp @@ -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; } diff --git a/src/psync/poverlay.c b/src/psync/poverlay.c index b0f753cc..0126c22e 100644 --- a/src/psync/poverlay.c +++ b/src/psync/poverlay.c @@ -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); diff --git a/src/psync/poverlay.h b/src/psync/poverlay.h index bdb8d5ca..740d1dc2 100644 --- a/src/psync/poverlay.h +++ b/src/psync/poverlay.h @@ -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. *