Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions include/curl_multi.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#include "curl_easy.h"

#define CURLCPP_DEFINE_OPTION(opt, value_type)\
#define CURLCPP_DEFINE_MOPTION(opt, value_type)\
template <> struct moption_t<opt> {\
using type = value_type;\
}
Expand All @@ -51,15 +51,15 @@ namespace curl {
* larger than CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, that pipeline will
* not be considered for additional requests.
*/
CURLCPP_DEFINE_OPTION(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, long);
CURLCPP_DEFINE_MOPTION(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, long);

/*
* If a pipelined connection is currently processing a request with a
* Content-Length larger than this
* CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, that pipeline will then not be
* considered for additional requests.
*/
CURLCPP_DEFINE_OPTION(CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, long);
CURLCPP_DEFINE_MOPTION(CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, long);

/*
* The set number will be used as the maximum amount of simultaneously
Expand All @@ -68,7 +68,7 @@ namespace curl {
* added easy handle to make it fit 4 times the number of added easy
* handles.
*/
CURLCPP_DEFINE_OPTION(CURLMOPT_MAXCONNECTS, long);
CURLCPP_DEFINE_MOPTION(CURLMOPT_MAXCONNECTS, long);

/*
* The set number will be used as the maximum amount of simultaneously
Expand All @@ -77,21 +77,21 @@ namespace curl {
* will open a new connection up to the limit set by
* CURLMOPT_MAX_HOST_CONNECTIONS.
*/
CURLCPP_DEFINE_OPTION(CURLMOPT_MAX_HOST_CONNECTIONS, long);
CURLCPP_DEFINE_MOPTION(CURLMOPT_MAX_HOST_CONNECTIONS, long);

/*
* The set max number will be used as the maximum amount of outstanding
* requests in a pipelined connection. Only used if pipelining is
* enabled.
*/
CURLCPP_DEFINE_OPTION(CURLMOPT_MAX_PIPELINE_LENGTH, long);
CURLCPP_DEFINE_MOPTION(CURLMOPT_MAX_PIPELINE_LENGTH, long);

/*
* Pass a long for the amount. The set number will be used as the
* maximum number of simultaneously open connections in total using
* this multi handle.
*/
CURLCPP_DEFINE_OPTION(CURLMOPT_MAX_TOTAL_CONNECTIONS, long);
CURLCPP_DEFINE_MOPTION(CURLMOPT_MAX_TOTAL_CONNECTIONS, long);

/*
* Set the bits parameter to 1 to make libcurl use HTTP pipelining for
Expand All @@ -100,7 +100,7 @@ namespace curl {
* existing connection, the second request will be "piped" on the same
* connection rather than being executed in parallel.
*/
CURLCPP_DEFINE_OPTION(CURLMOPT_PIPELINING, long);
CURLCPP_DEFINE_MOPTION(CURLMOPT_PIPELINING, long);

/*
* Pass a servers array of char *, ending with a NULL entry. This is a
Expand All @@ -115,7 +115,7 @@ namespace curl {
*
* Pass a NULL pointer to clear the blacklist.
*/
CURLCPP_DEFINE_OPTION(CURLMOPT_PIPELINING_SERVER_BL, char**);
CURLCPP_DEFINE_MOPTION(CURLMOPT_PIPELINING_SERVER_BL, char**);

/*
* Pass a hosts array of char *, ending with a NULL entry. This is a
Expand All @@ -125,32 +125,32 @@ namespace curl {
*
* Pass a NULL pointer to clear the blacklist.
*/
CURLCPP_DEFINE_OPTION(CURLMOPT_PIPELINING_SITE_BL, char**);
CURLCPP_DEFINE_MOPTION(CURLMOPT_PIPELINING_SITE_BL, char**);

/*
* A data pointer to pass to the socket callback set with the
* CURLMOPT_SOCKETFUNCTION option.
*/
CURLCPP_DEFINE_OPTION(CURLMOPT_SOCKETDATA, void*);
CURLCPP_DEFINE_MOPTION(CURLMOPT_SOCKETDATA, void*);

/*
* The callback gets status updates with changes since the previous
* time the callback was called. See curl_multi_socket_action for more
* details on how the callback is used and should work.
*/
CURLCPP_DEFINE_OPTION(CURLMOPT_SOCKETFUNCTION, int(*)(CURL* easy, curl_socket_t socket, int action, void* userp, void* socketp));
CURLCPP_DEFINE_MOPTION(CURLMOPT_SOCKETFUNCTION, int(*)(CURL* easy, curl_socket_t socket, int action, void* userp, void* socketp));

/*
* A data pointer to pass to the timer callback set with the
* CURLMOPT_TIMERFUNCTION option.
*/
CURLCPP_DEFINE_OPTION(CURLMOPT_TIMERDATA, void*);
CURLCPP_DEFINE_MOPTION(CURLMOPT_TIMERDATA, void*);

/*
* Your callback function timer_callback should install a non-repeating
* timer with an interval of timeout_ms.
*/
CURLCPP_DEFINE_OPTION(CURLMOPT_TIMERFUNCTION, int(*)(CURLM* multi, long timeout_ms, void* userp));
CURLCPP_DEFINE_MOPTION(CURLMOPT_TIMERFUNCTION, int(*)(CURLM* multi, long timeout_ms, void* userp));
}

/**
Expand Down Expand Up @@ -382,5 +382,5 @@ namespace curl {
}
}

#undef CURLCPP_DEFINE_OPTION
#undef CURLCPP_DEFINE_MOPTION
#endif /* defined(__curlcpp__curl_multi__) */
12 changes: 6 additions & 6 deletions include/curl_share.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "curl_interface.h"
#include "curl_pair.h"

#define CURLCPP_DEFINE_OPTION(opt, value_type)\
#define CURLCPP_DEFINE_SOPTION(opt, value_type)\
template <> struct shoption_t<opt> {\
using type = value_type;\
}
Expand All @@ -49,7 +49,7 @@ namespace curl {
* at any time for each kind of data. access defines what access type libcurl wants, shared or single.
* userptr is the pointer you set with CURLSHOPT_USERDATA.
*/
CURLCPP_DEFINE_OPTION(CURLSHOPT_LOCKFUNC,
CURLCPP_DEFINE_SOPTION(CURLSHOPT_LOCKFUNC,
void(*)(CURL *handle, curl_lock_data data, curl_lock_access access, void *userptr));
/*
* The parameter must be a pointer to a function matching the following prototype:
Expand All @@ -58,7 +58,7 @@ namespace curl {
* at any time for each kind of data.
* userptr is the pointer you set with CURLSHOPT_USERDATA.
*/
CURLCPP_DEFINE_OPTION(CURLSHOPT_UNLOCKFUNC, void(*)(CURL *handle, curl_lock_data data, void *userptr));
CURLCPP_DEFINE_SOPTION(CURLSHOPT_UNLOCKFUNC, void(*)(CURL *handle, curl_lock_data data, void *userptr));

/*
* The parameter specifies a type of data that should be shared. This may be set to one of the values described below.
Expand All @@ -71,19 +71,19 @@ namespace curl {
* Note SSL session IDs are reused within the same easy handle by default. Note this symbol was added
* in 7.10.3 but was not implemented until 7.23.0.
*/
CURLCPP_DEFINE_OPTION(CURLSHOPT_SHARE, int);
CURLCPP_DEFINE_SOPTION(CURLSHOPT_SHARE, int);

/*
* This option does the opposite of CURLSHOPT_SHARE. It specifies that the specified parameter will no longer
* be shared. Valid values are the same as those for CURLSHOPT_SHARE.
*/
CURLCPP_DEFINE_OPTION(CURLSHOPT_UNSHARE, int);
CURLCPP_DEFINE_SOPTION(CURLSHOPT_UNSHARE, int);

/*
* The parameter allows you to specify a pointer to data that will be passed to the lock_function and
* unlock_function each time it is called.
*/
CURLCPP_DEFINE_OPTION(CURLSHOPT_USERDATA, void *);
CURLCPP_DEFINE_SOPTION(CURLSHOPT_USERDATA, void *);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ target_compile_features(curlcpp PUBLIC cxx_std_11)
target_compile_options(curlcpp PRIVATE
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wpedantic>
$<$<CXX_COMPILER_ID:Clang>:-Wall -Wpedantic>
$<$<CXX_COMPILER_ID:MSVC>:/W4 /wd4244 /wd4305 /wd4996 /wd4267 /wd4018>
$<$<CXX_COMPILER_ID:MSVC>:/W4 /wd4244 /wd4305 /wd4996 /wd4267 /wd4018 /wd4706>
)

if(CURLCPP_USE_PKGCONFIG)
Expand Down
4 changes: 2 additions & 2 deletions src/cookie_date.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ curl::cookie_date::cookie_date(const unsigned int week_day, const unsigned int d
curl::cookie_date *curl::cookie_date::set_week_day(const unsigned int weekDay) NOEXCEPT {
try {
this->week_day = details::weekdayNames.at(weekDay);
} catch (const out_of_range &exception) {
} catch (const out_of_range &) {
this->week_day = "Mon";
}
return this;
Expand All @@ -35,7 +35,7 @@ curl::cookie_date *curl::cookie_date::set_day(const unsigned int cookieDay) NOEX
curl::cookie_date *curl::cookie_date::set_month(const unsigned int cookieMonth) {
try {
this->month = details::monthsNames.at(cookieMonth);
} catch (const out_of_range &exception) {
} catch (const out_of_range &) {
this->month = "Jan";
}
return this;
Expand Down