1 --- source/common/rbbidata.h
2 +++ source/common/rbbidata.h
4 /* StatusTable of the set of matching */
5 /* tags (rule status values) */
7 - uint16_t fNextState[2]; /* Next State, indexed by char category. */
8 + uint16_t fNextState[1]; /* Next State, indexed by char category. */
9 /* This array does not have two elements */
10 /* Array Size is actually fData->fHeader->fCatCount */
11 /* CAUTION: see RBBITableBuilder::getTableSize() */
13 uint32_t fRowLen; /* Length of a state table row, in bytes. */
14 uint32_t fFlags; /* Option Flags for this state table */
15 uint32_t fReserved; /* reserved */
16 - char fTableData[4]; /* First RBBIStateTableRow begins here. */
17 + char fTableData[1]; /* First RBBIStateTableRow begins here. */
18 /* (making it char[] simplifies ugly address */
19 /* arithmetic for indexing variable length rows.) */
21 --- source/common/rbbitblb.cpp
22 +++ source/common/rbbitblb.cpp
23 @@ -1067,15 +1067,15 @@
27 - size = sizeof(RBBIStateTable) - 4; // The header, with no rows to the table.
28 + size = offsetof(RBBIStateTable, fTableData); // The header, with no rows to the table.
30 numRows = fDStates->size();
31 numCols = fRB->fSetBuilder->getNumCharCategories();
33 - // Note The declaration of RBBIStateTableRow is for a table of two columns.
34 - // Therefore we subtract two from numCols when determining
35 + // Note The declaration of RBBIStateTableRow is for a table of one columns.
36 + // Therefore we subtract one from numCols when determining
37 // how much storage to add to a row for the total columns.
38 - rowSize = sizeof(RBBIStateTableRow) + sizeof(uint16_t)*(numCols-2);
39 + rowSize = sizeof(RBBIStateTableRow) + sizeof(uint16_t)*(numCols-1);
40 size += numRows * rowSize;
46 table->fRowLen = sizeof(RBBIStateTableRow) +
47 - sizeof(uint16_t) * (fRB->fSetBuilder->getNumCharCategories() - 2);
48 + sizeof(uint16_t) * (fRB->fSetBuilder->getNumCharCategories() - 1);
49 table->fNumStates = fDStates->size();
51 if (fRB->fLookAheadHardBreak) {
52 --- source/common/ubidiimp.h
53 +++ source/common/ubidiimp.h
55 /* in a Run, logicalStart will get this bit set if the run level is odd */
56 #define INDEX_ODD_BIT (1UL<<31)
58 -#define MAKE_INDEX_ODD_PAIR(index, level) ((index)|((int32_t)(level)<<31))
59 -#define ADD_ODD_BIT_FROM_LEVEL(x, level) ((x)|=((int32_t)(level)<<31))
60 +#define MAKE_INDEX_ODD_PAIR(index, level) ((index)|((uint32_t)(level)<<31))
61 +#define ADD_ODD_BIT_FROM_LEVEL(x, level) ((x)|=((uint32_t)(level)<<31))
62 #define REMOVE_ODD_BIT(x) ((x)&=~INDEX_ODD_BIT)
64 #define GET_INDEX(x) ((x)&~INDEX_ODD_BIT)
65 --- source/common/ucharstriebuilder.cpp
66 +++ source/common/ucharstriebuilder.cpp
69 UCharsTrieBuilder::UCTLinearMatchNode::UCTLinearMatchNode(const UChar *units, int32_t len, Node *nextNode)
70 : LinearMatchNode(len, nextNode), s(units) {
71 - hash=hash*37+ustr_hashUCharsN(units, len);
72 + hash=hash*37U+ustr_hashUCharsN(units, len);
76 --- source/common/ucmndata.c
77 +++ source/common/ucmndata.c
82 - PointerTOCEntry entry[2]; /* Actual size is from count. */
83 + PointerTOCEntry entry[1]; /* Actual size is from count. */
87 --- source/common/ucmndata.h
88 +++ source/common/ucmndata.h
93 - UDataOffsetTOCEntry entry[2]; /* Actual size of array is from count. */
94 + UDataOffsetTOCEntry entry[1]; /* Actual size of array is from count. */
98 --- source/common/unicode/stringtriebuilder.h
99 +++ source/common/unicode/stringtriebuilder.h
101 void setValue(int32_t v) {
110 class LinearMatchNode : public ValueNode {
112 LinearMatchNode(int32_t len, Node *nextNode)
113 - : ValueNode((0x333333*37+len)*37+hashCode(nextNode)),
114 + : ValueNode((0x333333U*37+len)*37+hashCode(nextNode)),
115 length(len), next(nextNode) {}
116 virtual UBool operator==(const Node &other) const;
117 virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
120 values[length]=value;
122 - hash=(hash*37+c)*37+value;
123 + hash=(hash*37U+c)*37+value;
125 // Adds a unit which leads to another match node.
126 void add(int32_t c, Node *node) {
131 - hash=(hash*37+c)*37+hashCode(node);
132 + hash=(hash*37U+c)*37+hashCode(node);
135 Node *equal[kMaxBranchLinearSubNodeLength]; // NULL means "has final value".
137 class SplitBranchNode : public BranchNode {
139 SplitBranchNode(UChar middleUnit, Node *lessThanNode, Node *greaterOrEqualNode)
140 - : BranchNode(((0x555555*37+middleUnit)*37+
141 + : BranchNode(((0x555555U*37+middleUnit)*37+
142 hashCode(lessThanNode))*37+hashCode(greaterOrEqualNode)),
143 unit(middleUnit), lessThan(lessThanNode), greaterOrEqual(greaterOrEqualNode) {}
144 virtual UBool operator==(const Node &other) const;
146 class BranchHeadNode : public ValueNode {
148 BranchHeadNode(int32_t len, Node *subNode)
149 - : ValueNode((0x666666*37+len)*37+hashCode(subNode)),
150 + : ValueNode((0x666666U*37+len)*37+hashCode(subNode)),
151 length(len), next(subNode) {}
152 virtual UBool operator==(const Node &other) const;
153 virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
154 --- source/common/unifiedcache.h
155 +++ source/common/unifiedcache.h
157 : CacheKey<T>(other), fLoc(other.fLoc) { }
158 virtual ~LocaleCacheKey() { }
159 virtual int32_t hashCode() const {
160 - return 37 *CacheKey<T>::hashCode() + fLoc.hashCode();
161 + return 37U *CacheKey<T>::hashCode() + fLoc.hashCode();
163 virtual UBool operator == (const CacheKeyBase &other) const {
165 --- source/common/uresbund.cpp
166 +++ source/common/uresbund.cpp
168 UHashTok namekey, pathkey;
169 namekey.pointer = b->fName;
170 pathkey.pointer = b->fPath;
171 - return uhash_hashChars(namekey)+37*uhash_hashChars(pathkey);
172 + return uhash_hashChars(namekey)+37U*uhash_hashChars(pathkey);
175 /* INTERNAL: compares two entries */