From e0ce967acc4de71aa6c475608128fe6c36012171 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Thu, 19 Sep 2024 11:11:40 +0200 Subject: [PATCH] Fix warnings detected with Apple clang version 16.0.0 (clang-1600.0.26.3) on Sonoma 14.7 --- modules/core/include/visp3/core/vpIoTools.h | 2 +- .../core/test/image/testImageOwnership.cpp | 4 +-- .../src/rgb-depth/realsense/vpRealSense2.cpp | 2 ++ .../rgb-depth/testRealSense2_D435_opencv.cpp | 30 ------------------- 4 files changed, 5 insertions(+), 33 deletions(-) diff --git a/modules/core/include/visp3/core/vpIoTools.h b/modules/core/include/visp3/core/vpIoTools.h index 246624d377..511b1333b5 100644 --- a/modules/core/include/visp3/core/vpIoTools.h +++ b/modules/core/include/visp3/core/vpIoTools.h @@ -316,7 +316,7 @@ template void npz_save(std::string zipname, std::string fname, const //write everything fwrite(&local_header[0], sizeof(char), local_header.size(), fp); fwrite(&npy_header[0], sizeof(char), npy_header.size(), fp); - fwrite(data, sizeof(T), nels, fp); + fwrite(&data[0], sizeof(T), nels, fp); fwrite(&global_header[0], sizeof(char), global_header.size(), fp); fwrite(&footer[0], sizeof(char), footer.size(), fp); fclose(fp); diff --git a/modules/core/test/image/testImageOwnership.cpp b/modules/core/test/image/testImageOwnership.cpp index 516284ec92..90399154d9 100644 --- a/modules/core/test/image/testImageOwnership.cpp +++ b/modules/core/test/image/testImageOwnership.cpp @@ -143,7 +143,7 @@ int main(int /* argc */, const char ** /* argv */) #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) { unsigned char *bitmap = new unsigned char[12]; - vpImage I = std::move(vpImage(bitmap, 3, 4, false)); + vpImage I = vpImage(bitmap, 3, 4, false); if (bitmap != I.bitmap) { std::cout << "std::move(vpImage) failed" << std::endl; return EXIT_FAILURE; @@ -152,7 +152,7 @@ int main(int /* argc */, const char ** /* argv */) } { unsigned char *bitmap = new unsigned char[12]; - vpImage I(std::move(vpImage(bitmap, 3, 4, false))); + vpImage I(vpImage(bitmap, 3, 4, false)); if (bitmap != I.bitmap) { std::cout << "vpImage(td::move(vpImage)) failed" << std::endl; return EXIT_FAILURE; diff --git a/modules/sensor/src/rgb-depth/realsense/vpRealSense2.cpp b/modules/sensor/src/rgb-depth/realsense/vpRealSense2.cpp index 3b51fe78f0..e63d1df584 100644 --- a/modules/sensor/src/rgb-depth/realsense/vpRealSense2.cpp +++ b/modules/sensor/src/rgb-depth/realsense/vpRealSense2.cpp @@ -45,6 +45,7 @@ #define MANUAL_POINTCLOUD 1 +#if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_COMMON) namespace { bool operator==(const rs2_extrinsics &lhs, const rs2_extrinsics &rhs) @@ -64,6 +65,7 @@ bool operator==(const rs2_extrinsics &lhs, const rs2_extrinsics &rhs) return true; } } // namespace +#endif BEGIN_VISP_NAMESPACE /*! diff --git a/modules/sensor/test/rgb-depth/testRealSense2_D435_opencv.cpp b/modules/sensor/test/rgb-depth/testRealSense2_D435_opencv.cpp index b58015fe2d..06b4a146a3 100644 --- a/modules/sensor/test/rgb-depth/testRealSense2_D435_opencv.cpp +++ b/modules/sensor/test/rgb-depth/testRealSense2_D435_opencv.cpp @@ -101,36 +101,6 @@ unsigned char getDepthColor(const std::vector &histogram, float z, flo return static_cast(histogram[static_cast(z * depth_scale)] * 255 / histogram[0xFFFF]); } -void getNativeFrame(const rs2::frame &frame, unsigned char *const data) -{ - auto vf = frame.as(); - int size = vf.get_width() * vf.get_height(); - - switch (frame.get_profile().format()) { - case RS2_FORMAT_RGB8: - case RS2_FORMAT_BGR8: - memcpy(data, frame.get_data(), size * 3); - break; - - case RS2_FORMAT_RGBA8: - case RS2_FORMAT_BGRA8: - memcpy(data, frame.get_data(), size * 4); - break; - - case RS2_FORMAT_Y16: - case RS2_FORMAT_Z16: - memcpy(data, frame.get_data(), size * 2); - break; - - case RS2_FORMAT_Y8: - memcpy(data, frame.get_data(), size); - break; - - default: - break; - } -} - void frame_to_mat(const rs2::frame &f, cv::Mat &img) { auto vf = f.as();