From 73de58376ac8f983ae64a643e01ec5bf047208d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sun, 10 May 2015 21:13:59 +0200 Subject: [PATCH] Update icu x86_64 package with namespace renaming enabled. "Renaming" means the icu namespace is suffixed with the version number, atm icu_55. Using "renaming" allows to use two different versions of ICU, thus easing upgrades. For instance haikuwebkit uses a current version of ICU, while the system uses a newer one after an upgrade. * Replace all uses of the icu namespace in our public headers, with a macro defaulting to icu. As the namespace is only used for private fields pointers, there should be no impact. * Locale kit *.cpp have to import the macro from *before* including any locale headers. Ditto for a Time preferences cpp file. This way, the correct current icu namespace is referenced. * Fixes bug #12057. --- build/jam/repositories/HaikuPorts/x86_64 | 4 ++-- headers/os/locale/Collator.h | 7 +++++-- headers/os/locale/Country.h | 7 +++++-- headers/os/locale/DateFormat.h | 7 +++++-- headers/os/locale/DateTimeFormat.h | 2 +- headers/os/locale/DurationFormat.h | 7 +++++-- headers/os/locale/FormattingConventions.h | 7 +++++-- headers/os/locale/Language.h | 7 +++++-- headers/os/locale/MessageFormat.h | 9 ++++++--- headers/os/locale/TimeFormat.h | 2 +- headers/os/locale/TimeUnitFormat.h | 7 +++++-- headers/os/locale/TimeZone.h | 9 ++++++--- src/kits/locale/Collator.cpp | 4 +++- src/kits/locale/Country.cpp | 1 + src/kits/locale/DateFormat.cpp | 1 + src/kits/locale/DateTimeFormat.cpp | 1 + src/kits/locale/DurationFormat.cpp | 1 + src/kits/locale/FormattingConventions.cpp | 1 + src/kits/locale/Language.cpp | 1 + src/kits/locale/LocaleRoster.cpp | 1 + src/kits/locale/LocaleRosterData.cpp | 1 + src/kits/locale/MessageFormat.cpp | 2 ++ src/kits/locale/NumberFormat.cpp | 1 + src/kits/locale/TimeFormat.cpp | 1 + src/kits/locale/TimeUnitFormat.cpp | 1 + src/kits/locale/TimeZone.cpp | 1 + src/preferences/time/ZoneView.cpp | 1 + 27 files changed, 69 insertions(+), 25 deletions(-) diff --git a/build/jam/repositories/HaikuPorts/x86_64 b/build/jam/repositories/HaikuPorts/x86_64 index 631649e319..1beb244ed1 100644 --- a/build/jam/repositories/HaikuPorts/x86_64 +++ b/build/jam/repositories/HaikuPorts/x86_64 @@ -97,8 +97,8 @@ RemotePackageRepository HaikuPorts harfbuzz_devel-0.9.39-1 help2man-1.44.1-1 htmldoc-1.8.27-3 - icu-55.1-2 - icu_devel-55.1-2 + icu-55.1-3 + icu_devel-55.1-3 icu54-54.1-1 icu54_devel-54.1-1 intltool-0.40.6-4 diff --git a/headers/os/locale/Collator.h b/headers/os/locale/Collator.h index 861ccfe812..58afa695a0 100644 --- a/headers/os/locale/Collator.h +++ b/headers/os/locale/Collator.h @@ -10,7 +10,10 @@ #include -namespace icu { +#ifndef U_ICU_NAMESPACE + #define U_ICU_NAMESPACE icu +#endif +namespace U_ICU_NAMESPACE { class Collator; }; @@ -73,7 +76,7 @@ public: private: status_t _SetStrength(int8 strength) const; - mutable icu::Collator* fICUCollator; + mutable U_ICU_NAMESPACE::Collator* fICUCollator; int8 fDefaultStrength; bool fIgnorePunctuation; }; diff --git a/headers/os/locale/Country.h b/headers/os/locale/Country.h index e8e9c92a21..681910e895 100644 --- a/headers/os/locale/Country.h +++ b/headers/os/locale/Country.h @@ -16,7 +16,10 @@ class BBitmap; class BLanguage; class BMessage; -namespace icu { +#ifndef U_ICU_NAMESPACE + #define U_ICU_NAMESPACE icu +#endif +namespace U_ICU_NAMESPACE { class DateFormat; class Locale; } @@ -45,7 +48,7 @@ public: private: friend class Private; - icu::Locale* fICULocale; + U_ICU_NAMESPACE::Locale* fICULocale; }; diff --git a/headers/os/locale/DateFormat.h b/headers/os/locale/DateFormat.h index 1eee1e81b2..76a0567a2c 100644 --- a/headers/os/locale/DateFormat.h +++ b/headers/os/locale/DateFormat.h @@ -14,7 +14,10 @@ #include -namespace icu { +#ifndef U_ICU_NAMESPACE + #define U_ICU_NAMESPACE icu +#endif +namespace U_ICU_NAMESPACE { class DateFormat; } @@ -76,7 +79,7 @@ public: BDate& output); private: - icu::DateFormat* _CreateDateFormatter( + U_ICU_NAMESPACE::DateFormat* _CreateDateFormatter( const BDateFormatStyle style) const; }; diff --git a/headers/os/locale/DateTimeFormat.h b/headers/os/locale/DateTimeFormat.h index b7916cfa9c..5a0e3a05e4 100644 --- a/headers/os/locale/DateTimeFormat.h +++ b/headers/os/locale/DateTimeFormat.h @@ -53,7 +53,7 @@ public: const BTimeZone* timeZone = NULL) const; private: - icu::DateFormat* _CreateDateTimeFormatter( + U_ICU_NAMESPACE::DateFormat* _CreateDateTimeFormatter( const BString& format) const; }; diff --git a/headers/os/locale/DurationFormat.h b/headers/os/locale/DurationFormat.h index d1f226ed68..9a529ec21e 100644 --- a/headers/os/locale/DurationFormat.h +++ b/headers/os/locale/DurationFormat.h @@ -14,7 +14,10 @@ class BTimeZone; -namespace icu { +#ifndef U_ICU_NAMESPACE + #define U_ICU_NAMESPACE icu +#endif +namespace U_ICU_NAMESPACE { class GregorianCalendar; } @@ -43,7 +46,7 @@ public: private: BString fSeparator; BTimeUnitFormat fTimeUnitFormat; - icu::GregorianCalendar* fCalendar; + U_ICU_NAMESPACE::GregorianCalendar* fCalendar; }; diff --git a/headers/os/locale/FormattingConventions.h b/headers/os/locale/FormattingConventions.h index b526ef3906..9a888f8aac 100644 --- a/headers/os/locale/FormattingConventions.h +++ b/headers/os/locale/FormattingConventions.h @@ -17,7 +17,10 @@ class BBitmap; class BLanguage; class BMessage; -namespace icu { +#ifndef U_ICU_NAMESPACE + #define U_ICU_NAMESPACE icu +#endif +namespace U_ICU_NAMESPACE { class DateFormat; class Locale; } @@ -137,7 +140,7 @@ private: bool fUseStringsFromPreferredLanguage; - icu::Locale* fICULocale; + U_ICU_NAMESPACE::Locale* fICULocale; }; diff --git a/headers/os/locale/Language.h b/headers/os/locale/Language.h index 133e798c8f..6f1136e710 100644 --- a/headers/os/locale/Language.h +++ b/headers/os/locale/Language.h @@ -15,7 +15,10 @@ class BBitmap; // We must not include the icu headers in there as it could mess up binary // compatibility. -namespace icu { +#ifndef U_ICU_NAMESPACE + #define U_ICU_NAMESPACE icu +#endif +namespace U_ICU_NAMESPACE { class Locale; } @@ -64,7 +67,7 @@ private: friend class Private; uint8 fDirection; - icu::Locale* fICULocale; + U_ICU_NAMESPACE::Locale* fICULocale; }; diff --git a/headers/os/locale/MessageFormat.h b/headers/os/locale/MessageFormat.h index eeaf978c00..38fb2054ad 100644 --- a/headers/os/locale/MessageFormat.h +++ b/headers/os/locale/MessageFormat.h @@ -13,7 +13,10 @@ #include -namespace icu { +#ifndef U_ICU_NAMESPACE + #define U_ICU_NAMESPACE icu +#endif +namespace U_ICU_NAMESPACE { class MessageFormat; class UnicodeString; } @@ -31,10 +34,10 @@ public: status_t Format(BString& buffer, const int64 arg) const; private: - status_t _Initialize(const icu::UnicodeString&); + status_t _Initialize(const U_ICU_NAMESPACE::UnicodeString&); private: - icu::MessageFormat* fFormatter; + U_ICU_NAMESPACE::MessageFormat* fFormatter; }; diff --git a/headers/os/locale/TimeFormat.h b/headers/os/locale/TimeFormat.h index 9a1dc0406d..152b872f8b 100644 --- a/headers/os/locale/TimeFormat.h +++ b/headers/os/locale/TimeFormat.h @@ -48,7 +48,7 @@ public: BPrivate::BTime& output); private: - icu::DateFormat* _CreateTimeFormatter( + U_ICU_NAMESPACE::DateFormat* _CreateTimeFormatter( const BTimeFormatStyle style) const; }; diff --git a/headers/os/locale/TimeUnitFormat.h b/headers/os/locale/TimeUnitFormat.h index d729efe90a..447284bb19 100644 --- a/headers/os/locale/TimeUnitFormat.h +++ b/headers/os/locale/TimeUnitFormat.h @@ -12,7 +12,10 @@ class BString; -namespace icu { +#ifndef U_ICU_NAMESPACE + #define U_ICU_NAMESPACE icu +#endif +namespace U_ICU_NAMESPACE { class TimeUnitFormat; } @@ -53,7 +56,7 @@ public: ) const; private: - icu::TimeUnitFormat* fFormatter; + U_ICU_NAMESPACE::TimeUnitFormat* fFormatter; }; diff --git a/headers/os/locale/TimeZone.h b/headers/os/locale/TimeZone.h index ced9e9050a..f58f99da85 100644 --- a/headers/os/locale/TimeZone.h +++ b/headers/os/locale/TimeZone.h @@ -9,7 +9,10 @@ #include -namespace icu { +#ifndef U_ICU_NAMESPACE + #define U_ICU_NAMESPACE icu +#endif +namespace U_ICU_NAMESPACE { class Locale; class TimeZone; } @@ -46,8 +49,8 @@ public: private: friend class Private; - icu::TimeZone* fICUTimeZone; - icu::Locale* fICULocale; + U_ICU_NAMESPACE::TimeZone* fICUTimeZone; + U_ICU_NAMESPACE::Locale* fICULocale; status_t fInitStatus; mutable uint32 fInitializedFields; diff --git a/src/kits/locale/Collator.cpp b/src/kits/locale/Collator.cpp index 47d7f55a3f..cfb0f9445a 100644 --- a/src/kits/locale/Collator.cpp +++ b/src/kits/locale/Collator.cpp @@ -5,13 +5,15 @@ */ +#include +#include + #include #include #include #include -#include #include #include #include diff --git a/src/kits/locale/Country.cpp b/src/kits/locale/Country.cpp index 8b67c9e743..e95711d5f0 100644 --- a/src/kits/locale/Country.cpp +++ b/src/kits/locale/Country.cpp @@ -5,6 +5,7 @@ */ +#include #include #include diff --git a/src/kits/locale/DateFormat.cpp b/src/kits/locale/DateFormat.cpp index ae067ab391..6542c3ba3e 100644 --- a/src/kits/locale/DateFormat.cpp +++ b/src/kits/locale/DateFormat.cpp @@ -7,6 +7,7 @@ * Adrien Desutugues */ +#include #include #include diff --git a/src/kits/locale/DateTimeFormat.cpp b/src/kits/locale/DateTimeFormat.cpp index 4e856ceaa2..7172257dd7 100644 --- a/src/kits/locale/DateTimeFormat.cpp +++ b/src/kits/locale/DateTimeFormat.cpp @@ -6,6 +6,7 @@ * Oliver Tappe */ +#include #include #include diff --git a/src/kits/locale/DurationFormat.cpp b/src/kits/locale/DurationFormat.cpp index 1d11ced2f0..9536480b38 100644 --- a/src/kits/locale/DurationFormat.cpp +++ b/src/kits/locale/DurationFormat.cpp @@ -7,6 +7,7 @@ */ +#include #include #include diff --git a/src/kits/locale/FormattingConventions.cpp b/src/kits/locale/FormattingConventions.cpp index 75353001cb..0ae512fee5 100644 --- a/src/kits/locale/FormattingConventions.cpp +++ b/src/kits/locale/FormattingConventions.cpp @@ -6,6 +6,7 @@ */ +#include #include #include diff --git a/src/kits/locale/Language.cpp b/src/kits/locale/Language.cpp index 1b140c7f48..047f58258d 100644 --- a/src/kits/locale/Language.cpp +++ b/src/kits/locale/Language.cpp @@ -4,6 +4,7 @@ */ +#include #include #include diff --git a/src/kits/locale/LocaleRoster.cpp b/src/kits/locale/LocaleRoster.cpp index 748c9882ba..1770960180 100644 --- a/src/kits/locale/LocaleRoster.cpp +++ b/src/kits/locale/LocaleRoster.cpp @@ -8,6 +8,7 @@ */ +#include #include #include diff --git a/src/kits/locale/LocaleRosterData.cpp b/src/kits/locale/LocaleRosterData.cpp index 2efbc99c1e..b1f9dfd7d1 100644 --- a/src/kits/locale/LocaleRosterData.cpp +++ b/src/kits/locale/LocaleRosterData.cpp @@ -8,6 +8,7 @@ */ +#include #include #include diff --git a/src/kits/locale/MessageFormat.cpp b/src/kits/locale/MessageFormat.cpp index 4c66e5a08f..274d4ac8a7 100644 --- a/src/kits/locale/MessageFormat.cpp +++ b/src/kits/locale/MessageFormat.cpp @@ -6,6 +6,8 @@ * Adrien Destugues, pulkomandy@pulkomandy.tk * John Scipione, jscipione@gmail.com */ + +#include #include #include diff --git a/src/kits/locale/NumberFormat.cpp b/src/kits/locale/NumberFormat.cpp index f6368afd10..fefd4a3627 100644 --- a/src/kits/locale/NumberFormat.cpp +++ b/src/kits/locale/NumberFormat.cpp @@ -6,6 +6,7 @@ */ +#include #include #include diff --git a/src/kits/locale/TimeFormat.cpp b/src/kits/locale/TimeFormat.cpp index 4e258cb5b2..55cc534299 100644 --- a/src/kits/locale/TimeFormat.cpp +++ b/src/kits/locale/TimeFormat.cpp @@ -6,6 +6,7 @@ * Oliver Tappe */ +#include #include #include diff --git a/src/kits/locale/TimeUnitFormat.cpp b/src/kits/locale/TimeUnitFormat.cpp index de125a7777..61a8ba5a0a 100644 --- a/src/kits/locale/TimeUnitFormat.cpp +++ b/src/kits/locale/TimeUnitFormat.cpp @@ -8,6 +8,7 @@ */ +#include #include #include diff --git a/src/kits/locale/TimeZone.cpp b/src/kits/locale/TimeZone.cpp index 86258e3fd8..d4860c6463 100644 --- a/src/kits/locale/TimeZone.cpp +++ b/src/kits/locale/TimeZone.cpp @@ -8,6 +8,7 @@ */ +#include #include #include diff --git a/src/preferences/time/ZoneView.cpp b/src/preferences/time/ZoneView.cpp index 03ca2c9f41..d62bbef616 100644 --- a/src/preferences/time/ZoneView.cpp +++ b/src/preferences/time/ZoneView.cpp @@ -13,6 +13,7 @@ */ +#include #include "ZoneView.h" #include