Source: openttd
Source-Version: 1.8.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-05

---

--- openttd-1.8.0.orig/src/gfx_layout.cpp
+++ openttd-1.8.0/src/gfx_layout.cpp
@@ -126,7 +126,7 @@ static size_t AppendToBuffer(UChar *buff
  * Wrapper for doing layouts with ICU.
  */
 class ICUParagraphLayout : public AutoDeleteSmallVector<ParagraphLayouter::Line *, 4>, public ParagraphLayouter {
-	ParagraphLayout *p; ///< The actual ICU paragraph layout.
+	icu::ParagraphLayout *p; ///< The actual ICU paragraph layout.
 public:
 	/** Helper for GetLayouter, to get the right type. */
 	typedef UChar CharType;
@@ -135,10 +135,10 @@ public:
 
 	/** Visual run contains data about the bit of text with the same font. */
 	class ICUVisualRun : public ParagraphLayouter::VisualRun {
-		const ParagraphLayout::VisualRun *vr; ///< The actual ICU vr.
+		const icu::ParagraphLayout::VisualRun *vr; ///< The actual ICU vr.
 
 	public:
-		ICUVisualRun(const ParagraphLayout::VisualRun *vr) : vr(vr) { }
+		ICUVisualRun(const icu::ParagraphLayout::VisualRun *vr) : vr(vr) { }
 
 		const Font *GetFont() const          { return (const Font*)vr->getFont(); }
 		int GetGlyphCount() const            { return vr->getGlyphCount(); }
@@ -150,10 +150,10 @@ public:
 
 	/** A single line worth of VisualRuns. */
 	class ICULine : public AutoDeleteSmallVector<ICUVisualRun *, 4>, public ParagraphLayouter::Line {
-		ParagraphLayout::Line *l; ///< The actual ICU line.
+		icu::ParagraphLayout::Line *l; ///< The actual ICU line.
 
 	public:
-		ICULine(ParagraphLayout::Line *l) : l(l)
+		ICULine(icu::ParagraphLayout::Line *l) : l(l)
 		{
 			for (int i = 0; i < l->countRuns(); i++) {
 				*this->Append() = new ICUVisualRun(l->getVisualRun(i));
@@ -173,13 +173,13 @@ public:
 		}
 	};
 
-	ICUParagraphLayout(ParagraphLayout *p) : p(p) { }
+	ICUParagraphLayout(icu::ParagraphLayout *p) : p(p) { }
 	~ICUParagraphLayout() { delete p; }
 	void Reflow() { p->reflow(); }
 
 	ParagraphLayouter::Line *NextLine(int max_width)
 	{
-		ParagraphLayout::Line *l = p->nextLine(max_width);
+		icu::ParagraphLayout::Line *l = p->nextLine(max_width);
 		return l == NULL ? NULL : new ICULine(l);
 	}
 };
@@ -196,7 +196,7 @@ static ParagraphLayouter *GetParagraphLa
 	}
 
 	/* Fill ICU's FontRuns with the right data. */
-	FontRuns runs(fontMapping.Length());
+	icu::FontRuns runs(fontMapping.Length());
 	for (FontMap::iterator iter = fontMapping.Begin(); iter != fontMapping.End(); iter++) {
 		runs.add(iter->second, iter->first);
 	}
@@ -204,7 +204,7 @@ static ParagraphLayouter *GetParagraphLa
 	LEErrorCode status = LE_NO_ERROR;
 	/* ParagraphLayout does not copy "buff", so it must stay valid.
 	 * "runs" is copied according to the ICU source, but the documentation does not specify anything, so this might break somewhen. */
-	ParagraphLayout *p = new ParagraphLayout(buff, length, &runs, NULL, NULL, NULL, _current_text_dir == TD_RTL ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR, false, status);
+	icu::ParagraphLayout *p = new icu::ParagraphLayout(buff, length, &runs, NULL, NULL, NULL, _current_text_dir == TD_RTL ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR, false, status);
 	if (status != LE_NO_ERROR) {
 		delete p;
 		return NULL;
--- openttd-1.8.0.orig/src/gfx_layout.h
+++ openttd-1.8.0/src/gfx_layout.h
@@ -21,7 +21,7 @@
 
 #ifdef WITH_ICU_LAYOUT
 #include "layout/ParagraphLayout.h"
-#define ICU_FONTINSTANCE : public LEFontInstance
+#define ICU_FONTINSTANCE : public icu::LEFontInstance
 #else /* WITH_ICU_LAYOUT */
 #define ICU_FONTINSTANCE
 #endif /* WITH_ICU_LAYOUT */
--- openttd-1.8.0.orig/src/language.h
+++ openttd-1.8.0/src/language.h
@@ -105,7 +105,7 @@ extern LanguageList _languages;
 extern const LanguageMetadata *_current_language;
 
 #ifdef WITH_ICU_SORT
-extern Collator *_current_collator;
+extern icu::Collator *_current_collator;
 #endif /* WITH_ICU_SORT */
 
 bool ReadLanguagePack(const LanguageMetadata *lang);
--- openttd-1.8.0.orig/src/strings.cpp
+++ openttd-1.8.0/src/strings.cpp
@@ -52,7 +52,7 @@ const LanguageMetadata *_current_languag
 TextDirection _current_text_dir; ///< Text direction of the currently selected language.
 
 #ifdef WITH_ICU_SORT
-Collator *_current_collator = NULL;               ///< Collator for the language currently in use.
+icu::Collator *_current_collator = NULL;               ///< Collator for the language currently in use.
 #endif /* WITH_ICU_SORT */
 
 static uint64 _global_string_params_data[20];     ///< Global array of string parameters. To access, use #SetDParam.
@@ -1795,7 +1795,7 @@ bool ReadLanguagePack(const LanguageMeta
 
 	/* Create a collator instance for our current locale. */
 	UErrorCode status = U_ZERO_ERROR;
-	_current_collator = Collator::createInstance(Locale(_current_language->isocode), status);
+	_current_collator = icu::Collator::createInstance(icu::Locale(_current_language->isocode), status);
 	/* Sort number substrings by their numerical value. */
 	if (_current_collator != NULL) _current_collator->setAttribute(UCOL_NUMERIC_COLLATION, UCOL_ON, status);
 	/* Avoid using the collator if it is not correctly set. */

Reply via email to