Fixing unreachable condition.

if (!isMultiLine) at line 563 suggests that isMultiline is 0 when if takes true branch. So the condition && at line 571 will always be false.
Also at line 568 !isMultiline in loop conditional check suggests that it depends only on one condition i.e. index <size because !isMultiline is always true. 
Hence , it seems logical mistake at line 571 of using && instead of ||
This commit is contained in:
renu555 2014-07-02 09:19:00 +05:30 committed by Christopher Dunn
parent 8050d8b677
commit 17c244e644

View File

@ -344,7 +344,7 @@ bool StyledWriter::isMultineArray(const Value &value) {
for (int index = 0; index < size && !isMultiLine; ++index) {
writeValue(value[index]);
lineLength += int(childValues_[index].length());
isMultiLine = isMultiLine && hasCommentForValue(value[index]);
isMultiLine = isMultiLine || hasCommentForValue(value[index]);
}
addChildValues_ = false;
isMultiLine = isMultiLine || lineLength >= rightMargin_;
@ -568,7 +568,7 @@ bool StyledStreamWriter::isMultineArray(const Value &value) {
for (int index = 0; index < size && !isMultiLine; ++index) {
writeValue(value[index]);
lineLength += int(childValues_[index].length());
isMultiLine = isMultiLine && hasCommentForValue(value[index]);
isMultiLine = isMultiLine || hasCommentForValue(value[index]);
}
addChildValues_ = false;
isMultiLine = isMultiLine || lineLength >= rightMargin_;