diff -ur icu.org/source/common/rbbidata.h icu/source/common/rbbidata.h --- icu.org/source/common/rbbidata.h 2017-02-03 19:57:23.000000000 +0100 +++ icu/source/common/rbbidata.h 2017-04-21 22:46:25.371651160 +0200 @@ -115,7 +115,7 @@ /* StatusTable of the set of matching */ /* tags (rule status values) */ int16_t fReserved; - uint16_t fNextState[2]; /* Next State, indexed by char category. */ + uint16_t fNextState[1]; /* Next State, indexed by char category. */ /* This array does not have two elements */ /* Array Size is actually fData->fHeader->fCatCount */ /* CAUTION: see RBBITableBuilder::getTableSize() */ @@ -128,7 +128,7 @@ uint32_t fRowLen; /* Length of a state table row, in bytes. */ uint32_t fFlags; /* Option Flags for this state table */ uint32_t fReserved; /* reserved */ - char fTableData[4]; /* First RBBIStateTableRow begins here. */ + char fTableData[1]; /* First RBBIStateTableRow begins here. */ /* (making it char[] simplifies ugly address */ /* arithmetic for indexing variable length rows.) */ }; diff -ur icu.org/source/common/rbbitblb.cpp icu/source/common/rbbitblb.cpp --- icu.org/source/common/rbbitblb.cpp 2017-01-20 01:20:31.000000000 +0100 +++ icu/source/common/rbbitblb.cpp 2017-04-21 22:46:25.373651159 +0200 @@ -1095,15 +1095,15 @@ return 0; } - size = sizeof(RBBIStateTable) - 4; // The header, with no rows to the table. + size = offsetof(RBBIStateTable, fTableData); // The header, with no rows to the table. numRows = fDStates->size(); numCols = fRB->fSetBuilder->getNumCharCategories(); - // Note The declaration of RBBIStateTableRow is for a table of two columns. - // Therefore we subtract two from numCols when determining + // Note The declaration of RBBIStateTableRow is for a table of one columns. + // Therefore we subtract one from numCols when determining // how much storage to add to a row for the total columns. - rowSize = sizeof(RBBIStateTableRow) + sizeof(uint16_t)*(numCols-2); + rowSize = sizeof(RBBIStateTableRow) + sizeof(uint16_t)*(numCols-1); size += numRows * rowSize; return size; } @@ -1133,7 +1133,7 @@ } table->fRowLen = sizeof(RBBIStateTableRow) + - sizeof(uint16_t) * (fRB->fSetBuilder->getNumCharCategories() - 2); + sizeof(uint16_t) * (fRB->fSetBuilder->getNumCharCategories() - 1); table->fNumStates = fDStates->size(); table->fFlags = 0; if (fRB->fLookAheadHardBreak) { diff -ur icu.org/source/common/ubidiimp.h icu/source/common/ubidiimp.h --- icu.org/source/common/ubidiimp.h 2017-02-03 19:57:23.000000000 +0100 +++ icu/source/common/ubidiimp.h 2017-04-21 22:46:25.374651159 +0200 @@ -198,8 +198,8 @@ /* in a Run, logicalStart will get this bit set if the run level is odd */ #define INDEX_ODD_BIT (1UL<<31) -#define MAKE_INDEX_ODD_PAIR(index, level) ((index)|((int32_t)(level)<<31)) -#define ADD_ODD_BIT_FROM_LEVEL(x, level) ((x)|=((int32_t)(level)<<31)) +#define MAKE_INDEX_ODD_PAIR(index, level) ((index)|((uint32_t)(level)<<31)) +#define ADD_ODD_BIT_FROM_LEVEL(x, level) ((x)|=((uint32_t)(level)<<31)) #define REMOVE_ODD_BIT(x) ((x)&=~INDEX_ODD_BIT) #define GET_INDEX(x) ((x)&~INDEX_ODD_BIT) diff -ur icu.org/source/common/ucharstriebuilder.cpp icu/source/common/ucharstriebuilder.cpp --- icu.org/source/common/ucharstriebuilder.cpp 2017-02-03 19:57:23.000000000 +0100 +++ icu/source/common/ucharstriebuilder.cpp 2017-04-21 22:46:25.375651159 +0200 @@ -287,7 +287,7 @@ UCharsTrieBuilder::UCTLinearMatchNode::UCTLinearMatchNode(const UChar *units, int32_t len, Node *nextNode) : LinearMatchNode(len, nextNode), s(units) { - hash=hash*37+ustr_hashUCharsN(units, len); + hash=hash*37U+ustr_hashUCharsN(units, len); } UBool diff -ur icu.org/source/common/ucmndata.cpp icu/source/common/ucmndata.cpp --- icu.org/source/common/ucmndata.cpp 2017-03-08 16:34:47.000000000 +0100 +++ icu/source/common/ucmndata.cpp 2017-04-21 22:46:25.376651159 +0200 @@ -77,7 +77,7 @@ typedef struct { uint32_t count; uint32_t reserved; - PointerTOCEntry entry[2]; /* Actual size is from count. */ + PointerTOCEntry entry[1]; /* Actual size is from count. */ } PointerTOC; diff -ur icu.org/source/common/ucmndata.h icu/source/common/ucmndata.h --- icu.org/source/common/ucmndata.h 2017-01-20 01:20:31.000000000 +0100 +++ icu/source/common/ucmndata.h 2017-04-21 22:46:25.377651159 +0200 @@ -52,7 +52,7 @@ typedef struct { uint32_t count; - UDataOffsetTOCEntry entry[2]; /* Actual size of array is from count. */ + UDataOffsetTOCEntry entry[1]; /* Actual size of array is from count. */ } UDataOffsetTOC; /** diff -ur icu.org/source/common/unicode/stringtriebuilder.h icu/source/common/unicode/stringtriebuilder.h --- icu.org/source/common/unicode/stringtriebuilder.h 2017-03-10 23:01:34.000000000 +0100 +++ icu/source/common/unicode/stringtriebuilder.h 2017-04-21 22:47:43.395634383 +0200 @@ -276,7 +276,7 @@ void setValue(int32_t v) { hasValue=TRUE; value=v; - hash=hash*37+v; + hash=hash*37U+v; } protected: UBool hasValue; @@ -307,7 +307,7 @@ class LinearMatchNode : public ValueNode { public: LinearMatchNode(int32_t len, Node *nextNode) - : ValueNode((0x333333*37+len)*37+hashCode(nextNode)), + : ValueNode((0x333333U*37+len)*37+hashCode(nextNode)), length(len), next(nextNode) {} virtual UBool operator==(const Node &other) const; virtual int32_t markRightEdgesFirst(int32_t edgeNumber); @@ -342,7 +342,7 @@ equal[length]=NULL; values[length]=value; ++length; - hash=(hash*37+c)*37+value; + hash=(hash*37U+c)*37+value; } // Adds a unit which leads to another match node. void add(int32_t c, Node *node) { @@ -350,7 +350,7 @@ equal[length]=node; values[length]=0; ++length; - hash=(hash*37+c)*37+hashCode(node); + hash=(hash*37U+c)*37+hashCode(node); } protected: Node *equal[kMaxBranchLinearSubNodeLength]; // NULL means "has final value". @@ -365,7 +365,7 @@ class SplitBranchNode : public BranchNode { public: SplitBranchNode(char16_t middleUnit, Node *lessThanNode, Node *greaterOrEqualNode) - : BranchNode(((0x555555*37+middleUnit)*37+ + : BranchNode(((0x555555U*37+middleUnit)*37+ hashCode(lessThanNode))*37+hashCode(greaterOrEqualNode)), unit(middleUnit), lessThan(lessThanNode), greaterOrEqual(greaterOrEqualNode) {} virtual UBool operator==(const Node &other) const; @@ -382,7 +382,7 @@ class BranchHeadNode : public ValueNode { public: BranchHeadNode(int32_t len, Node *subNode) - : ValueNode((0x666666*37+len)*37+hashCode(subNode)), + : ValueNode((0x666666U*37+len)*37+hashCode(subNode)), length(len), next(subNode) {} virtual UBool operator==(const Node &other) const; virtual int32_t markRightEdgesFirst(int32_t edgeNumber); diff -ur icu.org/source/i18n/collationdatareader.cpp icu/source/i18n/collationdatareader.cpp --- icu.org/source/i18n/collationdatareader.cpp 2017-01-20 01:20:31.000000000 +0100 +++ icu/source/i18n/collationdatareader.cpp 2017-04-21 22:46:25.380651158 +0200 @@ -419,6 +419,7 @@ tailoring.data, ts, fastLatinPrimaries, UPRV_LENGTHOF(fastLatinPrimaries)); if(options == ts.options && ts.variableTop != 0 && reorderCodesLength == ts.reorderCodesLength && + reorderCodesLength != 0 && uprv_memcmp(reorderCodes, ts.reorderCodes, reorderCodesLength * 4) == 0 && fastLatinOptions == ts.fastLatinOptions && (fastLatinOptions < 0 ||