summaryrefslogtreecommitdiff
path: root/ext/intl/timezone
diff options
context:
space:
mode:
authorGustavo André dos Santos Lopes <cataphract@php.net>2012-04-01 21:28:54 +0200
committerGustavo André dos Santos Lopes <cataphract@php.net>2012-04-01 23:28:01 +0100
commit95fbae891a653758a0e52879af808af7eedfb043 (patch)
treeeac7a015b341bf1a474fd0d1a65c5487f50c9288 /ext/intl/timezone
parent69f75bb43c7e6f2e8b4661ff48aaf68b9b9b2c5c (diff)
downloadphp-git-95fbae891a653758a0e52879af808af7eedfb043.tar.gz
Compatibility with old versions of ICU (4.0+).
Diffstat (limited to 'ext/intl/timezone')
-rw-r--r--ext/intl/timezone/timezone_class.cpp9
-rw-r--r--ext/intl/timezone/timezone_class.h3
-rw-r--r--ext/intl/timezone/timezone_methods.cpp6
3 files changed, 18 insertions, 0 deletions
diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp
index dcd62929ca..ad9e6fd839 100644
--- a/ext/intl/timezone/timezone_class.cpp
+++ b/ext/intl/timezone/timezone_class.cpp
@@ -376,9 +376,13 @@ static zend_function_entry TimeZone_class_functions[] = {
#endif
PHP_ME_MAPPING(createEnumeration, intltz_create_enumeration, ainfo_tz_createEnumeration, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME_MAPPING(countEquivalentIDs, intltz_count_equivalent_ids, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
PHP_ME_MAPPING(createTimeZoneIDEnumeration, intltz_create_time_zone_id_enumeration, ainfo_tz_createTimeZoneIDEnumeration, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+#endif
PHP_ME_MAPPING(getCanonicalID, intltz_get_canonical_id, ainfo_tz_getCanonicalID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
PHP_ME_MAPPING(getRegion, intltz_get_region, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+#endif
PHP_ME_MAPPING(getTZDataVersion, intltz_get_tz_data_version, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME_MAPPING(getEquivalentID, intltz_get_equivalent_id, ainfo_tz_getEquivalentID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
@@ -426,16 +430,21 @@ U_CFUNC void timezone_register_IntlTimeZone_class(TSRMLS_D)
TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT", TimeZone::SHORT);
TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG", TimeZone::LONG);
+
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GENERIC", TimeZone::SHORT_GENERIC);
TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GENERIC", TimeZone::LONG_GENERIC);
TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GMT", TimeZone::SHORT_GMT);
TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GMT", TimeZone::LONG_GMT);
TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_COMMONLY_USED", TimeZone::SHORT_COMMONLY_USED);
TIMEZONE_DECL_LONG_CONST("DISPLAY_GENERIC_LOCATION", TimeZone::GENERIC_LOCATION);
+#endif
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
TIMEZONE_DECL_LONG_CONST("TYPE_ANY", UCAL_ZONE_TYPE_ANY);
TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL", UCAL_ZONE_TYPE_CANONICAL);
TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL_LOCATION", UCAL_ZONE_TYPE_CANONICAL_LOCATION);
+#endif
/* Declare 'IntlTimeZone' class properties */
diff --git a/ext/intl/timezone/timezone_class.h b/ext/intl/timezone/timezone_class.h
index a239a18b67..89d694621f 100644
--- a/ext/intl/timezone/timezone_class.h
+++ b/ext/intl/timezone/timezone_class.h
@@ -20,6 +20,9 @@
//redefinition of inline in PHP headers causes problems, so include this before
#include <math.h>
+//fixes the build on windows for old versions of ICU
+#include <stdio.h>
+
#include <php.h>
#include "intl_error.h"
#include "intl_data.h"
diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp
index 37b3996706..eaa6b46e39 100644
--- a/ext/intl/timezone/timezone_methods.cpp
+++ b/ext/intl/timezone/timezone_methods.cpp
@@ -189,6 +189,7 @@ U_CFUNC PHP_FUNCTION(intltz_count_equivalent_ids)
RETURN_LONG((long)result);
}
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration)
{
long zoneType,
@@ -243,6 +244,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration)
IntlIterator_from_StringEnumeration(se, return_value TSRMLS_CC);
}
+#endif
U_CFUNC PHP_FUNCTION(intltz_get_canonical_id)
{
@@ -283,6 +285,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_canonical_id)
}
}
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
U_CFUNC PHP_FUNCTION(intltz_get_region)
{
char *str_id;
@@ -310,6 +313,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_region)
RETURN_STRINGL(outbuf, region_len, 1);
}
+#endif
U_CFUNC PHP_FUNCTION(intltz_get_tz_data_version)
{
@@ -477,9 +481,11 @@ U_CFUNC PHP_FUNCTION(intltz_has_same_rules)
static const TimeZone::EDisplayType display_types[] = {
TimeZone::SHORT, TimeZone::LONG,
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
TimeZone::SHORT_GENERIC, TimeZone::LONG_GENERIC,
TimeZone::SHORT_GMT, TimeZone::LONG_GMT,
TimeZone::SHORT_COMMONLY_USED, TimeZone::GENERIC_LOCATION
+#endif
};
U_CFUNC PHP_FUNCTION(intltz_get_display_name)