hwpfilter/source/hwpfile.cxx | 10 ++++++++++ hwpfilter/source/hwpfile.h | 1 + hwpfilter/source/hwplib.h | 2 +- hwpfilter/source/hwpreader.cxx | 16 ++++++++-------- 4 files changed, 20 insertions(+), 9 deletions(-)
New commits: commit 46eb2fa586b683858dc35cc535e0f30108b1cdbe Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Thu Nov 24 13:48:30 2022 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Thu Nov 24 17:37:21 2022 +0100 hwpfilter: Fix use of std::char_trait<unsigned short> ...now that it is gone from libc++ 16 trunk since <https://github.com/llvm/llvm-project/commit/aeecef08c385b1e4955155dd649a2d3724463849> "[libc++] Remove default definition of std::char_traits", causing > In file included from hwpfilter/source/formula.cxx:20: > In file included from hwpfilter/source/formula.h:23: > In file included from workdir/UnoApiHeadersTarget/offapi/normal/com/sun/star/xml/sax/XDocumentHandler.hpp:6: > In file included from workdir/UnoApiHeadersTarget/offapi/normal/com/sun/star/xml/sax/XDocumentHandler.hdl:6: > In file included from workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/uno/XInterface.hdl:6: > In file included from include/com/sun/star/uno/Any.h:30: > In file included from include/rtl/ustring.hxx:34: > In file included from ~/llvm/inst/bin/../include/c++/v1/ostream:170: > In file included from ~/llvm/inst/bin/../include/c++/v1/bitset:131: > ~/llvm/inst/bin/../include/c++/v1/string:676:46: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' > static_assert(( is_same<_CharT, typename traits_type::char_type>::value), > ^ > hwpfilter/source/hwplib.h:47:10: note: in instantiation of template class 'std::basic_string<unsigned short>' requested here > if (s.length() > o3tl::make_unsigned(std::numeric_limits<sal_Int32>::max())) { > ^ > ~/llvm/inst/bin/../include/c++/v1/__fwd/string.h:22:29: note: template is declared here > struct _LIBCPP_TEMPLATE_VIS char_traits; > ^ Change-Id: Ied437a079cb66c8b49f9980ab29b59ec5e2097d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143238 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx index f9d5b3ab6008..637489aee04b 100644 --- a/hwpfilter/source/hwpfile.cxx +++ b/hwpfilter/source/hwpfile.cxx @@ -139,6 +139,16 @@ bool HWPFile::Read2b(unsigned short &out) return hiodev && hiodev->read2b(out); } +bool HWPFile::Read2b(char16_t &out) +{ + unsigned short n; + auto const ok = Read2b(n); + if (ok) { + out = n; + } + return ok; +} + bool HWPFile::Read4b(unsigned int &out) { return hiodev && hiodev->read4b(out); diff --git a/hwpfilter/source/hwpfile.h b/hwpfilter/source/hwpfile.h index 72d22a5aeb95..2c4d7e7bdc9e 100644 --- a/hwpfilter/source/hwpfile.h +++ b/hwpfilter/source/hwpfile.h @@ -130,6 +130,7 @@ class DLLEXPORT HWPFile * Reads two byte from HIODev */ bool Read2b(unsigned short &out); + bool Read2b(char16_t &out); /** * Reads four byte from HIODev */ diff --git a/hwpfilter/source/hwplib.h b/hwpfilter/source/hwplib.h index ec438d36134e..48c0cb4a3146 100644 --- a/hwpfilter/source/hwplib.h +++ b/hwpfilter/source/hwplib.h @@ -33,7 +33,7 @@ /** * size of hunit is 4 since hwp96 version */ -typedef unsigned short hchar; +typedef char16_t hchar; typedef int hunit; typedef unsigned char kchar; diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index 5db11d92b848..3cab4cb9ba72 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -239,21 +239,21 @@ void HwpReader::makeMeta() if (hwpinfo.summary.title[0]) { startEl("dc:title"); - chars(hstr2OUString(hwpinfo.summary.title)); + chars(hstr2OUString(reinterpret_cast<hchar *>(hwpinfo.summary.title))); endEl("dc:title"); } if (hwpinfo.summary.subject[0]) { startEl("dc:subject"); - chars(hstr2OUString(hwpinfo.summary.subject)); + chars(hstr2OUString(reinterpret_cast<hchar *>(hwpinfo.summary.subject))); endEl("dc:subject"); } if (hwpinfo.summary.author[0]) { startEl("meta:initial-creator"); - chars(hstr2OUString(hwpinfo.summary.author)); + chars(hstr2OUString(reinterpret_cast<hchar *>(hwpinfo.summary.author))); endEl("meta:initial-creator"); } @@ -327,31 +327,31 @@ void HwpReader::makeMeta() if (hwpinfo.summary.keyword[0][0]) { startEl("meta:keyword"); - chars(hstr2OUString(hwpinfo.summary.keyword[0])); + chars(hstr2OUString(reinterpret_cast<hchar *>(hwpinfo.summary.keyword[0]))); endEl("meta:keyword"); } if (hwpinfo.summary.keyword[1][0]) { startEl("meta:keyword"); - chars(hstr2OUString(hwpinfo.summary.keyword[1])); + chars(hstr2OUString(reinterpret_cast<hchar *>(hwpinfo.summary.keyword[1]))); endEl("meta:keyword"); } if (hwpinfo.summary.etc[0][0]) { startEl("meta:keyword"); - chars(hstr2OUString(hwpinfo.summary.etc[0])); + chars(hstr2OUString(reinterpret_cast<hchar *>(hwpinfo.summary.etc[0]))); endEl("meta:keyword"); } if (hwpinfo.summary.etc[1][0]) { startEl("meta:keyword"); - chars(hstr2OUString(hwpinfo.summary.etc[1])); + chars(hstr2OUString(reinterpret_cast<hchar *>(hwpinfo.summary.etc[1]))); endEl("meta:keyword"); } if (hwpinfo.summary.etc[2][0]) { startEl("meta:keyword"); - chars(hstr2OUString(hwpinfo.summary.etc[2])); + chars(hstr2OUString(reinterpret_cast<hchar *>(hwpinfo.summary.etc[2]))); endEl("meta:keyword"); } endEl("meta:keywords");