[med-svn] [Git][med-team/charls][master] 5 commits: d/patches: Refactor patch for upstream submission
Mathieu Malaterre (@malat)
gitlab at salsa.debian.org
Wed Jan 26 08:44:06 GMT 2022
Mathieu Malaterre pushed to branch master at Debian Med / charls
Commits:
19ed4389 by Mathieu Malaterre at 2022-01-26T09:38:32+01:00
d/patches: Refactor patch for upstream submission
- - - - -
ab237d48 by Mathieu Malaterre at 2022-01-26T09:40:07+01:00
d/patches: Simplify std c++ version setup
- - - - -
1d0f7a2c by Mathieu Malaterre at 2022-01-26T09:42:43+01:00
New upstream version 2.3.1+dfsg
- - - - -
26431ba8 by Mathieu Malaterre at 2022-01-26T09:42:43+01:00
Update upstream source from tag 'upstream/2.3.1+dfsg'
Update to upstream version '2.3.1+dfsg'
with Debian dir 2b30afa0a1a0c864ddf6d4f552c7fdfe7c525894
- - - - -
15213f5e by Mathieu Malaterre at 2022-01-26T09:43:40+01:00
d/changelog: Prepare 2.3.1 upload
- - - - -
10 changed files:
- CHANGELOG.md
- SECURITY.md
- debian/changelog
- debian/patches/noexplicitstd.patch
- debian/patches/stl_symbols_hack.patch
- include/charls/charls_jpegls_decoder.h
- include/charls/charls_jpegls_encoder.h
- include/charls/version.h
- unittest/jpegls_decoder_test.cpp
- unittest/jpegls_encoder_test.cpp
Changes:
=====================================
CHANGELOG.md
=====================================
@@ -4,6 +4,12 @@ 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.1] - 2021-1-25
+
+### Fixed
+
+- Fixed [#155](https://github.com/team-charls/charls/issues/155), charls::jpegls_decoder::decode: 2 overloads have similar conversions in v2.3.0
+
## [2.3.0] - 2022-1-24
### Added
=====================================
SECURITY.md
=====================================
@@ -4,7 +4,8 @@
| Version | Supported |
| ------- | ------------------ |
-| 2.3.0 | :white_check_mark: |
+| 2.3.1 | :white_check_mark: |
+| 2.3.0 | :x: |
| 2.2.0 | :x: |
| 2.1.0 | :x: |
| 2.0.0 | :x: |
=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+charls (2.3.1+dfsg-1) UNRELEASED; urgency=medium
+
+ * d/patches: Refactor patch for upstream submission
+ * d/patches: Simplify std c++ version setup
+ * New upstream version 2.3.1+dfsg
+
+ -- Mathieu Malaterre <malat at debian.org> Wed, 26 Jan 2022 09:43:33 +0100
+
charls (2.3.0+dfsg-1) unstable; urgency=medium
* New upstream version 2.3.0+dfsg
=====================================
debian/patches/noexplicitstd.patch
=====================================
@@ -7,12 +7,14 @@ Index: charls/CMakeLists.txt
===================================================================
--- charls.orig/CMakeLists.txt
+++ charls/CMakeLists.txt
-@@ -37,7 +37,7 @@ option(CHARLS_PEDANTIC_WARNINGS "Enable
+@@ -37,8 +37,8 @@ option(CHARLS_PEDANTIC_WARNINGS "Enable
option(CHARLS_TREAT_WARNING_AS_ERROR "Treat a warning as an error." OFF)
# CharLS requires C++14 or newer.
-set(CMAKE_CXX_STANDARD 14)
+-set(CMAKE_CXX_STANDARD_REQUIRED ON)
+#set(CMAKE_CXX_STANDARD 14)
- set(CMAKE_CXX_STANDARD_REQUIRED ON)
++#set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
+ # Configure the supported C++ compilers: gcc, clang and MSVC
=====================================
debian/patches/stl_symbols_hack.patch
=====================================
@@ -3,31 +3,31 @@ Description: Rework the symbol file to hide stl exported symbols
Author: Mathieu Malaterre <malat at debian.org>
Forwarded: no
-Index: charls/exports.version
+Index: charls/charls.version
===================================================================
--- /dev/null
-+++ charls/exports.version
++++ charls/charls.version
@@ -0,0 +1,21 @@
+{
-+global:
-+ JpegLsDecode;
-+ JpegLsDecodeRect;
-+ JpegLsEncode;
-+ JpegLsReadHeader;
-+ charls_get*;
-+ charls_jpegls_encoder*;
-+ charls_jpegls_decoder*;
++ global:
++ JpegLs*;
++ charls_*;
+ extern "C++" {
-+ JpegLsDecode;
-+ JpegLsDecodeRect;
-+ JpegLsEncode;
-+ JpegLsReadHeader;
-+ charls_get*;
-+ charls_jpegls_encoder*;
-+ charls_jpegls_decoder*;
++ JpegLs*;
++ charls_*;
++ };
++ local:
++ # Hide all the std namespace symbols. std namespace is explicitly marked
++ # as visibility(default) and header-only functions or methods (such as those
++ # from templates) should be exposed in shared libraries as weak symbols but
++ # this is only needed when we expose those types in the shared library API
++ # in any way. We don't use C++ std types in the API and we also don't
++ # support exceptions in the library.
++ # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36022 for a discussion
++ # about this.
++ extern "C++" {
++ *std::*;
+ };
-+local:
-+ *;
+};
Index: charls/src/CMakeLists.txt
===================================================================
@@ -37,7 +37,7 @@ Index: charls/src/CMakeLists.txt
set_target_properties(charls PROPERTIES CXX_VISIBILITY_PRESET hidden)
set_property(TARGET charls PROPERTY PUBLIC_HEADER ${HEADERS})
-+set_property(TARGET charls PROPERTY LINK_FLAGS "-Wl,--version-script=../exports.version")
++set_property(TARGET charls PROPERTY LINK_FLAGS "-Wl,--version-script=../charls.version")
+
target_sources(charls
PUBLIC
=====================================
include/charls/charls_jpegls_decoder.h
=====================================
@@ -271,7 +271,8 @@ public:
/// <exception cref="charls::jpegls_error">An error occurred during the operation.</exception>
/// <exception cref="std::bad_alloc">Thrown when memory for the decoder could not be allocated.</exception>
/// <returns>Frame info of the decoded image and the interleave mode.</returns>
- template<typename SourceContainer, typename DestinationContainer>
+ template<typename SourceContainer, typename DestinationContainer, typename T1 = typename SourceContainer::value_type,
+ 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)
@@ -324,7 +325,7 @@ public:
/// </param>
/// <exception cref="charls::jpegls_error">An error occurred during the operation.</exception>
/// <exception cref="std::bad_alloc">Thrown when memory for the decoder could not be allocated.</exception>
- template<typename Container>
+ template<typename Container, typename T = typename Container::value_type>
jpegls_decoder(const Container& source_container, const bool parse_header) :
jpegls_decoder(source_container.data(), source_container.size() * sizeof(typename Container::value_type),
parse_header)
@@ -354,7 +355,7 @@ public:
/// A STL like container that provides the functions data() and size() and the type value_type.
/// </param>
/// <exception cref="charls::jpegls_error">An error occurred during the operation.</exception>
- template<typename Container>
+ template<typename Container, typename T = typename Container::value_type>
jpegls_decoder& source(const Container& source_container)
{
return source(source_container.data(), source_container.size() * sizeof(typename Container::value_type));
@@ -557,7 +558,7 @@ public:
/// </param>
/// <param name="stride">Number of bytes to the next line in the buffer, when zero, decoder will compute it.</param>
/// <exception cref="charls::jpegls_error">An error occurred during the operation.</exception>
- template<typename Container>
+ template<typename Container, typename T = typename Container::value_type>
void decode(CHARLS_OUT Container& destination_container, const uint32_t stride = 0) const
{
decode(destination_container.data(), destination_container.size() * sizeof(typename Container::value_type), stride);
@@ -569,7 +570,7 @@ public:
/// <param name="stride">Number of bytes to the next line in the buffer, when zero, decoder will compute it.</param>
/// <exception cref="charls::jpegls_error">An error occurred during the operation.</exception>
/// <returns>Container with the decoded data.</returns>
- template<typename Container>
+ template<typename Container, typename T = typename Container::value_type>
CHARLS_CHECK_RETURN Container decode(const uint32_t stride = 0) const
{
Container destination(destination_size() / sizeof(typename Container::value_type));
=====================================
include/charls/charls_jpegls_encoder.h
=====================================
@@ -285,7 +285,7 @@ public:
/// <exception cref="charls::jpegls_error">An error occurred during the operation.</exception>
/// <exception cref="std::bad_alloc">Thrown when memory for the encoder could not be allocated.</exception>
/// <returns>Container with the JPEG-LS encoded bytes.</returns>
- template<typename Container>
+ template<typename Container, typename T = typename Container::value_type>
static Container encode(const Container& source, const charls::frame_info& frame,
const charls::interleave_mode interleave_mode = charls::interleave_mode::none,
const encoding_options encoding_options = charls::encoding_options::none)
@@ -410,14 +410,14 @@ public:
/// <param name="destination_container">
/// The STL like container, that supports the functions data() and size() and the typedef value_type.
/// </param>
- template<typename Container>
+ template<typename Container, typename T = typename Container::value_type>
jpegls_encoder& destination(Container& destination_container)
{
return destination(destination_container.data(),
destination_container.size() * sizeof(typename Container::value_type));
}
- template<typename Container>
+ template<typename Container, typename T = typename Container::value_type>
jpegls_encoder& destination(const Container& destination_container) = delete;
/// <summary>
@@ -519,7 +519,7 @@ public:
/// Stride is sometimes called pitch. If padding bytes are present, the stride is wider than the width of the image.
/// </param>
/// <returns>The number of bytes written to the destination.</returns>
- template<typename Container>
+ template<typename Container, typename T = typename Container::value_type>
size_t encode(const Container& source_container, const uint32_t stride = 0) const
{
return encode(source_container.data(), source_container.size() * sizeof(typename Container::value_type), stride);
=====================================
include/charls/version.h
=====================================
@@ -16,7 +16,7 @@ extern "C" {
#define CHARLS_VERSION_MAJOR 2
#define CHARLS_VERSION_MINOR 3
-#define CHARLS_VERSION_PATCH 0
+#define CHARLS_VERSION_PATCH 1
/// <summary>
/// Returns the version of CharLS in the semver format "major.minor.patch" or "major.minor.patch-pre_release"
=====================================
unittest/jpegls_decoder_test.cpp
=====================================
@@ -735,6 +735,28 @@ public:
#endif
}
+ TEST_METHOD(decode_to_buffer_with_uint16_size_works) // NOLINT
+ {
+ // These are compile time checks to detect issues with overloads that have similar conversions.
+ constexpr frame_info frame_info{100, 100, 8, 1};
+ const vector<uint8_t> source(static_cast<size_t>(frame_info.width) * frame_info.height);
+
+ const vector<uint8_t> encoded_source{
+ jpegls_encoder::encode(source, frame_info, interleave_mode::none, encoding_options::even_destination_size)};
+
+ jpegls_decoder decoder;
+ decoder.source(encoded_source);
+ decoder.read_header();
+
+ vector<uint8_t> destination(decoder.destination_size());
+
+ void* data{destination.data()};
+ const uint16_t size{static_cast<uint16_t>(destination.size())};
+
+ // size is not a perfect match and needs a conversion.
+ decoder.decode(data, size);
+ }
+
private:
static vector<uint8_t>::iterator find_scan_header(const vector<uint8_t>::iterator begin,
const vector<uint8_t>::iterator end) noexcept
=====================================
unittest/jpegls_encoder_test.cpp
=====================================
@@ -1324,6 +1324,32 @@ public:
Assert::IsFalse(it == destination.cend());
}
+ TEST_METHOD(encode_to_buffer_with_uint16_size_works) // NOLINT
+ {
+ // These are compile time checks to detect issues with overloads that have similar conversions.
+ constexpr frame_info frame_info{100, 100, 8, 1};
+
+ jpegls_encoder encoder;
+ encoder.frame_info(frame_info);
+
+ vector<uint8_t> destination(encoder.estimated_destination_size());
+
+ void* data1 = destination.data();
+ const uint16_t 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());
+
+ // Set 1 value to prevent complains about const.
+ uint8_t* p = static_cast<uint8_t*>(data2);
+ *p = 7;
+
+ // size2 is not a perfect match and needs a conversion.
+ ignore = encoder.encode(data2, size2);
+ }
+
private:
static void test_by_decoding(const vector<uint8_t>& encoded_source, const frame_info& source_frame_info,
const void* expected_destination, const size_t expected_destination_size,
View it on GitLab: https://salsa.debian.org/med-team/charls/-/compare/5df0b2930636fa9e88244231dab087b826eb229d...15213f5e410574c3e55e5771c92a27e5f3805934
--
View it on GitLab: https://salsa.debian.org/med-team/charls/-/compare/5df0b2930636fa9e88244231dab087b826eb229d...15213f5e410574c3e55e5771c92a27e5f3805934
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/20220126/00591fde/attachment-0001.htm>
More information about the debian-med-commit
mailing list