[poppler] 6 commits - cpp/poppler-global.cpp goo/gmem.cc poppler/Gfx.cc poppler/Gfx.h splash/SplashFTFont.cc utils/HtmlFonts.cc utils/HtmlFonts.h utils/pdfinfo.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Tue Nov 13 14:37:43 PST 2012


 cpp/poppler-global.cpp |    8 ++------
 goo/gmem.cc            |   22 +---------------------
 poppler/Gfx.cc         |    3 ---
 poppler/Gfx.h          |    5 +----
 splash/SplashFTFont.cc |    8 --------
 utils/HtmlFonts.cc     |    6 +++---
 utils/HtmlFonts.h      |    4 ++--
 utils/pdfinfo.cc       |    2 +-
 8 files changed, 10 insertions(+), 48 deletions(-)

New commits:
commit 06951f529e6514a0c26d6d821ab5fab0920a7cf3
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Nov 13 23:37:22 2012 +0100

    Simplify >= 0 ifs for unsigned

diff --git a/cpp/poppler-global.cpp b/cpp/poppler-global.cpp
index f99dbb7..176c0c8 100644
--- a/cpp/poppler-global.cpp
+++ b/cpp/poppler-global.cpp
@@ -236,9 +236,7 @@ byte_array ustring::to_utf8() const
             return byte_array();
         }
     }
-    if (str_len_left >= 0) {
-        str.resize(str.size() - str_len_left);
-    }
+    str.resize(str.size() - str_len_left);
     return str;
 }
 
@@ -287,9 +285,7 @@ ustring ustring::from_utf8(const char *str, int len)
             return ustring();
         }
     }
-    if (ret_len_left >= 0) {
-        ret.resize(ret.size() - ret_len_left);
-    }
+    ret.resize(ret.size() - ret_len_left);
 
     return ret;
 }
commit fa813adc3f7b7ee3cc819f1e0cb85e01f13c2c01
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Nov 13 23:37:01 2012 +0100

    Remove < 0 ifs for unsigned

diff --git a/splash/SplashFTFont.cc b/splash/SplashFTFont.cc
index e57425e..2a23625 100644
--- a/splash/SplashFTFont.cc
+++ b/splash/SplashFTFont.cc
@@ -370,10 +370,6 @@ double SplashFTFont::getGlyphAdvance(int c)
   } else {
     gid = (FT_UInt)c;
   }
-  if (ff->trueType && gid < 0) {
-    // skip the TrueType notdef glyph
-    return -1;
-  }
 
   if (FT_Load_Glyph(ff->face, gid, getFTLoadFlags(ff->type1, ff->trueType, aa, enableFreeTypeHinting, enableSlightHinting))) {
     return -1;
@@ -419,10 +415,6 @@ SplashPath *SplashFTFont::getGlyphPath(int c) {
   } else {
     gid = (FT_UInt)c;
   }
-  if (ff->trueType && gid < 0) {
-    // skip the TrueType notdef glyph
-    return NULL;
-  }
   if (FT_Load_Glyph(ff->face, gid, getFTLoadFlags(ff->type1, ff->trueType, aa, enableFreeTypeHinting, enableSlightHinting))) {
     return NULL;
   }
commit 1969bcd693289eba1138fcaa74a684cb3ff2aefc
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Nov 13 23:36:40 2012 +0100

    Remove unused members

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 8ee2026..99c326e 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -568,7 +568,6 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict,
     baseMatrix[i] = state->getCTM()[i];
   }
   formDepth = 0;
-  textClipBBoxEmpty = gTrue;
   ocState = gTrue;
   parser = NULL;
   abortCheckCbk = abortCheckCbkA;
@@ -621,7 +620,6 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, Dict *resDict,
     baseMatrix[i] = state->getCTM()[i];
   }
   formDepth = 0;
-  textClipBBoxEmpty = gTrue;
   ocState = gTrue;
   parser = NULL;
   abortCheckCbk = abortCheckCbkA;
@@ -3618,7 +3616,6 @@ void Gfx::opBeginText(Object args[], int numArgs) {
   out->updateTextMat(state);
   out->updateTextPos(state);
   fontChanged = gTrue;
-  textClipBBoxEmpty = gTrue;
 }
 
 void Gfx::opEndText(Object args[], int numArgs) {
diff --git a/poppler/Gfx.h b/poppler/Gfx.h
index 37022e0..7c42f14 100644
--- a/poppler/Gfx.h
+++ b/poppler/Gfx.h
@@ -17,7 +17,7 @@
 // Copyright (C) 2007 Iñigo Martínez <inigomartinez at gmail.com>
 // Copyright (C) 2008 Brad Hards <bradh at kde.org>
 // Copyright (C) 2008, 2010 Carlos Garcia Campos <carlosgc at gnome.org>
-// Copyright (C) 2009-2011 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2009-2012 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009, 2010, 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2010 David Benjamin <davidben at mit.edu>
 // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
@@ -219,9 +219,6 @@ private:
   double baseMatrix[6];		// default matrix for most recent
 				//   page/form/pattern
   int formDepth;
-  double textClipBBox[4];	// text clipping bounding box
-  GBool textClipBBoxEmpty;	// true if textClipBBox has not been
-				//   initialized yet
   GBool ocState;		// true if drawing is enabled, false if
 				//   disabled
 
commit 3a6e5ed5e28b6113696a7ae60b0b85d7097eb731
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Nov 13 23:35:53 2012 +0100

    Remove >= 0 checks for unsigned variables

diff --git a/utils/HtmlFonts.cc b/utils/HtmlFonts.cc
index e0ea8a7..d8334bc 100644
--- a/utils/HtmlFonts.cc
+++ b/utils/HtmlFonts.cc
@@ -17,7 +17,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2007, 2010 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2007, 2010, 2012 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2008 Boris Toloknov <tlknv at yandex.ru>
 // Copyright (C) 2008 Tomas Are Haavet <tomasare at gmail.com>
 // Copyright (C) 2010 OSSD CDAC Mumbai by Leena Chourey (leenac at cdacmumbai.in) and Onkar Potdar (onkar at cdacmumbai.in)
@@ -83,10 +83,10 @@ GooString *HtmlFontColor::convtoX(unsigned int xcol) const{
   char tmp;
   unsigned  int k;
   k = (xcol/16);
-  if ((k>=0)&&(k<10)) tmp=(char) ('0'+k); else tmp=(char)('a'+k-10);
+  if (k<10) tmp=(char) ('0'+k); else tmp=(char)('a'+k-10);
   xret->append(tmp);
   k = (xcol%16);
-  if ((k>=0)&&(k<10)) tmp=(char) ('0'+k); else tmp=(char)('a'+k-10);
+  if (k<10) tmp=(char) ('0'+k); else tmp=(char)('a'+k-10);
   xret->append(tmp);
  return xret;
 }
diff --git a/utils/HtmlFonts.h b/utils/HtmlFonts.h
index 22368b2..7993c78 100644
--- a/utils/HtmlFonts.h
+++ b/utils/HtmlFonts.h
@@ -18,7 +18,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2010 OSSD CDAC Mumbai by Leena Chourey (leenac at cdacmumbai.in) and Onkar Potdar (onkar at cdacmumbai.in)
-// Copyright (C) 2010 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2010, 2012 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2011 Steven Murdoch <Steven.Murdoch at cl.cam.ac.uk>
 // Copyright (C) 2011 Joshua Richardson <jric at chegg.com>
 // Copyright (C) 2012 Igor Slepchin <igor.slepchin at gmail.com>
@@ -40,7 +40,7 @@ class HtmlFontColor{
    unsigned int r;
    unsigned int g;
    unsigned int b;
-   GBool Ok(unsigned int xcol){ return ((xcol<=255)&&(xcol>=0));}
+   GBool Ok(unsigned int xcol){ return xcol<=255;}
    GooString *convtoX(unsigned  int xcol) const;
  public:
    HtmlFontColor():r(0),g(0),b(0){}
commit 0dcc2d711810dd64aa8d8721ce53a6b72e12c47c
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Nov 13 23:35:10 2012 +0100

    Remove unused var

diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc
index 36e7a1b..10a6c31 100644
--- a/utils/pdfinfo.cc
+++ b/utils/pdfinfo.cc
@@ -108,7 +108,7 @@ int main(int argc, char *argv[]) {
   GooString *ownerPW, *userPW;
   UnicodeMap *uMap;
   Page *page;
-  Object info, xfa;
+  Object info;
   char buf[256];
   double w, h, wISO, hISO;
   FILE *f;
commit 1fc97862d30bf723135310bfc8701e6788bfd284
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Nov 13 23:24:19 2012 +0100

    size can't be smaller than 0 because it's a size_t

diff --git a/goo/gmem.cc b/goo/gmem.cc
index 768b283..c1c607a 100644
--- a/goo/gmem.cc
+++ b/goo/gmem.cc
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Takashi Iwai <tiwai at suse.de>
-// Copyright (C) 2007-2010 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2007-2010, 2012 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2008 Jonathan Kew <jonathan_kew at sil.org>
 //
 // To see a description of the changes please see the Changelog file that
@@ -71,11 +71,6 @@ inline static void *gmalloc(size_t size, bool checkoverflow) {
   void *data;
   unsigned long *trl, *p;
 
-  if (size < 0) {
-    fprintf(stderr, "Invalid memory allocation size\n");
-    if (checkoverflow) return NULL;
-    else exit(1);
-  }
   if (size == 0) {
     return NULL;
   }
@@ -109,11 +104,6 @@ inline static void *gmalloc(size_t size, bool checkoverflow) {
 #else
   void *p;
 
-  if (size < 0) {
-    fprintf(stderr, "Invalid memory allocation size\n");
-    if (checkoverflow) return NULL;
-    else exit(1);
-  }
   if (size == 0) {
     return NULL;
   }
@@ -140,11 +130,6 @@ inline static void *grealloc(void *p, size_t size, bool checkoverflow) {
   void *q;
   int oldSize;
 
-  if (size < 0) {
-    fprintf(stderr, "Invalid memory allocation size\n");
-    if (checkoverflow) return NULL;
-    else exit(1);
-  }
   if (size == 0) {
     if (p) {
       gfree(p);
@@ -164,11 +149,6 @@ inline static void *grealloc(void *p, size_t size, bool checkoverflow) {
 #else
   void *q;
 
-  if (size < 0) {
-    fprintf(stderr, "Invalid memory allocation size\n");
-    if (checkoverflow) return NULL;
-    else exit(1);
-  }
   if (size == 0) {
     if (p) {
       free(p);


More information about the poppler mailing list