From bae74a501c520bc180ea329dbe8d91b1ce81d90e Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 9 Nov 2019 19:46:38 +0100 Subject: Fixed use of uninitialized pointer in preprocessor --- src/fileparser.h | 2 +- src/fortranscanner.h | 2 +- src/fortranscanner.l | 2 +- src/markdown.h | 2 +- src/parserintf.h | 2 +- src/pre.l | 10 +++++----- src/pyscanner.h | 2 +- src/pyscanner.l | 2 +- src/scanner.h | 2 +- src/scanner.l | 2 +- src/sqlscanner.h | 2 +- src/tclscanner.h | 2 +- src/tclscanner.l | 2 +- src/vhdljjparser.h | 2 +- src/xmlscanner.h | 2 +- 15 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/fileparser.h b/src/fileparser.h index 7c3f40c..3132f92 100644 --- a/src/fileparser.h +++ b/src/fileparser.h @@ -26,7 +26,7 @@ class FileParser : public ParserInterface void startTranslationUnit(const char *) {} void finishTranslationUnit() {} void parseInput(const char *, const char *,const std::unique_ptr &, bool, QStrList &) {} - bool needsPreprocessing(const QCString &) { return FALSE; } + bool needsPreprocessing(const QCString &) const { return FALSE; } void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, diff --git a/src/fortranscanner.h b/src/fortranscanner.h index 7490cde..6476c98 100644 --- a/src/fortranscanner.h +++ b/src/fortranscanner.h @@ -36,7 +36,7 @@ class FortranLanguageScanner : public ParserInterface const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit); - bool needsPreprocessing(const QCString &extension); + bool needsPreprocessing(const QCString &extension) const; void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, diff --git a/src/fortranscanner.l b/src/fortranscanner.l index a053910..39c45e7 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -2793,7 +2793,7 @@ void FortranLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, showLineNumbers,searchCtx,collectXRefs,m_format); } -bool FortranLanguageScanner::needsPreprocessing(const QCString &extension) +bool FortranLanguageScanner::needsPreprocessing(const QCString &extension) const { return extension!=extension.lower(); // use preprocessor only for upper case extensions } diff --git a/src/markdown.h b/src/markdown.h index f101e5a..2c9a496 100644 --- a/src/markdown.h +++ b/src/markdown.h @@ -36,7 +36,7 @@ class MarkdownFileParser : public ParserInterface const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit); - bool needsPreprocessing(const QCString &) { return FALSE; } + bool needsPreprocessing(const QCString &) const { return FALSE; } void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, diff --git a/src/parserintf.h b/src/parserintf.h index a269bfb..c0939c9 100644 --- a/src/parserintf.h +++ b/src/parserintf.h @@ -78,7 +78,7 @@ class ParserInterface * parser. * @see parseInput() */ - virtual bool needsPreprocessing(const QCString &extension) = 0; + virtual bool needsPreprocessing(const QCString &extension) const = 0; /** Parses a source file or fragment with the goal to produce * highlighted and cross-referenced output. diff --git a/src/pre.l b/src/pre.l index 0ce7eaa..0aa54b9 100644 --- a/src/pre.l +++ b/src/pre.l @@ -334,9 +334,9 @@ struct preYY_state FileDef *yyFileDef; FileDef *inputFileDef; int ifcount = 0; - QStrList *pathList = 0; + QStrList *pathList = 0; QStack includeStack; - QDict *argDict; + QDict *argDict = 0; int defArgs = -1; QCString defName; QCString defText; @@ -348,12 +348,12 @@ struct preYY_state int lastCContext; int lastCPPContext; QArray levelGuard; - BufStr *inputBuf; + BufStr *inputBuf = 0; int inputBufPos; - BufStr *outputBuf; + BufStr *outputBuf = 0; int roundCount; bool quoteArg; - DefineDict *expandedDict; + DefineDict *expandedDict = 0; int findDefArgContext; bool expectGuard; QCString guardName; diff --git a/src/pyscanner.h b/src/pyscanner.h index 13b10b9..2faffdc 100644 --- a/src/pyscanner.h +++ b/src/pyscanner.h @@ -42,7 +42,7 @@ class PythonLanguageScanner : public ParserInterface const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit); - bool needsPreprocessing(const QCString &extension); + bool needsPreprocessing(const QCString &extension) const; void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, diff --git a/src/pyscanner.l b/src/pyscanner.l index 829980c..63f11e3 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -1901,7 +1901,7 @@ void PythonLanguageScanner::parseInput(const char *fileName, // printAST(global_root); } -bool PythonLanguageScanner::needsPreprocessing(const QCString &) +bool PythonLanguageScanner::needsPreprocessing(const QCString &) const { return FALSE; } diff --git a/src/scanner.h b/src/scanner.h index 7103cb0..65206be 100644 --- a/src/scanner.h +++ b/src/scanner.h @@ -37,7 +37,7 @@ class CLanguageScanner : public ParserInterface const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit); - bool needsPreprocessing(const QCString &extension); + bool needsPreprocessing(const QCString &extension) const; void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, diff --git a/src/scanner.l b/src/scanner.l index 8710ca2..33ea4d4 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -7364,7 +7364,7 @@ void CLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, showLineNumbers,searchCtx,collectXRefs); } -bool CLanguageScanner::needsPreprocessing(const QCString &extension) +bool CLanguageScanner::needsPreprocessing(const QCString &extension) const { QCString fe=extension.lower(); SrcLangExt lang = getLanguageFromFileName(extension); diff --git a/src/sqlscanner.h b/src/sqlscanner.h index b981b5b..694bf80 100644 --- a/src/sqlscanner.h +++ b/src/sqlscanner.h @@ -29,7 +29,7 @@ public: void startTranslationUnit(const char *) {} void finishTranslationUnit() {} void parseInput(const char *, const char *, const std::unique_ptr &, bool , QStrList &) {} - bool needsPreprocessing(const QCString &) { return FALSE; } + bool needsPreprocessing(const QCString &) const { return FALSE; } void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, diff --git a/src/tclscanner.h b/src/tclscanner.h index 482fb1f..94da68b 100644 --- a/src/tclscanner.h +++ b/src/tclscanner.h @@ -36,7 +36,7 @@ class TclLanguageScanner : public ParserInterface const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit); - bool needsPreprocessing(const QCString &extension); + bool needsPreprocessing(const QCString &extension) const; void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, diff --git a/src/tclscanner.l b/src/tclscanner.l index 45ad9c0..4f2d837 100644 --- a/src/tclscanner.l +++ b/src/tclscanner.l @@ -3081,7 +3081,7 @@ tcl_inf("%s (%d,%d) %d %d\n",myStr.data(),startLine,endLine,isExampleBlock,inlin printlex(yy_flex_debug, FALSE, __FILE__, fileDef ? fileDef->fileName().data(): NULL); } -bool TclLanguageScanner::needsPreprocessing(const QCString &extension) +bool TclLanguageScanner::needsPreprocessing(const QCString &extension) const { (void)extension; return FALSE; diff --git a/src/vhdljjparser.h b/src/vhdljjparser.h index d38a731..f2bf60d 100644 --- a/src/vhdljjparser.h +++ b/src/vhdljjparser.h @@ -66,7 +66,7 @@ class VHDLLanguageScanner : public ParserInterface const Definition *searchCtx=0, bool collectXRefs=TRUE ); - bool needsPreprocessing(const QCString &) { return TRUE; } + bool needsPreprocessing(const QCString &) const { return TRUE; } void resetCodeParserState(){}; void parsePrototype(const char *text); }; diff --git a/src/xmlscanner.h b/src/xmlscanner.h index b54d416..0fe01a7 100644 --- a/src/xmlscanner.h +++ b/src/xmlscanner.h @@ -29,7 +29,7 @@ public: void startTranslationUnit(const char *) {} void finishTranslationUnit() {} void parseInput(const char *, const char *, const std::unique_ptr &, bool , QStrList &) {} - bool needsPreprocessing(const QCString &) { return FALSE; } + bool needsPreprocessing(const QCString &) const { return FALSE; } void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, -- cgit v0.12