Closed Bug 550912 Opened 10 years ago Closed 7 years ago

unreachable code in CViewSourceHTML::CopyPossibleEntity

Categories

(Core :: DOM: HTML Parser, defect, trivial)

x86
Linux
defect
Not set
trivial

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: timeless, Unassigned)

References

(Blocks 1 open bug, )

Details

(Keywords: coverity)

i understand this is defensive programming, but we can consider dropping useless code. anyone who will touch this code should be trusted not to mess this up.

1283 void CViewSourceHTML::CopyPossibleEntity(nsAString::const_iterator& iter,

1301   enum {TYPE_ID, TYPE_DECIMAL, TYPE_HEXADECIMAL} entityType;
1302   if (ConsumeChar(iter, end, IsHashsign)) {
1303     if (ConsumeChar(iter, end, IsXx)) {
1305       entityType = TYPE_HEXADECIMAL;
1309     } else {
1311       entityType = TYPE_DECIMAL;
1315     }
1316   } else {
1318     entityType = TYPE_ID;
1325   }

after this, entityType is one of the values in the enum....

1346   switch (entityType) {
1347   case TYPE_ID:
1349     break;
1350   case TYPE_DECIMAL:
1352     break;
1353   case TYPE_HEXADECIMAL:
1355     break;

so default can't be reached:
1356   default:
1357     NS_NOTREACHED("Unknown entity type!");
Bug 648252 removed nsViewSourceHTML.cpp/h from the tree.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.