renames.folder_renamed_to.clear();
status = CSYNC_STATUS_INIT;
- SAFE_FREE(error_string);
+ error_string.clear();
rc = 0;
return rc;
csync_s::~csync_s() {
SAFE_FREE(local.uri);
- SAFE_FREE(error_string);
}
void *csync_get_userdata(CSYNC *ctx) {
return ctx->status_code;
}
-const char *csync_get_status_string(CSYNC *ctx)
-{
- return csync_vio_get_status_string(ctx);
-}
-
void csync_request_abort(CSYNC *ctx)
{
if (ctx) {
*/
int OCSYNC_EXPORT csync_walk_remote_tree(CSYNC *ctx, const csync_treewalk_visit_func &visitor);
-/**
- * @brief Get the csync status string.
- *
- * @param ctx The csync context.
- *
- * @return A const pointer to a string with more precise status info.
- */
-const char OCSYNC_EXPORT *csync_get_status_string(CSYNC *ctx);
-
/**
* @brief Aborts the current sync run as soon as possible. Can be called from another thread.
*
/* csync error code */
enum CSYNC_STATUS status_code = CSYNC_STATUS_OK;
- char *error_string = nullptr;
+ /* Some additional string information which is added to the error message corresponding to the error code in errno.
+ * Usually a filename
+ */
+ QString error_string;
int status = CSYNC_STATUS_INIT;
volatile bool abort = false;
ctx->status_code = CSYNC_STATUS_ABORTED;
goto error;
}
- int asp = 0;
/* permission denied */
ctx->status_code = csync_errno_to_status(errno, CSYNC_STATUS_OPENDIR_ERROR);
if (errno == EACCES) {
return 0;
}
} else if(errno == ENOENT) {
- asp = asprintf( &ctx->error_string, "%s", uri);
- ASSERT(asp >= 0);
+ ctx->error_string = QString::fromUtf8(uri);
}
// 403 Forbidden can be sent by the server if the file firewall is active.
// A file or directory should be ignored and sync must continue. See #3490
/* Conversion error */
if (dirent->path.isEmpty() && !dirent->original_path.isEmpty()) {
ctx->status_code = CSYNC_STATUS_INVALID_CHARACTERS;
- ctx->error_string = c_strdup(dirent->original_path);
+ ctx->error_string = QString::fromUtf8(dirent->original_path);
dirent->original_path.clear();
goto error;
}
return nullptr;
}
-char *csync_vio_get_status_string(CSYNC *ctx) {
- if(ctx->error_string) {
- return ctx->error_string;
- }
- return nullptr;
-}
csync_vio_handle_t *csync_vio_opendir(CSYNC *ctx, const char *name);
int csync_vio_closedir(CSYNC *ctx, csync_vio_handle_t *dhandle);
std::unique_ptr<csync_file_stat_t> csync_vio_readdir(CSYNC *ctx, csync_vio_handle_t *dhandle);
-
-char *csync_vio_get_status_string(CSYNC *ctx);
-
-
#endif /* _CSYNC_VIO_H */
qCDebug(lcDiscovery) << directoryResult->code << "when opening" << url << "msg=" << directoryResult->msg;
errno = directoryResult->code;
// save the error string to the context
- discoveryJob->_csync_ctx->error_string = qstrdup(directoryResult->msg.toUtf8().constData());
+ discoveryJob->_csync_ctx->error_string = directoryResult->msg;
return nullptr;
}
void SyncEngine::handleSyncError(CSYNC *ctx, const char *state)
{
CSYNC_STATUS err = csync_get_status(ctx);
- const char *errMsg = csync_get_status_string(ctx);
+ QString errMsg = ctx->error_string;
QString errStr = csyncErrorToString(err);
- if (errMsg) {
+ if (!errMsg.isEmpty()) {
if (!errStr.endsWith(" ")) {
errStr.append(" ");
}
- errStr += QString::fromUtf8(errMsg);
+ errStr += errMsg;
}
// Special handling CSYNC_STATUS_INVALID_CHARACTERS
if (err == CSYNC_STATUS_INVALID_CHARACTERS) {