You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

305 lines
9.3 KiB

  1. From 8d35a423838eb462cd39ee535c5d003073cc5f22 Mon Sep 17 00:00:00 2001
  2. From: Anatol Belski <ab@php.net>
  3. Date: Sat, 31 Mar 2018 18:51:03 +0200
  4. Subject: [PATCH] Utilize the recommended way to handle the icu namespace
  5. ---
  6. ext/intl/breakiterator/breakiterator_class.cpp | 1 +
  7. ext/intl/breakiterator/breakiterator_class.h | 2 ++
  8. ext/intl/breakiterator/breakiterator_methods.cpp | 2 ++
  9. ext/intl/breakiterator/codepointiterator_internal.cpp | 2 ++
  10. ext/intl/breakiterator/codepointiterator_internal.h | 3 +++
  11. ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp | 3 +++
  12. ext/intl/calendar/calendar_class.cpp | 3 +++
  13. ext/intl/calendar/calendar_class.h | 2 ++
  14. ext/intl/calendar/calendar_methods.cpp | 2 ++
  15. ext/intl/calendar/gregoriancalendar_methods.cpp | 7 +++++++
  16. ext/intl/common/common_date.cpp | 3 +++
  17. ext/intl/common/common_date.h | 2 ++
  18. ext/intl/common/common_enum.h | 1 +
  19. ext/intl/dateformat/dateformat_format_object.cpp | 6 ++++++
  20. ext/intl/dateformat/dateformat_helpers.cpp | 2 ++
  21. ext/intl/dateformat/dateformat_helpers.h | 5 +++++
  22. ext/intl/intl_convertcpp.h | 2 ++
  23. ext/intl/msgformat/msgformat_helpers.cpp | 10 ++++++++++
  24. ext/intl/timezone/timezone_class.cpp | 2 ++
  25. ext/intl/timezone/timezone_class.h | 2 ++
  26. ext/intl/timezone/timezone_methods.cpp | 4 ++++
  27. 21 files changed, 66 insertions(+)
  28. --- a/ext/intl/breakiterator/breakiterator_class.cpp
  29. +++ b/ext/intl/breakiterator/breakiterator_class.cpp
  30. @@ -38,6 +38,7 @@ extern "C" {
  31. }
  32. using PHP::CodePointBreakIterator;
  33. +using U_ICU_NAMESPACE::RuleBasedBreakIterator;
  34. /* {{{ Global variables */
  35. zend_class_entry *BreakIterator_ce_ptr;
  36. --- a/ext/intl/breakiterator/breakiterator_class.h
  37. +++ b/ext/intl/breakiterator/breakiterator_class.h
  38. @@ -26,6 +26,8 @@
  39. #ifndef USE_BREAKITERATOR_POINTER
  40. typedef void BreakIterator;
  41. +#else
  42. +using U_ICU_NAMESPACE::BreakIterator;
  43. #endif
  44. typedef struct {
  45. --- a/ext/intl/breakiterator/breakiterator_methods.cpp
  46. +++ b/ext/intl/breakiterator/breakiterator_methods.cpp
  47. @@ -32,6 +32,8 @@ extern "C" {
  48. }
  49. using PHP::CodePointBreakIterator;
  50. +using U_ICU_NAMESPACE::BreakIterator;
  51. +using U_ICU_NAMESPACE::Locale;
  52. U_CFUNC PHP_METHOD(BreakIterator, __construct)
  53. {
  54. --- a/ext/intl/breakiterator/codepointiterator_internal.cpp
  55. +++ b/ext/intl/breakiterator/codepointiterator_internal.cpp
  56. @@ -33,6 +33,8 @@ typedef union {
  57. using namespace PHP;
  58. +using U_ICU_NAMESPACE::UCharCharacterIterator;
  59. +
  60. UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CodePointBreakIterator);
  61. CodePointBreakIterator::CodePointBreakIterator()
  62. --- a/ext/intl/breakiterator/codepointiterator_internal.h
  63. +++ b/ext/intl/breakiterator/codepointiterator_internal.h
  64. @@ -18,8 +18,11 @@
  65. #define CODEPOINTITERATOR_INTERNAL_H
  66. #include <unicode/brkiter.h>
  67. +#include <unicode/unistr.h>
  68. using U_ICU_NAMESPACE::BreakIterator;
  69. +using U_ICU_NAMESPACE::CharacterIterator;
  70. +using U_ICU_NAMESPACE::UnicodeString;
  71. namespace PHP {
  72. --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
  73. +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
  74. @@ -26,6 +26,9 @@ extern "C" {
  75. #include "../intl_convertcpp.h"
  76. #include "../intl_common.h"
  77. +using U_ICU_NAMESPACE::RuleBasedBreakIterator;
  78. +using U_ICU_NAMESPACE::Locale;
  79. +
  80. static inline RuleBasedBreakIterator *fetch_rbbi(BreakIterator_object *bio) {
  81. return (RuleBasedBreakIterator*)bio->biter;
  82. }
  83. --- a/ext/intl/calendar/calendar_class.cpp
  84. +++ b/ext/intl/calendar/calendar_class.cpp
  85. @@ -34,6 +34,9 @@ extern "C" {
  86. #include <assert.h>
  87. }
  88. +using U_ICU_NAMESPACE::GregorianCalendar;
  89. +using U_ICU_NAMESPACE::Locale;
  90. +
  91. /* {{{ Global variables */
  92. zend_class_entry *Calendar_ce_ptr;
  93. zend_class_entry *GregorianCalendar_ce_ptr;
  94. --- a/ext/intl/calendar/calendar_class.h
  95. +++ b/ext/intl/calendar/calendar_class.h
  96. @@ -26,6 +26,8 @@
  97. #ifndef USE_CALENDAR_POINTER
  98. typedef void Calendar;
  99. +#else
  100. +using U_ICU_NAMESPACE::Calendar;
  101. #endif
  102. typedef struct {
  103. --- a/ext/intl/calendar/calendar_methods.cpp
  104. +++ b/ext/intl/calendar/calendar_methods.cpp
  105. @@ -40,6 +40,8 @@ extern "C" {
  106. }
  107. #include "../common/common_enum.h"
  108. +using U_ICU_NAMESPACE::Locale;
  109. +
  110. U_CFUNC PHP_METHOD(IntlCalendar, __construct)
  111. {
  112. zend_throw_exception( NULL,
  113. --- a/ext/intl/calendar/gregoriancalendar_methods.cpp
  114. +++ b/ext/intl/calendar/gregoriancalendar_methods.cpp
  115. @@ -23,6 +23,8 @@
  116. #include <unicode/locid.h>
  117. #include <unicode/calendar.h>
  118. #include <unicode/gregocal.h>
  119. +#include <unicode/ustring.h>
  120. +
  121. extern "C" {
  122. #include "../php_intl.h"
  123. #include "../intl_common.h"
  124. @@ -34,6 +36,11 @@ extern "C" {
  125. #include "zend_exceptions.h"
  126. }
  127. +using U_ICU_NAMESPACE::GregorianCalendar;
  128. +using U_ICU_NAMESPACE::Locale;
  129. +using U_ICU_NAMESPACE::UnicodeString;
  130. +using U_ICU_NAMESPACE::StringPiece;
  131. +
  132. static inline GregorianCalendar *fetch_greg(Calendar_object *co) {
  133. return (GregorianCalendar*)co->ucal;
  134. }
  135. --- a/ext/intl/common/common_date.cpp
  136. +++ b/ext/intl/common/common_date.cpp
  137. @@ -25,6 +25,9 @@ extern "C" {
  138. #include <ext/date/php_date.h>
  139. }
  140. +using U_ICU_NAMESPACE::TimeZone;
  141. +using U_ICU_NAMESPACE::UnicodeString;
  142. +
  143. #include "zend_portability.h"
  144. /* {{{ timezone_convert_datetimezone
  145. --- a/ext/intl/common/common_date.h
  146. +++ b/ext/intl/common/common_date.h
  147. @@ -28,6 +28,8 @@ U_CDECL_END
  148. #include <unicode/timezone.h>
  149. +using U_ICU_NAMESPACE::TimeZone;
  150. +
  151. U_CFUNC TimeZone *timezone_convert_datetimezone(int type, void *object, int is_datetime, intl_error *outside_error, const char *func);
  152. U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz,
  153. intl_error *err, const char *func);
  154. --- a/ext/intl/common/common_enum.h
  155. +++ b/ext/intl/common/common_enum.h
  156. @@ -75,6 +75,7 @@ U_CFUNC zval *zoi_with_current_get_curre
  157. U_CFUNC void zoi_with_current_invalidate_current(zend_object_iterator *iter);
  158. #ifdef __cplusplus
  159. +using U_ICU_NAMESPACE::StringEnumeration;
  160. U_CFUNC void IntlIterator_from_StringEnumeration(StringEnumeration *se, zval *object);
  161. #endif
  162. --- a/ext/intl/dateformat/dateformat_format_object.cpp
  163. +++ b/ext/intl/dateformat/dateformat_format_object.cpp
  164. @@ -33,6 +33,12 @@ extern "C" {
  165. #include "../common/common_date.h"
  166. }
  167. +using U_ICU_NAMESPACE::Locale;
  168. +using U_ICU_NAMESPACE::DateFormat;
  169. +using U_ICU_NAMESPACE::GregorianCalendar;
  170. +using U_ICU_NAMESPACE::StringPiece;
  171. +using U_ICU_NAMESPACE::SimpleDateFormat;
  172. +
  173. static const DateFormat::EStyle valid_styles[] = {
  174. DateFormat::kNone,
  175. DateFormat::kFull,
  176. --- a/ext/intl/dateformat/dateformat_helpers.cpp
  177. +++ b/ext/intl/dateformat/dateformat_helpers.cpp
  178. @@ -28,6 +28,8 @@ extern "C" {
  179. #include "../calendar/calendar_class.h"
  180. }
  181. +using U_ICU_NAMESPACE::GregorianCalendar;
  182. +
  183. int datefmt_process_calendar_arg(zval* calendar_zv,
  184. Locale const& locale,
  185. const char *func_name,
  186. --- a/ext/intl/dateformat/dateformat_helpers.h
  187. +++ b/ext/intl/dateformat/dateformat_helpers.h
  188. @@ -22,11 +22,16 @@
  189. #endif
  190. #include <unicode/calendar.h>
  191. +#include <unicode/datefmt.h>
  192. extern "C" {
  193. #include "../php_intl.h"
  194. }
  195. +using U_ICU_NAMESPACE::Locale;
  196. +using U_ICU_NAMESPACE::Calendar;
  197. +using U_ICU_NAMESPACE::DateFormat;
  198. +
  199. int datefmt_process_calendar_arg(zval* calendar_zv,
  200. Locale const& locale,
  201. const char *func_name,
  202. --- a/ext/intl/intl_convertcpp.h
  203. +++ b/ext/intl/intl_convertcpp.h
  204. @@ -26,6 +26,8 @@
  205. #include <unicode/unistr.h>
  206. #include <zend_types.h>
  207. +using U_ICU_NAMESPACE::UnicodeString;
  208. +
  209. int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status);
  210. zend_string* intl_charFromString(const UnicodeString &from, UErrorCode *status);
  211. --- a/ext/intl/msgformat/msgformat_helpers.cpp
  212. +++ b/ext/intl/msgformat/msgformat_helpers.cpp
  213. @@ -76,6 +76,16 @@ MessageFormatAdapter::getMessagePattern(
  214. #endif
  215. U_NAMESPACE_END
  216. +using U_ICU_NAMESPACE::Formattable;
  217. +using U_ICU_NAMESPACE::Format;
  218. +using U_ICU_NAMESPACE::DateFormat;
  219. +using U_ICU_NAMESPACE::MessageFormat;
  220. +#ifdef HAS_MESSAGE_PATTERN
  221. +using U_ICU_NAMESPACE::MessagePattern;
  222. +#endif
  223. +using U_ICU_NAMESPACE::MessageFormatAdapter;
  224. +using U_ICU_NAMESPACE::FieldPosition;
  225. +
  226. U_CFUNC int32_t umsg_format_arg_count(UMessageFormat *fmt)
  227. {
  228. int32_t fmt_count = 0;
  229. --- a/ext/intl/timezone/timezone_class.cpp
  230. +++ b/ext/intl/timezone/timezone_class.cpp
  231. @@ -37,6 +37,8 @@ extern "C" {
  232. #include <ext/date/php_date.h>
  233. }
  234. +using U_ICU_NAMESPACE::Calendar;
  235. +
  236. /* {{{ Global variables */
  237. U_CDECL_BEGIN
  238. zend_class_entry *TimeZone_ce_ptr = NULL;
  239. --- a/ext/intl/timezone/timezone_class.h
  240. +++ b/ext/intl/timezone/timezone_class.h
  241. @@ -29,6 +29,8 @@
  242. #ifndef USE_TIMEZONE_POINTER
  243. typedef void TimeZone;
  244. +#else
  245. +using U_ICU_NAMESPACE::TimeZone;
  246. #endif
  247. typedef struct {
  248. --- a/ext/intl/timezone/timezone_methods.cpp
  249. +++ b/ext/intl/timezone/timezone_methods.cpp
  250. @@ -23,6 +23,7 @@
  251. #include <unicode/locid.h>
  252. #include <unicode/timezone.h>
  253. #include <unicode/ustring.h>
  254. +#include <unicode/calendar.h>
  255. #include "intl_convertcpp.h"
  256. #include "../common/common_date.h"
  257. @@ -37,6 +38,9 @@ extern "C" {
  258. }
  259. #include "common/common_enum.h"
  260. +using U_ICU_NAMESPACE::Locale;
  261. +using U_ICU_NAMESPACE::Calendar;
  262. +
  263. U_CFUNC PHP_METHOD(IntlTimeZone, __construct)
  264. {
  265. zend_throw_exception( NULL,