Skip to content

Commit

Permalink
fix -Wunused-variable warning/errors in output
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer authored and joto committed Sep 8, 2014
1 parent 5b70eb5 commit daece40
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions include/osmium/io/detail/opl_output_format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,13 @@ namespace osmium {

template <typename... TArgs>
void output_formatted(const char* format, TArgs&&... args) {
#ifndef NDEBUG
int len =
#endif
#ifndef _MSC_VER
int len = snprintf(m_tmp_buffer, tmp_buffer_size, format, std::forward<TArgs>(args)...);
snprintf(m_tmp_buffer, tmp_buffer_size, format, std::forward<TArgs>(args)...);
#else
int len = _snprintf(m_tmp_buffer, tmp_buffer_size, format, std::forward<TArgs>(args)...);
_snprintf(m_tmp_buffer, tmp_buffer_size, format, std::forward<TArgs>(args)...);
#endif
assert(len > 0 && static_cast<size_t>(len) < tmp_buffer_size);
m_out += m_tmp_buffer;
Expand Down
7 changes: 5 additions & 2 deletions include/osmium/io/detail/xml_output_format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,13 @@ namespace osmium {
void oprintf(std::string& out, const char* format, T value) {
char buffer[tmp_buffer_size+1];
size_t max_size = sizeof(buffer)/sizeof(char);
#ifndef NDEBUG
int len =
#endif
#ifndef _MSC_VER
int len = snprintf(buffer, max_size, format, value);
snprintf(buffer, max_size, format, value);
#else
int len = _snprintf(buffer, max_size, format, value);
_snprintf(buffer, max_size, format, value);
#endif
assert(len > 0 && static_cast<size_t>(len) < max_size);
out += buffer;
Expand Down

0 comments on commit daece40

Please sign in to comment.