summaryrefslogtreecommitdiff
path: root/ext/intl/msgformat/msgformat_helpers.cpp
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-11-27 10:02:00 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-11-27 10:02:00 +0100
commit5240f8391ff30a91a7c07e1611e749807bb14429 (patch)
tree1940e46f91565c3d73dd64001a18783ae061acee /ext/intl/msgformat/msgformat_helpers.cpp
parentea372e74634f14bdb534f4921e1e325e3f589c8f (diff)
downloadphp-git-5240f8391ff30a91a7c07e1611e749807bb14429.tar.gz
Fixed bug #80425
Rename the methods in MessageFormatAdapter to make sure they don't clash with anything defined by icu itself, which may be a problem if icu is linked statically.
Diffstat (limited to 'ext/intl/msgformat/msgformat_helpers.cpp')
-rw-r--r--ext/intl/msgformat/msgformat_helpers.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp
index 11ff2f3388..5fcb2bb48a 100644
--- a/ext/intl/msgformat/msgformat_helpers.cpp
+++ b/ext/intl/msgformat/msgformat_helpers.cpp
@@ -46,25 +46,26 @@ extern "C" {
U_NAMESPACE_BEGIN
/**
- * This class isolates our access to private internal methods of
- * MessageFormat. It is never instantiated; it exists only for C++
- * access management.
+ * ICU declares MessageFormatAdapter as a friend class of MessageFormat,
+ * to use as a backdoor for accessing private MessageFormat members.
+ * We use it for the same purpose here. Prefix the methods with php to
+ * avoid clashes with any definitions in ICU.
*/
class MessageFormatAdapter {
public:
- static const Formattable::Type* getArgTypeList(const MessageFormat& m,
+ static const Formattable::Type* phpGetArgTypeList(const MessageFormat& m,
int32_t& count);
- static const MessagePattern getMessagePattern(MessageFormat* m);
+ static const MessagePattern phpGetMessagePattern(MessageFormat* m);
};
const Formattable::Type*
-MessageFormatAdapter::getArgTypeList(const MessageFormat& m,
+MessageFormatAdapter::phpGetArgTypeList(const MessageFormat& m,
int32_t& count) {
return m.getArgTypeList(count);
}
const MessagePattern
-MessageFormatAdapter::getMessagePattern(MessageFormat* m) {
+MessageFormatAdapter::phpGetMessagePattern(MessageFormat* m) {
return m->msgPattern;
}
U_NAMESPACE_END
@@ -80,7 +81,7 @@ using icu::FieldPosition;
U_CFUNC int32_t umsg_format_arg_count(UMessageFormat *fmt)
{
int32_t fmt_count = 0;
- MessageFormatAdapter::getArgTypeList(*(const MessageFormat*)fmt, fmt_count);
+ MessageFormatAdapter::phpGetArgTypeList(*(const MessageFormat*)fmt, fmt_count);
return fmt_count;
}
@@ -103,7 +104,7 @@ static HashTable *umsg_get_numeric_types(MessageFormatter_object *mfo,
return mfo->mf_data.arg_types;
}
- const Formattable::Type *types = MessageFormatAdapter::getArgTypeList(
+ const Formattable::Type *types = MessageFormatAdapter::phpGetArgTypeList(
*(MessageFormat*)mfo->mf_data.umsgf, parts_count);
/* Hash table will store Formattable::Type objects directly,
@@ -288,7 +289,7 @@ static HashTable *umsg_get_types(MessageFormatter_object *mfo,
{
MessageFormat *mf = (MessageFormat *)mfo->mf_data.umsgf;
- const MessagePattern mp = MessageFormatAdapter::getMessagePattern(mf);
+ const MessagePattern mp = MessageFormatAdapter::phpGetMessagePattern(mf);
return umsg_parse_format(mfo, mp, err);
}