Skip to content

Commit

Permalink
Fix clang warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mmd-osm committed Jul 2, 2022
1 parent f51f70e commit d493ca2
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 74 deletions.
3 changes: 1 addition & 2 deletions include/cgimap/choose_formatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ mime::type choose_best_mime_type(request &req, responder& hptr);
* passed in as an argument.
*/
std::unique_ptr<output_formatter>
create_formatter(request &req, mime::type best_type,
output_buffer&);
create_formatter(mime::type best_type, output_buffer&);

#endif /* CHOOSE_FORMATTER_HPP */
6 changes: 3 additions & 3 deletions include/cgimap/fcgi_request.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ struct fcgi_request : public request {
void dispose() override;

protected:
void write_header_info(int status, const request::headers_t &headers);
std::shared_ptr<output_buffer> get_buffer_internal();
void finish_internal();
void write_header_info(int status, const request::headers_t &headers) override;
std::shared_ptr<output_buffer> get_buffer_internal() override;
void finish_internal() override;

private:
struct pimpl;
Expand Down
1 change: 0 additions & 1 deletion include/cgimap/json_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class json_writer : public output_writer {
json_writer(const json_writer &) = delete;
json_writer& operator=(const json_writer &) = delete;
json_writer(json_writer &&) = default;
json_writer& operator=(json_writer &&) = default;

// create a json writer using a callback object for output
json_writer(output_buffer &out, bool indent = false);
Expand Down
1 change: 0 additions & 1 deletion include/cgimap/text_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class text_writer : public output_writer {
text_writer(const text_writer &) = delete;
text_writer& operator=(const text_writer &) = delete;
text_writer(text_writer &&) = default;
text_writer& operator=(text_writer &&) = default;

// create a new text writer using writer callback functions
text_writer(output_buffer &out, bool indent = false);
Expand Down
23 changes: 12 additions & 11 deletions src/choose_formatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,26 +258,27 @@ mime::type choose_best_mime_type(request &req, responder& hptr) {
return best_type;
}

std::unique_ptr<output_formatter> create_formatter(request &req,
mime::type best_type,
output_buffer& out) {
std::unique_ptr<output_formatter> create_formatter(mime::type best_type, output_buffer& out) {


if (best_type == mime::application_xml) {
return std::unique_ptr<output_formatter>(new xml_formatter(std::unique_ptr<xml_writer>(new xml_writer(out, true))));
switch (best_type) {
case mime::application_xml:
return std::unique_ptr<output_formatter>(new xml_formatter(std::unique_ptr<xml_writer>(new xml_writer(out, true))));

#ifdef HAVE_YAJL
} else if (best_type == mime::application_json) {
case mime::application_json:
return std::unique_ptr<output_formatter>(new json_formatter(std::unique_ptr<json_writer>(new json_writer(out, false))));
#endif
} else if (best_type == mime::text_plain) {
case mime::text_plain:
return std::unique_ptr<output_formatter>(new text_formatter(std::unique_ptr<text_writer>(new text_writer(out, true))));

default:
ostringstream ostr;
ostr << "Could not create formatter for MIME type `"
<< mime::to_string(best_type) << "'.";
throw runtime_error(ostr.str());
}

ostringstream ostr;
ostr << "Could not create formatter for MIME type `"
<< mime::to_string(best_type) << "'.";
throw runtime_error(ostr.str());
}


43 changes: 0 additions & 43 deletions src/data_selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,6 @@

data_selection::~data_selection() = default;

/*
int data_selection::select_historical_nodes(const std::vector<osm_edition_t> &) {
return 0;
}
int data_selection::select_nodes_with_history(const std::vector<osm_nwr_id_t> &) {
return 0;
}
int data_selection::select_historical_ways(const std::vector<osm_edition_t> &) {
return 0;
}
int data_selection::select_ways_with_history(const std::vector<osm_nwr_id_t> &) {
return 0;
}
int data_selection::select_historical_relations(const std::vector<osm_edition_t> &) {
return 0;
}
int data_selection::select_relations_with_history(const std::vector<osm_nwr_id_t> &) {
return 0;
}
void data_selection::set_redactions_visible(bool) {}
int data_selection::select_historical_by_changesets(const std::vector<osm_changeset_id_t> &) {
return 0;
}
void data_selection::write_changesets(output_formatter &, const std::chrono::system_clock::time_point &) {
}
int data_selection::select_changesets(const std::vector<osm_changeset_id_t> &) {
return 0;
}
void data_selection::select_changeset_discussions() {
}
*/

data_selection::factory::~factory() = default;


Expand Down
4 changes: 2 additions & 2 deletions src/process_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ process_get_request(request &req, handler_ptr_t handler,
std::shared_ptr<output_buffer> out = encoding->buffer(req.get_buffer());

// create the correct mime type output formatter.
auto o_formatter = create_formatter(req, best_mime_type, *out);
auto o_formatter = create_formatter(best_mime_type, *out);

try {
// call to write the response
Expand Down Expand Up @@ -301,7 +301,7 @@ process_post_put_request(request &req, handler_ptr_t handler,
std::shared_ptr<output_buffer> out = encoding->buffer(req.get_buffer());

// create the correct mime type output formatter.
auto o_formatter = create_formatter(req, best_mime_type, *out);
auto o_formatter = create_formatter(best_mime_type, *out);

try {
// // call to write the response
Expand Down
4 changes: 2 additions & 2 deletions src/rate_limiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ rate_limiter::~rate_limiter() = default;

null_rate_limiter::~null_rate_limiter() = default;

bool null_rate_limiter::check(const std::string &key) {
bool null_rate_limiter::check(const std::string &) {
return true;
}

void null_rate_limiter::update(const std::string &key, int bytes) {
void null_rate_limiter::update(const std::string &, int) {
}

struct memcached_rate_limiter::state {
Expand Down
6 changes: 3 additions & 3 deletions test/test_apidb_backend_oauth2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ class empty_data_selection

virtual ~empty_data_selection() = default;

void write_nodes(output_formatter &formatter) {}
void write_ways(output_formatter &formatter) {}
void write_relations(output_formatter &formatter) {}
void write_nodes(output_formatter &formatter) override {}
void write_ways(output_formatter &formatter) override {}
void write_relations(output_formatter &formatter) override {}
void write_changesets(output_formatter &formatter,
const std::chrono::system_clock::time_point &now) override {}

Expand Down
10 changes: 5 additions & 5 deletions test/test_oauth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ struct test_request : public request {
const char *get_param(const char *key) const override;
const std::string get_payload() override;

void dispose();
void dispose() override;

std::chrono::system_clock::time_point get_current_time() const;
std::chrono::system_clock::time_point get_current_time() const override;

protected:
void write_header_info(int status, const headers_t &headers);
void write_header_info(int status, const headers_t &headers) override;

std::shared_ptr<output_buffer> get_buffer_internal();
void finish_internal();
std::shared_ptr<output_buffer> get_buffer_internal() override;
void finish_internal() override;

private:
std::string method, scheme, authority, port, path, get_params;
Expand Down
2 changes: 1 addition & 1 deletion test/test_request.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct test_request : public request {
std::stringstream &body();
std::stringstream &header();

std::chrono::system_clock::time_point get_current_time() const;
std::chrono::system_clock::time_point get_current_time() const override;
void set_current_time(const std::chrono::system_clock::time_point &now);

int response_status() const;
Expand Down

0 comments on commit d493ca2

Please # to comment.