Fix compiler warnings (-Wdouble-promotion)

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
This commit is contained in:
Ferry Huberts 2023-08-15 20:46:50 +02:00
parent 78f2232012
commit 4b82a5cadd
2 changed files with 2 additions and 2 deletions

View File

@ -120,7 +120,7 @@ endif (CMAKE_CXX_COMPILER_ID MATCHES GNU)
if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
add_compiler_flags(4.6 "-Wcast-align")
add_compiler_flags(4.6 "-Wconversion")
#add_compiler_flags(4.6 "-Wdouble-promotion")
add_compiler_flags(4.6 "-Wdouble-promotion")
add_compiler_flags(4.6 "-Winvalid-pch")
add_compiler_flags(4.6 "-Wmissing-declarations")
add_compiler_flags(4.6 "-Wmissing-format-attribute")

View File

@ -189,7 +189,7 @@ namespace oatpp { namespace utils { namespace conversion {
}
v_buff_size float32ToCharSequence(v_float32 value, p_char8 data, v_buff_size n, const char* format) {
return snprintf(reinterpret_cast<char*>(data), n, format, value);
return snprintf(reinterpret_cast<char*>(data), n, format, static_cast<double>(value));
}
v_buff_size float64ToCharSequence(v_float64 value, p_char8 data, v_buff_size n, const char* format) {