From e45509ad5c9f0aca5570089d38ff9407d6e9652e Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Fri, 3 Mar 2023 20:14:31 +0100 Subject: [PATCH] Clean up ZSyncFileMaker API a bit --- include/zsmake.h | 4 ++-- src/zsmake.cpp | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/zsmake.h b/include/zsmake.h index 4f124b6..4358b8e 100644 --- a/include/zsmake.h +++ b/include/zsmake.h @@ -34,7 +34,7 @@ namespace zsync2 { void setUrl(const std::string& url); // will be called for every log message issued by the code - bool setLogMessageCallback(std::function callback); + void setLogMessageCallback(std::function callback); // add custom header field // returns true when there is no header with such a key yet, otherwise overwrites the existing value and @@ -42,7 +42,7 @@ namespace zsync2 { // getHeaderFields() can be used to check whether a header with a given key exists already // beware that this function does not check whether any essential headers are set, these will be silently // overwritten within dump() - bool addCustomHeaderField(const std::string& key, const std::string& value); + void addCustomHeaderField(const std::string& key, const std::string& value); // returns all custom headers set by the user std::map getCustomHeaderFields(); diff --git a/src/zsmake.cpp b/src/zsmake.cpp index 8828650..aa3c056 100644 --- a/src/zsmake.cpp +++ b/src/zsmake.cpp @@ -295,8 +295,7 @@ namespace zsync2 { return true; } - bool addCustomHeaderField(const std::string& key, const std::string& value) { - auto rv = (customHeaderFields.find(key) != customHeaderFields.end()); + void addCustomHeaderField(const std::string& key, const std::string& value) { customHeaderFields[key] = value; } }; @@ -346,11 +345,11 @@ namespace zsync2 { d->url = url; } - bool ZSyncFileMaker::setLogMessageCallback(std::function callback) { + void ZSyncFileMaker::setLogMessageCallback(std::function callback) { d->logMessage = std::move(callback); } - bool ZSyncFileMaker::addCustomHeaderField(const std::string& key, const std::string& value) { + void ZSyncFileMaker::addCustomHeaderField(const std::string& key, const std::string& value) { return d->addCustomHeaderField(key, value); }