@@ -159,8 +159,8 @@ webserver::webserver(const create_webserver& params):
159159 method_not_allowed_resource (params._method_not_allowed_resource),
160160 internal_error_resource (params._internal_error_resource) {
161161 ignore_sigpipe ();
162- pthread_mutex_init (&mutexwait, NULL );
163- pthread_cond_init (&mutexcond, NULL );
162+ pthread_mutex_init (&mutexwait, nullptr );
163+ pthread_cond_init (&mutexcond, nullptr );
164164}
165165
166166webserver::~webserver () {
@@ -180,10 +180,10 @@ void webserver::request_completed(void *cls, struct MHD_Connection *connection,
180180 std::ignore = toe;
181181
182182 details::modded_request* mr = static_cast <details::modded_request*>(*con_cls);
183- if (mr == 0x0 ) return ;
183+ if (mr == nullptr ) return ;
184184
185185 delete mr;
186- mr = 0x0 ;
186+ mr = nullptr ;
187187}
188188
189189bool webserver::register_resource (const std::string& resource, http_resource* hrm, bool family) {
@@ -204,14 +204,14 @@ bool webserver::register_resource(const std::string& resource, http_resource* hr
204204
205205bool webserver::start (bool blocking) {
206206 struct {
207- MHD_OptionItem operator ()(enum MHD_OPTION opt, intptr_t val, void *ptr = 0 ) {
207+ MHD_OptionItem operator ()(enum MHD_OPTION opt, intptr_t val, void *ptr = nullptr ) {
208208 MHD_OptionItem x = {opt, val, ptr};
209209 return x;
210210 }
211211 } gen;
212212 vector<struct MHD_OptionItem > iov;
213213
214- iov.push_back (gen (MHD_OPTION_NOTIFY_COMPLETED, (intptr_t ) &request_completed, NULL ));
214+ iov.push_back (gen (MHD_OPTION_NOTIFY_COMPLETED, (intptr_t ) &request_completed, nullptr ));
215215 iov.push_back (gen (MHD_OPTION_URI_LOG_CALLBACK, (intptr_t ) &uri_log, this ));
216216 iov.push_back (gen (MHD_OPTION_EXTERNAL_LOGGER, (intptr_t ) &error_log, this ));
217217 iov.push_back (gen (MHD_OPTION_UNESCAPE_CALLBACK, (intptr_t ) &unescaper_func, this ));
@@ -279,7 +279,7 @@ bool webserver::start(bool blocking) {
279279 }
280280#endif // HAVE_GNUTLS
281281
282- iov.push_back (gen (MHD_OPTION_END, 0 , NULL ));
282+ iov.push_back (gen (MHD_OPTION_END, 0 , nullptr ));
283283
284284 int start_conf = start_method;
285285
@@ -310,8 +310,8 @@ bool webserver::start(bool blocking) {
310310 start_conf |= MHD_USE_TCP_FASTOPEN;
311311#endif
312312
313- daemon = NULL ;
314- if (bind_address == 0x0 ) {
313+ daemon = nullptr ;
314+ if (bind_address == nullptr ) {
315315 daemon = MHD_start_daemon (start_conf, port, &policy_callback, this ,
316316 &answer_to_connection, this , MHD_OPTION_ARRAY,
317317 &iov[0 ], MHD_OPTION_END);
@@ -321,7 +321,7 @@ bool webserver::start(bool blocking) {
321321 &iov[0 ], MHD_OPTION_SOCK_ADDR, bind_address, MHD_OPTION_END);
322322 }
323323
324- if (daemon == NULL ) {
324+ if (daemon == nullptr ) {
325325 throw std::invalid_argument (" Unable to connect daemon to port: " + std::to_string (port));
326326 }
327327
@@ -430,11 +430,11 @@ void error_log(void* cls, const char* fmt, va_list ap) {
430430 std::ignore = ap;
431431
432432 webserver* dws = static_cast <webserver*>(cls);
433- if (dws->log_error != 0x0 ) dws->log_error (fmt);
433+ if (dws->log_error != nullptr ) dws->log_error (fmt);
434434}
435435
436436void access_log (webserver* dws, string uri) {
437- if (dws->log_access != 0x0 ) dws->log_access (uri);
437+ if (dws->log_access != nullptr ) dws->log_access (uri);
438438}
439439
440440size_t unescaper_func (void * cls, struct MHD_Connection *c, char *s) {
@@ -472,23 +472,23 @@ void webserver::upgrade_handler(void *cls, struct MHD_Connection* connection, vo
472472}
473473
474474const std::shared_ptr<http_response> webserver::not_found_page (details::modded_request* mr) const {
475- if (not_found_resource != 0x0 ) {
475+ if (not_found_resource != nullptr ) {
476476 return not_found_resource (*mr->dhr );
477477 } else {
478478 return std::shared_ptr<http_response>(new string_response (NOT_FOUND_ERROR, http_utils::http_not_found));
479479 }
480480}
481481
482482const std::shared_ptr<http_response> webserver::method_not_allowed_page (details::modded_request* mr) const {
483- if (method_not_allowed_resource != 0x0 ) {
483+ if (method_not_allowed_resource != nullptr ) {
484484 return method_not_allowed_resource (*mr->dhr );
485485 } else {
486486 return std::shared_ptr<http_response>(new string_response (METHOD_ERROR, http_utils::http_method_not_allowed));
487487 }
488488}
489489
490490const std::shared_ptr<http_response> webserver::internal_error_page (details::modded_request* mr, bool force_our) const {
491- if (internal_error_resource != 0x0 && !force_our) {
491+ if (internal_error_resource != nullptr && !force_our) {
492492 return internal_error_resource (*mr->dhr );
493493 } else {
494494 return std::shared_ptr<http_response>(new string_response (GENERIC_ERROR, http_utils::http_internal_server_error, " text/plain" ));
@@ -507,13 +507,13 @@ MHD_Result webserver::requests_answer_first_step(MHD_Connection* connection, str
507507 const char *encoding = MHD_lookup_connection_value (connection, MHD_HEADER_KIND, http_utils::http_header_content_type);
508508
509509 if (post_process_enabled &&
510- (0x0 != encoding &&
510+ (nullptr != encoding &&
511511 ((0 == strncasecmp (http_utils::http_post_encoding_form_urlencoded, encoding, strlen (http_utils::http_post_encoding_form_urlencoded))) ||
512512 (0 == strncasecmp (http_utils::http_post_encoding_multipart_formdata, encoding, strlen (http_utils::http_post_encoding_multipart_formdata)))))) {
513513 const size_t post_memory_limit (32 * 1024 ); // Same as #MHD_POOL_SIZE_DEFAULT
514514 mr->pp = MHD_create_post_processor (connection, post_memory_limit, &post_iterator, mr);
515515 } else {
516- mr->pp = NULL ;
516+ mr->pp = nullptr ;
517517 }
518518 return MHD_YES;
519519}
@@ -529,7 +529,7 @@ MHD_Result webserver::requests_answer_second_step(MHD_Connection* connection, co
529529#endif // DEBUG
530530 mr->dhr ->grow_content (upload_data, *upload_data_size);
531531
532- if (mr->pp != NULL ) MHD_post_process (mr->pp , upload_data, *upload_data_size);
532+ if (mr->pp != nullptr ) MHD_post_process (mr->pp , upload_data, *upload_data_size);
533533 }
534534
535535 *upload_data_size = 0 ;
0 commit comments