fixed handling of NULL strings in logf calls.
authorkramm <kramm>
Wed, 16 Jan 2002 11:32:42 +0000 (11:32 +0000)
committerkramm <kramm>
Wed, 16 Jan 2002 11:32:42 +0000 (11:32 +0000)
pdf2swf/SWFOutputDev.cc
pdf2swf/swfoutput.cc

index 6af4102..326f98b 100644 (file)
@@ -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("<verbose> \"%s\" link to \"%s\" (%d)\n", type, s, page);
+    logf("<verbose> \"%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("<verbose> substituting %s -> %s", oldname, fontname);
+         logf("<verbose> substituting %s -> %s", FIXNULL(oldname), FIXNULL(fontname));
          substitutepos ++;
       }
       return fontname;
@@ -1100,7 +1100,7 @@ void SWFOutputDev::updateFont(GfxState *state)
       return;
   }
 
-  logf("<verbose> Creating new SWF font: t1id: %d, filename: %s name:%s", this->t1id, fileName, fontname);
+  logf("<verbose> 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);
index eb810bc..170d3cf 100644 (file)
@@ -450,7 +450,7 @@ static void drawchar(struct swfoutput*obj, SWFFont*font, char*character, int cha
 
         if(!outline) {
          logf("<warning> 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("<verbose> Font %s(%d): Storing %d outlines.\n", name, id, charnum);
+    logf("<verbose> 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("<verbose> Font %s has %d used characters",fontid, usednum);
+        logf("<verbose> 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("<warning> Didn't find character '%s' in font '%s'", name, this->name);
+    logf("<warning> 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("<error> internal error: t1id:%d, fontid:%s\n", t1id,fontid);
+        logf("<error> 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("<fatal> Could not create \"%s\". ", filename);
+     logf("<fatal> Could not create \"%s\". ", FIXNULL(filename));
      exit(1);
     }