[poppler/f19] Merge of commits from poppler's "poppler-0.22" branch

mkasik mkasik at fedoraproject.org
Wed Jun 5 12:53:44 UTC 2013


commit 0aa0ce07f9ae1389427563f1729618f75550ca7b
Author: Marek Kasik <mkasik at redhat.com>
Date:   Wed Jun 5 14:46:13 2013 +0200

    Merge of commits from poppler's "poppler-0.22" branch
    
    It doesn't contain commits which needs soname bump
    For the list of included commits see the header of the patch

 poppler-0.22.4.patch |  625 ++++++++++++++++++++++++++++++++++++++++++++++++++
 poppler.spec         |   11 +-
 2 files changed, 635 insertions(+), 1 deletions(-)
---
diff --git a/poppler-0.22.4.patch b/poppler-0.22.4.patch
new file mode 100644
index 0000000..9615a76
--- /dev/null
+++ b/poppler-0.22.4.patch
@@ -0,0 +1,625 @@
+Subject: Merged patches from poppler-0.22 branch
+
+This patch includes these commits:
+  true->TRUE
+  Use the toLatin function in PageLabelInfo::indexToLabel
+  Forgot my C here
+  Fix indent
+  Initialize cSrcNonIso[3] in splashModeXBGR8
+  height -> maskHeight
+  Correct rendering of underline and strike out annotations
+  Restore CTM on early exits
+  Make sure we don't try to paint in x < 0
+  cairo: Don't change image interpolation when printing
+  Spec says Zoom -> 0 means no zoom change
+  check order bounding box values in tiling pattern
+  glib: Always start from the beginning when starting a new search on a page
+  Only write the file once when saving
+  Fix for complete rewrites in repaired files
+  Last commit was Thomas' forgot his (C)
+  Update copyrgihts
+  Splash: Always consider a softmask transfer function
+  cairo: Always use the trasnfer function if present in setSoftMask
+  Make sure getKids returns != 0 before using it
+  Update my C of the last two previous commits
+  We need UnicodeParsedString here too
+  Fix compilation with fixed point mode enabled
+  Update copyright years
+  Make sure that Title: doesn't contain \n or \n
+  Make an invalid nSharedGroupsFirst a real error
+  Fix infinite loop while feeding wrong data in stdin
+  Fix crash on malformed file
+---
+
+--- poppler-0.22.1/glib/poppler-page.cc
++++ poppler-0.22.1/glib/poppler-page.cc
+@@ -877,6 +877,7 @@ poppler_page_find_text_with_options (Pop
+   double height;
+   TextPage *text_dev;
+   gboolean backwards;
++  gboolean start_at_last = FALSE;
+ 
+   g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL);
+   g_return_val_if_fail (text != NULL, NULL);
+@@ -893,7 +894,8 @@ poppler_page_find_text_with_options (Pop
+ 
+   while (text_dev->findText (ucs4, ucs4_len,
+                              gFalse, gTrue, // startAtTop, stopAtBottom
+-                             gTrue, gFalse, // startAtLast, stopAtLast
++                             start_at_last,
++                             gFalse, //stopAtLast
+                              options & POPPLER_FIND_CASE_SENSITIVE,
+                              backwards,
+                              options & POPPLER_FIND_WHOLE_WORDS_ONLY,
+@@ -905,6 +907,7 @@ poppler_page_find_text_with_options (Pop
+       match->x2 = xMax;
+       match->y2 = height - yMin;
+       matches = g_list_prepend (matches, match);
++      start_at_last = TRUE;
+     }
+ 
+   g_free (ucs4);
+--- poppler-0.22.1/goo/JpegWriter.cc
++++ poppler-0.22.1/goo/JpegWriter.cc
+@@ -8,6 +8,7 @@
+ // Copyright (C) 2010, 2012 Adrian Johnson <ajohnson at redneon.com>
+ // Copyright (C) 2010 Harry Roberts <harry.roberts at midnight-labs.org>
+ // Copyright (C) 2011 Thomas Freitag <Thomas.Freitag at alfa.de>
++// Copyright (C) 2013 Peter Breitenlohner <peb at mppmu.mpg.de>
+ //
+ //========================================================================
+ 
+@@ -117,7 +118,7 @@ bool JpegWriter::init(FILE *f, int width
+ 
+   // Set quality
+   if (priv->quality >= 0 && priv->quality <= 100) {
+-    jpeg_set_quality(&priv->cinfo, priv->quality, true);
++    jpeg_set_quality(&priv->cinfo, priv->quality, TRUE);
+   }
+ 
+   // Use progressive mode
+--- poppler-0.22.1/poppler/Annot.cc
++++ poppler-0.22.1/poppler/Annot.cc
+@@ -23,7 +23,7 @@
+ // Copyright (C) 2008 Michael Vrable <mvrable at cs.ucsd.edu>
+ // Copyright (C) 2008 Hugo Mercier <hmercier31 at gmail.com>
+ // Copyright (C) 2009 Ilya Gorenbein <igorenbein at finjan.com>
+-// Copyright (C) 2011 José Aliste <jaliste at src.gnome.org>
++// Copyright (C) 2011, 2013 José Aliste <jaliste at src.gnome.org>
+ // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
+ // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
+ // Copyright (C) 2012 Tobias Koenig <tokoe at kdab.com>
+@@ -3601,14 +3601,15 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBo
+       appearBuf->append ("[] 0 d 1 w\n");
+ 
+       for (i = 0; i < quadrilaterals->getQuadrilateralsLength(); ++i) {
+-        double x1, x2, y3;
++	double x3, y3, x4, y4;
+ 
+-	x1 = quadrilaterals->getX1(i);
+-	x2 = quadrilaterals->getX2(i);
++	x3 = quadrilaterals->getX3(i);
+ 	y3 = quadrilaterals->getY3(i);
++	x4 = quadrilaterals->getX4(i);
++	y4 = quadrilaterals->getY4(i);
+ 
+-	appearBuf->appendf ("{0:.2f} {1:.2f} m\n", x1, y3);
+-	appearBuf->appendf ("{0:.2f} {1:.2f} l\n", x2, y3);
++	appearBuf->appendf ("{0:.2f} {1:.2f} m\n", x3, y3);
++	appearBuf->appendf ("{0:.2f} {1:.2f} l\n", x4, y4);
+ 	appearBuf->append ("S\n");
+       }
+       break;
+@@ -3620,17 +3621,21 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBo
+       appearBuf->append ("[] 0 d 1 w\n");
+ 
+       for (i = 0; i < quadrilaterals->getQuadrilateralsLength(); ++i) {
+-        double x1, y1, x2, y3;
+-	double h2;
++	double x1, y1, x2, y2;
++	double x3, y3, x4, y4;
+ 
+ 	x1 = quadrilaterals->getX1(i);
+ 	y1 = quadrilaterals->getY1(i);
+ 	x2 = quadrilaterals->getX2(i);
++	y2 = quadrilaterals->getY2(i);
++
++	x3 = quadrilaterals->getX3(i);
+ 	y3 = quadrilaterals->getY3(i);
+-	h2 = (y1 - y3) / 2.0;
++	x4 = quadrilaterals->getX4(i);
++	y4 = quadrilaterals->getY4(i);
+ 
+-	appearBuf->appendf ("{0:.2f} {1:.2f} m\n", x1, y3+h2);
+-	appearBuf->appendf ("{0:.2f} {1:.2f} l\n", x2, y3+h2);
++	appearBuf->appendf ("{0:.2f} {1:.2f} m\n", (x1+x3)/2., (y1+y3)/2.);
++	appearBuf->appendf ("{0:.2f} {1:.2f} l\n", (x2+x4)/2., (y2+y4)/2.);
+ 	appearBuf->append ("S\n");
+       }
+       break;
+--- poppler-0.22.1/poppler/CairoOutputDev.cc
++++ poppler-0.22.1/poppler/CairoOutputDev.cc
+@@ -18,9 +18,9 @@
+ // Copyright (C) 2005, 2006 Kristian Høgsberg <krh at redhat.com>
+ // Copyright (C) 2005, 2009, 2012 Albert Astals Cid <aacid at kde.org>
+ // Copyright (C) 2005 Nickolay V. Shmyrev <nshmyrev at yandex.ru>
+-// Copyright (C) 2006-2011 Carlos Garcia Campos <carlosgc at gnome.org>
++// Copyright (C) 2006-2011, 2013 Carlos Garcia Campos <carlosgc at gnome.org>
+ // Copyright (C) 2008 Carl Worth <cworth at cworth.org>
+-// Copyright (C) 2008-2012 Adrian Johnson <ajohnson at redneon.com>
++// Copyright (C) 2008-2013 Adrian Johnson <ajohnson at redneon.com>
+ // Copyright (C) 2008 Michael Vrable <mvrable at cs.ucsd.edu>
+ // Copyright (C) 2008, 2009 Chris Wilson <chris at chris-wilson.co.uk>
+ // Copyright (C) 2008, 2012 Hib Eris <hib at hiberis.nl>
+@@ -1552,7 +1552,7 @@ void CairoOutputDev::setSoftMask(GfxStat
+ 
+   LOG(printf ("set softMask\n"));
+ 
+-  if (alpha == false) {
++  if (!alpha || transferFunc) {
+     /* We need to mask according to the luminocity of the group.
+      * So we paint the group to an image surface convert it to a luminocity map
+      * and then use that as the mask. */
+@@ -1595,13 +1595,15 @@ void CairoOutputDev::setSoftMask(GfxStat
+     cairo_t *maskCtx = cairo_create(source);
+ 
+     //XXX: hopefully this uses the correct color space */
+-    GfxRGB backdropColorRGB;
+-    groupColorSpaceStack->cs->getRGB(backdropColor, &backdropColorRGB);
+-    /* paint the backdrop */
+-    cairo_set_source_rgb(maskCtx,
+-			 colToDbl(backdropColorRGB.r),
+-			 colToDbl(backdropColorRGB.g),
+-			 colToDbl(backdropColorRGB.b));
++    if (!alpha) {
++      GfxRGB backdropColorRGB;
++      groupColorSpaceStack->cs->getRGB(backdropColor, &backdropColorRGB);
++      /* paint the backdrop */
++      cairo_set_source_rgb(maskCtx,
++                           colToDbl(backdropColorRGB.r),
++                           colToDbl(backdropColorRGB.g),
++                           colToDbl(backdropColorRGB.b));
++    }
+     cairo_paint(maskCtx);
+ 
+     /* Copy source ctm to mask ctm and translate origin so that the
+@@ -1628,15 +1630,14 @@ void CairoOutputDev::setSoftMask(GfxStat
+     int stride = cairo_image_surface_get_stride(source)/4;
+     for (int y=0; y<height; y++) {
+       for (int x=0; x<width; x++) {
+-	int lum;
+-	lum = luminocity(source_data[y*stride + x]);
+-	if (transferFunc) {
+-	  double lum_in, lum_out;
+-	  lum_in = lum/256.0;
+-	  transferFunc->transform(&lum_in, &lum_out);
+-	  lum = (int)(lum_out * 255.0 + 0.5);
+-	}
+-	source_data[y*stride + x] = lum << 24;
++	int lum = alpha ? fill_opacity : luminocity(source_data[y*stride + x]);
++        if (transferFunc) {
++          double lum_in, lum_out;
++          lum_in = lum/256.0;
++          transferFunc->transform(&lum_in, &lum_out);
++          lum = (int)(lum_out * 255.0 + 0.5);
++        }
++        source_data[y*stride + x] = lum << 24;
+       }
+     }
+     cairo_surface_mark_dirty (source);
+@@ -1656,7 +1657,7 @@ void CairoOutputDev::setSoftMask(GfxStat
+     }
+ 
+     cairo_surface_destroy(source);
+-  } else {
++  } else if (alpha) {
+     mask = cairo_pattern_reference(group);
+     cairo_get_matrix(cairo, &mask_matrix);
+   }
+@@ -1765,6 +1766,10 @@ CairoOutputDev::getFilterForSurface(cair
+   if (orig_width == 0 || orig_height == 0)
+ 	  return CAIRO_FILTER_NEAREST;
+ 
++  /* When printing, don't change the interpolation. */
++  if (printing)
++    return CAIRO_FILTER_NEAREST;
++
+   int scaled_width, scaled_height;
+   getScaledSize (orig_width, orig_height, &scaled_width, &scaled_height);
+ 
+--- poppler-0.22.1/poppler/Gfx.cc
++++ poppler-0.22.1/poppler/Gfx.cc
+@@ -14,7 +14,7 @@
+ // under GPL version 2 or later
+ //
+ // Copyright (C) 2005 Jonathan Blandford <jrb at redhat.com>
+-// Copyright (C) 2005-2012 Albert Astals Cid <aacid at kde.org>
++// Copyright (C) 2005-2013 Albert Astals Cid <aacid at kde.org>
+ // Copyright (C) 2006 Thorkild Stray <thorkild at ifi.uio.no>
+ // Copyright (C) 2006 Kristian Høgsberg <krh at redhat.com>
+ // Copyright (C) 2006-2011 Carlos Garcia Campos <carlosgc at gnome.org>
+@@ -28,7 +28,7 @@
+ // Copyright (C) 2008 Michael Vrable <mvrable at cs.ucsd.edu>
+ // Copyright (C) 2008 Hib Eris <hib at hiberis.nl>
+ // Copyright (C) 2009 M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
+-// Copyright (C) 2009-2012 Thomas Freitag <Thomas.Freitag at alfa.de>
++// Copyright (C) 2009-2013 Thomas Freitag <Thomas.Freitag at alfa.de>
+ // Copyright (C) 2009 William Bader <williambader at hotmail.com>
+ // Copyright (C) 2009, 2010 David Benjamin <davidben at mit.edu>
+ // Copyright (C) 2010 Nils Höglund <nils.hoglund at gmail.com>
+@@ -2205,10 +2205,20 @@ void Gfx::doTilingPatternFill(GfxTilingP
+   //~ edge instead of left/bottom (?)
+   xstep = fabs(tPat->getXStep());
+   ystep = fabs(tPat->getYStep());
+-  xi0 = (int)ceil((xMin - tPat->getBBox()[2]) / xstep);
+-  xi1 = (int)floor((xMax - tPat->getBBox()[0]) / xstep) + 1;
+-  yi0 = (int)ceil((yMin - tPat->getBBox()[3]) / ystep);
+-  yi1 = (int)floor((yMax - tPat->getBBox()[1]) / ystep) + 1;
++  if (tPat->getBBox()[0] < tPat->getBBox()[2]) {
++    xi0 = (int)ceil((xMin - tPat->getBBox()[2]) / xstep);
++    xi1 = (int)floor((xMax - tPat->getBBox()[0]) / xstep) + 1;
++  } else {
++    xi0 = (int)ceil((xMin - tPat->getBBox()[0]) / xstep);
++    xi1 = (int)floor((xMax - tPat->getBBox()[2]) / xstep) + 1;
++  }
++  if (tPat->getBBox()[1] < tPat->getBBox()[3]) {
++    yi0 = (int)ceil((yMin - tPat->getBBox()[3]) / ystep);
++    yi1 = (int)floor((yMax - tPat->getBBox()[1]) / ystep) + 1;
++  } else {
++    yi0 = (int)ceil((yMin - tPat->getBBox()[1]) / ystep);
++    yi1 = (int)floor((yMax - tPat->getBBox()[3]) / ystep) + 1;
++  }
+   for (i = 0; i < 4; ++i) {
+     m1[i] = m[i];
+   }
+--- poppler-0.22.1/poppler/Hints.cc
++++ poppler-0.22.1/poppler/Hints.cc
+@@ -5,7 +5,7 @@
+ // This file is licensed under the GPLv2 or later
+ //
+ // Copyright 2010, 2012 Hib Eris <hib at hiberis.nl>
+-// Copyright 2010, 2011 Albert Astals Cid <aacid at kde.org>
++// Copyright 2010, 2011, 2013 Albert Astals Cid <aacid at kde.org>
+ // Copyright 2010 Pino Toscano <pino at kde.org>
+ //
+ //========================================================================
+@@ -282,7 +282,8 @@ void Hints::readSharedObjectsTable(Strea
+   }
+   if ((!nSharedGroupsFirst) || (nSharedGroupsFirst > nSharedGroups)) {
+      error(errSyntaxWarning, -1, "Invalid number of first page shared object groups");
+-     nSharedGroupsFirst = nSharedGroups;
++     nSharedGroups = 0;
++     return;
+   }
+ 
+   groupLength = (Guint *) gmallocn_checkoverflow(nSharedGroups, sizeof(Guint));
+--- poppler-0.22.1/poppler/Link.cc
++++ poppler-0.22.1/poppler/Link.cc
+@@ -16,7 +16,7 @@
+ // Copyright (C) 2006, 2008 Pino Toscano <pino at kde.org>
+ // Copyright (C) 2007, 2010, 2011 Carlos Garcia Campos <carlosgc at gnome.org>
+ // Copyright (C) 2008 Hugo Mercier <hmercier31 at gmail.com>
+-// Copyright (C) 2008-2010, 2012 Albert Astals Cid <aacid at kde.org>
++// Copyright (C) 2008-2010, 2012, 2013 Albert Astals Cid <aacid at kde.org>
+ // Copyright (C) 2009 Kovid Goyal <kovid at kovidgoyal.net>
+ // Copyright (C) 2009 Ilya Gorenbein <igorenbein at finjan.com>
+ // Copyright (C) 2012 Tobias Koening <tobias.koenig at kdab.com>
+@@ -220,8 +220,8 @@ LinkDest::LinkDest(Array *a) {
+       if (obj2.isNull()) {
+ 	changeZoom = gFalse;
+       } else if (obj2.isNum()) {
+-	changeZoom = gTrue;
+ 	zoom = obj2.getNum();
++	changeZoom = (zoom == 0) ? gFalse : gTrue;
+       } else {
+ 	error(errSyntaxWarning, -1, "Bad annotation destination position");
+ 	goto err1;
+--- poppler-0.22.1/poppler/PageLabelInfo.cc
++++ poppler-0.22.1/poppler/PageLabelInfo.cc
+@@ -3,7 +3,7 @@
+ // This file is under the GPLv2 or later license
+ //
+ // Copyright (C) 2005-2006 Kristian Høgsberg <krh at redhat.com>
+-// Copyright (C) 2005, 2009 Albert Astals Cid <aacid at kde.org>
++// Copyright (C) 2005, 2009, 2013 Albert Astals Cid <aacid at kde.org>
+ // Copyright (C) 2011 Simon Kellner <kellner at kit.edu>
+ // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
+ //
+@@ -136,7 +136,6 @@ 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;
+@@ -152,7 +151,6 @@ 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;
+@@ -332,9 +330,11 @@ GBool PageLabelInfo::indexToLabel(int in
+   case Interval::UppercaseRoman:
+     toRoman(number, &number_string, gTrue);
+     break;
+-  case Interval::UppercaseLatin:
+   case Interval::LowercaseLatin:
+-    number = 0;
++    toLatin(number, &number_string, gFalse);
++    break;
++  case Interval::UppercaseLatin:
++    toLatin(number, &number_string, gTrue);
+     break;
+   case Interval::None:
+     break;
+--- poppler-0.22.1/poppler/PDFDoc.cc
++++ poppler-0.22.1/poppler/PDFDoc.cc
+@@ -14,7 +14,7 @@
+ // under GPL version 2 or later
+ //
+ // Copyright (C) 2005, 2006, 2008 Brad Hards <bradh at frogmouth.net>
+-// Copyright (C) 2005, 2007-2009, 2011, 2012 Albert Astals Cid <aacid at kde.org>
++// Copyright (C) 2005, 2007-2009, 2011-2013 Albert Astals Cid <aacid at kde.org>
+ // Copyright (C) 2008 Julien Rebetez <julienr at svn.gnome.org>
+ // Copyright (C) 2008, 2010 Pino Toscano <pino at kde.org>
+ // Copyright (C) 2008, 2010, 2011 Carlos Garcia Campos <carlosgc at gnome.org>
+@@ -795,7 +795,7 @@ int PDFDoc::saveAs(OutStream *outStr, PD
+   if (!updated && mode == writeStandard) {
+     // simply copy the original file
+     saveWithoutChangesAs (outStr);
+-  } if (mode == writeForceRewrite) {
++  } else if (mode == writeForceRewrite) {
+     saveCompleteRewrite(outStr);
+   } else {
+     saveIncrementalUpdate(outStr);
+--- poppler-0.22.1/poppler/PSOutputDev.cc
++++ poppler-0.22.1/poppler/PSOutputDev.cc
+@@ -15,7 +15,7 @@
+ //
+ // Copyright (C) 2005 Martin Kretzschmar <martink at gnome.org>
+ // Copyright (C) 2005, 2006 Kristian Høgsberg <krh at redhat.com>
+-// Copyright (C) 2006-2009, 2011, 2012 Albert Astals Cid <aacid at kde.org>
++// Copyright (C) 2006-2009, 2011-2013 Albert Astals Cid <aacid at kde.org>
+ // Copyright (C) 2006 Jeff Muizelaar <jeff at infidigm.net>
+ // Copyright (C) 2007, 2008 Brad Hards <bradh at kde.org>
+ // Copyright (C) 2008, 2009 Koji Otani <sho at bbr.jp>
+@@ -1414,7 +1414,14 @@ void PSOutputDev::writeHeader(int firstP
+   obj1.free();
+   info.free();
+   if(psTitle) {
+-    writePSFmt("%%Title: {0:s}\n", psTitle);
++    char *sanitizedTile = strdup(psTitle);
++    for (Guint i = 0; i < strlen(sanitizedTile); ++i) {
++      if (sanitizedTile[i] == '\n' || sanitizedTile[i] == '\r') {
++        sanitizedTile[i] = ' ';
++      }
++    }
++    writePSFmt("%%Title: {0:s}\n", sanitizedTile);
++    free(sanitizedTile);
+   }
+   writePSFmt("%%LanguageLevel: {0:d}\n",
+ 	     (level == psLevel1 || level == psLevel1Sep) ? 1 :
+--- poppler-0.22.1/poppler/SplashOutputDev.cc
++++ poppler-0.22.1/poppler/SplashOutputDev.cc
+@@ -20,7 +20,7 @@
+ // Copyright (C) 2006 Scott Turner <scotty1024 at mac.com>
+ // Copyright (C) 2007 Koji Otani <sho at bbr.jp>
+ // Copyright (C) 2009 Petr Gajdos <pgajdos at novell.com>
+-// Copyright (C) 2009-2012 Thomas Freitag <Thomas.Freitag at alfa.de>
++// Copyright (C) 2009-2013 Thomas Freitag <Thomas.Freitag at alfa.de>
+ // Copyright (C) 2009 Carlos Garcia Campos <carlosgc at gnome.org>
+ // Copyright (C) 2009 William Bader <williambader at hotmail.com>
+ // Copyright (C) 2010 Patrick Spendrin <ps_ml at gmx.de>
+@@ -3975,7 +3975,12 @@ void SplashOutputDev::setSoftMask(GfxSta
+   for (y = 0; y < yMax; ++y) {
+     for (x = 0; x < xMax; ++x) {
+       if (alpha) {
+-	p[x] = tBitmap->getAlpha(x, y);
++	if (transferFunc) {
++	  lum = tBitmap->getAlpha(x, y) / 255.0;
++	  transferFunc->transform(&lum, &lum2);
++	  p[x] = (int)(lum2 * 255.0 + 0.5);
++	} else 
++	  p[x] = tBitmap->getAlpha(x, y);
+       } else {
+ 	  tBitmap->getPixel(x, y, color);
+ 	  // convert to luminosity
+@@ -4109,8 +4114,10 @@ GBool SplashOutputDev::tilingPatternFill
+   state->concatCTM(1, 0, 0, 1, bbox[0], bbox[1]);
+   ctm = state->getCTM();
+   for (i = 0; i < 6; ++i) {
+-    if (!isfinite(ctm[i]))
++    if (!isfinite(ctm[i])) {
++      state->setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]);
+       return gFalse;
++    }
+   }
+   matc[4] = x0 * xStep * ctm[0] + y0 * yStep * ctm[2] + ctm[4];
+   matc[5] = x0 * xStep * ctm[1] + y0 * yStep * ctm[3] + ctm[5];
+@@ -4152,8 +4159,10 @@ GBool SplashOutputDev::tilingPatternFill
+     repeatX = x1 - x0;
+     repeatY = y1 - y0;
+   } else {
+-    if ((unsigned long) result_width * result_height > 0x800000L)
++    if ((unsigned long) result_width * result_height > 0x800000L) {
++      state->setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]);
+       return gFalse;
++    }
+     while(fabs(kx) > 16384 || fabs(ky) > 16384) {
+       // limit pattern bitmap size
+       m1.m[0] /= 2;
+@@ -4184,8 +4193,10 @@ GBool SplashOutputDev::tilingPatternFill
+   matc[2] = ctm[2];
+   matc[3] = ctm[3];
+ 
+-  if (surface_width == 0 || surface_height == 0)
++  if (surface_width == 0 || surface_height == 0) {
++    state->setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]);
+     return gFalse;
++  }
+   m1.transform(bbox[0], bbox[1], &kx, &ky);
+   m1.m[4] = -kx;
+   m1.m[5] = -ky;
+--- poppler-0.22.1/poppler/Stream.cc
++++ poppler-0.22.1/poppler/Stream.cc
+@@ -421,7 +421,6 @@ ImageStream::ImageStream(Stream *strA, i
+   nVals = width * nComps;
+   inputLineSize = (nVals * nBits + 7) >> 3;
+   if (nBits <= 0 || nVals > INT_MAX / nBits - 7) {
+-    // force a call to gmallocn(-1,...), which will throw an exception
+     inputLineSize = -1;
+   }
+   inputLine = (Guchar *)gmallocn_checkoverflow(inputLineSize, sizeof(char));
+@@ -478,6 +477,10 @@ Guchar *ImageStream::getLine() {
+   int c;
+   int i;
+   Guchar *p;
++  
++  if (unlikely(inputLine == NULL)) {
++      return NULL;
++  }
+  
+   int readChars = str->doGetChars(inputLineSize, inputLine);
+   for ( ; readChars < inputLineSize; readChars++) inputLine[readChars] = EOF;
+@@ -909,7 +912,7 @@ GBool CachedFileStream::fillBuf()
+   } else {
+     n = cachedStreamBufSize - (bufPos % cachedStreamBufSize);
+   }
+-  cc->read(buf, 1, n);
++  n = cc->read(buf, 1, n);
+   bufEnd = buf + n;
+   if (bufPtr >= bufEnd) {
+     return gFalse;
+--- poppler-0.22.1/poppler/TextOutputDev.cc
++++ poppler-0.22.1/poppler/TextOutputDev.cc
+@@ -30,7 +30,7 @@
+ // Copyright (C) 2010 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
+ // Copyright (C) 2011 Sam Liao <phyomh at gmail.com>
+ // Copyright (C) 2012 Horst Prote <prote at fmi.uni-stuttgart.de>
+-// Copyright (C) 2012 Jason Crain <jason at aquaticape.us>
++// Copyright (C) 2012, 2013 Jason Crain <jason at aquaticape.us>
+ // Copyright (C) 2012 Peter Breitenlohner <peb at mppmu.mpg.de>
+ // Copyright (C) 2013 José Aliste <jaliste at src.gnome.org>
+ //
+--- poppler-0.22.1/poppler/XRef.cc
++++ poppler-0.22.1/poppler/XRef.cc
+@@ -20,7 +20,7 @@
+ // Copyright (C) 2007 Carlos Garcia Campos <carlosgc at gnome.org>
+ // Copyright (C) 2009, 2010 Ilya Gorenbein <igorenbein at finjan.com>
+ // Copyright (C) 2010 Hib Eris <hib at hiberis.nl>
+-// Copyright (C) 2012 Thomas Freitag <Thomas.Freitag at kabelmail.de>
++// Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag at kabelmail.de>
+ // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
+ //
+ // To see a description of the changes please see the Changelog file that
+@@ -1556,7 +1556,9 @@ void XRef::scanSpecialFlags() {
+   prevXRefOffset = mainXRefOffset;
+ 
+   std::vector<int> xrefStreamObjNums;
+-  readXRefUntil(-1 /* read all xref sections */, &xrefStreamObjNums);
++  if (!streamEndsLen) { // don't do it for already reconstructed xref
++    readXRefUntil(-1 /* read all xref sections */, &xrefStreamObjNums);
++  }
+ 
+   // Mark object streams as DontRewrite, because we write each object
+   // individually in full rewrite mode.
+--- poppler-0.22.1/qt4/src/poppler-embeddedfile.cc
++++ poppler-0.22.1/qt4/src/poppler-embeddedfile.cc
+@@ -1,5 +1,5 @@
+ /* poppler-document.cc: qt interface to poppler
+- * Copyright (C) 2005, 2008, 2009, 2012, Albert Astals Cid <aacid at kde.org>
++ * Copyright (C) 2005, 2008, 2009, 2012, 2013, Albert Astals Cid <aacid at kde.org>
+  * Copyright (C) 2005, Brad Hards <bradh at frogmouth.net>
+  * Copyright (C) 2008, 2011, Pino Toscano <pino at kde.org>
+  *
+@@ -69,7 +69,7 @@ EmbeddedFile::~EmbeddedFile()
+ QString EmbeddedFile::name() const
+ {
+ 	GooString *goo = m_embeddedFile->filespec->getFileName();
+-	return goo ? QString(goo->getCString()) : QString();
++	return goo ? UnicodeParsedString(goo) : QString();
+ }
+ 
+ QString EmbeddedFile::description() const
+--- poppler-0.22.1/splash/Splash.cc
++++ poppler-0.22.1/splash/Splash.cc
+@@ -525,8 +525,9 @@ void Splash::pipeRun(SplashPipe *pipe) {
+ 	  cSrcNonIso[3] = clip255(pipe->cSrc[3] +
+ 				  ((pipe->cSrc[3] - cDest[3]) * t) / 255);
+ #endif
++	case splashModeXBGR8:
++	  cSrcNonIso[3] = 255;
+ 	case splashModeRGB8:
+-  case splashModeXBGR8:
+ 	case splashModeBGR8:
+ 	  cSrcNonIso[2] = clip255(pipe->cSrc[2] +
+ 				  ((pipe->cSrc[2] - cDest[2]) * t) / 255);
+@@ -1493,7 +1494,7 @@ inline void Splash::drawAALine(SplashPip
+ #endif
+ 
+     if (t != 0) {
+-      pipe->shape = aaGamma[t];
++      pipe->shape = (double)aaGamma[t];
+       (this->*pipe->run)(pipe);
+       updateModX(x);
+       updateModY(y);
+@@ -3926,6 +3927,8 @@ SplashError Splash::arbitraryTransformIm
+       xa = imgCoordMungeLower(section[i].xa0 +
+ 			      ((SplashCoord)y + 0.5 - section[i].ya0) *
+ 			        section[i].dxdya);
++      if (unlikely(xa < 0))
++        xa = 0;
+       xb = imgCoordMungeUpper(section[i].xb0 +
+ 			      ((SplashCoord)y + 0.5 - section[i].yb0) *
+ 			        section[i].dxdyb);
+--- poppler-0.22.1/utils/HtmlOutputDev.cc
++++ poppler-0.22.1/utils/HtmlOutputDev.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) 2005-2012 Albert Astals Cid <aacid at kde.org>
++// Copyright (C) 2005-2013 Albert Astals Cid <aacid at kde.org>
+ // Copyright (C) 2008 Kjartan Maraas <kmaraas at gnome.org>
+ // Copyright (C) 2008 Boris Toloknov <tlknv at yandex.ru>
+ // Copyright (C) 2008 Haruyuki Kawabe <Haruyuki.Kawabe at unisys.co.jp>
+@@ -1795,7 +1795,7 @@ GBool HtmlOutputDev::newHtmlOutlineLevel
+ 		atLeastOne = gTrue;
+ 
+ 		item->open();
+-		if (item->hasKids())
++		if (item->hasKids() && item->getKids())
+ 		{
+ 			fputs("\n",output);
+ 			newHtmlOutlineLevel(output, item->getKids(), catalog, level+1);
+@@ -1832,7 +1832,7 @@ void HtmlOutputDev::newXmlOutlineLevel(F
+         delete titleStr;
+ 
+         item->open();
+-        if (item->hasKids())
++        if (item->hasKids() && item->getKids())
+         {
+             newXmlOutlineLevel(output, item->getKids(), catalog);
+         }
+--- poppler-0.22.1/utils/ImageOutputDev.cc
++++ poppler-0.22.1/utils/ImageOutputDev.cc
+@@ -21,6 +21,7 @@
+ // Copyright (C) 2009 William Bader <williambader at hotmail.com>
+ // Copyright (C) 2010 Jakob Voss <jakob.voss at gbv.de>
+ // Copyright (C) 2012 Adrian Johnson <ajohnson at redneon.com>
++// Copyright (C) 2013 Thomas Fischer <fischer at unix-ag.uni-kl.de>
+ //
+ // To see a description of the changes please see the Changelog file that
+ // came with your tarball or type make ChangeLog if you are building from git
+@@ -416,7 +417,7 @@ void ImageOutputDev::drawSoftMaskedImage
+   GfxImageColorMap *maskColorMap, GBool maskInterpolate) {
+   if (listImages) {
+     listImage(state, ref, str, width, height, colorMap, interpolate, gFalse, imgImage);
+-    listImage(state, ref, maskStr, maskWidth, height, maskColorMap, maskInterpolate, gFalse, imgSmask);
++    listImage(state, ref, maskStr, maskWidth, maskHeight, maskColorMap, maskInterpolate, gFalse, imgSmask);
+   } else {
+     drawImage(state, ref, str, width, height, colorMap, interpolate, NULL, gFalse);
+     drawImage(state, ref, maskStr, maskWidth, maskHeight,
diff --git a/poppler.spec b/poppler.spec
index d60e5a7..b7f5623 100644
--- a/poppler.spec
+++ b/poppler.spec
@@ -1,7 +1,7 @@
 Summary: PDF rendering library
 Name: poppler
 Version: 0.22.1
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: (GPLv2 or GPLv3) and GPLv2+ and LGPLv2+ and MIT
 Group: Development/Libraries
 URL:     http://poppler.freedesktop.org/
@@ -10,6 +10,9 @@ Source0: http://poppler.freedesktop.org/poppler-%{version}.tar.gz
 # https://bugs.freedesktop.org/show_bug.cgi?id=63385
 Patch0:  poppler-0.22.1-man.patch
 
+# Merge of commits from stable branch
+Patch1:  poppler-0.22.4.patch
+
 Requires: poppler-data >= 0.4.0
 BuildRequires: automake libtool
 BuildRequires: gettext-devel
@@ -124,6 +127,7 @@ Requires: %{name}-glib%{?_isa} = %{version}-%{release}
 %prep
 %setup -q
 %patch0 -p1 -b .man
+%patch1 -p1 -b .0.22.4
 
 iconv -f iso-8859-1 -t utf-8 < "utils/pdftohtml.1" > "utils/pdftohtml.1.utf8"
 mv "utils/pdftohtml.1.utf8" "utils/pdftohtml.1"
@@ -246,6 +250,11 @@ test "$(pkg-config --modversion poppler-splash)" = "%{version}"
 
 
 %changelog
+* Wed Jun  5 2013 Marek Kasik <mkasik at redhat.com> 0.22.1-3
+- Merge of commits from poppler's "poppler-0.22" branch
+- It doesn't contain commits which needs soname bump
+- For the list of included commits see the header of the patch
+
 * Thu Apr 11 2013 Marek Kasik <mkasik at redhat.com> 0.22.1-2
 - Fix man pages of pdftops and pdfseparate
 


More information about the scm-commits mailing list