From 26f3d147cf3acf62007cb2223c46d6dd033c6fd5 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 29 Mar 2020 12:02:44 +0200 Subject: Revert addition of std::string conversion operator for QCString --- qtools/qcstring.h | 5 ----- src/dotrunner.cpp | 12 ++++++------ src/pre.l | 12 ++++++------ src/section.h | 5 +++-- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/qtools/qcstring.h b/qtools/qcstring.h index c62ce73..ee3b82c 100644 --- a/qtools/qcstring.h +++ b/qtools/qcstring.h @@ -305,11 +305,6 @@ public: return (const char *)data(); } - operator std::string() const - { - return data(); - } - /** Appends string \a str to this string and returns a reference to the result. */ QCString &operator+=( const char *str ) { diff --git a/src/dotrunner.cpp b/src/dotrunner.cpp index cb6bd73..c9ff284 100644 --- a/src/dotrunner.cpp +++ b/src/dotrunner.cpp @@ -73,7 +73,7 @@ static bool resetPDFSize(const int width,const int height, const char *base) } QFile fi(tmpName); QFile fo(patchFile); - if (!fi.open(IO_ReadOnly)) + if (!fi.open(IO_ReadOnly)) { err("problem opening file %s for patching!\n",tmpName.data()); QDir::current().rename(tmpName,patchFile); @@ -117,7 +117,7 @@ bool DotRunner::readBoundingBox(const char *fileName,int *width,int *height,bool const char *bb = isEps ? "%%PageBoundingBox:" : "/MediaBox ["; int bblen = (int)strlen(bb); FILE *f = Portable::fopen(fileName,"rb"); - if (!f) + if (!f) { //printf("readBoundingBox: could not open %s\n",fileName); return FALSE; @@ -158,7 +158,7 @@ DotRunner::DotRunner(const std::string& absDotName, const std::string& md5Hash) void DotRunner::addJob(const char *format, const char *output) { - + for (auto& s: m_jobs) { if (s.format != format) continue; @@ -226,20 +226,20 @@ bool DotRunner::run() } // remove .dot files - if (m_cleanUp) + if (m_cleanUp) { //printf("removing dot file %s\n",m_file.data()); Portable::unlink(m_file.data()); } // create checksum file - if (!m_md5Hash.empty()) + if (!m_md5Hash.empty()) { QCString md5Name = getBaseNameOfOutput(m_file.data()) + ".md5"; FILE *f = Portable::fopen(md5Name,"w"); if (f) { - fwrite(m_md5Hash.data(),1,32,f); + fwrite(m_md5Hash.data(),1,32,f); fclose(f); } } diff --git a/src/pre.l b/src/pre.l index 1dd6004..c7b874f 100644 --- a/src/pre.l +++ b/src/pre.l @@ -1782,13 +1782,13 @@ static FileState *checkAndOpenFile(yyscan_t yyscanner,const QCString &fileName,b // global guard if (state->curlyCount==0) // not #include inside { ... } { - if (g_allIncludes.find(absName)!=g_allIncludes.end()) + if (g_allIncludes.find(absName.data())!=g_allIncludes.end()) { alreadyIncluded = TRUE; //printf(" already included 1\n"); return 0; // already done } - g_allIncludes.insert(absName); + g_allIncludes.insert(absName.data()); } // check include stack for absName @@ -2396,7 +2396,7 @@ static bool expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in //printf("expanded.find(expr)!=state->expanded.end() && + if (state->expanded.find(expr.data())!=state->expanded.end() && level>MAX_EXPANSION_DEPTH) // check for too deep recursive expansions { //printf("expanded.insert(expr); + state->expanded.insert(expr.data()); } QCString macroName; QCString expMacro; @@ -2419,7 +2419,7 @@ static bool expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in //printf(" p=%d macroName=%s\n",p,macroName.data()); if (p<2 || !(expr.at(p-2)=='@' && expr.at(p-1)=='-')) // no-rescan marker? { - if (state->expandedDict.find(macroName)==state->expandedDict.end()) // expand macro + if (state->expandedDict.find(macroName.data())==state->expandedDict.end()) // expand macro { Define *def=state->defineManager.isDefined(macroName); if (macroName=="defined") @@ -2472,7 +2472,7 @@ static bool expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in { state->expandedDict.emplace(macroName,def); expanded = expandExpression(yyscanner,resultExpr,&restExpr,0,level+1); - state->expandedDict.erase(macroName); + state->expandedDict.erase(macroName.data()); } if (expanded) { diff --git a/src/section.h b/src/section.h index 9f1916e..ce778b9 100644 --- a/src/section.h +++ b/src/section.h @@ -3,8 +3,8 @@ * Copyright (C) 1997-2020 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -16,6 +16,7 @@ #ifndef SECTION_H #define SECTION_H +#include #include #include -- cgit v0.12