zxing-cpp: upgrade to release 2.1.0

- remove external/zxing/invalid_argument.patch.1 and
  external/zxing/no_sanitize_ignored.patch.0, no longer needed in 2.1.0.

- If "Utf.h" can be included, use ZXing::FromUtf8() instaed of
  ZXing::TextUtfEncoding::FromUtf8().
  This makes external/zxing/undeprecate-warning.patch.0 unnecessary.

Change-Id: I06acebb623aa8b60c5d2e5f7f265998571d75a89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154221
Tested-by: Jenkins
Reviewed-by: Taichi Haradaguchi <20001722@ymail.ne.jp>
This commit is contained in:
Taichi Haradaguchi 2023-07-08 23:50:10 +09:00
parent e339b3dea0
commit 09c6ef36f4
8 changed files with 29 additions and 82 deletions

View file

@ -29,7 +29,6 @@
#include <BarcodeFormat.h>
#include <BitMatrix.h>
#include <MultiFormatWriter.h>
#include <TextUtfEncoding.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
@ -39,6 +38,12 @@
#include <BitMatrixIO.h>
#endif
#if __has_include(<Utf.h>)
#include <Utf.h>
#else
#include <TextUtfEncoding.h>
#endif
#endif // ENABLE_ZXING
#include <com/sun/star/beans/XPropertySet.hpp>
@ -148,7 +153,11 @@ OString GenerateQRCode(std::u16string_view aQRText, tools::Long aQRECC, int aQRB
ZXing::BarcodeFormat format = ZXing::BarcodeFormatFromString(GetBarCodeType(aQRType));
auto writer = ZXing::MultiFormatWriter(format).setMargin(aQRBorder).setEccLevel(bqrEcc);
writer.setEncoding(ZXing::CharacterSet::UTF8);
#if __has_include(<Utf.h>)
ZXing::BitMatrix bitmatrix = writer.encode(ZXing::FromUtf8(QRText), 0, 0);
#else
ZXing::BitMatrix bitmatrix = writer.encode(ZXing::TextUtfEncoding::FromUtf8(QRText), 0, 0);
#endif
#if HAVE_ZXING_TOSVG
return OString(ZXing::ToSVG(bitmatrix));
#else

View file

@ -565,8 +565,8 @@ ZMF_TARBALL := libzmf-0.0.2.tar.xz
# three static lines
# so that git cherry-pick
# will not run into conflicts
ZXING_SHA256SUM := 12b76b7005c30d34265fc20356d340da179b0b4d43d2c1b35bcca86776069f76
ZXING_TARBALL := zxing-cpp-2.0.0.tar.gz
ZXING_SHA256SUM := 6d54e403592ec7a143791c6526c1baafddf4c0897bb49b1af72b70a0f0c4a3fe
ZXING_TARBALL := zxing-cpp-2.1.0.tar.gz
# three static lines
# so that git cherry-pick
# will not run into conflicts

View file

@ -79,29 +79,29 @@ $(eval $(call gb_StaticLibrary_add_generated_exception_objects,zxing,\
UnpackedTarball/zxing/core/src/oned/ODDataBarReader \
UnpackedTarball/zxing/core/src/oned/ODEAN8Writer \
UnpackedTarball/zxing/core/src/oned/ODEAN13Writer \
UnpackedTarball/zxing/core/src/oned/ODITFWriter \
UnpackedTarball/zxing/core/src/oned/ODITFReader \
UnpackedTarball/zxing/core/src/oned/ODITFWriter \
UnpackedTarball/zxing/core/src/oned/ODMultiUPCEANReader \
UnpackedTarball/zxing/core/src/oned/ODUPCEANCommon \
UnpackedTarball/zxing/core/src/oned/ODUPCAWriter \
UnpackedTarball/zxing/core/src/oned/ODUPCEWriter \
UnpackedTarball/zxing/core/src/oned/ODUPCEANCommon \
UnpackedTarball/zxing/core/src/oned/ODRowReader \
UnpackedTarball/zxing/core/src/oned/ODReader \
UnpackedTarball/zxing/core/src/oned/ODWriterHelper \
UnpackedTarball/zxing/core/src/pdf417/PDFCodewordDecoder \
UnpackedTarball/zxing/core/src/pdf417/PDFHighLevelEncoder \
UnpackedTarball/zxing/core/src/pdf417/PDFDetectionResultColumn \
UnpackedTarball/zxing/core/src/pdf417/PDFReader \
UnpackedTarball/zxing/core/src/pdf417/PDFBoundingBox \
UnpackedTarball/zxing/core/src/pdf417/PDFScanningDecoder \
UnpackedTarball/zxing/core/src/pdf417/PDFModulusGF \
UnpackedTarball/zxing/core/src/pdf417/PDFEncoder \
UnpackedTarball/zxing/core/src/pdf417/PDFDecodedBitStreamParser \
UnpackedTarball/zxing/core/src/pdf417/PDFWriter \
UnpackedTarball/zxing/core/src/pdf417/PDFDetectionResult \
UnpackedTarball/zxing/core/src/pdf417/PDFModulusPoly \
UnpackedTarball/zxing/core/src/pdf417/PDFDetector \
UnpackedTarball/zxing/core/src/pdf417/PDFBarcodeValue \
UnpackedTarball/zxing/core/src/pdf417/PDFBoundingBox \
UnpackedTarball/zxing/core/src/pdf417/PDFCodewordDecoder \
UnpackedTarball/zxing/core/src/pdf417/PDFDecoder \
UnpackedTarball/zxing/core/src/pdf417/PDFDetector \
UnpackedTarball/zxing/core/src/pdf417/PDFDetectionResult \
UnpackedTarball/zxing/core/src/pdf417/PDFDetectionResultColumn \
UnpackedTarball/zxing/core/src/pdf417/PDFEncoder \
UnpackedTarball/zxing/core/src/pdf417/PDFHighLevelEncoder \
UnpackedTarball/zxing/core/src/pdf417/PDFModulusGF \
UnpackedTarball/zxing/core/src/pdf417/PDFModulusPoly \
UnpackedTarball/zxing/core/src/pdf417/PDFReader \
UnpackedTarball/zxing/core/src/pdf417/PDFScanningDecoder \
UnpackedTarball/zxing/core/src/pdf417/PDFWriter \
UnpackedTarball/zxing/core/src/PerspectiveTransform \
UnpackedTarball/zxing/core/src/qrcode/QRBitMatrixParser \
UnpackedTarball/zxing/core/src/qrcode/QRCodecMode \

View file

@ -14,9 +14,6 @@ $(eval $(call gb_UnpackedTarball_set_tarball,zxing,$(ZXING_TARBALL)))
$(eval $(call gb_UnpackedTarball_set_patchlevel,zxing,1))
$(eval $(call gb_UnpackedTarball_add_patches,zxing, \
external/zxing/undeprecate-warning.patch.0 \
external/zxing/no_sanitize_ignored.patch.0 \
external/zxing/invalid_argument.patch.1 \
))
# vim: set noet sw=4 ts=4:

View file

@ -13,7 +13,7 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
Generated on 2023-02-24 12:48:45 using:
Generated on 2023-07-09 00:00:16 using:
./bin/update_pch external/zxing zxing --cutoff=1 --exclude:system --include:module --include:local
If after updating build fails, use the following command to locate conflicting headers:
@ -26,6 +26,7 @@
#include <array>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstddef>
#include <cstdint>

View file

@ -1,22 +0,0 @@
From 302e8210b865576b35164f48bd57e003f6674dd1 Mon Sep 17 00:00:00 2001
From: FalsinSoft <falsinsoft@gmail.com>
Date: Wed, 11 Jan 2023 20:58:04 +0100
Subject: [PATCH] Fixed 'invalid_argument' is not a member of 'std' error on
Visual Studio
---
core/src/Matrix.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/core/src/Matrix.h b/core/src/Matrix.h
index 8b04bb1af..0c7c4e88b 100644
--- a/core/src/Matrix.h
+++ b/core/src/Matrix.h
@@ -9,6 +9,7 @@
#include "Point.h"
#include "ZXAlgorithms.h"
+#include <stdexcept>
#include <algorithm>
#include <cassert>
#include <vector>

View file

@ -1,24 +0,0 @@
--- core/src/Matrix.h 2023-02-24 14:46:06.244773735 +0000
+++ core/src/Matrix.h 2023-02-24 14:46:12.619482571 +0000
@@ -34,9 +34,6 @@
public:
Matrix() = default;
-#ifdef __GNUC__
- __attribute__((no_sanitize("signed-integer-overflow")))
-#endif
Matrix(int width, int height, value_t val = {}) : _width(width), _height(height), _data(_width * _height, val) {
if (width != 0 && Size(_data) / width != height)
throw std::invalid_argument("invalid size: width * height is too big");
--- core/src/BitMatrix.h 2023-02-24 15:56:00.813976749 +0000
+++ core/src/BitMatrix.h 2023-02-24 15:56:18.740156420 +0000
@@ -57,9 +57,6 @@
public:
BitMatrix() = default;
-#ifdef __GNUC__
- __attribute__((no_sanitize("signed-integer-overflow")))
-#endif
BitMatrix(int width, int height) : _width(width), _height(height), _bits(width * height, UNSET_V)
{
if (width != 0 && Size(_bits) / width != height)

View file

@ -1,14 +0,0 @@
--- core/src/TextUtfEncoding.h 2023-02-24 11:30:34.505322162 +0000
+++ core/src/TextUtfEncoding.h 2023-02-24 11:30:40.425049296 +0000
@@ -12,8 +12,8 @@
// The following functions are not required anymore after Result::text() now returns utf8 natively and the encoders accept utf8 as well.
-[[deprecated]] std::string ToUtf8(std::wstring_view str);
-[[deprecated]] std::string ToUtf8(std::wstring_view str, const bool angleEscape);
-[[deprecated]] std::wstring FromUtf8(std::string_view utf8);
+std::string ToUtf8(std::wstring_view str);
+std::string ToUtf8(std::wstring_view str, const bool angleEscape);
+std::wstring FromUtf8(std::string_view utf8);
} // namespace ZXing::TextUtfEncoding