[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-poppler
Subject:    [poppler] 5 commits - fofi/FoFiType1.cc goo/grandom.cc poppler/FlateEncoder.cc poppler/Form.cc poppl
From:       GitLab Mirror <gitlab-mirror () kemper ! freedesktop ! org>
Date:       2022-04-08 11:47:53
Message-ID: 20220408114753.D5D31760BC () kemper ! freedesktop ! org
[Download RAW message or body]

 fofi/FoFiType1.cc         |    6 +++---
 goo/grandom.cc            |    3 ++-
 poppler/FlateEncoder.cc   |    8 ++++----
 poppler/Form.cc           |    7 ++++++-
 poppler/JBIG2Stream.cc    |   13 ++++++-------
 splash/Splash.cc          |   14 +++++++-------
 utils/HtmlLinks.cc        |    6 +++---
 utils/HtmlLinks.h         |    6 +++---
 utils/HtmlOutputDev.cc    |    4 ++--
 utils/pdftocairo-win32.cc |   24 ++++++++++++------------
 utils/pdftocairo.cc       |    6 +++---
 utils/pdftoppm.cc         |    4 ++--
 12 files changed, 53 insertions(+), 48 deletions(-)

New commits:
commit 3ca9992ad4660d979491829048a6da84be192671
Author: Albert Astals Cid <aacid@kde.org>
Date:   Fri Apr 8 11:26:29 2022 +0200

    MSVC: Fix conversion warnings
    
    Make the conversions from double to int/char explicit, we want them

diff --git a/splash/Splash.cc b/splash/Splash.cc
index a467006d..e3f6e9e9 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -11,7 +11,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2005-2021 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2005-2022 Albert Astals Cid <aacid@kde.org>
 // Copyright (C) 2005 Marco Pesenti Gritti <mpg@redhat.com>
 // Copyright (C) 2010-2016 Thomas Freitag <Thomas.Freitag@alfa.de>
 // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com>
@@ -1342,7 +1342,7 @@ inline void Splash::drawAAPixel(SplashPipe *pipe, int x, int y)
     // draw the pixel
     if (t != 0) {
         pipeSetXY(pipe, x, y);
-        pipe->shape = div255(aaGamma[t] * pipe->shape);
+        pipe->shape = div255(static_cast<int>(aaGamma[t] * pipe->shape));
         (this->*pipe->run)(pipe);
     }
 }
@@ -1417,7 +1417,7 @@ inline void Splash::drawAALine(SplashPipe *pipe, int x0, int \
x1, int y, bool adj  #endif
 
         if (t != 0) {
-            pipe->shape = (adjustLine) ? div255((int)lineOpacity * \
(double)aaGamma[t]) : (double)aaGamma[t]; +            pipe->shape = (adjustLine) ? \
div255(static_cast<int>((int)lineOpacity * (double)aaGamma[t])) : (int)aaGamma[t];  \
(this->*pipe->run)(pipe);  } else {
             pipeIncX(pipe);
@@ -2432,7 +2432,7 @@ SplashError Splash::fillWithPattern(SplashPath *path, bool eo, \
SplashPattern *pa  transform(state->matrix, 0, 0, &mx, &my);
                     transform(state->matrix, state->lineWidth, 0, &delta, &my);
                     doAdjustLine = true;
-                    lineShape = clip255((delta - mx) * 255);
+                    lineShape = clip255(static_cast<int>((delta - mx) * 255));
                 }
                 drawAALine(&pipe, x0, x1, y, doAdjustLine, lineShape);
             }
@@ -4719,7 +4719,7 @@ static void expandRow(unsigned char *srcBuf, unsigned char \
*dstBuf, int srcWidth  xFrac = modf(xSrc, &xInt);
         p = (int)xInt;
         for (int c = 0; c < nComps; c++) {
-            dstBuf[nComps * x + c] = srcBuf[nComps * p + c] * (1.0 - xFrac) + \
srcBuf[nComps * (p + 1) + c] * xFrac; +            dstBuf[nComps * x + c] = \
static_cast<unsigned char>(srcBuf[nComps * p + c] * (1.0 - xFrac) + srcBuf[nComps * \
(p + 1) + c] * xFrac);  }
         xSrc += xStep;
     }
@@ -4788,7 +4788,7 @@ bool Splash::scaleImageYupXupBilinear(SplashImageSource src, \
void *srcData, Spla  for (int x = 0; x < scaledWidth; ++x) {
             // compute the final pixel
             for (i = 0; i < nComps; ++i) {
-                pix[i] = lineBuf1[x * nComps + i] * (1.0 - yFrac) + lineBuf2[x * \
nComps + i] * yFrac; +                pix[i] = static_cast<unsigned char>(lineBuf1[x \
* nComps + i] * (1.0 - yFrac) + lineBuf2[x * nComps + i] * yFrac);  }
 
             // store the pixel
@@ -4831,7 +4831,7 @@ bool Splash::scaleImageYupXupBilinear(SplashImageSource src, \
void *srcData, Spla  // process alpha
             if (srcAlpha) {
                 destAlphaPtr = destAlphaPtr0 + y * scaledWidth + x;
-                *destAlphaPtr = alphaLineBuf1[x] * (1.0 - yFrac) + alphaLineBuf2[x] \
* yFrac; +                *destAlphaPtr = static_cast<unsigned char>(alphaLineBuf1[x] \
* (1.0 - yFrac) + alphaLineBuf2[x] * yFrac);  }
         }
 
commit b1ad047408152e4a36f170728b6e97784fa48395
Author: Albert Astals Cid <aacid@kde.org>
Date:   Fri Apr 8 11:21:09 2022 +0200

    MSVC: type conversion warning fix
    
    Don't support adding fonts bigger than INT_MAX

diff --git a/poppler/Form.cc b/poppler/Form.cc
index a7bf9aba..0aafd912 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -2807,8 +2807,13 @@ std::string Form::addFontToDefaultResources(const std::string \
                &filepath, int fac
                     error(errIO, -1, "Failed to get file size for %s", \
filepath.c_str());  return {};
                 }
+                // GooFile::read only takes an integer so for now we don't support \
huge fonts +                if (fileSize > std::numeric_limits<int>::max()) {
+                    error(errIO, -1, "Font size is too big %s", filepath.c_str());
+                    return {};
+                }
                 char *dataPtr = static_cast<char *>(gmalloc(fileSize));
-                const Goffset bytesRead = file->read(dataPtr, fileSize, 0);
+                const Goffset bytesRead = file->read(dataPtr, \
static_cast<int>(fileSize), 0);  if (bytesRead != fileSize) {
                     error(errIO, -1, "Failed to read contents of %s", \
filepath.c_str());  gfree(dataPtr);
commit 6f9f838341173667d2a253df64f1706392649564
Author: Albert Astals Cid <aacid@kde.org>
Date:   Fri Apr 8 11:18:57 2022 +0200

    MSVC: type warning fixes
    
    outBuf is 16384 long so we can cast its ptrdiff_t to int fine

diff --git a/poppler/FlateEncoder.cc b/poppler/FlateEncoder.cc
index 478b4b4e..0786565d 100644
--- a/poppler/FlateEncoder.cc
+++ b/poppler/FlateEncoder.cc
@@ -5,6 +5,7 @@
 // Copyright (C) 2016, William Bader <williambader@hotmail.com>
 // Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com>
 // Copyright (C) 2021 Even Rouault <even.rouault@spatialys.com>
+// Copyright (C) 2022 Albert Astals Cid <aacid@kde.org>
 //
 // This file is under the GPLv2 or later license
 //
@@ -78,7 +79,6 @@ void FlateEncoder::reset()
 
 bool FlateEncoder::fillBuf()
 {
-    int n;
     unsigned int starting_avail_out;
     int zlib_status;
 
@@ -92,7 +92,7 @@ bool FlateEncoder::fillBuf()
     /* If it is not empty, push any processed data to the start. */
 
     if (outBufPtr > outBuf && outBufPtr < outBufEnd) {
-        n = outBufEnd - outBufPtr;
+        const ptrdiff_t n = outBufEnd - outBufPtr;
         memmove(outBuf, outBufPtr, n);
         outBufEnd = &outBuf[n];
     } else {
@@ -114,7 +114,7 @@ bool FlateEncoder::fillBuf()
 
             /* Fill the input buffer */
 
-            n = (inBufEof ? 0 : str->doGetChars(inBufSize, inBuf));
+            const int n = (inBufEof ? 0 : str->doGetChars(inBufSize, inBuf));
 
             if (n == 0) {
                 inBufEof = true;
@@ -127,7 +127,7 @@ bool FlateEncoder::fillBuf()
         /* Ask zlib for output. */
 
         zlib_stream.next_out = outBufEnd;
-        starting_avail_out = &outBuf[outBufSize] - outBufEnd;
+        starting_avail_out = static_cast<unsigned int>(&outBuf[outBufSize] - \
outBufEnd);  zlib_stream.avail_out = starting_avail_out;
 
         zlib_status = deflate(&zlib_stream, (inBufEof ? Z_FINISH : Z_NO_FLUSH));
diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index 49249030..57e1e3a8 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2006 Raj Kumar <rkumar@archive.org>
 // Copyright (C) 2006 Paul Walmsley <paul@booyaka.com>
-// Copyright (C) 2006-2010, 2012, 2014-2021 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2014-2022 Albert Astals Cid <aacid@kde.org>
 // Copyright (C) 2009 David Benjamin <davidben@mit.edu>
 // Copyright (C) 2011 Edward Jiang <ejiang@google.com>
 // Copyright (C) 2012 William Bader <williambader@hotmail.com>
@@ -1424,8 +1424,8 @@ void JBIG2Stream::readSegments()
             byteCounter += huffDecoder->getByteCounter();
             byteCounter += mmrDecoder->getByteCounter();
 
-            Goffset segExtraBytes = segLength - byteCounter;
-            if (segExtraBytes > 0) {
+            if (segLength > byteCounter) {
+                const unsigned int segExtraBytes = segLength - byteCounter;
 
                 // If we didn't read all of the bytes in the segment data,
                 // indicate an error, and throw away the rest of the data.
@@ -1435,9 +1435,9 @@ void JBIG2Stream::readSegments()
                 // arithmetic-coded symbol dictionary segments when numNewSyms
                 // == 0.  Segments like this often occur for blank pages.
 
-                error(errSyntaxError, curStr->getPos(), "{0:lld} extraneous \
                byte{1:s} after segment", segExtraBytes, (segExtraBytes > 1) ? "s" : \
                "");
-
-            } else if (segExtraBytes < 0 || segLength - byteCounter > 65536) {
+                error(errSyntaxError, curStr->getPos(), "{0:ud} extraneous byte{1:s} \
after segment", segExtraBytes, (segExtraBytes > 1) ? "s" : ""); +                \
byteCounter += curStr->discardChars(segExtraBytes); +            } else if (segLength \
< byteCounter) {  
                 // If we read more bytes than we should have, according to the
                 // segment length field, note an error.
@@ -1445,7 +1445,6 @@ void JBIG2Stream::readSegments()
                 error(errSyntaxError, curStr->getPos(), "Previous segment handler \
read too many bytes");  goto syntaxError;
             }
-            byteCounter += curStr->discardChars(segExtraBytes);
         }
 
         gfree(refSegs);
commit 23c70adb7671c174ee5084eb28cd0100f8877065
Author: Albert Astals Cid <aacid@kde.org>
Date:   Fri Apr 8 11:15:41 2022 +0200

    MSVC: type conversion warnings
    
    int to size_t
    float to double

diff --git a/utils/HtmlLinks.cc b/utils/HtmlLinks.cc
index f2782e46..a28d23d6 100644
--- a/utils/HtmlLinks.cc
+++ b/utils/HtmlLinks.cc
@@ -18,7 +18,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2008 Boris Toloknov <tlknv@yandex.ru>
-// Copyright (C) 2010, 2021 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2010, 2021, 2022 Albert Astals Cid <aacid@kde.org>
 // Copyright (C) 2013 Julien Nabet <serval2412@yahoo.fr>
 //
 // To see a description of the changes please see the Changelog file that
@@ -140,7 +140,7 @@ HtmlLinks::HtmlLinks() { }
 
 HtmlLinks::~HtmlLinks() { }
 
-bool HtmlLinks::inLink(double xmin, double ymin, double xmax, double ymax, int &p) \
const +bool HtmlLinks::inLink(double xmin, double ymin, double xmax, double ymax, \
size_t &p) const  {
 
     for (std::vector<HtmlLink>::const_iterator i = accu.begin(); i != accu.end(); \
++i) { @@ -152,7 +152,7 @@ bool HtmlLinks::inLink(double xmin, double ymin, double \
xmax, double ymax, int &  return false;
 }
 
-const HtmlLink *HtmlLinks::getLink(int i) const
+const HtmlLink *HtmlLinks::getLink(size_t i) const
 {
     return &accu[i];
 }
diff --git a/utils/HtmlLinks.h b/utils/HtmlLinks.h
index 7bb8cc39..0e62f56e 100644
--- a/utils/HtmlLinks.h
+++ b/utils/HtmlLinks.h
@@ -17,7 +17,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2010, 2018, 2021 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2010, 2018, 2021, 2022 Albert Astals Cid <aacid@kde.org>
 //
 // 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
@@ -69,8 +69,8 @@ public:
     HtmlLinks(const HtmlLinks &) = delete;
     HtmlLinks &operator=(const HtmlLinks &) = delete;
     void AddLink(const HtmlLink &x) { accu.push_back(x); }
-    bool inLink(double xmin, double ymin, double xmax, double ymax, int &p) const;
-    const HtmlLink *getLink(int i) const;
+    bool inLink(double xmin, double ymin, double xmax, double ymax, size_t &p) \
const; +    const HtmlLink *getLink(size_t i) const;
 };
 
 #endif
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 606d911a..94f3a67c 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -103,7 +103,7 @@ public:
 };
 
 // returns true if x is closer to y than x is to z
-static inline bool IS_CLOSER(float x, float y, float z)
+static inline bool IS_CLOSER(double x, double y, double z)
 {
     return std::fabs((x) - (y)) < std::fabs((x) - (z));
 }
@@ -343,7 +343,7 @@ void HtmlPage::conv()
         delete tmp->htext;
         tmp->htext = HtmlFont::HtmlFilter(tmp->text, tmp->len);
 
-        int linkIndex = 0;
+        size_t linkIndex = 0;
         if (links->inLink(tmp->xMin, tmp->yMin, tmp->xMax, tmp->yMax, linkIndex)) {
             tmp->link = links->getLink(linkIndex);
         }
commit 0ccae23433365297acb391471cc783be03d33c30
Author: Albert Astals Cid <aacid@kde.org>
Date:   Fri Apr 8 10:47:01 2022 +0200

    MSVC: More warning fixes
    
     * Add casts that convert between types but we know the value inside the
       bigger type will be small enough
     * Some ceil/round/floor -> int cast
     * Add forced casts because the destination type is needed
     * Add some casts (distance between characters in an user option will be
       int) which potentially could be wrong, but noone is going to write
       such a long parameter in the command line

diff --git a/fofi/FoFiType1.cc b/fofi/FoFiType1.cc
index 59a95e51..3fcac6cc 100644
--- a/fofi/FoFiType1.cc
+++ b/fofi/FoFiType1.cc
@@ -13,7 +13,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2005, 2008, 2010, 2018, 2021 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2005, 2008, 2010, 2018, 2021, 2022 Albert Astals Cid \
<aacid@kde.org>  // Copyright (C) 2005 Kristian Høgsberg <krh@redhat.com>
 // Copyright (C) 2010 Jakub Wilk <jwilk@jwilk.net>
 // Copyright (C) 2014 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -223,7 +223,7 @@ void FoFiType1::parse()
         // get font name
         if (!name && (line + 9 <= (char *)file + len) && !strncmp(line, "/FontName", \
9)) {  const auto availableFile = (char *)file + len - line;
-            const int lineLen = availableFile < 255 ? availableFile : 255;
+            const int lineLen = static_cast<int>(availableFile < 255 ? availableFile \
: 255);  strncpy(buf, line, lineLen);
             buf[lineLen] = '\0';
             if ((p = strchr(buf + 9, '/')) && (p = strtok_r(p + 1, " \t\n\r", \
&tokptr))) { @@ -337,7 +337,7 @@ void FoFiType1::parse()
 
         } else if (!gotMatrix && (line + 11 <= (char *)file + len) && !strncmp(line, \
"/FontMatrix", 11)) {  const auto availableFile = (char *)file + len - (line + 11);
-            const int bufLen = availableFile < 255 ? availableFile : 255;
+            const int bufLen = static_cast<int>(availableFile < 255 ? availableFile \
: 255);  strncpy(buf, line + 11, bufLen);
             buf[bufLen] = '\0';
             if ((p = strchr(buf, '['))) {
diff --git a/goo/grandom.cc b/goo/grandom.cc
index c2d9c026..90909b0f 100644
--- a/goo/grandom.cc
+++ b/goo/grandom.cc
@@ -7,6 +7,7 @@
  *
  * Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it>
  * Copyright (C) 2018 Adam Reichold <adam.reichold@t-online.de>
+ * Copyright (C) 2022 Albert Astals Cid <aacid@kde.org>
  */
 
 #include "grandom.h"
@@ -28,7 +29,7 @@ void grandom_fill(unsigned char *buff, int size)
     auto &engine = grandom_engine();
     std::uniform_int_distribution<unsigned short> distribution { \
std::numeric_limits<unsigned char>::min(), std::numeric_limits<unsigned char>::max() \
};  for (int index = 0; index < size; ++index) {
-        buff[index] = distribution(engine);
+        buff[index] = static_cast<unsigned char>(distribution(engine));
     }
 }
 
diff --git a/utils/pdftocairo-win32.cc b/utils/pdftocairo-win32.cc
index 9dc6ad95..013eeb56 100644
--- a/utils/pdftocairo-win32.cc
+++ b/utils/pdftocairo-win32.cc
@@ -4,7 +4,7 @@
 //
 // Copyright (C) 2014 Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
 // Copyright (C) 2014, 2017 Adrian Johnson <ajohnson@redneon.com>
-// Copyright (C) 2017, 2018 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2017, 2018, 2022 Albert Astals Cid <aacid@kde.org>
 //
 // 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
@@ -90,12 +90,12 @@ static void fillPagePrinterOptions(double w, double h)
     h *= 254.0 / 72.0;
     if (w > h) {
         devmode->dmOrientation = DMORIENT_LANDSCAPE;
-        devmode->dmPaperWidth = h;
-        devmode->dmPaperLength = w;
+        devmode->dmPaperWidth = static_cast<short>(h);
+        devmode->dmPaperLength = static_cast<short>(w);
     } else {
         devmode->dmOrientation = DMORIENT_PORTRAIT;
-        devmode->dmPaperWidth = w;
-        devmode->dmPaperLength = h;
+        devmode->dmPaperWidth = static_cast<short>(w);
+        devmode->dmPaperLength = static_cast<short>(h);
     }
     devmode->dmPaperSize = 0;
     devmode->dmFields |= DM_ORIENTATION | DM_PAPERWIDTH | DM_PAPERLENGTH;
@@ -109,7 +109,7 @@ static void fillPrinterOptions(bool duplex, GooString *printOpt)
         const char *comma = strchr(nextOpt, ',');
         GooString opt;
         if (comma) {
-            opt.Set(nextOpt, comma - nextOpt);
+            opt.Set(nextOpt, static_cast<int>(comma - nextOpt));
             nextOpt = comma + 1;
         } else {
             opt.Set(nextOpt);
@@ -121,7 +121,7 @@ static void fillPrinterOptions(bool duplex, GooString *printOpt)
             fprintf(stderr, "Warning: unknown printer option \"%s\"\n", \
opt.c_str());  continue;
         }
-        int iequal = equal - opt.c_str();
+        const int iequal = static_cast<int>(equal - opt.c_str());
         GooString value(&opt, iequal + 1, opt.getLength() - iequal - 1);
         opt.del(iequal, opt.getLength() - iequal);
         // here opt is "<optN>" and value is "<valN>"
@@ -255,7 +255,7 @@ static UINT_PTR CALLBACK printDialogHookProc(HWND hdlg, UINT \
uiMsg, WPARAM wPara  
         RECT textRect;
         textRect.left = nameLabelRect.left;
-        textRect.right = nameLabelRect.left + 1.8 * (printerComboRect.left - \
nameLabelRect.left); +        textRect.right = static_cast<LONG>(nameLabelRect.left + \
                1.8 * (printerComboRect.left - nameLabelRect.left));
         textRect.top = pdfGroupBoxRect.top + nameLabelRect.top - \
                printerGroupRect.top;
         textRect.bottom = textRect.top + nameLabelRect.bottom - nameLabelRect.top;
         createStaticText(hdlg, hinstance, (HMENU)stc1, "Page Scaling:", &textRect);
@@ -463,13 +463,13 @@ void win32BeginPage(double *w, double *h, bool changePageSize, \
                bool useFullPage)
         *h = GetDeviceCaps(hdc, VERTRES) * 72.0 / y_dpi;
     }
     XFORM xform;
-    xform.eM11 = x_dpi / 72.0;
+    xform.eM11 = x_dpi / 72.0f;
     xform.eM12 = 0;
     xform.eM21 = 0;
-    xform.eM22 = y_dpi / 72.0;
+    xform.eM22 = y_dpi / 72.0f;
     if (useFullPage) {
-        xform.eDx = -x_off;
-        xform.eDy = -y_off;
+        xform.eDx = static_cast<FLOAT>(-x_off);
+        xform.eDy = static_cast<FLOAT>(-y_off);
     } else {
         xform.eDx = 0;
         xform.eDy = 0;
diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index 07e3f206..476f0be2 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -282,7 +282,7 @@ static bool parseJpegOptions()
         const char *comma = strchr(nextOpt, ',');
         GooString opt;
         if (comma) {
-            opt.Set(nextOpt, comma - nextOpt);
+            opt.Set(nextOpt, static_cast<int>(comma - nextOpt));
             nextOpt = comma + 1;
         } else {
             opt.Set(nextOpt);
@@ -294,7 +294,7 @@ static bool parseJpegOptions()
             fprintf(stderr, "Unknown jpeg option \"%s\"\n", opt.c_str());
             return false;
         }
-        int iequal = equal - opt.c_str();
+        const int iequal = static_cast<int>(equal - opt.c_str());
         GooString value(&opt, iequal + 1, opt.getLength() - iequal - 1);
         opt.del(iequal, opt.getLength() - iequal);
         // here opt is "<optN>" and value is "<valN>"
@@ -658,7 +658,7 @@ static void beginPage(double *w, double *h)
         cairo_surface_set_fallback_resolution(surface, x_resolution, y_resolution);
 
     } else {
-        surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, ceil(*w), \
ceil(*h)); +        surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, \
static_cast<int>(ceil(*w)), static_cast<int>(ceil(*h)));  }
 }
 
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index a3129035..69e56a72 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -226,7 +226,7 @@ static bool parseJpegOptions()
         const char *comma = strchr(nextOpt, ',');
         GooString opt;
         if (comma) {
-            opt.Set(nextOpt, comma - nextOpt);
+            opt.Set(nextOpt, static_cast<int>(comma - nextOpt));
             nextOpt = comma + 1;
         } else {
             opt.Set(nextOpt);
@@ -238,7 +238,7 @@ static bool parseJpegOptions()
             fprintf(stderr, "Unknown jpeg option \"%s\"\n", opt.c_str());
             return false;
         }
-        int iequal = equal - opt.c_str();
+        const int iequal = static_cast<int>(equal - opt.c_str());
         GooString value(&opt, iequal + 1, opt.getLength() - iequal - 1);
         opt.del(iequal, opt.getLength() - iequal);
         // here opt is "<optN>" and value is "<valN>"


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic