Permalink
Browse files

Guarded debug prints against printing a NULL pointer.

  • Loading branch information...
Dimitri van Heesch
Dimitri van Heesch committed Apr 6, 2015
1 parent 39ba42c commit 0831c71c05c9204839e187759f13303e64783730
Showing with 106 additions and 106 deletions.
  1. +1 −1 src/classdef.cpp
  2. +4 −4 src/commentscan.l
  3. +2 −2 src/definition.cpp
  4. +87 −87 src/doxygen.cpp
  5. +1 −1 src/filedef.cpp
  6. +1 −1 src/markdown.cpp
  7. +4 −4 src/message.cpp
  8. +1 −1 src/portable.cpp
  9. +3 −3 src/pre.l
  10. +2 −2 src/util.cpp
View
@@ -3714,7 +3714,7 @@ ClassDef *ClassDef::insertTemplateInstance(const QCString &fileName,
ClassDef *templateClass=m_impl->templateInstances->find(templSpec);
if (templateClass==0)
{
Debug::print(Debug::Classes,0," New template instance class `%s'`%s'\n",name().data(),templSpec.data());
Debug::print(Debug::Classes,0," New template instance class `%s'`%s'\n",qPrint(name()),qPrint(templSpec));
QCString tcname = removeRedundantWhiteSpace(localName()+templSpec);
templateClass = new ClassDef(
fileName,startLine,startColumn,tcname,ClassDef::Class);
View
@@ -2915,7 +2915,7 @@ bool parseCommentBlock(/* in */ ParserInterface *parser,
}
Debug::print(Debug::CommentScan,0,"-----------\nCommentScanner: %s:%d\n"
"input=[\n%s]\n",fileName.data(),lineNr,comment.data()
"input=[\n%s]\n",qPrint(fileName),lineNr,qPrint(comment)
);
commentscanYYrestart( commentscanYYin );
@@ -2962,9 +2962,9 @@ bool parseCommentBlock(/* in */ ParserInterface *parser,
Debug::print(Debug::CommentScan,0,
"brief=[line=%d\n%s]\ndocs=[line=%d\n%s]\ninbody=[line=%d\n%s]\n===========\n",
current->briefLine,current->brief.data(),
current->docLine,current->doc.data(),
current->inbodyLine,current->inbodyDocs.data()
current->briefLine,qPrint(current->brief),
current->docLine,qPrint(current->doc),
current->inbodyLine,qPrint(current->inbodyDocs)
);
checkFormula();
View
@@ -741,7 +741,7 @@ bool readCodeFragment(const char *fileName,
else // use filter
{
QCString cmd=filter+" \""+fileName+"\"";
Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",cmd.data());
Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",qPrint(cmd));
f = portable_popen(cmd,"r");
}
bool found = lang==SrcLangExt_VHDL ||
@@ -868,7 +868,7 @@ bool readCodeFragment(const char *fileName,
{
portable_pclose(f);
Debug::print(Debug::FilterOutput, 0, "Filter output\n");
Debug::print(Debug::FilterOutput,0,"-------------\n%s\n-------------\n",result.data());
Debug::print(Debug::FilterOutput,0,"-------------\n%s\n-------------\n",qPrint(result));
}
else
{
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1741,7 +1741,7 @@ void FileDef::acquireFileVersion()
{
msg("Version of %s : ",m_filePath.data());
QCString cmd = vercmd+" \""+m_filePath+"\"";
Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",cmd.data());
Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",qPrint(cmd));
FILE *f=portable_popen(cmd,"r");
if (!f)
{
View
@@ -2318,7 +2318,7 @@ QCString processMarkdown(const QCString &fileName,const int lineNr,Entry *e,cons
// finally process the inline markup (links, emphasis and code spans)
processInline(out,s,s.length());
out.addChar(0);
Debug::print(Debug::Markdown,0,"======== Markdown =========\n---- input ------- \n%s\n---- output -----\n%s\n---------\n",input.data(),out.get());
Debug::print(Debug::Markdown,0,"======== Markdown =========\n---- input ------- \n%s\n---- output -----\n%s\n---------\n",qPrint(input),qPrint(out.get()));
return out.get();
}
View
@@ -238,15 +238,15 @@ void printlex(int dbg, bool enter, const char *lexName, const char *fileName)
if (dbg)
{
if (fileName)
fprintf(stderr,"--%s lexical analyzer: %s (for: %s)\n",enter_txt, lexName, fileName);
fprintf(stderr,"--%s lexical analyzer: %s (for: %s)\n",enter_txt, qPrint(lexName), qPrint(fileName));
else
fprintf(stderr,"--%s lexical analyzer: %s\n",enter_txt, lexName);
fprintf(stderr,"--%s lexical analyzer: %s\n",enter_txt, qPrint(lexName));
}
else
{
if (fileName)
Debug::print(Debug::Lex,0,"%s lexical analyzer: %s (for: %s)\n",enter_txt_uc, lexName, fileName);
Debug::print(Debug::Lex,0,"%s lexical analyzer: %s (for: %s)\n",enter_txt_uc, qPrint(lexName), qPrint(fileName));
else
Debug::print(Debug::Lex,0,"%s lexical analyzer: %s\n",enter_txt_uc, lexName);
Debug::print(Debug::Lex,0,"%s lexical analyzer: %s\n",enter_txt_uc, qPrint(lexName));
}
}
View
@@ -45,7 +45,7 @@ int portable_system(const char *command,const char *args,bool commandHasConsole)
fullCmd += " ";
fullCmd += args;
#ifndef NODEBUG
Debug::print(Debug::ExtCmd,0,"Executing external command `%s`\n",fullCmd.data());
Debug::print(Debug::ExtCmd,0,"Executing external command `%s`\n",qPrint(fullCmd));
#endif
#if !defined(_WIN32) || defined(__CYGWIN__)
View
@@ -1618,11 +1618,11 @@ static void readIncludeFile(const QCString &inc)
{
if (alreadyIncluded)
{
Debug::print(Debug::Preprocessor,0,"#include %s: already included! skipping...\n",incFileName.data());
Debug::print(Debug::Preprocessor,0,"#include %s: already included! skipping...\n",qPrint(incFileName));
}
else
{
Debug::print(Debug::Preprocessor,0,"#include %s: not found! skipping...\n",incFileName.data());
Debug::print(Debug::Preprocessor,0,"#include %s: not found! skipping...\n",qPrint(incFileName));
}
//printf("error: include file %s not found\n",yytext);
}
@@ -3199,7 +3199,7 @@ void preprocessFile(const char *fileName,BufStr &input,BufStr &output)
Define *def;
for (di.toFirst();(def=di.current());++di)
{
Debug::print(Debug::Preprocessor,0,"%s ",def->name.data());
Debug::print(Debug::Preprocessor,0,"%s ",qPrint(def->name));
}
Debug::print(Debug::Preprocessor,0,"\n---------\n");
}
View
@@ -7521,7 +7521,7 @@ bool readInputFile(const char *fileName,BufStr &inBuf,bool filter,bool isSourceC
else
{
QCString cmd=filterName+" \""+fileName+"\"";
Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",cmd.data());
Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",qPrint(cmd));
FILE *f=portable_popen(cmd,"r");
if (!f)
{
@@ -7539,7 +7539,7 @@ bool readInputFile(const char *fileName,BufStr &inBuf,bool filter,bool isSourceC
portable_pclose(f);
inBuf.at(inBuf.curPos()) ='\0';
Debug::print(Debug::FilterOutput, 0, "Filter output\n");
Debug::print(Debug::FilterOutput,0,"-------------\n%s\n-------------\n",inBuf.data());
Debug::print(Debug::FilterOutput,0,"-------------\n%s\n-------------\n",qPrint(inBuf));
}
int start=0;

0 comments on commit 0831c71

Please sign in to comment.