Source: libkiwix
Source-Version: 0.2.0-1
Severity: important
Tags: patch
Usertags: icu63

Dear Maintainer,

ICU 63.1 recently released, packaged and uploaded to experimental.
Its transition is going to start soon. However your package fails to
build with this version. I attach a patch which fixes the problem.
Please check if it works with the version in Sid and upload the
package when it's feasible for you.

Thanks,
Laszlo/GCS
Description: fix FTBFS with ICU 63.1
 Add icu namespace.
Author: Laszlo Boszormenyi (GCS) <gcs@debian.org>
Last-Update: 2018-11-07

---

--- libkiwix-0.2.0.orig/include/common/stringTools.h
+++ libkiwix-0.2.0/include/common/stringTools.h
@@ -38,7 +38,7 @@ namespace kiwix {
   std::string beautifyFileSize(const unsigned int number);
   std::string urlEncode(const std::string &c);
   void printStringInHexadecimal(const char *s);
-  void printStringInHexadecimal(UnicodeString s);
+  void printStringInHexadecimal(icu::UnicodeString s);
   void stringReplacement(std::string& str, const std::string& oldStr, const std::string& newStr);
   std::string encodeDiples(const std::string& str);
 
--- libkiwix-0.2.0.orig/src/common/regexTools.cpp
+++ libkiwix-0.2.0/src/common/regexTools.cpp
@@ -19,11 +19,11 @@
 
 #include <common/regexTools.h>
 
-std::map<std::string, RegexMatcher*> regexCache;
+std::map<std::string, icu::RegexMatcher*> regexCache;
 
-RegexMatcher *buildRegex(const std::string &regex) {
-  RegexMatcher *matcher;
-  std::map<std::string, RegexMatcher*>::iterator itr = regexCache.find(regex);
+icu::RegexMatcher *buildRegex(const std::string &regex) {
+  icu::RegexMatcher *matcher;
+  std::map<std::string, icu::RegexMatcher*>::iterator itr = regexCache.find(regex);
   
   /* Regex is in cache */
   if (itr != regexCache.end()) {
@@ -33,8 +33,8 @@ RegexMatcher *buildRegex(const std::stri
   /* Regex needs to be parsed (and cached) */
   else {
     UErrorCode status = U_ZERO_ERROR;
-    UnicodeString uregex = UnicodeString(regex.c_str());
-    matcher = new RegexMatcher(uregex, UREGEX_CASE_INSENSITIVE, status);
+    icu::UnicodeString uregex = icu::UnicodeString(regex.c_str());
+    matcher = new icu::RegexMatcher(uregex, UREGEX_CASE_INSENSITIVE, status);
     regexCache[regex] = matcher;
   }
 
@@ -47,20 +47,20 @@ void freeRegexCache() {
 
 bool matchRegex(const std::string &content, const std::string &regex) {
   ucnv_setDefaultName("UTF-8");
-  UnicodeString ucontent = UnicodeString(content.c_str());
-  RegexMatcher *matcher = buildRegex(regex);
+  icu::UnicodeString ucontent = icu::UnicodeString(content.c_str());
+  icu::RegexMatcher *matcher = buildRegex(regex);
   matcher->reset(ucontent);
   return matcher->find();
 }
 
 std::string replaceRegex(const std::string &content, const std::string &replacement, const std::string &regex) {
   ucnv_setDefaultName("UTF-8");
-  UnicodeString ucontent = UnicodeString(content.c_str());
-  UnicodeString ureplacement = UnicodeString(replacement.c_str());
-  RegexMatcher *matcher = buildRegex(regex);
+  icu::UnicodeString ucontent = icu::UnicodeString(content.c_str());
+  icu::UnicodeString ureplacement = icu::UnicodeString(replacement.c_str());
+  icu::RegexMatcher *matcher = buildRegex(regex);
   matcher->reset(ucontent);
   UErrorCode status = U_ZERO_ERROR;
-  UnicodeString uresult = matcher->replaceAll(ureplacement, status);
+  icu::UnicodeString uresult = matcher->replaceAll(ureplacement, status);
   std::string tmp;
   uresult.toUTF8String(tmp);
   return tmp;
@@ -68,9 +68,9 @@ std::string replaceRegex(const std::stri
 
 std::string appendToFirstOccurence(const std::string &content, const  std::string regex, const std::string &replacement) {
   ucnv_setDefaultName("UTF-8");
-  UnicodeString ucontent = UnicodeString(content.c_str());
-  UnicodeString ureplacement = UnicodeString(replacement.c_str());
-  RegexMatcher *matcher = buildRegex(regex);
+  icu::UnicodeString ucontent = icu::UnicodeString(content.c_str());
+  icu::UnicodeString ureplacement = icu::UnicodeString(replacement.c_str());
+  icu::RegexMatcher *matcher = buildRegex(regex);
   matcher->reset(ucontent);
 
   if (matcher->find()) {
--- libkiwix-0.2.0.orig/src/common/stringTools.cpp
+++ libkiwix-0.2.0/src/common/stringTools.cpp
@@ -44,8 +44,8 @@ std::string kiwix::removeAccents(const s
   loadICUExternalTables();
   ucnv_setDefaultName("UTF-8");
   UErrorCode status = U_ZERO_ERROR;
-  Transliterator *removeAccentsTrans = Transliterator::createInstance("Lower; NFD; [:M:] remove; NFC", UTRANS_FORWARD, status);
-  UnicodeString ustring = UnicodeString(text.c_str());
+  icu::Transliterator *removeAccentsTrans = icu::Transliterator::createInstance("Lower; NFD; [:M:] remove; NFC", UTRANS_FORWARD, status);
+  icu::UnicodeString ustring = icu::UnicodeString(text.c_str());
   removeAccentsTrans->transliterate(ustring);
   delete removeAccentsTrans;
   std::string unaccentedText;
@@ -79,7 +79,7 @@ std::string kiwix::beautifyFileSize(cons
   }
 }
 
-void kiwix::printStringInHexadecimal(UnicodeString s) {
+void kiwix::printStringInHexadecimal(icu::UnicodeString s) {
   std::cout << std::showbase << std::hex;
   for (int i=0; i<s.length(); i++) {
     char c = (char)((s.getTerminatedBuffer())[i]);
@@ -215,8 +215,8 @@ std::string kiwix::ucFirst (const std::s
 
   std::string result;
 
-  UnicodeString unicodeWord(word.c_str());
-  UnicodeString unicodeFirstLetter = UnicodeString(unicodeWord, 0, 1).toUpper();
+  icu::UnicodeString unicodeWord(word.c_str());
+  icu::UnicodeString unicodeFirstLetter = icu::UnicodeString(unicodeWord, 0, 1).toUpper();
   unicodeWord.replace(0, 1, unicodeFirstLetter);
   unicodeWord.toUTF8String(result);
 
@@ -229,7 +229,7 @@ std::string kiwix::ucAll (const std::str
 
   std::string result;
 
-  UnicodeString unicodeWord(word.c_str());
+  icu::UnicodeString unicodeWord(word.c_str());
   unicodeWord.toUpper().toUTF8String(result);
 
   return result;
@@ -241,8 +241,8 @@ std::string kiwix::lcFirst (const std::s
 
   std::string result;
 
-  UnicodeString unicodeWord(word.c_str());
-  UnicodeString unicodeFirstLetter = UnicodeString(unicodeWord, 0, 1).toLower();
+  icu::UnicodeString unicodeWord(word.c_str());
+  icu::UnicodeString unicodeFirstLetter = icu::UnicodeString(unicodeWord, 0, 1).toLower();
   unicodeWord.replace(0, 1, unicodeFirstLetter);
   unicodeWord.toUTF8String(result);
 
@@ -255,7 +255,7 @@ std::string kiwix::lcAll (const std::str
 
   std::string result;
 
-  UnicodeString unicodeWord(word.c_str());
+  icu::UnicodeString unicodeWord(word.c_str());
   unicodeWord.toLower().toUTF8String(result);
 
   return result;
@@ -267,7 +267,7 @@ std::string kiwix::toTitle (const std::s
 
   std::string result;
 
-  UnicodeString unicodeWord(word.c_str());
+  icu::UnicodeString unicodeWord(word.c_str());
   unicodeWord = unicodeWord.toTitle(0);
   unicodeWord.toUTF8String(result);
 

Reply via email to