diff --git a/cmake/k4aCompilerFlags.cmake b/cmake/k4aCompilerFlags.cmake index d94c8969..e938c907 100644 --- a/cmake/k4aCompilerFlags.cmake +++ b/cmake/k4aCompilerFlags.cmake @@ -29,6 +29,11 @@ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") # Added in clang 5 list(APPEND CLANG_ALL_WARNINGS "-Wno-zero-as-null-pointer-constant") # Allow zero as nullptr endif() + if (NOT (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "8.0.0")) + # Added in clang 8 + list(APPEND CLANG_ALL_WARNINGS "-Wno-extra-semi-stmt") # Allow semi-colons to be used after #define's + list(APPEND CLANG_ALL_WARNINGS "-Wno-atomic-implicit-seq-cst") # Allow use of __sync_add_and_fetch() atomic + endif() set(CLANG_WARNINGS_AS_ERRORS "-Werror") add_compile_options(${CLANG_ALL_WARNINGS}) add_compile_options(${CLANG_WARNINGS_AS_ERRORS}) diff --git a/extern/imgui/src b/extern/imgui/src index e0cab566..6a0d0dab 160000 --- a/extern/imgui/src +++ b/extern/imgui/src @@ -1 +1 @@ -Subproject commit e0cab5664adf02c030f9cf2a05d2c334638a85f8 +Subproject commit 6a0d0dab5a9f0b9518a2bc9bb456a69895ae0962 diff --git a/include/k4a/k4a.hpp b/include/k4a/k4a.hpp index ee0f9749..f36d14f7 100644 --- a/include/k4a/k4a.hpp +++ b/include/k4a/k4a.hpp @@ -730,12 +730,15 @@ struct calibration : public k4a_calibration_t */ static calibration get_from_raw(char *raw_calibration, size_t raw_calibration_size, - k4a_depth_mode_t depth_mode, - k4a_color_resolution_t color_resolution) + k4a_depth_mode_t target_depth_mode, + k4a_color_resolution_t target_color_resolution) { calibration calib; - k4a_result_t result = - k4a_calibration_get_from_raw(raw_calibration, raw_calibration_size, depth_mode, color_resolution, &calib); + k4a_result_t result = k4a_calibration_get_from_raw(raw_calibration, + raw_calibration_size, + target_depth_mode, + target_color_resolution, + &calib); if (K4A_RESULT_SUCCEEDED != result) { @@ -751,13 +754,13 @@ struct calibration : public k4a_calibration_t */ static calibration get_from_raw(uint8_t *raw_calibration, size_t raw_calibration_size, - k4a_depth_mode_t depth_mode, - k4a_color_resolution_t color_resolution) + k4a_depth_mode_t target_depth_mode, + k4a_color_resolution_t target_color_resolution) { return get_from_raw(reinterpret_cast(raw_calibration), raw_calibration_size, - depth_mode, - color_resolution); + target_depth_mode, + target_color_resolution); } /** Get the camera calibration for a device from a raw calibration blob. @@ -766,13 +769,13 @@ struct calibration : public k4a_calibration_t * \sa k4a_calibration_get_from_raw */ static calibration get_from_raw(std::vector &raw_calibration, - k4a_depth_mode_t depth_mode, - k4a_color_resolution_t color_resolution) + k4a_depth_mode_t target_depth_mode, + k4a_color_resolution_t target_color_resolution) { return get_from_raw(reinterpret_cast(raw_calibration.data()), raw_calibration.size(), - depth_mode, - color_resolution); + target_depth_mode, + target_color_resolution); } }; diff --git a/include/k4ainternal/global.h b/include/k4ainternal/global.h index a902befa..096cc7ec 100644 --- a/include/k4ainternal/global.h +++ b/include/k4ainternal/global.h @@ -21,6 +21,12 @@ typedef void(k4a_init_once_function_t)(void); void global_init_once(k4a_init_once_t *init_once, k4a_init_once_function_t *init_function); +#ifdef __cplusplus +#define DEFAULT_INIT(type, field) field = type() +#else +#define DEFAULT_INIT(type, field) memset(&field, 0, sizeof(field)) +#endif + /** Declares an initialized global context * * \param _global_type_ @@ -41,7 +47,7 @@ void global_init_once(k4a_init_once_t *init_once, k4a_init_once_function_t *init static _global_type_ _##_global_type_##_private; \ static void fn_##_global_type_##_init_function(void) \ { \ - memset(&_##_global_type_##_private, 0, sizeof(_##_global_type_##_private)); \ + DEFAULT_INIT(_global_type_, _##_global_type_##_private); \ _init_function_(&_##_global_type_##_private); \ return; \ } \ diff --git a/src/record/internal/matroska_read.cpp b/src/record/internal/matroska_read.cpp index 5510210f..bd360118 100644 --- a/src/record/internal/matroska_read.cpp +++ b/src/record/internal/matroska_read.cpp @@ -193,7 +193,7 @@ k4a_result_t parse_mkv(k4a_playback_context_t *context) if (check_element_type(e, &seek)) { KaxSeekID &seek_id = GetChild(*seek); - EbmlId ebml_id(seek_id.GetBuffer(), (const unsigned int)seek_id.GetSize()); + EbmlId ebml_id(seek_id.GetBuffer(), static_cast(seek_id.GetSize())); int64_t seek_location = seek->Location(); assert(seek_location >= 0); match_ebml_id(context, ebml_id, (uint64_t)seek_location); diff --git a/tests/UnitTests/depthmcu_ut/depthmcu_ut.cpp b/tests/UnitTests/depthmcu_ut/depthmcu_ut.cpp index 31598a60..631f456a 100644 --- a/tests/UnitTests/depthmcu_ut/depthmcu_ut.cpp +++ b/tests/UnitTests/depthmcu_ut/depthmcu_ut.cpp @@ -495,7 +495,7 @@ TEST_F(depthmcu_ut, depthmcu_get_serialnum_non_ascii) // Create a serial number with non-ACII characters char mockSerialNumber[20]; - memcpy(mockSerialNumber, "12\145\t67890\0WXYZ", sizeof("1234567890\0WXYZ")); + memcpy(mockSerialNumber, "12\145\t67890\0WXYZ", sizeof("12\145\t67890\0WXYZ")); // If the implementation caches the result, only a single call may be made. Otherwise it may be called multiple // times diff --git a/tools/k4aviewer/k4apointcloudwindow.cpp b/tools/k4aviewer/k4apointcloudwindow.cpp index 9a307ed4..eb3fc1f3 100644 --- a/tools/k4aviewer/k4apointcloudwindow.cpp +++ b/tools/k4aviewer/k4apointcloudwindow.cpp @@ -92,7 +92,7 @@ void K4APointCloudWindow::Show(K4AWindowPlacementInfo placementInfo) } ImGui::SameLine(); - ImGui::VerticalSeparator(); + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); ImGui::SameLine(); ImGui::TextDisabled("[Show Controls]"); const char *controlsHelpMessage = "Rotate: [Left Mouse] + Drag\n"