Skip to content

Commit cb42631

Browse files
JosephP91JosephP91
authored and
JosephP91
committed
General warning removal to fix #124
1 parent 14b3ca1 commit cb42631

28 files changed

+126
-90
lines changed

include/cookie.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ namespace curl {
3737
*/
3838
class cookie {
3939
public:
40-
/*
40+
/**
4141
* Default constructor.
4242
*/
43-
cookie() {}
43+
cookie() = default;
4444
/**
45-
* The constructor allow a fast way to build a cookie.
45+
* The overloaded constructor allow a fast way to build a cookie.
4646
*/
4747
cookie(const std::string&, const std::string&, const cookie_datetime &,
4848
const std::string& = "", const std::string& = "", bool = false);

include/cookie_date.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ namespace curl {
4242
// Leave this alone :)
4343
namespace details {
4444
// Map months numbers with months short names (cookies likes it short XD)
45-
static const std::map<int,std::string> months_names = {
45+
static const std::map<int,std::string> monthsNames = {
4646
{JANUARY,"Jan"}, {FEBRUARY,"Feb"}, {MARCH,"Mar"}, {APRIL,"Apr"}, {MAY,"May"}, {JUNE,"Jun"},
4747
{JULY,"Jul"},{AUGUST,"Aug"},{SEPTEMBER,"Sep"},{OCTOBER,"Oct"},{NOVEMBER,"Nov"},{DECEMBER,"Dec"}
4848
};
4949
// Map week days numbers with days short names (cookies likes it, still, short XD)
50-
static const std::map<int,std::string> weekday_names = {
50+
static const std::map<int,std::string> weekdayNames = {
5151
{MONDAY,"Mon"}, {TUESDAY,"Tue"}, {WEDNESDAY,"Wed"}, {THURSDAY,"Thu"}, {FRIDAY,"Fri"}, {SATURDAY,"Sat"},
5252
{SUNDAY,"Sun"}
5353
};

include/cookie_datetime.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ namespace curl {
5454
/**
5555
* This method returns the time object.
5656
*/
57-
const cookie_time get_time() const NOEXCEPT;
57+
cookie_time get_time() const NOEXCEPT;
5858
/**
5959
* This method returns the date object.
6060
*/
61-
const cookie_date get_date() const NOEXCEPT;
61+
cookie_date get_date() const NOEXCEPT;
6262
/**
6363
* This method returns the cookie_datetime as a string.
6464
*/

include/cookie_time.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,19 @@ namespace curl {
6161
/**
6262
* This method returns the hours.
6363
*/
64-
const unsigned int get_hour() const NOEXCEPT;
64+
unsigned int get_hour() const NOEXCEPT;
6565
/**
6666
* This method returns the minutes.
6767
*/
68-
const unsigned int get_minutes() const NOEXCEPT;
68+
unsigned int get_minutes() const NOEXCEPT;
6969
/**
7070
* This method returns the seconds.
7171
*/
72-
const unsigned int get_seconds() const NOEXCEPT;
72+
unsigned int get_seconds() const NOEXCEPT;
7373
/**
7474
* This method returns the time formatted as h:m:s
7575
*/
76-
std::string get_formatted() NOEXCEPT;
76+
std::string get_formatted() const NOEXCEPT;
7777
private:
7878
/**
7979
* The hours.

include/curl_cookie.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ namespace curl {
5252
* If you pass an empty string or a string containing a non existing file's path,
5353
* the cookie engine will be initialized, but without reading initial cookies.
5454
*/
55-
void set_file(std::string);
55+
void set_file(const std::string&);
5656
/**
5757
* This method allow you to specify a string that represents a cookie. Such a cookie
5858
* can be either a single line in Netscape / Mozilla format or just regular HTTP-style
@@ -67,7 +67,7 @@ namespace curl {
6767
/**
6868
* This method allow you to get all known cookies for a specific domain.
6969
*/
70-
const curlcpp_cookies get() const NOEXCEPT;
70+
curlcpp_cookies get() const NOEXCEPT;
7171
/**
7272
* This method erases all cookies held in memory.
7373
*/

include/curl_easy.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,14 @@ namespace curl {
175175
CURLCPP_DEFINE_OPTION(CURLOPT_ERRORBUFFER, char*);
176176
/* Function that will be called to store the output (instead of fwrite). The
177177
* parameters will use fwrite() syntax, make sure to follow them. */
178-
CURLCPP_DEFINE_OPTION(CURLOPT_WRITEFUNCTION, size_t(*)(void *ptr, size_t size, size_t nmemb, void *userdata));
178+
CURLCPP_DEFINE_OPTION(CURLOPT_WRITEFUNCTION,
179+
size_t(*)(void *ptr, size_t size, size_t nmemb, void *userdata));
180+
179181
/* Function that will be called to read the input (instead of fread). The
180182
* parameters will use fread() syntax, make sure to follow them. */
181-
CURLCPP_DEFINE_OPTION(CURLOPT_READFUNCTION, size_t(*)(void *buffer, size_t size, size_t nitems, void *instream));
183+
CURLCPP_DEFINE_OPTION(CURLOPT_READFUNCTION,
184+
size_t(*)(void *buffer, size_t size, size_t nitems, void *instream));
185+
182186
/* Time-out the read operation after this amount of seconds */
183187
CURLCPP_DEFINE_OPTION(CURLOPT_TIMEOUT, long);
184188
/* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
@@ -383,7 +387,8 @@ namespace curl {
383387

384388
/* Function that will be called to store headers (instead of fwrite). The
385389
* parameters will use fwrite() syntax, make sure to follow them. */
386-
CURLCPP_DEFINE_OPTION(CURLOPT_HEADERFUNCTION, size_t(*)(void *buffer, size_t size, size_t nitems, void *userdata));
390+
CURLCPP_DEFINE_OPTION(CURLOPT_HEADERFUNCTION,
391+
size_t(*)(void *buffer, size_t size, size_t nitems, void *userdata));
387392

388393
/* Set this to force the HTTP request to get back to GET. Only really usable
389394
if POST, PUT or a custom request have been used first.
@@ -495,7 +500,8 @@ namespace curl {
495500
/* Set the ssl context callback function, currently only for OpenSSL ssl_ctx
496501
in second argument. The function must be matching the
497502
curl_ssl_ctx_callback proto. */
498-
CURLCPP_DEFINE_OPTION(CURLOPT_SSL_CTX_FUNCTION, CURLcode(*)(CURL *curl, void *ssl_ctx, void *userptr));
503+
CURLCPP_DEFINE_OPTION(CURLOPT_SSL_CTX_FUNCTION,
504+
CURLcode(*)(CURL *curl, void *ssl_ctx, void *userptr));
499505

500506
/* Set the userdata for the ssl context callback function's third
501507
argument */

include/curl_exception.h

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ namespace curl {
102102
// Implementation of print_traceback
103103
inline void curl_exception::print_traceback() const {
104104
curl_exception::tracebackLocker.lock();
105-
std::for_each(curl_exception::traceback.begin(),curl_exception::traceback.end(),[](const curlcpp_traceback_object &value) {
105+
std::for_each(curl_exception::traceback.begin(),curl_exception::traceback.end(),
106+
[](const curlcpp_traceback_object &value) {
107+
106108
std::cout<<"ERROR: "<<value.first<<" ::::: FUNCTION: "<<value.second<<std::endl;
107109
});
108110
curl_exception::tracebackLocker.unlock();
@@ -141,11 +143,14 @@ namespace curl {
141143
* This constructor allows to specify a custom error message and the method name where
142144
* the exception has been thrown.
143145
*/
144-
curl_easy_exception(const std::string &error, const std::string &method) : curl_exception(error,method), code(CURLE_OK) {}
146+
curl_easy_exception(const std::string &error, const std::string &method) :
147+
curl_exception(error,method), code(CURLE_OK) {}
148+
145149
/**
146150
* The constructor will transform a CURLcode error in a proper error message.
147151
*/
148-
curl_easy_exception(const CURLcode &code, const std::string &method) : curl_exception(curl_easy_strerror(code),method), code(code) {}
152+
curl_easy_exception(const CURLcode &code, const std::string &method) :
153+
curl_exception(curl_easy_strerror(code),method), code(code) {}
149154

150155
/**
151156
* Returns the error code if there is one. Returns CURLE_OK if none has been set.
@@ -167,11 +172,13 @@ namespace curl {
167172
* This constructor enables setting a custom error message and the method name where
168173
* the exception has been thrown.
169174
*/
170-
curl_multi_exception(const std::string &error, const std::string &method) : curl_exception(error,method), code(CURLM_OK) {}
175+
curl_multi_exception(const std::string &error, const std::string &method) :
176+
curl_exception(error,method), code(CURLM_OK) {}
171177
/**
172178
* The constructor will transform a CURLMcode error to a proper error message.
173179
*/
174-
curl_multi_exception(const CURLMcode code, const std::string &method) : curl_exception(curl_multi_strerror(code),method), code(code) {}
180+
curl_multi_exception(const CURLMcode code, const std::string &method) :
181+
curl_exception(curl_multi_strerror(code),method), code(code) {}
175182

176183
/**
177184
* Returns the error code if there is one. Returns CURLM_OK if none has been set.
@@ -193,11 +200,13 @@ namespace curl {
193200
* This constructor enables setting a custom error message and the method name where
194201
* the exception has been thrown.
195202
*/
196-
curl_share_exception(const std::string &error, const std::string &method) : curl_exception(error,method), code(CURLSHE_OK) {}
203+
curl_share_exception(const std::string &error, const std::string &method) :
204+
curl_exception(error,method), code(CURLSHE_OK) {}
197205
/**
198206
* The constructor will transform a CURLSHcode error in a proper error message.
199207
*/
200-
curl_share_exception(const CURLSHcode code, const std::string &method) : curl_exception(curl_share_strerror(code),method), code(code) {}
208+
curl_share_exception(const CURLSHcode code, const std::string &method) :
209+
curl_exception(curl_share_strerror(code),method), code(code) {}
201210

202211
/**
203212
* Returns the error code if there is one. Returns CURLE_OK if none has been set.

include/curl_form.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,28 +70,33 @@ namespace curl {
7070
/**
7171
* Overloaded add method.
7272
*/
73-
void add(const curl_pair<CURLformoption,std::string> &, const curl_pair<CURLformoption,std::string> &, const curl_pair<CURLformoption,std::string> &);
73+
void add(const curl_pair<CURLformoption,std::string> &,
74+
const curl_pair<CURLformoption,std::string> &, const curl_pair<CURLformoption,std::string> &);
7475
/**
7576
* Overloaded add method. It adds another curl_pair object to add more
7677
* contents to the form contents list.
7778
*/
78-
void add(const curl_pair<CURLformoption,std::string> &, const curl_pair<CURLformoption,std::string> &, const curl_pair<CURLformoption,int> &);
79+
void add(const curl_pair<CURLformoption,std::string> &,
80+
const curl_pair<CURLformoption,std::string> &, const curl_pair<CURLformoption,int> &);
7981
/**
8082
* Overloaded add method. It adds another curl_pair object to add more
8183
* contents to the form contents list.
8284
*/
83-
void add(const curl_pair<CURLformoption,std::string> &, const curl_pair<CURLformoption,int> &, const curl_pair<CURLformoption,std::string> &);
85+
void add(const curl_pair<CURLformoption,std::string> &,
86+
const curl_pair<CURLformoption,int> &, const curl_pair<CURLformoption,std::string> &);
8487
/**
8588
* Overloaded add method. It adds another curl_pair object to add more
8689
* contents to the form contents list.
8790
*/
88-
void add(const curl_pair<CURLformoption,std::string> &, const curl_pair<CURLformoption,std::string> &, const curl_pair<CURLformoption,int> &, const curl_pair<CURLformoption,std::string> &);
91+
void add(const curl_pair<CURLformoption,std::string> &,const curl_pair<CURLformoption,std::string> &,
92+
const curl_pair<CURLformoption,int> &, const curl_pair<CURLformoption,std::string> &);
8993
/**
9094
* Overloaded add method. Used primarily to pass data via CURLFORM_BUFFERPTR.
9195
* E.g. first option is content name, second is buffer name,
9296
* third is buffer data pointer, fourth is buffer length.
9397
*/
94-
void add(const curl_pair<CURLformoption,std::string> &, const curl_pair<CURLformoption,std::string> &, const curl_pair<CURLformoption, char*> &, const curl_pair<CURLformoption,long> &);
98+
void add(const curl_pair<CURLformoption,std::string> &, const curl_pair<CURLformoption,std::string> &,
99+
const curl_pair<CURLformoption, char*> &, const curl_pair<CURLformoption,long> &);
95100
/**
96101
* Overloaded add method. This version is primarily used to upload multiple files.
97102
* You can pass a vector of filenames to upload them.

include/curl_option.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#define __curlcpp__curl_option__
2828

2929
#include <string>
30+
#include <curl/curl.h>
3031
#include "curl_pair.h"
3132

3233
namespace curl {

include/curl_pair.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ namespace curl {
110110
* The two parameters constructor gives users a fast way to
111111
* build an object of this type.
112112
*/
113-
curl_pair(const T option, const std::string &value) : option(option == CURLOPT_POSTFIELDS ? CURLOPT_COPYPOSTFIELDS : option), value(value) {};
113+
curl_pair(const T option, const std::string &value) :
114+
option(option == CURLOPT_POSTFIELDS ? CURLOPT_COPYPOSTFIELDS : option), value(value) {};
114115
/**
115116
* Simple method that returns the first field of the pair.
116117
*/

include/curl_receiver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace curl {
4545
/**
4646
* In this case the destructor does not have to release any resource.
4747
*/
48-
~curl_receiver() {}
48+
~curl_receiver() = default;
4949
/**
5050
* The receive method wraps curl_easy_recv function and receives raw
5151
* data from the established connection on an easy handler.

include/curl_sender.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ namespace curl {
3939
* The constructor initializes the easy handler and the number of
4040
* sent bytes.
4141
*/
42-
curl_sender(curl_easy &easy);
42+
explicit curl_sender(curl_easy &easy);
4343
/**
4444
* This method wraps the curl_easy_send function that sends raw data
4545
* on an established connection on an easy handler.
4646
*/
47-
void send(const T, const size_t);
47+
void send(T, size_t);
4848
/**
4949
* Simple getter method that returns sent's current byte number.
5050
*/
@@ -83,13 +83,13 @@ namespace curl {
8383
* The constructor initializes the easy handler and the number of
8484
* sent bytes.
8585
*/
86-
curl_sender(curl_easy &easy) : _easy(easy), _sent_bytes(0) {}
86+
explicit curl_sender(curl_easy &easy) : _easy(easy), _sent_bytes(0) {}
8787
/**
8888
* This method wraps the curl_easy_send function that sends raw data
8989
* on an established connection on an easy handler, treating strings
9090
* as const char pointers.
9191
*/
92-
void send(const std::string buffer) {
92+
void send(const std::string& buffer) {
9393
const CURLcode code = curl_easy_send(_easy.get_curl(),buffer.c_str(),buffer.length(),&_sent_bytes);
9494
if (code != CURLE_OK) {
9595
throw curl_easy_exception(code,__FUNCTION__);

include/curl_utility.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ namespace curl {
4343
* online documentation for more information about the datetime
4444
* parameter.
4545
*/
46-
static time_t get_date(const std::string);
46+
static time_t get_date(const std::string&);
4747
private:
4848
/**
4949
* Build an object of this type have no sense. So let's hide
5050
* the constructor.
5151
*/
52-
curl_utility() {};
52+
curl_utility() = default;
5353
};
5454

5555
// Implementation of get_date method.
56-
time_t curl_utility::get_date(const std::string format) {
56+
time_t curl_utility::get_date(const std::string& format) {
5757
const time_t value = curl_getdate(format.c_str(),nullptr);
5858
if (value == -1) {
5959
throw curl_exception("*** Error while parsing the date ***",__FUNCTION__);

src/cookie_date.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,41 @@ using std::out_of_range;
99
using std::ostringstream;
1010

1111
// Implementation of constructor with parameters.
12-
curl::cookie_date::cookie_date(const unsigned int week_day, const unsigned int day, const unsigned int month, const unsigned int year) NOEXCEPT {
12+
curl::cookie_date::cookie_date(const unsigned int week_day, const unsigned int day,
13+
const unsigned int month, const unsigned int year) NOEXCEPT {
14+
1315
this->set_week_day(week_day)->set_day(day)->set_month(month)->set_year(year);
1416
}
1517

1618
// Implementation of set_week_day method.
17-
curl::cookie_date *curl::cookie_date::set_week_day(const unsigned int week_day) NOEXCEPT {
19+
curl::cookie_date *curl::cookie_date::set_week_day(const unsigned int weekDay) NOEXCEPT {
1820
try {
19-
this->week_day = details::weekday_names.at(week_day);
21+
this->week_day = details::weekdayNames.at(weekDay);
2022
} catch (const out_of_range &exception) {
2123
this->week_day = "Mon";
2224
}
2325
return this;
2426
}
2527

2628
// Implementation of set_day method.
27-
curl::cookie_date *curl::cookie_date::set_day(const unsigned int day) NOEXCEPT {
28-
this->day = (day < 1 or day > 31) ? 1 : day;
29+
curl::cookie_date *curl::cookie_date::set_day(const unsigned int cookieDay) NOEXCEPT {
30+
this->day = (cookieDay < 1 or cookieDay > 31) ? 1 : cookieDay;
2931
return this;
3032
}
3133

3234
// Implementation of set_month method.
33-
curl::cookie_date *curl::cookie_date::set_month(const unsigned int month) {
35+
curl::cookie_date *curl::cookie_date::set_month(const unsigned int cookieMonth) {
3436
try {
35-
this->month = details::months_names.at(month);
37+
this->month = details::monthsNames.at(cookieMonth);
3638
} catch (const out_of_range &exception) {
3739
this->month = "Jan";
3840
}
3941
return this;
4042
}
4143

4244
// Implementation of set_year method.
43-
curl::cookie_date *curl::cookie_date::set_year(const unsigned int year) NOEXCEPT {
44-
this->year = (year < 1970 ) ? 1970 : year;
45+
curl::cookie_date *curl::cookie_date::set_year(const unsigned int cookieYear) NOEXCEPT {
46+
this->year = (cookieYear < 1970 ) ? 1970 : cookieYear;
4547
return this;
4648
}
4749

src/cookie_datetime.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@ curl::cookie_datetime::cookie_datetime(const cookie_time &time, const cookie_dat
1111
}
1212

1313
// Implementation of set_time method.
14-
curl::cookie_datetime *curl::cookie_datetime::set_time(const cookie_time &time) NOEXCEPT {
15-
this->time = time;
14+
curl::cookie_datetime *curl::cookie_datetime::set_time(const cookie_time &cookieTime) NOEXCEPT {
15+
this->time = cookieTime;
1616
return this;
1717
}
1818

1919
// Implementation of set_date method.
20-
curl::cookie_datetime *curl::cookie_datetime::set_date(const cookie_date &date) NOEXCEPT {
21-
this->date = date;
20+
curl::cookie_datetime *curl::cookie_datetime::set_date(const cookie_date &cookieDate) NOEXCEPT {
21+
this->date = cookieDate;
2222
return this;
2323
}
2424

2525
// Implementation of get_time method.
26-
const curl::cookie_time curl::cookie_datetime::get_time() const NOEXCEPT {
26+
curl::cookie_time curl::cookie_datetime::get_time() const NOEXCEPT {
2727
return this->time;
2828
}
2929

3030
// Implementation of get_date method.
31-
const curl::cookie_date curl::cookie_datetime::get_date() const NOEXCEPT {
31+
curl::cookie_date curl::cookie_datetime::get_date() const NOEXCEPT {
3232
return this->date;
3333
}
3434

0 commit comments

Comments
 (0)