cui/source/dialogs/QrCodeGenDialog.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
New commits: commit 14c4c077182f0338a21ae7dedf862ffff0e339d2 Author: Thorsten Behrens <thorsten.behr...@allotropia.de> AuthorDate: Fri Dec 22 15:22:19 2023 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Sat Dec 23 09:52:54 2023 +0100 ZXing: no need for deprecated utf-8 conversions anymore With ZXing 2.0, the library directly supports utf8 std::string parameters: https://github.com/zxing-cpp/zxing-cpp/releases/tag/v2.0.0 Fixes the warning: cui/source/dialogs/QrCodeGenDialog.cxx:161:72: warning: 'FromUtf8' is deprecated [-Wdeprecated-declarations] 161 | ZXing::BitMatrix bitmatrix = writer.encode(ZXing::TextUtfEncoding::FromUtf8(QRText), 0, 0); | ^ /usr/include/ZXing/TextUtfEncoding.h:17:3: note: 'FromUtf8' has been explicitly marked deprecated here 17 | [[deprecated]] std::wstring FromUtf8(std::string_view utf8); | ^ Change-Id: Ic0a65d4455dabea1a7a4e23f558e4158a0c3f39f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161182 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/cui/source/dialogs/QrCodeGenDialog.cxx b/cui/source/dialogs/QrCodeGenDialog.cxx index 8a25e3b364e7..c727f4cdbd02 100644 --- a/cui/source/dialogs/QrCodeGenDialog.cxx +++ b/cui/source/dialogs/QrCodeGenDialog.cxx @@ -19,6 +19,7 @@ #include <vcl/svapp.hxx> #if ENABLE_ZXING +#include <ZXVersion.h> #include <rtl/strbuf.hxx> #ifdef __GNUC__ @@ -38,9 +39,7 @@ #include <BitMatrixIO.h> #endif -#if __has_include(<Utf.h>) -#include <Utf.h> -#else +#if ZXING_VERSION_MAJOR < 2 #include <TextUtfEncoding.h> #endif @@ -153,8 +152,8 @@ 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); +#if ZXING_VERSION_MAJOR >= 2 + ZXing::BitMatrix bitmatrix = writer.encode(QRText, 0, 0); #else ZXing::BitMatrix bitmatrix = writer.encode(ZXing::TextUtfEncoding::FromUtf8(QRText), 0, 0); #endif