[med-svn] [Git][med-team/charls][master] 4 commits: New upstream version 2.3.3+dfsg

Mathieu Malaterre (@malat) gitlab at salsa.debian.org
Mon Feb 7 08:28:48 GMT 2022



Mathieu Malaterre pushed to branch master at Debian Med / charls


Commits:
0e5b1a03 by Mathieu Malaterre at 2022-02-07T09:24:34+01:00
New upstream version 2.3.3+dfsg
- - - - -
181737b1 by Mathieu Malaterre at 2022-02-07T09:24:34+01:00
Update upstream source from tag 'upstream/2.3.3+dfsg'

Update to upstream version '2.3.3+dfsg'
with Debian dir f791b982f34c60b2a4a1d55d4c44e0748b7dd03e
- - - - -
7bcef48b by Mathieu Malaterre at 2022-02-07T09:25:56+01:00
d/rules: Start running test suite

For now do not check the return code, since we are not shipping the test
data.

- - - - -
72074c27 by Mathieu Malaterre at 2022-02-07T09:27:10+01:00
d/changelog: Upload 2.3.3 to unstable

- - - - -


20 changed files:

- CHANGELOG.md
- CMakeLists.txt
- CharLS.sln.DotSettings
- SECURITY.md
- benchmark/benchmark.cpp
- debian/changelog
- debian/rules
- include/charls/charls_jpegls_decoder.h
- include/charls/version.h
- src/jpeg_stream_writer.h
- src/util.h
- test/main.cpp
- test/portable_anymap_file.h
- test/util.h
- unittest/jpeg_error_test.cpp
- unittest/jpeg_stream_reader_test.cpp
- unittest/jpegls_encoder_test.cpp
- unittest/scan_test.cpp
- unittest/util.cpp
- unittest/util_test.cpp


Changes:

=====================================
CHANGELOG.md
=====================================
@@ -4,6 +4,16 @@ All notable changes to this project are documented in this file.
 
 The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
 
+## [2.3.3] - 2021-2-5
+
+### Fixed
+
+- Fixed [#167](https://github.com/team-charls/charls/issues/167), Decoding\Encoding fails on IBM s390x CPU (Big Endian architecture)
+
+### Changed
+
+- CTest is now used in the CI build pipeline to test the output of the Linux and macOS builds.
+
 ## [2.3.2] - 2021-1-29
 
 ### Fixed
@@ -50,6 +60,12 @@ Typically CMake will select the latest C++ standard version that used C++ compil
 - GCC shared library release builds are now using LTO (Link Time Optimization).
 - Some functions use compiler intrinsics for slightly better performance.
 
+## [2.2.1] - 2022-2-3
+
+### Fixed
+
+- Backport of fix for [#167](https://github.com/team-charls/charls/issues/167), Decoding\Encoding fails on IBM s390x CPU (Big Endian architecture).
+
 ## [2.2.0] - 2021-1-10
 
 ### Added


=====================================
CMakeLists.txt
=====================================
@@ -210,7 +210,15 @@ endif()
 include(src/CMakeLists.txt)
 
 if(CHARLS_BUILD_TESTS)
+  enable_testing()
   add_subdirectory(test)
+
+  # The unit tests project depends on the VS C++ unit test framework. Use the -unittest option of the charlstest tool for other platforms.
+  add_test(
+    NAME basic-test
+    COMMAND charlstest -unittest
+    WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
+  )
 endif()
 
 if(CHARLS_BUILD_FUZZ_TEST)


=====================================
CharLS.sln.DotSettings
=====================================
@@ -44,6 +44,7 @@
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=anymap/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=banny/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=Bgra/@EntryIndexedValue">True</s:Boolean>
+	<s:Boolean x:Key="/Default/UserDictionary/Words/=bitstreamdamage/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=Braun/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=bugprone/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=byteswap/@EntryIndexedValue">True</s:Boolean>
@@ -51,15 +52,20 @@
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=charlstest/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=cmove/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=cmyk/@EntryIndexedValue">True</s:Boolean>
+	<s:Boolean x:Key="/Default/UserDictionary/Words/=comparepnm/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=countl/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=cpixel/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=cppcoreguidelines/@EntryIndexedValue">True</s:Boolean>
+	<s:Boolean x:Key="/Default/UserDictionary/Words/=decodeperformance/@EntryIndexedValue">True</s:Boolean>
+	<s:Boolean x:Key="/Default/UserDictionary/Words/=decoderaw/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=decodetest/@EntryIndexedValue">True</s:Boolean>
+	<s:Boolean x:Key="/Default/UserDictionary/Words/=decodetopnm/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=dequantize/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=destructors/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=Dicom/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=Dtor/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=emcc/@EntryIndexedValue">True</s:Boolean>
+	<s:Boolean x:Key="/Default/UserDictionary/Words/=encodepnm/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=Endian/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=errc/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=Errval/@EntryIndexedValue">True</s:Boolean>
@@ -91,6 +97,7 @@
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=Runmode/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=strcpy/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=Undefine/@EntryIndexedValue">True</s:Boolean>
+	<s:Boolean x:Key="/Default/UserDictionary/Words/=unittest/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=unmap/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=UNSUPPRESS/@EntryIndexedValue">True</s:Boolean>
 	<s:Boolean x:Key="/Default/UserDictionary/Words/=Vaan/@EntryIndexedValue">True</s:Boolean>


=====================================
SECURITY.md
=====================================
@@ -4,9 +4,11 @@
 
 | Version | Supported          |
 | ------- | ------------------ |
-| 2.3.2   | :white_check_mark: |
+| 2.3.3   | :white_check_mark: |
+| 2.3.2   | :x:                |
 | 2.3.1   | :x:                |
 | 2.3.0   | :x:                |
+| 2.2.1   | :white_check_mark: |
 | 2.2.0   | :x:                |
 | 2.1.0   | :x:                |
 | 2.0.0   | :x:                |


=====================================
benchmark/benchmark.cpp
=====================================
@@ -7,6 +7,7 @@
 
 #include <cstdint>
 #include <memory>
+#include <vector>
 
 #pragma warning(disable : 26409) // Avoid calling new explicitly (triggered by BENCHMARK macro)
 
@@ -160,7 +161,7 @@ inline int countl_zero(const uint64_t value) noexcept
     unsigned long index;
     _BitScanReverse64(&index, value);
 
-    return 63 - index;
+    return 63 - static_cast<int>(index);
 }
 #endif
 


=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+charls (2.3.3+dfsg-1) unstable; urgency=medium
+
+  * Team upload.
+  * New upstream version 2.3.3+dfsg. Closes: #1004842
+
+ -- Mathieu Malaterre <malat at debian.org>  Mon, 07 Feb 2022 09:26:50 +0100
+
 charls (2.3.2+dfsg-1) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/rules
=====================================
@@ -20,6 +20,9 @@ CMAKE_EXTRA_FLAGS += \
 override_dh_auto_configure:
 	dh_auto_configure -- $(CMAKE_EXTRA_FLAGS)
 
+override_dh_auto_test-arch:
+	dh_auto_test || true
+
 pkg_run = libcharls2
 pkg_dev = libcharls-dev
 


=====================================
include/charls/charls_jpegls_decoder.h
=====================================
@@ -275,7 +275,7 @@ public:
              typename T2 = typename DestinationContainer::value_type>
     static std::pair<charls::frame_info, charls::interleave_mode>
     decode(const SourceContainer& source, DestinationContainer& destination,
-           const size_t maximum_size_in_bytes = 7680 * 4320 * 3)
+           const size_t maximum_size_in_bytes = static_cast<size_t>(7680) * 4320 * 3)
     {
         jpegls_decoder decoder{source, true};
 


=====================================
include/charls/version.h
=====================================
@@ -16,7 +16,7 @@ extern "C" {
 
 #define CHARLS_VERSION_MAJOR 2
 #define CHARLS_VERSION_MINOR 3
-#define CHARLS_VERSION_PATCH 2
+#define CHARLS_VERSION_PATCH 3
 
 /// <summary>
 /// Returns the version of CharLS in the semver format "major.minor.patch" or "major.minor.patch-pre_release"


=====================================
src/jpeg_stream_writer.h
=====================================
@@ -163,7 +163,11 @@ private:
 
         // Use write_bytes to write to the unaligned byte array.
         // The compiler will perform the correct optimization when the target platform support unaligned writes.
+#ifdef LITTLE_ENDIAN_ARCHITECTURE
         const UnsignedIntType big_endian_value{byte_swap(value)};
+#else
+        const UnsignedIntType big_endian_value{value};
+#endif
         write_bytes(&big_endian_value, sizeof big_endian_value);
     }
 


=====================================
src/util.h
=====================================
@@ -81,6 +81,17 @@
 #define UNLIKELY(x) (x)
 #endif
 
+// C++20 provides std::endian, use for now compiler macros.
+#ifdef _MSC_VER
+#define LITTLE_ENDIAN_ARCHITECTURE // MSVC++ compiler support only little endian platforms.
+#elif __GNUC__
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#define LITTLE_ENDIAN_ARCHITECTURE
+#endif
+#else
+#error "Unknown compiler"
+#endif
+
 // Turn A into a string literal without expanding macro definitions
 // (however, if invoked from a macro, macro arguments are expanded).
 #define TO_STRING_NX(A) #A // NOLINT(cppcoreguidelines-macro-usage)
@@ -349,7 +360,11 @@ inline size_t read_big_endian_unaligned<size_t>(const void* buffer) noexcept
 template<typename T>
 T read_big_endian_unaligned(const void* buffer) noexcept
 {
+#ifdef LITTLE_ENDIAN_ARCHITECTURE
     return byte_swap(read_unaligned<T>(buffer));
+#else
+    return read_unaligned<T>(buffer);
+#endif
 }
 
 #endif


=====================================
test/main.cpp
=====================================
@@ -74,6 +74,12 @@ uint32_t log2_floor(uint32_t n) noexcept
 }
 
 
+constexpr int result_to_exit_code(const bool result) noexcept
+{
+    return result ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+
+
 uint32_t max_value_to_bits_per_sample(uint32_t max_value) noexcept
 {
     ASSERT(max_value > 0);
@@ -735,7 +741,7 @@ void test_encode_from_stream()
 }
 
 
-void unit_test()
+bool unit_test()
 {
     try
     {
@@ -776,11 +782,19 @@ void unit_test()
 
         cout << "Test Legacy API\n";
         test_legacy_api();
+
+        return true;
     }
     catch (const unit_test_exception&)
     {
         cout << "==> Unit test failed <==\n";
     }
+    catch (const std::runtime_error& error)
+    {
+        cout << "==> Unit test failed due to external problem: " << error.what() << "\n";
+    }
+
+    return false;
 }
 
 } // namespace
@@ -800,8 +814,7 @@ int main(const int argc, const char* const argv[]) // NOLINT(bugprone-exception-
         string str{argv[i]};
         if (str == "-unittest")
         {
-            unit_test();
-            continue;
+            return result_to_exit_code(unit_test());
         }
 
         if (str == "-decoderaw")
@@ -811,7 +824,7 @@ int main(const int argc, const char* const argv[]) // NOLINT(bugprone-exception-
                 cout << "Syntax: -decoderaw input-file output-file\n";
                 return EXIT_FAILURE;
             }
-            return decode_raw(argv[2], argv[3]) ? EXIT_SUCCESS : EXIT_FAILURE;
+            return result_to_exit_code(decode_raw(argv[2], argv[3]));
         }
 
         if (str == "-decodetopnm")
@@ -822,7 +835,7 @@ int main(const int argc, const char* const argv[]) // NOLINT(bugprone-exception-
                 return EXIT_FAILURE;
             }
 
-            return decode_to_pnm(argv[2], argv[3]) ? EXIT_SUCCESS : EXIT_FAILURE;
+            return result_to_exit_code(decode_to_pnm(argv[2], argv[3]));
         }
 
         if (str == "-encodepnm")
@@ -833,7 +846,7 @@ int main(const int argc, const char* const argv[]) // NOLINT(bugprone-exception-
                 return EXIT_FAILURE;
             }
 
-            return encode_pnm(argv[2], argv[3]) ? EXIT_SUCCESS : EXIT_FAILURE;
+            return result_to_exit_code(encode_pnm(argv[2], argv[3]));
         }
 
         if (str == "-comparepnm")
@@ -846,7 +859,7 @@ int main(const int argc, const char* const argv[]) // NOLINT(bugprone-exception-
             ifstream pnm_file1(argv[2], mode_input);
             ifstream pnm_file2(argv[3], mode_input);
 
-            return compare_pnm(pnm_file1, pnm_file2) ? EXIT_SUCCESS : EXIT_FAILURE;
+            return result_to_exit_code(compare_pnm(pnm_file1, pnm_file2));
         }
 
         if (str == "-bitstreamdamage")
@@ -938,7 +951,7 @@ int main(const int argc, const char* const argv[]) // NOLINT(bugprone-exception-
         }
 
         cout << "Option not understood: " << argv[i] << "\n";
-        break;
+        return EXIT_FAILURE;
     }
 
     return EXIT_SUCCESS;


=====================================
test/portable_anymap_file.h
=====================================
@@ -51,7 +51,7 @@ public:
 
         const int bytes_per_sample = (bits_per_sample_ + 7) / 8;
         input_buffer_.resize(static_cast<size_t>(width_) * height_ * bytes_per_sample * component_count_);
-        pnm_file.read(reinterpret_cast<char*>(input_buffer_.data()), input_buffer_.size());
+        pnm_file.read(reinterpret_cast<char*>(input_buffer_.data()), static_cast<std::streamsize>(input_buffer_.size()));
 
         convert_to_little_endian_if_needed();
     }


=====================================
test/util.h
=====================================
@@ -54,19 +54,18 @@ void write(std::ostream& output, const Container& source, const size_t size)
 
 class unit_test_exception final : public std::exception
 {
-public:
-    explicit unit_test_exception() = default;
 };
 
-class assert final
+
+namespace assert {
+
+inline void is_true(const bool condition)
 {
-public:
-    static void is_true(const bool condition)
-    {
-        if (!condition)
-            throw unit_test_exception();
-    }
-};
+    if (!condition)
+        throw unit_test_exception();
+}
+
+}
 
 #ifdef _MSC_VER
 #define MSVC_WARNING_SUPPRESS(x) \


=====================================
unittest/jpeg_error_test.cpp
=====================================
@@ -45,7 +45,7 @@ public:
         const std::error_category& category{jpegls_category()};
 
         const std::string message{category.message(0)};
-        Assert::IsTrue(message.size() > 0);
+        Assert::IsFalse(message.empty());
     }
 };
 


=====================================
unittest/jpeg_stream_reader_test.cpp
=====================================
@@ -16,7 +16,6 @@
 using Microsoft::VisualStudio::CppUnitTestFramework::Assert;
 using std::array;
 using std::numeric_limits;
-using std::system_error;
 using std::vector;
 
 namespace charls { namespace test {


=====================================
unittest/jpegls_encoder_test.cpp
=====================================
@@ -876,7 +876,7 @@ public:
 
     TEST_METHOD(encode_1_component_4_bit_with_high_bits_set) // NOLINT
     {
-        const vector<uint8_t> source(512 * 512, 0xFF);
+        const vector<uint8_t> source(static_cast<size_t>(512) * 512, 0xFF);
         constexpr frame_info frame_info{512, 512, 4, 1};
 
         jpegls_encoder encoder;
@@ -888,13 +888,13 @@ public:
         const size_t bytes_written{encoder.encode(source)};
         destination.resize(bytes_written);
 
-        const vector<uint8_t> expected(512 * 512, 15);
+        const vector<uint8_t> expected(static_cast<size_t>(512) * 512, 15);
         test_by_decoding(destination, frame_info, expected.data(), expected.size(), interleave_mode::none);
     }
 
     TEST_METHOD(encode_1_component_12_bit_with_high_bits_set) // NOLINT
     {
-        const vector<uint8_t> source(512 * 512 * 2, 0xFF);
+        const vector<uint8_t> source(static_cast<size_t>(512) * 512 * 2, 0xFF);
         constexpr frame_info frame_info{512, 512, 12, 1};
 
         jpegls_encoder encoder;
@@ -906,14 +906,14 @@ public:
         const size_t bytes_written{encoder.encode(source)};
         destination.resize(bytes_written);
 
-        const vector<uint16_t> expected(512 * 512, 4095);
+        const vector<uint16_t> expected(static_cast<size_t>(512) * 512, 4095);
         test_by_decoding(destination, frame_info, expected.data(), expected.size() * sizeof(uint16_t),
                          interleave_mode::none);
     }
 
     TEST_METHOD(encode_3_components_6_bit_with_high_bits_set_interleave_mode_sample) // NOLINT
     {
-        const vector<uint8_t> source(512 * 512 * 3, 0xFF);
+        const vector<uint8_t> source(static_cast<size_t>(512) * 512 * 3, 0xFF);
         constexpr frame_info frame_info{512, 512, 6, 3};
 
         jpegls_encoder encoder;
@@ -925,13 +925,13 @@ public:
         const size_t bytes_written{encoder.encode(source)};
         destination.resize(bytes_written);
 
-        const vector<uint8_t> expected(512 * 512 * 3, 63);
+        const vector<uint8_t> expected(static_cast<size_t>(512) * 512 * 3, 63);
         test_by_decoding(destination, frame_info, expected.data(), expected.size(), interleave_mode::sample);
     }
 
     TEST_METHOD(encode_3_components_6_bit_with_high_bits_set_interleave_mode_line) // NOLINT
     {
-        const vector<uint8_t> source(512 * 512 * 3, 0xFF);
+        const vector<uint8_t> source(static_cast<size_t>(512) * 512 * 3, 0xFF);
         constexpr frame_info frame_info{512, 512, 6, 3};
 
         jpegls_encoder encoder;
@@ -943,13 +943,13 @@ public:
         const size_t bytes_written{encoder.encode(source)};
         destination.resize(bytes_written);
 
-        const vector<uint8_t> expected(512 * 512 * 3, 63);
+        const vector<uint8_t> expected(static_cast<size_t>(512) * 512 * 3, 63);
         test_by_decoding(destination, frame_info, expected.data(), expected.size(), interleave_mode::line);
     }
 
     TEST_METHOD(encode_3_components_10_bit_with_high_bits_set_interleave_mode_sample) // NOLINT
     {
-        const vector<uint8_t> source(512 * 512 * 2 * 3, 0xFF);
+        const vector<uint8_t> source(static_cast<size_t>(512) * 512 * 2 * 3, 0xFF);
         constexpr frame_info frame_info{512, 512, 10, 3};
 
         jpegls_encoder encoder;
@@ -961,13 +961,13 @@ public:
         const size_t bytes_written{encoder.encode(source)};
         destination.resize(bytes_written);
 
-        const vector<uint16_t> expected(512 * 512 * 3, 1023);
+        const vector<uint16_t> expected(static_cast<size_t>(512) * 512 * 3, 1023);
         test_by_decoding(destination, frame_info, expected.data(), expected.size() * 2, interleave_mode::sample);
     }
 
     TEST_METHOD(encode_3_components_10_bit_with_high_bits_set_interleave_mode_line) // NOLINT
     {
-        const vector<uint8_t> source(512 * 512 * 2 * 3, 0xFF);
+        const vector<uint8_t> source(static_cast<size_t>(512) * 512 * 2 * 3, 0xFF);
         constexpr frame_info frame_info{512, 512, 10, 3};
 
         jpegls_encoder encoder;
@@ -979,13 +979,13 @@ public:
         const size_t bytes_written{encoder.encode(source)};
         destination.resize(bytes_written);
 
-        const vector<uint16_t> expected(512 * 512 * 3, 1023);
+        const vector<uint16_t> expected(static_cast<size_t>(512) * 512 * 3, 1023);
         test_by_decoding(destination, frame_info, expected.data(), expected.size() * 2, interleave_mode::line);
     }
 
     TEST_METHOD(encode_4_components_6_bit_with_high_bits_set_interleave_mode_sample) // NOLINT
     {
-        const vector<uint8_t> source(512 * 512 * 4, 0xFF);
+        const vector<uint8_t> source(static_cast<size_t>(512) * 512 * 4, 0xFF);
         constexpr frame_info frame_info{512, 512, 6, 4};
 
         jpegls_encoder encoder;
@@ -997,13 +997,13 @@ public:
         const size_t bytes_written{encoder.encode(source)};
         destination.resize(bytes_written);
 
-        const vector<uint8_t> expected(512 * 512 * 4, 63);
+        const vector<uint8_t> expected(static_cast<size_t>(512) * 512 * 4, 63);
         test_by_decoding(destination, frame_info, expected.data(), expected.size(), interleave_mode::sample);
     }
 
     TEST_METHOD(encode_4_components_6_bit_with_high_bits_set_interleave_mode_line) // NOLINT
     {
-        const vector<uint8_t> source(512 * 512 * 4, 0xFF);
+        const vector<uint8_t> source(static_cast<size_t>(512) * 512 * 4, 0xFF);
         constexpr frame_info frame_info{512, 512, 6, 4};
 
         jpegls_encoder encoder;
@@ -1015,13 +1015,13 @@ public:
         const size_t bytes_written{encoder.encode(source)};
         destination.resize(bytes_written);
 
-        const vector<uint8_t> expected(512 * 512 * 4, 63);
+        const vector<uint8_t> expected(static_cast<size_t>(512) * 512 * 4, 63);
         test_by_decoding(destination, frame_info, expected.data(), expected.size(), interleave_mode::line);
     }
 
     TEST_METHOD(encode_4_components_10_bit_with_high_bits_set_interleave_mode_sample) // NOLINT
     {
-        const vector<uint8_t> source(512 * 512 * 2 * 4, 0xFF);
+        const vector<uint8_t> source(static_cast<size_t>(512) * 512 * 2 * 4, 0xFF);
         constexpr frame_info frame_info{512, 512, 10, 4};
 
         jpegls_encoder encoder;
@@ -1033,13 +1033,13 @@ public:
         const size_t bytes_written{encoder.encode(source)};
         destination.resize(bytes_written);
 
-        const vector<uint16_t> expected(512 * 512 * 4, 1023);
+        const vector<uint16_t> expected(static_cast<size_t>(512) * 512 * 4, 1023);
         test_by_decoding(destination, frame_info, expected.data(), expected.size() * 2, interleave_mode::sample);
     }
 
     TEST_METHOD(encode_4_components_10_bit_with_high_bits_set_interleave_mode_line) // NOLINT
     {
-        const vector<uint8_t> source(512 * 512 * 2 * 4, 0xFF);
+        const vector<uint8_t> source(static_cast<size_t>(512) * 512 * 2 * 4, 0xFF);
         constexpr frame_info frame_info{512, 512, 10, 4};
 
         jpegls_encoder encoder;
@@ -1051,7 +1051,7 @@ public:
         const size_t bytes_written{encoder.encode(source)};
         destination.resize(bytes_written);
 
-        const vector<uint16_t> expected(512 * 512 * 4, 1023);
+        const vector<uint16_t> expected(static_cast<size_t>(512) * 512 * 4, 1023);
         test_by_decoding(destination, frame_info, expected.data(), expected.size() * 2, interleave_mode::line);
     }
 
@@ -1335,15 +1335,15 @@ public:
         vector<uint8_t> destination(encoder.estimated_destination_size());
 
         void* data1 = destination.data();
-        const uint16_t size1 = static_cast<uint16_t>(destination.size());
+        const auto size1 = static_cast<uint16_t>(destination.size());
         encoder.destination(data1, size1);
 
         vector<uint8_t> source(static_cast<size_t>(frame_info.width) * frame_info.height);
         void* data2 = source.data();
-        const uint16_t size2 = static_cast<uint16_t>(source.size());
+        const auto size2 = static_cast<uint16_t>(source.size());
 
         // Set 1 value to prevent complains about const.
-        uint8_t* p = static_cast<uint8_t*>(data2);
+        auto* p = static_cast<uint8_t*>(data2);
         *p = 7;
 
         // size2 is not a perfect match and needs a conversion.


=====================================
unittest/scan_test.cpp
=====================================
@@ -9,7 +9,6 @@
 
 
 using Microsoft::VisualStudio::CppUnitTestFramework::Assert;
-using std::vector;
 using std::numeric_limits;
 
 namespace {


=====================================
unittest/util.cpp
=====================================
@@ -52,7 +52,7 @@ vector<uint8_t> read_file(const char* filename)
     input.seekg(0, ios::beg);
 
     vector<uint8_t> buffer(byte_count_file);
-    input.read(reinterpret_cast<char*>(buffer.data()), buffer.size());
+    input.read(reinterpret_cast<char*>(buffer.data()), static_cast<std::streamsize>(buffer.size()));
 
     return buffer;
 }


=====================================
unittest/util_test.cpp
=====================================
@@ -6,7 +6,6 @@
 #include "../src/util.h"
 
 using Microsoft::VisualStudio::CppUnitTestFramework::Assert;
-using std::array;
 using std::numeric_limits;
 
 namespace charls { namespace test {



View it on GitLab: https://salsa.debian.org/med-team/charls/-/compare/787884cebd5fae7a25ddfaa3c93fc63826c200e2...72074c27ca5f699195cef142417835b558fd5c07

-- 
View it on GitLab: https://salsa.debian.org/med-team/charls/-/compare/787884cebd5fae7a25ddfaa3c93fc63826c200e2...72074c27ca5f699195cef142417835b558fd5c07
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20220207/a027c843/attachment-0001.htm>


More information about the debian-med-commit mailing list