mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 06:25:30 +00:00
ICU-22707 appease rbbitst UBSan for RBBIStateTableRow
This commit is contained in:
parent
b32d4a718e
commit
fe23620f12
1 changed files with 19 additions and 11 deletions
|
@ -4771,8 +4771,14 @@ void RBBITest::TestTableRedundancies() {
|
|||
for (int32_t column = 0; column < numCharClasses; column++) {
|
||||
UnicodeString s;
|
||||
for (int32_t r = 1; r < (int32_t)fwtbl->fNumStates; r++) {
|
||||
RBBIStateTableRow *row = reinterpret_cast<RBBIStateTableRow *>(const_cast<char*>(fwtbl->fTableData + (fwtbl->fRowLen * r)));
|
||||
s.append(in8Bits ? row->r8.fNextState[column] : row->r16.fNextState[column]);
|
||||
char *rowBytes = const_cast<char*>(fwtbl->fTableData + (fwtbl->fRowLen * r));
|
||||
if (in8Bits) {
|
||||
RBBIStateTableRow8 *row = reinterpret_cast<RBBIStateTableRow8 *>(rowBytes);
|
||||
s.append(row->fNextState[column]);
|
||||
} else {
|
||||
RBBIStateTableRow16 *row = reinterpret_cast<RBBIStateTableRow16 *>(rowBytes);
|
||||
s.append(row->fNextState[column]);
|
||||
}
|
||||
}
|
||||
columns.push_back(s);
|
||||
}
|
||||
|
@ -4792,20 +4798,22 @@ void RBBITest::TestTableRedundancies() {
|
|||
std::vector<UnicodeString> rows;
|
||||
for (int32_t r=0; r < (int32_t)fwtbl->fNumStates; r++) {
|
||||
UnicodeString s;
|
||||
RBBIStateTableRow *row = reinterpret_cast<RBBIStateTableRow *>(const_cast<char*>((fwtbl->fTableData + (fwtbl->fRowLen * r))));
|
||||
char *rowBytes = const_cast<char*>(fwtbl->fTableData + (fwtbl->fRowLen * r));
|
||||
if (in8Bits) {
|
||||
s.append(row->r8.fAccepting);
|
||||
s.append(row->r8.fLookAhead);
|
||||
s.append(row->r8.fTagsIdx);
|
||||
RBBIStateTableRow8 *row = reinterpret_cast<RBBIStateTableRow8 *>(rowBytes);
|
||||
s.append(row->fAccepting);
|
||||
s.append(row->fLookAhead);
|
||||
s.append(row->fTagsIdx);
|
||||
for (int32_t column = 0; column < numCharClasses; column++) {
|
||||
s.append(row->r8.fNextState[column]);
|
||||
s.append(row->fNextState[column]);
|
||||
}
|
||||
} else {
|
||||
s.append(row->r16.fAccepting);
|
||||
s.append(row->r16.fLookAhead);
|
||||
s.append(row->r16.fTagsIdx);
|
||||
RBBIStateTableRow16 *row = reinterpret_cast<RBBIStateTableRow16 *>(rowBytes);
|
||||
s.append(row->fAccepting);
|
||||
s.append(row->fLookAhead);
|
||||
s.append(row->fTagsIdx);
|
||||
for (int32_t column = 0; column < numCharClasses; column++) {
|
||||
s.append(row->r16.fNextState[column]);
|
||||
s.append(row->fNextState[column]);
|
||||
}
|
||||
}
|
||||
rows.push_back(s);
|
||||
|
|
Loading…
Add table
Reference in a new issue