From 10689ffaba0caeecb59e8cb974a5454cff340197 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 10 Apr 2010 09:11:52 -0400 Subject: [PATCH] Fix carrage return purging, broke in pre-release only --- src/V3PreProc.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/V3PreProc.cpp b/src/V3PreProc.cpp index 926c1cc9b..6be05dd96 100644 --- a/src/V3PreProc.cpp +++ b/src/V3PreProc.cpp @@ -636,20 +636,25 @@ void V3PreProcImp::openFile(FileLine* fl, V3InFilter* filterp, const string& fil // Filter all DOS CR's en-mass. This avoids bugs with lexing CRs in the wrong places. // This will also strip them from strings, but strings aren't supposed to be multi-line without a "\" for (StrList::iterator it=wholefile.begin(); it!=wholefile.end(); ++it) { - // We don't test for \0 as we allow and strip mid-string '\0's (for now). - // We also edit in place. This is nasty to other users of the string, but - // there aren't any, and it avoids needing 2x the memory on very large files. + // We don't end-loop at \0 as we allow and strip mid-string '\0's (for now). + bool strip = false; const char* sp = it->data(); const char* ep = sp + it->length(); - char* cp = (char*) sp; - for (; spdata(); - // Truncate old string - it->erase(len); + if (strip) { + string out; out.reserve(it->length()); + for (const char* cp=sp; cpscanBytesBack(*it);