libreoffice/0001-Make-charmap.cxx-compile-with-icu-4.4.patch
2013-08-28 11:03:11 +01:00

139 lines
6.5 KiB
Diff

From 163116da07b5b277b9f0489e2542fac6eef43cc9 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Fri, 31 May 2013 00:10:58 +0200
Subject: [PATCH] Make charmap.cxx compile with icu >= 4.4.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
configure.ac claims ICU >= 4.2 is supported. Make it so.
Change-Id: Ia08bb492f41dcb88bc84550edb51ce5e89fe1103
Reviewed-on: https://gerrit.libreoffice.org/4112
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 30c3032920be91741ab089966f7e458ce08d09a4)
---
i18npool/qa/cppunit/test_breakiterator.cxx | 4 +++-
i18nutil/source/utility/unicode.cxx | 6 +++---
svx/source/dialog/charmap.cxx | 5 +++++
sw/source/core/text/porlay.cxx | 4 ++++
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx
index 41e4077..b121f6d 100644
--- a/i18npool/qa/cppunit/test_breakiterator.cxx
+++ b/i18npool/qa/cppunit/test_breakiterator.cxx
@@ -16,7 +16,7 @@
#include <com/sun/star/i18n/WordType.hpp>
#include <unotest/bootstrapfixturebase.hxx>
-#include <unicode/uvernum.h>
+#include <unicode/uversion.h>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -233,6 +233,8 @@ void TestBreakIterator::testWordBoundaries()
}
//See https://bugs.freedesktop.org/show_bug.cgi?id=49629
+ //Note that the breakiterator test will fail on older icu versions
+ //(4.2.1) for the 200B (ZWSP) Zero Width Space testcase.
sal_Unicode aBreakTests[] = { ' ', 1, 2, 3, 4, 5, 6, 7, 0x91, 0x92, 0x200B, 0xE8FF, 0xF8FF };
for (int mode = i18n::WordType::ANY_WORD; mode <= i18n::WordType::WORD_COUNT; ++mode)
{
diff --git a/i18nutil/source/utility/unicode.cxx b/i18nutil/source/utility/unicode.cxx
index 2c2dd42..b46a7f6 100644
--- a/i18nutil/source/utility/unicode.cxx
+++ b/i18nutil/source/utility/unicode.cxx
@@ -826,6 +826,9 @@ OString SAL_CALL unicode::getExemplerLanguageForUScriptCode(UScriptCode eScript)
case USCRIPT_TAI_VIET:
sRet = "blt";
break;
+ case USCRIPT_MANDAEAN: /* Aliased to USCRIPT_MANDAIC in icu 4.6. */
+ sRet = "mic";
+ break;
#if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >= 4)
case USCRIPT_NABATAEAN: //no language with an assigned code yet
sRet = "mis";
@@ -833,9 +836,6 @@ OString SAL_CALL unicode::getExemplerLanguageForUScriptCode(UScriptCode eScript)
case USCRIPT_PALMYRENE: //no language with an assigned code yet
sRet = "mis";
break;
- case USCRIPT_MANDAIC:
- sRet = "mic";
- break;
case USCRIPT_BAMUM:
sRet = "bax";
break;
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index 82239d8..be165f8 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -1302,6 +1302,7 @@ void SubsetMap::InitList()
case UBLOCK_DOMINO_TILES:
aAllSubsets.push_back( Subset( 0x1F030, 0x1F09F, RID_SUBSETSTR_DOMINO_TILES ) );
break;
+#if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >= 4)
case UBLOCK_SAMARITAN:
aAllSubsets.push_back( Subset( 0x0800, 0x083F, RID_SUBSETSTR_SAMARITAN ) );
break;
@@ -1380,6 +1381,8 @@ void SubsetMap::InitList()
case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C:
aAllSubsets.push_back( Subset( 0x2A700, 0x2B73F, RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C ) );
break;
+#endif
+#if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >= 6)
case UBLOCK_MANDAIC:
aAllSubsets.push_back( Subset( 0x0840, 0x085F, RID_SUBSETSTR_MANDAIC ) );
break;
@@ -1416,6 +1419,8 @@ void SubsetMap::InitList()
case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D:
aAllSubsets.push_back( Subset( 0x2B740, 0x2B81F, RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D ) );
break;
+#endif
+// Note ICU version 49 (NOT 4.9), so the MAJOR_NUM is two digits.
#if U_ICU_VERSION_MAJOR_NUM >= 49
case UBLOCK_ARABIC_EXTENDED_A:
aAllSubsets.push_back( Subset( 0x08A0, 0x08FF, RID_SUBSETSTR_ARABIC_EXTENDED_A ) );
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index b820b8b..edc8458 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -72,7 +72,11 @@ using namespace i18n::ScriptType;
#define isRehChar(c) IS_JOINING_GROUP((c), REH)
#define isTehMarbutaChar(c) IS_JOINING_GROUP((c), TEH_MARBUTA)
#define isWawChar(c) IS_JOINING_GROUP((c), WAW)
+#if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >= 4)
#define isYehChar(c) (IS_JOINING_GROUP((c), YEH) || IS_JOINING_GROUP((c), FARSI_YEH))
+#else
+#define isYehChar(c) IS_JOINING_GROUP((c), YEH)
+#endif
#define isSeenOrSadChar(c) (IS_JOINING_GROUP((c), SAD) || IS_JOINING_GROUP((c), SEEN))
bool isTransparentChar ( sal_Unicode cCh )
diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx
--- a/i18npool/qa/cppunit/test_breakiterator.cxx
+++ b/i18npool/qa/cppunit/test_breakiterator.cxx
@@ -233,14 +233,18 @@
}
//See https://bugs.freedesktop.org/show_bug.cgi?id=49629
- //Note that the breakiterator test will fail on older icu versions
- //(4.2.1) for the 200B (ZWSP) Zero Width Space testcase.
sal_Unicode aBreakTests[] = { ' ', 1, 2, 3, 4, 5, 6, 7, 0x91, 0x92, 0x200B, 0xE8FF, 0xF8FF };
for (int mode = i18n::WordType::ANY_WORD; mode <= i18n::WordType::WORD_COUNT; ++mode)
{
//make sure that in all cases isBeginWord and isEndWord matches getWordBoundary
for (size_t i = 0; i < SAL_N_ELEMENTS(aBreakTests); ++i)
{
+#if (U_ICU_VERSION_MAJOR_NUM == 4) && (U_ICU_VERSION_MINOR_NUM <= 2)
+ //Note the breakiterator test is known to fail on older icu
+ //versions (4.2.1) for the 200B (ZWSP) Zero Width Space testcase.
+ if (aBreakTests[i] == 0x200B)
+ continue;
+#endif
OUString aTest("Word");
aTest += OUString(aBreakTests[i]) + OUString("Word");
aBounds = m_xBreak->getWordBoundary(aTest, 0, aLocale, mode, true);