Commit b659858b authored by Alexander Anokhin's avatar Alexander Anokhin Committed by Jesse Beder
Browse files

Some small changes as a result of using a static analyzer (#643)

* Removed an expression which is always true
* The second expression (ch is space) is removed because the first one contains space 0x20
* nextEmptyLine is always false so it is removed from the expression
parent 2443da52
......@@ -285,10 +285,8 @@ void Emitter::PrepareTopNode(EmitterNodeType::value child) {
if (child == EmitterNodeType::NoType)
return;
if (m_pState->CurGroupChildCount() > 0 && m_stream.col() > 0) {
if (child != EmitterNodeType::NoType)
if (m_pState->CurGroupChildCount() > 0 && m_stream.col() > 0)
EmitBeginDoc();
}
switch (child) {
case EmitterNodeType::NoType:
......
......@@ -382,7 +382,7 @@ bool WriteChar(ostream_wrapper& out, char ch) {
out << "\"\\b\"";
} else if (ch == '\\') {
out << "\"\\\\\"";
} else if ((0x20 <= ch && ch <= 0x7e) || ch == ' ') {
} else if (0x20 <= ch && ch <= 0x7e) {
out << "\"" << ch << "\"";
} else {
out << "\"";
......
......@@ -183,7 +183,7 @@ std::string ScanScalar(Stream& INPUT, ScanScalarParams& params) {
case FOLD_FLOW:
if (nextEmptyLine) {
scalar += "\n";
} else if (!emptyLine && !nextEmptyLine && !escapedNewline) {
} else if (!emptyLine && !escapedNewline) {
scalar += " ";
}
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment