diff -Naur icu-50.1/layout/LEFontInstance.h icu-50.1.1/layout/LEFontInstance.h --- icu-50.1/layout/LEFontInstance.h 2013-01-19 04:55:01.959370739 +0100 +++ icu-50.1.1/layout/LEFontInstance.h 2013-01-19 04:56:28.450366883 +0100 @@ -1,7 +1,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2007 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2012 - All Rights Reserved * */ @@ -166,6 +166,25 @@ virtual const void *getFontTable(LETag tableTag) const = 0; /** + * This method reads a table from the font. Note that in general, + * it only makes sense to call this method on an LEFontInstance + * which represents a physical font - i.e. one which has been returned by + * getSubFont(). This is because each subfont in a composite font + * will have different tables, and there's no way to know which subfont to access. + * + * Subclasses which represent composite fonts should always return NULL. + * + * This version sets a length, for range checking. + * + * @param tableTag - the four byte table tag. (e.g. 'cmap') + * @param length - ignored on entry, on exit will be the length of the table if known, or -1 if unknown. + * @return the address of the table in memory, or NULL + * if the table doesn't exist. + * @internal + */ + virtual const void* getFontTable(LETag tableTag, size_t &length) const { length=-1; return getFontTable(tableTag); } /* -1 = unknown length */ + + /** * This method is used to determine if the font can * render the given character. This can usually be done * by looking the character up in the font's character diff -Naur icu-50.1/layout/LETypes.h icu-50.1.1/layout/LETypes.h --- icu-50.1/layout/LETypes.h 2013-01-19 04:55:01.930370740 +0100 +++ icu-50.1.1/layout/LETypes.h 2013-01-19 04:56:28.449366883 +0100 @@ -1,6 +1,6 @@ /* * - * (C) Copyright IBM Corp. 1998-2011 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2012 - All Rights Reserved * */ @@ -309,6 +309,51 @@ * @internal */ #define LE_DELETE_ARRAY(array) uprv_free((void *) (array)) +#else + +/* Not using ICU memory - use C std lib versions */ + +#include +#include + +/** + * A convenience macro to get the length of an array. + * + * @internal + */ +#define LE_ARRAY_SIZE(array) (sizeof array / sizeof array[0]) + +/** + * A convenience macro for copying an array. + * + * @internal + */ +#define LE_ARRAY_COPY(dst, src, count) memcpy((void *) (dst), (void *) (src), (count) * sizeof (src)[0]) + +/** + * Allocate an array of basic types. This is used to isolate the rest of + * the LayoutEngine code from cmemory.h. + * + * @internal + */ +#define LE_NEW_ARRAY(type, count) (type *) malloc((count) * sizeof(type)) + +/** + * Re-allocate an array of basic types. This is used to isolate the rest of + * the LayoutEngine code from cmemory.h. + * + * @internal + */ +#define LE_GROW_ARRAY(array, newSize) realloc((void *) (array), (newSize) * sizeof (array)[0]) + + /** + * Free an array of basic types. This is used to isolate the rest of + * the LayoutEngine code from cmemory.h. + * + * @internal + */ +#define LE_DELETE_ARRAY(array) free((void *) (array)) + #endif #endif /* U_HIDE_INTERNAL_API */ diff -Naur icu-50.1/unicode/decimfmt.h icu-50.1.1/unicode/decimfmt.h --- icu-50.1/unicode/decimfmt.h 2013-01-19 04:55:01.177370774 +0100 +++ icu-50.1.1/unicode/decimfmt.h 2013-01-19 04:56:28.413366884 +0100 @@ -38,6 +38,7 @@ #include "unicode/fpositer.h" #include "unicode/stringpiece.h" #include "unicode/curramt.h" +#include "unicode/enumset.h" /** * \def UNUM_DECIMALFORMAT_INTERNAL_SIZE @@ -56,39 +57,12 @@ class UnicodeSet; class FieldPositionHandler; -/** - * enum bitset for boolean fields. Similar to Java EnumSet<>. - * Needs to range check. Not specific to decimal format. - * @internal - */ -template -class EnumSet { -public: - EnumSet() : fBools(0) {} - EnumSet(const EnumSet& other) : fBools(other.fBools) {} - ~EnumSet() {} - void clear() { fBools=0; } - void add(T toAdd) { set(toAdd, 1); } - void remove(T toRemove) { set(toRemove, 0); } - int32_t contains(T toCheck) const { return get(toCheck); } - void set(T toSet, int32_t v) { fBools=(fBools&(~flag(toSet)))|(v?(flag(toSet)):0); } - int32_t get(T toCheck) const { return (fBools & flag(toCheck))?1:0; } - UBool isValidEnum(T toCheck) const { return (toCheck>=minValue&&toCheck& operator=(const EnumSet& other) { - fBools = other.fBools; - return *this; - } - - uint32_t getAll() const { - return fBools; - } - -private: - uint32_t flag(T toCheck) const { return (1<<(toCheck-minValue)); } -private: - uint32_t fBools; -}; +// explicit template instantiation. see digitlst.h +#if defined (_MSC_VER) +template class U_I18N_API EnumSet; +#endif /** * DecimalFormat is a concrete subclass of NumberFormat that formats decimal diff -Naur icu-50.1/unicode/dtfmtsym.h icu-50.1.1/unicode/dtfmtsym.h --- icu-50.1/unicode/dtfmtsym.h 2013-01-19 04:55:01.322370767 +0100 +++ icu-50.1.1/unicode/dtfmtsym.h 2013-01-19 04:56:28.415366884 +0100 @@ -25,6 +25,7 @@ #include "unicode/calendar.h" #include "unicode/uobject.h" #include "unicode/locid.h" +#include "unicode/udat.h" #include "unicode/ures.h" /** @@ -802,6 +803,22 @@ * Delete just the zone strings. */ void disposeZoneStrings(void); + + /** + * Returns the date format field index of the pattern character c, + * or UDAT_FIELD_COUNT if c is not a pattern character. + */ + static UDateFormatField U_EXPORT2 getPatternCharIndex(UChar c); + + /** + * Returns TRUE if f (with its pattern character repeated count times) is a numeric field. + */ + static UBool U_EXPORT2 isNumericField(UDateFormatField f, int32_t count); + + /** + * Returns TRUE if c (repeated count times) is the pattern character for a numeric field. + */ + static UBool U_EXPORT2 isNumericPatternChar(UChar c, int32_t count); }; U_NAMESPACE_END diff -Naur icu-50.1/unicode/enumset.h icu-50.1.1/unicode/enumset.h --- icu-50.1/unicode/enumset.h 1970-01-01 01:00:00.000000000 +0100 +++ icu-50.1.1/unicode/enumset.h 2013-01-19 04:56:28.416366884 +0100 @@ -0,0 +1,61 @@ +/* +****************************************************************************** +* +* Copyright (C) 2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +*/ + +/** + * \file + * \brief C++: internal template EnumSet<> + */ + +#ifndef ENUMSET_H +#define ENUMSET_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * enum bitset for boolean fields. Similar to Java EnumSet<>. + * Needs to range check. + * @internal + */ +template +class EnumSet { +public: + inline EnumSet() : fBools(0) {} + inline EnumSet(const EnumSet& other) : fBools(other.fBools) {} + inline ~EnumSet() {} + inline void clear() { fBools=0; } + inline void add(T toAdd) { set(toAdd, 1); } + inline void remove(T toRemove) { set(toRemove, 0); } + inline int32_t contains(T toCheck) const { return get(toCheck); } + inline void set(T toSet, int32_t v) { fBools=(fBools&(~flag(toSet)))|(v?(flag(toSet)):0); } + inline int32_t get(T toCheck) const { return (fBools & flag(toCheck))?1:0; } + inline UBool isValidEnum(T toCheck) const { return (toCheck>=minValue&&toCheck& operator=(const EnumSet& other) { + fBools = other.fBools; + return *this; + } + + inline uint32_t getAll() const { + return fBools; + } + +private: + inline uint32_t flag(T toCheck) const { return (1<<(toCheck-minValue)); } +private: + uint32_t fBools; +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ +#endif /* ENUMSET_H */ diff -Naur icu-50.1/unicode/fmtable.h icu-50.1.1/unicode/fmtable.h --- icu-50.1/unicode/fmtable.h 2013-01-19 04:55:01.720370749 +0100 +++ icu-50.1.1/unicode/fmtable.h 2013-01-19 04:56:28.432366884 +0100 @@ -32,6 +32,16 @@ class DigitList; /** + * \def UNUM_INTERNAL_STACKARRAY_SIZE + * @internal + */ +#if U_PLATFORM == U_PF_OS400 +#define UNUM_INTERNAL_STACKARRAY_SIZE 144 +#else +#define UNUM_INTERNAL_STACKARRAY_SIZE 128 +#endif + +/** * Formattable objects can be passed to the Format class or * its subclasses for formatting. Formattable is a thin wrapper * class which interconverts between the primitive numeric types @@ -649,7 +659,7 @@ DigitList *fDecimalNum; - char fStackData[128]; // must be big enough for DigitList + char fStackData[UNUM_INTERNAL_STACKARRAY_SIZE]; // must be big enough for DigitList Type fType; UnicodeString fBogus; // Bogus string when it's needed. diff -Naur icu-50.1/unicode/locid.h icu-50.1.1/unicode/locid.h --- icu-50.1/unicode/locid.h 2013-01-19 04:55:01.504370759 +0100 +++ icu-50.1.1/unicode/locid.h 2013-01-19 04:56:28.430366884 +0100 @@ -739,7 +739,7 @@ * A friend to allow the default locale to be set by either the C or C++ API. * @internal */ - friend void locale_set_default_internal(const char *); + friend Locale *locale_set_default_internal(const char *, UErrorCode& status); }; inline UBool diff -Naur icu-50.1/unicode/smpdtfmt.h icu-50.1.1/unicode/smpdtfmt.h --- icu-50.1/unicode/smpdtfmt.h 2013-01-19 04:55:01.571370756 +0100 +++ icu-50.1.1/unicode/smpdtfmt.h 2013-01-19 04:56:28.430366884 +0100 @@ -946,6 +946,16 @@ static UBool isNumeric(UChar formatChar, int32_t count); /** + * Returns TRUE if the patternOffset is at the start of a numeric field. + */ + static UBool isAtNumericField(const UnicodeString &pattern, int32_t patternOffset); + + /** + * Returns TRUE if the patternOffset is right after a non-numeric field. + */ + static UBool isAfterNonNumericField(const UnicodeString &pattern, int32_t patternOffset); + + /** * initializes fCalendar from parameters. Returns fCalendar as a convenience. * @param adoptZone Zone to be adopted, or NULL for TimeZone::createDefault(). * @param locale Locale of the calendar diff -Naur icu-50.1/unicode/uvernum.h icu-50.1.1/unicode/uvernum.h --- icu-50.1/unicode/uvernum.h 2013-01-19 04:55:01.330370767 +0100 +++ icu-50.1.1/unicode/uvernum.h 2013-01-19 04:56:28.415366884 +0100 @@ -69,7 +69,7 @@ * This value will change in the subsequent releases of ICU * @stable ICU 2.4 */ -#define U_ICU_VERSION_PATCHLEVEL_NUM 0 +#define U_ICU_VERSION_PATCHLEVEL_NUM 1 /** The current ICU build level version as an integer. * This value is for use by ICU clients. It defaults to 0. @@ -118,7 +118,7 @@ * This value will change in the subsequent releases of ICU * @stable ICU 2.4 */ -#define U_ICU_VERSION "50.1" +#define U_ICU_VERSION "50.1.1" /** The current ICU library major/minor version as a string without dots, for library name suffixes. * This value will change in the subsequent releases of ICU