From db81982982ba2a80f8c84a96251f726d3ca03dbd Mon Sep 17 00:00:00 2001 From: kramm Date: Wed, 16 Jan 2002 11:32:42 +0000 Subject: [PATCH] fixed handling of NULL strings in logf calls. --- pdf2swf/SWFOutputDev.cc | 14 +++++++------- pdf2swf/swfoutput.cc | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pdf2swf/SWFOutputDev.cc b/pdf2swf/SWFOutputDev.cc index 6af4102..326f98b 100644 --- a/pdf2swf/SWFOutputDev.cc +++ b/pdf2swf/SWFOutputDev.cc @@ -343,11 +343,11 @@ void dumpFontInfo(char*loglevel, GfxFont*font) char*name; gstr = font->getName(); Ref r=font->getID(); - logf("%s=========== %s (ID:%d,%d) ==========\n", loglevel, gstr?gstr->getCString():"(unknown font)", r.num,r.gen); + logf("%s=========== %s (ID:%d,%d) ==========\n", loglevel, gstr?FIXNULL(gstr->getCString()):"(unknown font)", r.num,r.gen); gstr = font->getTag(); if(gstr) - logf("%sTag: %s\n", loglevel, gstr->getCString()); + logf("%sTag: %s\n", loglevel, FIXNULL(gstr->getCString())); if(font->is16Bit()) logf("%sis 16 bit\n", loglevel); GfxFontType type=font->getType(); @@ -376,11 +376,11 @@ void dumpFontInfo(char*loglevel, GfxFont*font) GBool embedded = font->getEmbeddedFontID(&embRef); name = font->getEmbeddedFontName(); if(embedded) - logf("%sEmbedded name: %s id: %d\n",loglevel, name, embRef.num); + logf("%sEmbedded name: %s id: %d\n",loglevel, FIXNULL(name), embRef.num); gstr = font->getExtFontFile(); if(gstr) - logf("%sExternal Font file: %s\n", loglevel, gstr->getCString()); + logf("%sExternal Font file: %s\n", loglevel, FIXNULL(gstr->getCString())); // Get font descriptor flags. if(font->isFixedWidth()) logf("%sis fixed width\n", loglevel); @@ -738,7 +738,7 @@ void SWFOutputDev::drawLink(Link *link, Catalog *catalog) { swfoutput_namedlink(&output, named, points); } - logf(" \"%s\" link to \"%s\" (%d)\n", type, s, page); + logf(" \"%s\" link to \"%s\" (%d)\n", type, FIXNULL(s), page); } } @@ -983,7 +983,7 @@ char* SWFOutputDev::substituteFont(GfxFont*gfxFont, char* oldname) if(oldname) { substitutesource[substitutepos] = oldname; substitutetarget[substitutepos] = fontname; - logf(" substituting %s -> %s", oldname, fontname); + logf(" substituting %s -> %s", FIXNULL(oldname), FIXNULL(fontname)); substitutepos ++; } return fontname; @@ -1100,7 +1100,7 @@ void SWFOutputDev::updateFont(GfxState *state) return; } - logf(" Creating new SWF font: t1id: %d, filename: %s name:%s", this->t1id, fileName, fontname); + logf(" Creating new SWF font: t1id: %d, filename: %s name:%s", this->t1id, FIXNULL(fileName), FIXNULL(fontname)); swfoutput_setfont(&output, fontname, this->t1id, fileName); if(fileName) unlinkfont(fileName); diff --git a/pdf2swf/swfoutput.cc b/pdf2swf/swfoutput.cc index eb810bc..170d3cf 100644 --- a/pdf2swf/swfoutput.cc +++ b/pdf2swf/swfoutput.cc @@ -450,7 +450,7 @@ static void drawchar(struct swfoutput*obj, SWFFont*font, char*character, int cha if(!outline) { logf(" Didn't find %s in current charset (%s)", - character,font->getName()); + FIXNULL(character),FIXNULL(font->getName())); return; } @@ -521,7 +521,7 @@ SWFFont::SWFFont(char*name, int id, char*filename) if(!charnum) return; - logf(" Font %s(%d): Storing %d outlines.\n", name, id, charnum); + logf(" Font %s(%d): Storing %d outlines.\n", FIXNULL(name), id, charnum); this->standardtablesize = 256; if(this->charnum < this->standardtablesize) @@ -607,7 +607,7 @@ SWFFont::~SWFFont() if(usednum && !drawonlyshapes) { - logf(" Font %s has %d used characters",fontid, usednum); + logf(" Font %s has %d used characters",FIXNULL(fontid), usednum); TAG*ftag = swf_InsertTag(swf.firstTag,ST_DEFINEFONT); swf_SetU16(ftag, this->swfid); int initpos = swf_GetTagLen(ftag); @@ -726,7 +726,7 @@ int SWFFont::getSWFCharID(char*name, int charnr) if(this->standardtable && charnr>=0 && charnr < this->standardtablesize) { return getSWFCharID(this->standardtable[charnr], -1); } - logf(" Didn't find character '%s' in font '%s'", name, this->name); + logf(" Didn't find character '%s' in font '%s'", FIXNULL(name), this->name); return 0; } @@ -762,7 +762,7 @@ void swfoutput_setfont(struct swfoutput*obj, char*fontid, int t1id, char*filenam } if(t1id<0) { - logf(" internal error: t1id:%d, fontid:%s\n", t1id,fontid); + logf(" internal error: t1id:%d, fontid:%s\n", t1id,FIXNULL(fontid)); } SWFFont*font = new SWFFont(fontid, t1id, filename); @@ -990,7 +990,7 @@ void swfoutput_destroy(struct swfoutput* obj) fi = 1; // stdout if(fi<=0) { - logf(" Could not create \"%s\". ", filename); + logf(" Could not create \"%s\". ", FIXNULL(filename)); exit(1); } -- 1.7.10.4