Skip to content

Commit

Permalink
Clean up ZSyncFileMaker API a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAssassin committed Mar 3, 2023
1 parent dc43891 commit e45509a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/zsmake.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ namespace zsync2 {
void setUrl(const std::string& url);

// will be called for every log message issued by the code
bool setLogMessageCallback(std::function<void(std::string)> callback);
void setLogMessageCallback(std::function<void(std::string)> callback);

// add custom header field
// returns true when there is no header with such a key yet, otherwise overwrites the existing value and
// returns false
// 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<std::string, std::string> getCustomHeaderFields();
Expand Down
7 changes: 3 additions & 4 deletions src/zsmake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};
Expand Down Expand Up @@ -346,11 +345,11 @@ namespace zsync2 {
d->url = url;
}

bool ZSyncFileMaker::setLogMessageCallback(std::function<void(std::string)> callback) {
void ZSyncFileMaker::setLogMessageCallback(std::function<void(std::string)> 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);
}

Expand Down

0 comments on commit e45509a

Please sign in to comment.