Skip to content

Commit

Permalink
Guarded debug prints against printing a NULL pointer.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitri van Heesch committed Apr 6, 2015
1 parent 39ba42c commit 0831c71
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 106 deletions.
2 changes: 1 addition & 1 deletion src/classdef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/commentscan.l
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/definition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down Expand Up @@ -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
{
Expand Down
174 changes: 87 additions & 87 deletions src/doxygen.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/filedef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/markdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
8 changes: 4 additions & 4 deletions src/message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
2 changes: 1 addition & 1 deletion src/portable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
6 changes: 3 additions & 3 deletions src/pre.l
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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");
}
Expand Down
4 changes: 2 additions & 2 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
Expand Down

0 comments on commit 0831c71

Please sign in to comment.