]> git.pld-linux.org Git - packages/php.git/blob - php-icu64.patch
98b53d524bf9631a2c5642a7f2337cb474b31a18
[packages/php.git] / php-icu64.patch
1 --- php-5.3.29/ext/intl/msgformat/msgformat_helpers.cpp.orig    2019-04-14 11:05:27.295916785 +0200
2 +++ php-5.3.29/ext/intl/msgformat/msgformat_helpers.cpp 2019-04-14 11:11:34.521781755 +0200
3 @@ -38,11 +38,11 @@
4   */
5  class MessageFormatAdapter {
6  public:
7 -    static const Formattable::Type* getArgTypeList(const MessageFormat& m,
8 +    static const icu::Formattable::Type* getArgTypeList(const icu::MessageFormat& m,
9                                                     int32_t& count);
10  };
11 -const Formattable::Type*
12 -MessageFormatAdapter::getArgTypeList(const MessageFormat& m,
13 +const icu::Formattable::Type*
14 +icu::MessageFormatAdapter::getArgTypeList(const icu::MessageFormat& m,
15                                       int32_t& count) {
16      return m.getArgTypeList(count);
17  }
18 @@ -51,16 +51,16 @@
19  U_CFUNC int32_t umsg_format_arg_count(UMessageFormat *fmt) 
20  {
21         int32_t fmt_count = 0;
22 -       MessageFormatAdapter::getArgTypeList(*(const MessageFormat*)fmt, fmt_count);
23 +       icu::MessageFormatAdapter::getArgTypeList(*(const icu::MessageFormat*)fmt, fmt_count);
24         return fmt_count;
25  }
26  
27  U_CFUNC void umsg_format_helper(UMessageFormat *fmt, int arg_count, zval **args, UChar **formatted, int *formatted_len, UErrorCode *status TSRMLS_DC)
28  {
29         int fmt_count = 0;
30 -    const Formattable::Type* argTypes =
31 -               MessageFormatAdapter::getArgTypeList(*(const MessageFormat*)fmt, fmt_count);
32 -       Formattable* fargs = new Formattable[fmt_count ? fmt_count : 1];
33 +    const icu::Formattable::Type* argTypes =
34 +               icu::MessageFormatAdapter::getArgTypeList(*(const icu::MessageFormat*)fmt, fmt_count);
35 +       icu::Formattable* fargs = new icu::Formattable[fmt_count ? fmt_count : 1];
36  
37         for(int32_t i = 0; i < fmt_count; ++i) {
38          UChar  *stringVal = NULL;
39 @@ -68,22 +68,22 @@
40                 int64_t tInt64 = 0;
41  
42                 switch(argTypes[i]) {
43 -                       case Formattable::kDate:
44 +                       case icu::Formattable::kDate:
45                                 convert_to_long_ex(&args[i]);
46                                 fargs[i].setDate(U_MILLIS_PER_SECOND * (double)Z_LVAL_P(args[i]));
47                                 break;
48  
49 -                       case Formattable::kDouble:
50 +                       case icu::Formattable::kDouble:
51                                 convert_to_double_ex(&args[i]);
52                             fargs[i].setDouble(Z_DVAL_P(args[i]));
53                                 break;
54              
55 -               case Formattable::kLong:
56 +               case icu::Formattable::kLong:
57                                 convert_to_long_ex(&args[i]);
58                             fargs[i].setLong(Z_LVAL_P(args[i]));
59                                 break;
60  
61 -               case Formattable::kInt64:
62 +               case icu::Formattable::kInt64:
63                                 if(Z_TYPE_P(args[i]) == IS_DOUBLE) {
64                                         tInt64 = (int64_t)Z_DVAL_P(args[i]);
65                                 } else if(Z_TYPE_P(args[i]) == IS_LONG) {
66 @@ -96,7 +96,7 @@
67                             fargs[i].setInt64(tInt64);
68                                 break;
69              
70 -               case Formattable::kString:
71 +               case icu::Formattable::kString:
72                         convert_to_string_ex(&args[i]);
73                                 intl_convert_utf8_to_utf16(&stringVal, &stringLen, Z_STRVAL_P(args[i]), Z_STRLEN_P(args[i]), status);
74                                 if(U_FAILURE(*status)){
75 @@ -107,19 +107,19 @@
76                                 efree(stringVal);
77                             break;
78              
79 -                       case Formattable::kArray:
80 -                       case Formattable::kObject:
81 +                       case icu::Formattable::kArray:
82 +                       case icu::Formattable::kObject:
83                                 *status = U_UNSUPPORTED_ERROR;
84                                 delete[] fargs;
85                                 return;
86          }              
87         }
88  
89 -    UnicodeString resultStr;
90 -    FieldPosition fieldPosition(0);
91 +       icu::UnicodeString resultStr;
92 +       icu::FieldPosition fieldPosition(0);
93      
94      /* format the message */
95 -    ((const MessageFormat*)fmt)->format(fargs, fmt_count, resultStr, fieldPosition, *status);
96 +    ((const icu::MessageFormat*)fmt)->format(fargs, fmt_count, resultStr, fieldPosition, *status);
97  
98      delete[] fargs;
99  
100 @@ -136,8 +136,8 @@
101  
102  U_CFUNC void umsg_parse_helper(UMessageFormat *fmt, int *count, zval ***args, UChar *source, int source_len, UErrorCode *status)
103  {
104 -    UnicodeString srcString(source, source_len);
105 -    Formattable *fargs = ((const MessageFormat*)fmt)->parse(srcString, *count, *status);
106 +       icu::UnicodeString srcString(source, source_len);
107 +       icu::Formattable *fargs = ((const icu::MessageFormat*)fmt)->parse(srcString, *count, *status);
108  
109         if(U_FAILURE(*status)) {
110                 return;
111 @@ -149,14 +149,14 @@
112      for(int32_t i = 0; i < *count; i++) {
113             int64_t aInt64;
114                 double aDate;
115 -               UnicodeString temp;
116 +               icu::UnicodeString temp;
117                 char *stmp;
118                 int stmp_len;
119  
120                 ALLOC_INIT_ZVAL((*args)[i]);
121                 
122                 switch(fargs[i].getType()) {
123 -        case Formattable::kDate:
124 +        case icu::Formattable::kDate:
125                         aDate = ((double)fargs[i].getDate())/U_MILLIS_PER_SECOND;
126                         if(aDate > LONG_MAX || aDate < -LONG_MAX) {
127                                 ZVAL_DOUBLE((*args)[i], aDate<0?ceil(aDate):floor(aDate));
128 @@ -165,15 +165,15 @@
129                         }
130              break;
131  
132 -        case Formattable::kDouble:
133 +        case icu::Formattable::kDouble:
134                         ZVAL_DOUBLE((*args)[i], (double)fargs[i].getDouble());
135              break;
136  
137 -        case Formattable::kLong:
138 +        case icu::Formattable::kLong:
139                         ZVAL_LONG((*args)[i], fargs[i].getLong());
140              break;
141  
142 -        case Formattable::kInt64:
143 +        case icu::Formattable::kInt64:
144              aInt64 = fargs[i].getInt64();
145                         if(aInt64 > LONG_MAX || aInt64 < -LONG_MAX) {
146                                 ZVAL_DOUBLE((*args)[i], (double)aInt64);
147 @@ -182,7 +182,7 @@
148                         }
149              break;
150  
151 -        case Formattable::kString:
152 +        case icu::Formattable::kString:
153              fargs[i].getString(temp);
154                         intl_convert_utf16_to_utf8(&stmp, &stmp_len, temp.getBuffer(), temp.length(), status);
155                         if(U_FAILURE(*status)) {
156 @@ -192,8 +192,8 @@
157                         ZVAL_STRINGL((*args)[i], stmp, stmp_len, 0);
158              break;
159  
160 -        case Formattable::kObject:
161 -        case Formattable::kArray:
162 +        case icu::Formattable::kObject:
163 +        case icu::Formattable::kArray:
164              *status = U_ILLEGAL_ARGUMENT_ERROR;
165                         cleanup_zvals();
166              break;
This page took 0.032673 seconds and 2 git commands to generate.