From f0f7a9f29962c55a6c2082b44c9befbd912c2f53 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 27 Mar 2004 15:33:19 +0000 Subject: [PATCH] * Do not close a nesting level twice after close() has been called explicitly on a Nest object. --- src/libutil/util.cc | 1 + src/log2xml/log2xml.cc | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libutil/util.cc b/src/libutil/util.cc index bf14e8aad..87b2ef236 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -279,6 +279,7 @@ void Nest::close() nestingLevel--; if (logType == ltEscapes) cerr << "\033[q"; + nest = false; } } diff --git a/src/log2xml/log2xml.cc b/src/log2xml/log2xml.cc index 66e182452..a4955dc6e 100644 --- a/src/log2xml/log2xml.cc +++ b/src/log2xml/log2xml.cc @@ -16,6 +16,7 @@ struct Decoder bool newNumber; int priority; bool ignoreLF; + int lineNo, charNo; Decoder() { @@ -25,6 +26,8 @@ struct Decoder level = 0; priority = 1; ignoreLF = false; + lineNo = 1; + charNo = 0; } void pushChar(char c); @@ -35,6 +38,11 @@ struct Decoder void Decoder::pushChar(char c) { + if (c == '\n') { + lineNo++; + charNo = 0; + } else charNo++; + switch (state) { case stTop: @@ -71,7 +79,8 @@ void Decoder::pushChar(char c) level--; cout << "" << endl; } else - cerr << "not enough nesting levels" << endl; + cerr << "not enough nesting levels at line " + << lineNo << ", character " << charNo << endl; break; case 's': if (line.size()) finishLine();