[poppler] 13 commits - fofi/FoFiType1C.cc glib/poppler-action.cc glib/poppler-document.cc glib/poppler-page.cc makefile.vc poppler/ArthurOutputDev.cc poppler/CairoOutputDev.cc poppler/CharCodeToUnicode.cc poppler/Error.cc poppler/Gfx.cc poppler/GlobalParams.cc poppler/JBIG2Stream.cc poppler/PageLabelInfo.cc poppler/XRef.cc qt4/src qt/poppler-document.cc qt/poppler-page.cc qt/poppler-private.h test/perf-test.cc utils/HtmlOutputDev.cc utils/pdftoppm.cc

Krzysztof Kowalczyk kjk at kemper.freedesktop.org
Mon Sep 24 01:08:31 PDT 2007


 fofi/FoFiType1C.cc            |   30 +++++++++++++++---------------
 glib/poppler-action.cc        |    1 -
 glib/poppler-document.cc      |    9 ++-------
 glib/poppler-page.cc          |    3 +--
 makefile.vc                   |    3 +--
 poppler/ArthurOutputDev.cc    |   16 +++++-----------
 poppler/CairoOutputDev.cc     |    6 +++---
 poppler/CharCodeToUnicode.cc  |    2 +-
 poppler/Error.cc              |   12 +++---------
 poppler/Gfx.cc                |    6 ++----
 poppler/GlobalParams.cc       |   40 ++++++++++++++++++----------------------
 poppler/JBIG2Stream.cc        |   16 ++++++++++++----
 poppler/PageLabelInfo.cc      |    2 ++
 poppler/XRef.cc               |   25 ++++---------------------
 qt/poppler-document.cc        |    9 ++++++++-
 qt/poppler-page.cc            |    3 +++
 qt/poppler-private.h          |    8 --------
 qt4/src/poppler-annotation.cc |   16 +++++++++++++---
 qt4/src/poppler-document.cc   |   10 ++++++++++
 qt4/src/poppler-form.cc       |   15 +++++++++++++++
 qt4/src/poppler-private.h     |   25 -------------------------
 test/perf-test.cc             |   10 +++++-----
 utils/HtmlOutputDev.cc        |   33 ++++++---------------------------
 utils/pdftoppm.cc             |    2 +-
 24 files changed, 130 insertions(+), 172 deletions(-)

New commits:
diff-tree 6347915085a487da08d39a859f4261fa812dab09 (from ed01b3965c57ce2a4eabf9c46b5319ea627d3324)
Author: Krzysztof Kowalczyk <kkowalczyk at tlapx60ubu.(none)>
Date:   Mon Sep 24 01:08:17 2007 -0700

    Add Error.cc in msvc build and use setErrorFunction in perf-test.

diff --git a/makefile.vc b/makefile.vc
index 0b0f0ee..feb613b 100644
--- a/makefile.vc
+++ b/makefile.vc
@@ -82,7 +82,7 @@ GOO_OBJS=$(O)\FixedPoint.obj $(O)\GooHas
 
 POPPLER_OBJS=$(O)\Annot.obj $(O)\Array.obj $(O)\BuiltinFont.obj $(O)\BuiltinFontTables.obj \
 	$(O)\CMap.obj $(O)\Catalog.obj $(O)\CharCodeToUnicode.obj $(O)\DCTStream.obj \
-	$(O)\Decrypt.obj $(O)\Dict.obj \
+	$(O)\Decrypt.obj $(O)\Dict.obj $(O)\Error.obj \
 	$(O)\FontEncodingTables.obj $(O)\FontInfo.obj $(O)\Form.obj $(O)\Function.obj \
 	$(O)\Gfx.obj $(O)\GfxFont.obj $(O)\GfxState.obj $(O)\GlobalParams.obj \
 	$(O)\GlobalParamsWin.obj \
@@ -95,7 +95,6 @@ POPPLER_OBJS=$(O)\Annot.obj $(O)\Array.o
 	$(O)\Stream.obj $(O)\TextOutputDev.obj $(O)\UnicodeMap.obj \
 	$(O)\UnicodeTypeTable.obj $(O)\XRef.obj
 
-#$(O)\Error.obj \
 # $(O)\FlateStream.obj 
 
 SPLASH_OBJS=$(O)\Splash.obj $(O)\SplashBitmap.obj $(O)\SplashClip.obj \
diff --git a/test/perf-test.cc b/test/perf-test.cc
index 02dfd52..7697a74 100644
--- a/test/perf-test.cc
+++ b/test/perf-test.cc
@@ -36,6 +36,7 @@
 #include <dirent.h>
 #endif
 
+#include "Error.h"
 #include "ErrorCodes.h"
 #include "GooString.h"
 #include "GooList.h"
@@ -787,8 +788,7 @@ void OutputDebugString(const char *txt)
 #define _vsnprintf vsnprintf
 #endif
 
-void CDECL error(int pos, char *msg, ...) {
-    va_list args;
+void my_error(int pos, char *msg, va_list args) {
     char        buf[4096], *p = buf;
 
     // NB: this can be called before the globalParams object is created
@@ -805,7 +805,6 @@ void CDECL error(int pos, char *msg, ...
     }
 
     p = buf;
-    va_start(args, msg);
     p += _vsnprintf(p, sizeof(buf) - 1, msg, args);
     while ( p > buf  &&  isspace(p[-1]) )
             *--p = '\0';
@@ -813,7 +812,6 @@ void CDECL error(int pos, char *msg, ...
     *p++ = '\n';
     *p   = '\0';
     OutputDebugString(buf);
-    va_end(args);
 
     if (pos >= 0) {
         p += _snprintf(p, sizeof(buf)-1, "Error (%d): ", pos);
@@ -826,7 +824,7 @@ void CDECL error(int pos, char *msg, ...
         if (gErrFile)
             fprintf(gErrFile, "Error: ");
     }
-
+#if 0
     p = buf;
     va_start(args, msg);
     p += _vsnprintf(p, sizeof(buf) - 3, msg, args);
@@ -839,6 +837,7 @@ void CDECL error(int pos, char *msg, ...
     if (gErrFile)
         fprintf(gErrFile, buf);
     va_end(args);
+#endif
 }
 
 void LogInfo(char *fmt, ...)
@@ -1314,6 +1313,7 @@ int main(int argc, char **argv)
 {
     //runAllUnitTests();
 
+    setErrorFunction(my_error);
     ParseCommandLine(argc, argv);
     if (0 == StrList_Len(&gArgsListRoot))
         PrintUsageAndExit(argc, argv);
diff-tree ed01b3965c57ce2a4eabf9c46b5319ea627d3324 (from 71fb15f8bd131a13d8cf0f394fe601cfbb6e1772)
Author: Krzysztof Kowalczyk <kkowalczyk at tlapx60ubu.(none)>
Date:   Mon Sep 24 01:03:09 2007 -0700

    Match declaration of setErrorFunction with its definition.
    
    Also enable this code for Windows, since CDECL was what
    was throwing msvc off.

diff --git a/poppler/Error.cc b/poppler/Error.cc
index fe1413b..80e45aa 100644
--- a/poppler/Error.cc
+++ b/poppler/Error.cc
@@ -18,7 +18,7 @@
 #include "GlobalParams.h"
 #include "Error.h"
 
-static void CDECL defaultErrorFunction(int pos, char *msg, va_list args)
+static void defaultErrorFunction(int pos, char *msg, va_list args)
 {
   if (pos >= 0) {
     fprintf(stderr, "Error (%d): ", pos);
@@ -30,14 +30,12 @@ static void CDECL defaultErrorFunction(i
   fflush(stderr);
 }
 
-#ifndef _MSC_VER
-static void CDECL (*errorFunction)(int , char *, va_list args) = defaultErrorFunction;
+static void (*errorFunction)(int, char *, va_list args) = defaultErrorFunction;
 
-void setErrorFunction(void CDECL (* f)(int , char *, va_list args))
+void setErrorFunction(void (* f)(int, char *, va_list args))
 {
     errorFunction = f;
 }
-#endif
 
 void CDECL error(int pos, char *msg, ...) {
   va_list args;
@@ -46,11 +44,7 @@ void CDECL error(int pos, char *msg, ...
     return;
   }
   va_start(args, msg);
-#ifdef _MSC_VER
-  defaultErrorFunction(pos, msg, args);
-#else
   (*errorFunction)(pos, msg, args);
-#endif
   va_end(args);
 }
 
diff-tree 71fb15f8bd131a13d8cf0f394fe601cfbb6e1772 (from 7ba3f198a0651d2a7c91b7d9e10a5173dc3de0a3)
Author: Krzysztof Kowalczyk <kkowalczyk at tlapx60ubu.(none)>
Date:   Mon Sep 24 00:38:29 2007 -0700

    Even less compiler warnings.

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 14db0d7..a51b6b6 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -592,7 +592,7 @@ static uint32_t luminocity(uint32_t x)
   int r = (x >> 16) & 0xff;
   int g = (x >>  8) & 0xff;
   int b = (x >>  0) & 0xff;
-  int y = 0.3 * r + 0.59 * g + 0.11 * b;
+  int y = (int) (0.3 * r + 0.59 * g + 0.11 * b);
   return y << 24;
 }
 
@@ -606,8 +606,8 @@ void CairoOutputDev::setSoftMask(GfxStat
 
     double x1, y1, x2, y2;
     cairo_clip_extents(cairo, &x1, &y1, &x2, &y2);
-    int width = ceil(x2) - floor(x1);
-    int height = ceil(y2) - floor(y1);
+    int width = (int)(ceil(x2) - floor(x1));
+    int height = (int)(ceil(y2) - floor(y1));
 
     cairo_surface_t *source = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
     cairo_t *maskCtx = cairo_create(source);
diff --git a/qt/poppler-page.cc b/qt/poppler-page.cc
index 4f630df..b59f699 100644
--- a/qt/poppler-page.cc
+++ b/qt/poppler-page.cc
@@ -339,6 +339,9 @@ QValueList<Link*> Page::links() const
           m_refGen = r->gen;
           copyString( m_uri, m->getTitle()->getCString() );
 */      break;
+        case actionSound:
+        /* TODO: write me */
+        break;
 
         case actionUnknown:
         break;
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 721e5c2..9a33050 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -59,6 +59,7 @@ static GooString* basename(GooString* st
   return new GooString(str);
 }
 
+#if 0
 static GooString* Dirname(GooString* str){
   
   char *p=str->getCString();
@@ -68,6 +69,7 @@ static GooString* Dirname(GooString* str
       return new GooString(p,i+1);
   return new GooString();
 } 
+#endif
 
 //------------------------------------------------------------------------
 // HtmlString
@@ -994,10 +996,9 @@ HtmlOutputDev::~HtmlOutputDev() {
       delete pages;
 }
 
-
-
 void HtmlOutputDev::startPage(int pageNum, GfxState *state) {
-  /*if (mode&&!xml){
+#if 0
+  if (mode&&!xml){
     if (write){
       write=gFalse;
       GooString* fname=Dirname(Docname);
@@ -1012,7 +1013,8 @@ void HtmlOutputDev::startPage(int pageNu
     // else 
       fprintf(tin,"ROTATE=%d neg %d neg translate\n",state->getX1(),state->getY1());  
     }
-  }*/
+  }
+#endif
 
   this->pageNum = pageNum;
   GooString *str=basename(Docname);
diff-tree 7ba3f198a0651d2a7c91b7d9e10a5173dc3de0a3 (from ab1059f594cb9fccd8568ca2a535a363c7521daa)
Author: Krzysztof Kowalczyk <kkowalczyk at tlapx60ubu.(none)>
Date:   Mon Sep 24 00:32:37 2007 -0700

    Even less compiler warnings.

diff --git a/qt/poppler-document.cc b/qt/poppler-document.cc
index bae8418..cd77151 100644
--- a/qt/poppler-document.cc
+++ b/qt/poppler-document.cc
@@ -30,6 +30,14 @@
 
 namespace Poppler {
 
+static GooString *QStringToGooString(const QString &s) {
+    int len = s.length();
+    char *cstring = (char *)gmallocn(s.length(), sizeof(char));
+    for (int i = 0; i < len; ++i)
+      cstring[i] = s.at(i).unicode();
+    return new GooString(cstring, len);
+}
+
 Document *Document::load(const QString &filePath)
 {
   if (!globalParams) {
diff --git a/qt/poppler-private.h b/qt/poppler-private.h
index 5a5a421..227547a 100644
--- a/qt/poppler-private.h
+++ b/qt/poppler-private.h
@@ -42,14 +42,6 @@ static QString unicodeToQString(Unicode*
     return ret;
 }
 
-static GooString *QStringToGooString(const QString &s) {
-    int len = s.length();
-    char *cstring = (char *)gmallocn(s.length(), sizeof(char));
-    for (int i = 0; i < len; ++i)
-      cstring[i] = s.at(i).unicode();
-    return new GooString(cstring, len);
-}
-
 static QString UnicodeParsedString(GooString *s1) {
     GBool isUnicode;
     int i;
diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc
index e34b1f2..5c21adf 100644
--- a/qt4/src/poppler-document.cc
+++ b/qt4/src/poppler-document.cc
@@ -36,6 +36,16 @@
 
 namespace Poppler {
 
+  static GooString *QStringToGooString(const QString &s) {
+      int len = s.length();
+      char *cstring = (char *)gmallocn(s.length(), sizeof(char));
+      for (int i = 0; i < len; ++i)
+        cstring[i] = s.at(i).unicode();
+      GooString *ret = new GooString(cstring, len);
+      gfree(cstring);
+      return ret;
+  }
+
   int DocumentData::count = 0;
 
   Document *Document::load(const QString &filePath, const QByteArray &ownerPassword,
diff --git a/qt4/src/poppler-form.cc b/qt4/src/poppler-form.cc
index c9f4239..51dc935 100644
--- a/qt4/src/poppler-form.cc
+++ b/qt4/src/poppler-form.cc
@@ -29,6 +29,21 @@
 
 namespace Poppler {
 
+static GooString *QStringToUnicodeGooString(const QString &s) {
+    int len = s.length() * 2 + 2;
+    char *cstring = (char *)gmallocn(len, sizeof(char));
+    cstring[0] = 0xfe;
+    cstring[1] = 0xff;
+    for (int i = 0; i < s.length(); ++i)
+    {
+      cstring[2+i*2] = s.at(i).row();
+      cstring[3+i*2] = s.at(i).cell();
+    }
+    GooString *ret = new GooString(cstring, len);
+    gfree(cstring);
+    return ret;
+}
+
 FormField::FormField(FormFieldData &dd)
   : m_formData(&dd)
 {
diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h
index 35ed164..43a67c8 100644
--- a/qt4/src/poppler-private.h
+++ b/qt4/src/poppler-private.h
@@ -50,31 +50,6 @@ namespace Poppler {
         return ret;
     }
 
-    static GooString *QStringToGooString(const QString &s) {
-        int len = s.length();
-        char *cstring = (char *)gmallocn(s.length(), sizeof(char));
-        for (int i = 0; i < len; ++i)
-          cstring[i] = s.at(i).unicode();
-        GooString *ret = new GooString(cstring, len);
-        gfree(cstring);
-        return ret;
-    }
-
-    static GooString *QStringToUnicodeGooString(const QString &s) {
-        int len = s.length() * 2 + 2;
-        char *cstring = (char *)gmallocn(len, sizeof(char));
-        cstring[0] = 0xfe;
-        cstring[1] = 0xff;
-        for (int i = 0; i < s.length(); ++i)
-        {
-          cstring[2+i*2] = s.at(i).row();
-          cstring[3+i*2] = s.at(i).cell();
-        }
-        GooString *ret = new GooString(cstring, len);
-        gfree(cstring);
-        return ret;
-    }
-
     static QString UnicodeParsedString(GooString *s1) {
         if ( !s1 || s1->getLength() == 0 )
             return QString();
diff-tree ab1059f594cb9fccd8568ca2a535a363c7521daa (from 71c47b30adf687a0bcece22834933267053360de)
Author: Krzysztof Kowalczyk <kkowalczyk at tlapx60ubu.(none)>
Date:   Mon Sep 24 00:14:01 2007 -0700

    Don't break aliasing.

diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 3f02013..1d59460 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -755,10 +755,6 @@ GBool GlobalParams::parseYesNo2(char *to
 }
 
 GlobalParams::~GlobalParams() {
-  GooHashIter *iter;
-  GooString *key;
-  GooList *list;
-
   freeBuiltinFontTables();
 
   delete macRomanReverseMap;
@@ -772,9 +768,7 @@ GlobalParams::~GlobalParams() {
   deleteGooList(toUnicodeDirs, GooString);
   deleteGooHash(displayFonts, DisplayFontParam);
 #ifdef WIN32
-  if (winFontList) {
-    delete winFontList;
-  }
+  delete winFontList;
 #endif
   deleteGooHash(psFonts, PSFontParam);
   deleteGooList(psNamedFonts16, PSFontParam);
@@ -782,8 +776,12 @@ GlobalParams::~GlobalParams() {
   delete textEncoding;
   deleteGooList(fontDirs, GooString);
 
+  GooHashIter *iter;
+  GooString *key;
   cMapDirs->startIter(&iter);
-  while (cMapDirs->getNext(&iter, &key, (void **)&list)) {
+  void *val;
+  while (cMapDirs->getNext(&iter, &key, &val)) {
+    GooList* list = (GooList*)val;
     deleteGooList(list, GooString);
   }
   delete cMapDirs;
@@ -1481,28 +1479,26 @@ CharCodeToUnicode *GlobalParams::getCIDT
 }
 
 CharCodeToUnicode *GlobalParams::getUnicodeToUnicode(GooString *fontName) {
-  CharCodeToUnicode *ctu;
-  GooHashIter *iter;
-  GooString *fontPattern, *fileName;
-
   lockGlobalParams;
-  fileName = NULL;
+  GooHashIter *iter;
   unicodeToUnicodes->startIter(&iter);
-  while (unicodeToUnicodes->getNext(&iter, &fontPattern, (void **)&fileName)) {
+  GooString *fileName = NULL;
+  GooString *fontPattern;
+  void *val;
+  while (!fileName && unicodeToUnicodes->getNext(&iter, &fontPattern, &val)) {
     if (strstr(fontName->getCString(), fontPattern->getCString())) {
       unicodeToUnicodes->killIter(&iter);
-      break;
+      fileName = (GooString*)val;
     }
-    fileName = NULL;
   }
+  CharCodeToUnicode *ctu = NULL;
   if (fileName) {
-    if (!(ctu = unicodeToUnicodeCache->getCharCodeToUnicode(fileName))) {
-      if ((ctu = CharCodeToUnicode::parseUnicodeToUnicode(fileName))) {
-	unicodeToUnicodeCache->add(ctu);
-      }
+    ctu = unicodeToUnicodeCache->getCharCodeToUnicode(fileName);
+    if (!ctu) {
+      ctu = CharCodeToUnicode::parseUnicodeToUnicode(fileName);
+      if (ctu)
+         unicodeToUnicodeCache->add(ctu);
     }
-  } else {
-    ctu = NULL;
   }
   unlockGlobalParams;
   return ctu;
diff-tree 71c47b30adf687a0bcece22834933267053360de (from 8466d94929844c976bbad8bb7d1ea7f7f77cc196)
Author: Krzysztof Kowalczyk <kkowalczyk at tlapx60ubu.(none)>
Date:   Sun Sep 23 23:49:31 2007 -0700

    Reduce compiler warnings.

diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index d1eb99b..349514a 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -2579,8 +2579,8 @@ JBIG2Bitmap *JBIG2Stream::readGenericBit
   JBIG2Bitmap *bitmap;
   GBool ltp;
   Guint ltpCX, cx, cx0, cx1, cx2;
-  JBIG2BitmapPtr cxPtr0, cxPtr1;
-  JBIG2BitmapPtr atPtr0, atPtr1, atPtr2, atPtr3;
+  JBIG2BitmapPtr cxPtr0 = {0}, cxPtr1 = {0};
+  JBIG2BitmapPtr atPtr0 = {0}, atPtr1 = {0}, atPtr2 = {0}, atPtr3 = {0};
   int *refLine, *codingLine;
   int code1, code2, code3;
   int x, y, a0, pix, i, refI, codingI;
@@ -3025,8 +3025,16 @@ JBIG2Bitmap *JBIG2Stream::readGenericRef
   JBIG2Bitmap *bitmap;
   GBool ltp;
   Guint ltpCX, cx, cx0, cx2, cx3, cx4, tpgrCX0, tpgrCX1, tpgrCX2;
-  JBIG2BitmapPtr cxPtr0, cxPtr1, cxPtr2, cxPtr3, cxPtr4, cxPtr5, cxPtr6;
-  JBIG2BitmapPtr tpgrCXPtr0, tpgrCXPtr1, tpgrCXPtr2;
+  JBIG2BitmapPtr cxPtr0 = {0};
+  JBIG2BitmapPtr cxPtr1 = {0};
+  JBIG2BitmapPtr cxPtr2 = {0};
+  JBIG2BitmapPtr cxPtr3 = {0};
+  JBIG2BitmapPtr cxPtr4 = {0};
+  JBIG2BitmapPtr cxPtr5 = {0};
+  JBIG2BitmapPtr cxPtr6 = {0};
+  JBIG2BitmapPtr tpgrCXPtr0 = {0};
+  JBIG2BitmapPtr tpgrCXPtr1 = {0};
+  JBIG2BitmapPtr tpgrCXPtr2 = {0};
   int x, y, pix;
 
   bitmap = new JBIG2Bitmap(0, w, h);
diff-tree 8466d94929844c976bbad8bb7d1ea7f7f77cc196 (from c53b8ccfba6fa4345086493f9e44212721c11d0a)
Author: Krzysztof Kowalczyk <kkowalczyk at tlapx60ubu.(none)>
Date:   Sun Sep 23 23:34:52 2007 -0700

    Reduce compiler warnings. Tabs to spaces.

diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc
index a3a0c59..6930c12 100644
--- a/fofi/FoFiType1C.cc
+++ b/fofi/FoFiType1C.cc
@@ -2043,7 +2043,7 @@ void FoFiType1C::readTopDict() {
 // (if any) out of the FD.
 void FoFiType1C::readFD(int offset, int length, Type1CPrivateDict *pDict) {
   int pos, pSize, pOffset;
-  double fontMatrix[6];
+  double fontMatrix[6] = {0};
   GBool hasFontMatrix;
 
   hasFontMatrix = gFalse;
@@ -2057,21 +2057,21 @@ void FoFiType1C::readFD(int offset, int 
     }
     if (!ops[nOps - 1].isNum) {
       if (ops[nOps - 1].op == 0x0012) {
-	if (nOps < 3) {
-	  parsedOk = gFalse;
-	  return;
-	}
-	pSize = (int)ops[0].num;
-	pOffset = (int)ops[1].num;
-	break;
+        if (nOps < 3) {
+          parsedOk = gFalse;
+          return;
+        }
+        pSize = (int)ops[0].num;
+        pOffset = (int)ops[1].num;
+        break;
       } else if (ops[nOps - 1].op == 0x0c07) {
-	fontMatrix[0] = ops[0].num;
-	fontMatrix[1] = ops[1].num;
-	fontMatrix[2] = ops[2].num;
-	fontMatrix[3] = ops[3].num;
-	fontMatrix[4] = ops[4].num;
-	fontMatrix[5] = ops[5].num;
-	hasFontMatrix = gTrue;
+        fontMatrix[0] = ops[0].num;
+        fontMatrix[1] = ops[1].num;
+        fontMatrix[2] = ops[2].num;
+        fontMatrix[3] = ops[3].num;
+        fontMatrix[4] = ops[4].num;
+        fontMatrix[5] = ops[5].num;
+        hasFontMatrix = gTrue;
       }
       nOps = 0;
     }
diff-tree c53b8ccfba6fa4345086493f9e44212721c11d0a (from abede2a06c5c9dc97b40479deda49621458f1171)
Author: Krzysztof Kowalczyk <kkowalczyk at tlapx60ubu.(none)>
Date:   Sun Sep 23 23:23:34 2007 -0700

    Reduce number of compiler warnings.

diff --git a/poppler/CharCodeToUnicode.cc b/poppler/CharCodeToUnicode.cc
index 0db7620..15011e1 100644
--- a/poppler/CharCodeToUnicode.cc
+++ b/poppler/CharCodeToUnicode.cc
@@ -500,7 +500,7 @@ int CharCodeToUnicode::mapToUnicode(Char
 int CharCodeToUnicode::mapToCharCode(Unicode* u, CharCode *c, int usize) {
   //look for charcode in map
   if (usize == 1) {
-    for (int i=0; i<mapLen; i++) {
+    for (CharCode i=0; i<mapLen; i++) {
       if (map[i] == ((*u)&0xff)) {
         *c = (char)map[i];
         return 1;
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index a533138..63b7732 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -564,9 +564,6 @@ void Gfx::go(GBool topLevel) {
   Object args[maxArgs];
   int numArgs, i;
   int lastAbortCheck;
-#ifdef HAVE_GETTIMEOFDAY
-  GooTimer *timer;
-#endif
 
   // scan a sequence of objects
   updateLevel = lastAbortCheck = 0;
@@ -586,6 +583,7 @@ void Gfx::go(GBool topLevel) {
 	fflush(stdout);
       }
 #ifdef HAVE_GETTIMEOFDAY
+      GooTimer *timer = NULL;
       if (profileCommands) 
 	timer = new GooTimer ();
 #endif
@@ -612,7 +610,7 @@ void Gfx::go(GBool topLevel) {
 	  
 	  data_p->addElement (timer->getElapsed ());
 	}
-	delete (timer);
+        delete timer;
       }
 #endif
       obj.free();
diff --git a/poppler/PageLabelInfo.cc b/poppler/PageLabelInfo.cc
index 8cd7282..6ca65e9 100644
--- a/poppler/PageLabelInfo.cc
+++ b/poppler/PageLabelInfo.cc
@@ -122,6 +122,7 @@ static int fromLatin(const char *buffer)
   return -1;
 }
 
+#ifdef TEST
 static void toLatin(int number, GooString *str, GBool uppercase) {
   char base, letter;
   int i, count;
@@ -137,6 +138,7 @@ static void toLatin(int number, GooStrin
   for (i = 0; i < count; i++)
     str->append(letter);
 }
+#endif
 
 PageLabelInfo::Interval::Interval(Object *dict, int baseA) {
   Object obj;
diff-tree abede2a06c5c9dc97b40479deda49621458f1171 (from 60f5bcea4a920441e25ae11d677636242aabb2db)
Author: Krzysztof Kowalczyk <kkowalczyk at tlapx60ubu.(none)>
Date:   Sun Sep 23 23:03:36 2007 -0700

    Reduce number of compiler warnings.

diff --git a/glib/poppler-action.cc b/glib/poppler-action.cc
index a580d6b..562790d 100644
--- a/glib/poppler-action.cc
+++ b/glib/poppler-action.cc
@@ -268,7 +268,6 @@ static PopplerDest *
 dest_new_named (GooString *named_dest)
 {
 	PopplerDest *dest;
-	gchar *name;
 
 	dest = g_new0 (PopplerDest, 1);
 
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 700fe13..a36dc4e 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -122,7 +122,6 @@ poppler_document_new_from_file (const ch
   PDFDoc *newDoc;
   GooString *filename_g;
   GooString *password_g;
-  int err;
   char *filename;
 
   if (!globalParams) {
@@ -141,8 +140,7 @@ poppler_document_new_from_file (const ch
     password_g = new GooString (password);
 
   newDoc = new PDFDoc(filename_g, password_g, password_g);
-  if (password_g)
-    delete password_g;
+  delete password_g;
 
   return _poppler_document_new_from_pdfdoc (newDoc, error);
 }
@@ -170,8 +168,6 @@ poppler_document_new_from_data (char    
   PDFDoc *newDoc;
   MemStream *str;
   GooString *password_g;
-  int err;
-  char *filename;
 
   if (!globalParams) {
     globalParams = new GlobalParams();
@@ -186,8 +182,7 @@ poppler_document_new_from_data (char    
     password_g = new GooString (password);
 
   newDoc = new PDFDoc(str, password_g, password_g);
-  if (password_g)
-    delete password_g;
+  delete password_g;
 
   return _poppler_document_new_from_pdfdoc (newDoc, error);
 }
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 9765608..973794c 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -914,9 +914,8 @@ poppler_page_get_text (PopplerPage      
 		       PopplerRectangle     *selection)
 {
   TextOutputDev *text_dev;
-  PDFDoc *doc;
   GooString *sel_text;
-  double height, y1, y2;
+  double height;
   char *result;
   SelectionStyle selection_style = selectionStyleGlyph;
   PDFRectangle pdf_selection;
diff --git a/qt/poppler-document.cc b/qt/poppler-document.cc
index 320e2cf..bae8418 100644
--- a/qt/poppler-document.cc
+++ b/qt/poppler-document.cc
@@ -206,7 +206,6 @@ QDateTime Document::getDate( const QStri
   }
 
   Object obj;
-  char *s;
   int year, mon, day, hour, min, sec;
   Dict *infoDict = info.getDict();
   QString result;
diff --git a/qt4/src/poppler-annotation.cc b/qt4/src/poppler-annotation.cc
index 2e43935..0e3fe52 100644
--- a/qt4/src/poppler-annotation.cc
+++ b/qt4/src/poppler-annotation.cc
@@ -1442,6 +1442,7 @@ LinkAnnotation::LinkAnnotation( const QD
                 {
                     Poppler::LinkAction::ActionType act;
                     QString actString = qe.attribute( "action" );
+                    bool found = true;
                     if ( actString == "PageFirst" )
                         act = Poppler::LinkAction::PageFirst;
                     else if ( actString == "PagePrev" )
@@ -1466,8 +1467,13 @@ LinkAnnotation::LinkAnnotation( const QD
                         act = Poppler::LinkAction::GoToPage;
                     else if ( actString == "Close" )
                         act = Poppler::LinkAction::Close;
-                    Poppler::LinkAction * action = new Poppler::LinkAction( QRect(), act );
-                    d->linkDestination = action;
+                    else
+                        found = false;
+                    if (found)
+                    {
+                        Poppler::LinkAction * action = new Poppler::LinkAction( QRect(), act );
+                        d->linkDestination = action;
+                    }
                 }
                 else if ( type == "Movie" )
                 {
@@ -1590,10 +1596,14 @@ void LinkAnnotation::store( QDomNode & n
             }
             case Poppler::Link::Movie:
             {
-                Poppler::LinkMovie * movie = static_cast< Poppler::LinkMovie * >( d->linkDestination );
                 hyperlinkElement.setAttribute( "type", "Movie" );
                 break;
             }
+            case Poppler::Link::Sound:
+            {
+                // FIXME: implement me
+                break;
+            }
             case Poppler::Link::None:
                 break;
         }
diff-tree 60f5bcea4a920441e25ae11d677636242aabb2db (from 3179eee44eb0afbc642675268b9a4abb16ccdde3)
Author: Krzysztof Kowalczyk <kkowalczyk at tlapx60ubu.(none)>
Date:   Sun Sep 23 22:48:06 2007 -0700

    Remove unused variables.

diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index e64a4f8..164679d 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -131,7 +131,7 @@ int main(int argc, char *argv[]) {
   SplashOutputDev *splashOut;
   GBool ok;
   int exitCode;
-  int pg, pg_num_len, pg_x_len, pg_y_len;
+  int pg, pg_num_len;
   double pg_w, pg_h, tmp;
 
   exitCode = 99;
diff-tree 3179eee44eb0afbc642675268b9a4abb16ccdde3 (from e9dc379190aa3166870d0b11a05ccc4e9dad2706)
Author: Krzysztof Kowalczyk <kkowalczyk at tlapx60ubu.(none)>
Date:   Sun Sep 23 22:47:21 2007 -0700

    Remove unused variables.

diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index f88ffb0..721e5c2 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -1084,8 +1084,6 @@ void HtmlOutputDev::drawImageMask(GfxSta
 			      int width, int height, GBool invert,
 			      GBool inlineImg) {
 
-  int i, j;
-  
   if (ignore||complexMode) {
     OutputDev::drawImageMask(state, ref, str, width, height, invert, inlineImg);
     return;
@@ -1098,14 +1096,6 @@ void HtmlOutputDev::drawImageMask(GfxSta
   int w0, h0, w1, h1;		// size of image
   double xt, yt, wt, ht;
   GBool rotate, xFlip, yFlip;
-  GBool dither;
-  int x, y;
-  int ix, iy;
-  int px1, px2, qx, dx;
-  int py1, py2, qy, dy;
-  Gulong pixel;
-  int nComps, nVals, nBits;
-  double r1, g1, b1;
  
   // get image position and size
   state->transform(0, 0, &xt, &yt);
@@ -1175,8 +1165,6 @@ void HtmlOutputDev::drawImage(GfxState *
 			  int width, int height, GfxImageColorMap *colorMap,
 			  int *maskColors, GBool inlineImg) {
 
-  int i, j;
-   
   if (ignore||complexMode) {
     OutputDev::drawImage(state, ref, str, width, height, colorMap, 
 			 maskColors, inlineImg);
@@ -1184,23 +1172,12 @@ void HtmlOutputDev::drawImage(GfxState *
   }
 
   FILE *f1;
-  ImageStream *imgStr;
-  Guchar pixBuf[4];
-  GfxColor color;
   int c;
   
   int x0, y0;			// top left corner of image
   int w0, h0, w1, h1;		// size of image
   double xt, yt, wt, ht;
   GBool rotate, xFlip, yFlip;
-  GBool dither;
-  int x, y;
-  int ix, iy;
-  int px1, px2, qx, dx;
-  int py1, py2, qy, dy;
-  Gulong pixel;
-  int nComps, nVals, nBits;
-  double r1, g1, b1;
  
   // get image position and size
   state->transform(0, 0, &xt, &yt);
diff-tree e9dc379190aa3166870d0b11a05ccc4e9dad2706 (from 08bf7c1151d594d4c7d253a2c89f4f3a088ad8ec)
Author: Krzysztof Kowalczyk <kkowalczyk at tlapx60ubu.(none)>
Date:   Sun Sep 23 22:41:59 2007 -0700

    Remove unused variables.

diff --git a/poppler/ArthurOutputDev.cc b/poppler/ArthurOutputDev.cc
index 1f509ea..134c05c 100644
--- a/poppler/ArthurOutputDev.cc
+++ b/poppler/ArthurOutputDev.cc
@@ -78,20 +78,16 @@ ArthurOutputDev::~ArthurOutputDev()
 }
 
 void ArthurOutputDev::startDoc(XRef *xrefA) {
-  int i;
-
   xref = xrefA;
-  if (m_fontEngine) {
-    delete m_fontEngine;
-  }
+  delete m_fontEngine;
   m_fontEngine = new SplashFontEngine(
 #if HAVE_T1LIB_H
-				    globalParams->getEnableT1lib(),
+  globalParams->getEnableT1lib(),
 #endif
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
-				    globalParams->getEnableFreeType(),
+  globalParams->getEnableFreeType(),
 #endif
-				    globalParams->getAntialias());
+  globalParams->getAntialias());
 }
 
 void ArthurOutputDev::startPage(int pageNum, GfxState *state)
@@ -497,7 +493,6 @@ void ArthurOutputDev::drawChar(GfxState 
   // fill
   if (!(render & 1)) {
     int x0, y0, xFrac, yFrac;
-    SplashGlyphBitmap glyph;
 
     x0 = static_cast<int>(floor(x1));
     xFrac = splashFloor((x1 - x0) * splashFontFraction);
@@ -681,8 +676,7 @@ void ArthurOutputDev::drawImage(GfxState
   int x, y;
   ImageStream *imgStr;
   Guchar *pix;
-  GfxRGB rgb;
-  int alpha, i;
+  int i;
   double *ctm;
   QMatrix matrix;
   int is_identity_transform;
diff-tree 08bf7c1151d594d4c7d253a2c89f4f3a088ad8ec (from 5a1f670a4d16affeed86cdf643ab22f481caa3a5)
Author: Krzysztof Kowalczyk <kkowalczyk at tlapx60ubu.(none)>
Date:   Sun Sep 23 22:28:16 2007 -0700

    replace extremely confusing 'a*(int)sizeof(foo)/sizeof(foo) != a' which, due to type promotions, if a is int, is equivalent to a < 0; fix problems revealed by the change

diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index b84e198..14b3ad5 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -12,6 +12,7 @@
 #pragma implementation
 #endif
 
+#include <assert.h>
 #include <stdlib.h>
 #include <stddef.h>
 #include <string.h>
@@ -110,11 +111,6 @@ ObjectStream::ObjectStream(XRef *xref, i
     goto err1;
   }
 
-  if (nObjects*(int)sizeof(int)/sizeof(int) != nObjects) {
-    error(-1, "Invalid 'nObjects'");
-    goto err1;
-  }
- 
   objs = new Object[nObjects];
   objNums = (int *)gmallocn(nObjects, sizeof(int));
   offsets = (int *)gmallocn(nObjects, sizeof(int));
@@ -400,11 +396,8 @@ GBool XRef::readXRefTable(Parser *parser
 	   first + n > newSize && newSize > 0;
 	   newSize <<= 1) ;
       if (newSize < 0) {
-	goto err1;
-      }
-      if (newSize*(int)sizeof(XRefEntry)/sizeof(XRefEntry) != newSize) {
         error(-1, "Invalid 'obj' parameters'");
-        goto err1;
+	goto err1;
       }
  
       entries = (XRefEntry *)greallocn(entries, newSize, sizeof(XRefEntry));
@@ -515,10 +508,7 @@ GBool XRef::readXRefStream(Stream *xrefS
     goto err1;
   }
   if (newSize > size) {
-    if (newSize * (int)sizeof(XRefEntry)/sizeof(XRefEntry) != newSize) {
-      error(-1, "Invalid 'size' parameter.");
-      return gFalse;
-    }
+    assert(newSize >= 0);
     entries = (XRefEntry *)greallocn(entries, newSize, sizeof(XRefEntry));
     for (i = size; i < newSize; ++i) {
       entries[i].offset = 0xffffffff;
@@ -608,9 +598,6 @@ GBool XRef::readXRefStreamSection(Stream
 	 first + n > newSize && newSize > 0;
 	 newSize <<= 1) ;
     if (newSize < 0) {
-      return gFalse;
-    }
-    if (newSize*(int)sizeof(XRefEntry)/sizeof(XRefEntry) != newSize) {
       error(-1, "Invalid 'size' inside xref table.");
       return gFalse;
     }
@@ -754,10 +741,6 @@ GBool XRef::constructXRef() {
 		    error(-1, "Bad object number");
 		    return gFalse;
 		  }
-                  if (newSize*(int)sizeof(XRefEntry)/sizeof(XRefEntry) != newSize) {
-                    error(-1, "Invalid 'obj' parameters.");
-                    return gFalse;
-                  }
 		  entries = (XRefEntry *)
 		      greallocn(entries, newSize, sizeof(XRefEntry));
 		  for (i = size; i < newSize; ++i) {
@@ -782,7 +765,7 @@ GBool XRef::constructXRef() {
     } else if (!strncmp(p, "endstream", 9)) {
       if (streamEndsLen == streamEndsSize) {
 	streamEndsSize += 64;
-        if (streamEndsSize*(int)sizeof(int)/sizeof(int) != streamEndsSize) {
+        if (streamEndsSize < 0) {
           error(-1, "Invalid 'endstream' parameter.");
           return gFalse;
         }


More information about the poppler mailing list