goo/glibc.cc | 3 ++- poppler/DateInfo.cc | 4 ++-- poppler/Form.cc | 6 +++--- poppler/XRef.cc | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-)
New commits: commit 695d1a6d6d64fad8303ca653666a96f9f880c46e Author: Albert Astals Cid <[email protected]> Date: Fri Apr 1 22:43:40 2022 +0200 Move MSVC warning silencing The static_casts are fine because the surrounding code makes sure they are in range The int -> intptr_t makes sense and the surrounding code is already goffset so that should be all good diff --git a/goo/glibc.cc b/goo/glibc.cc index d390b4fa..93968ed7 100644 --- a/goo/glibc.cc +++ b/goo/glibc.cc @@ -7,6 +7,7 @@ // This file is licensed under the GPLv2 or later // // Copyright (C) 2016 Adrian Johnson <[email protected]> +// Copyright (C) 2022 Albert Astals Cid <[email protected]> // //======================================================================== @@ -42,7 +43,7 @@ static time_t getLocalTimeZoneOffset() time(&utc); gmtime_r(&utc, &tm_utc); local = mktime(&tm_utc); - return difftime(utc, local); + return static_cast<time_t>(difftime(utc, local)); } time_t timegm(struct tm *tm) diff --git a/poppler/DateInfo.cc b/poppler/DateInfo.cc index 36e98048..cdba4ab7 100644 --- a/poppler/DateInfo.cc +++ b/poppler/DateInfo.cc @@ -2,7 +2,7 @@ // // DateInfo.cc // -// Copyright (C) 2008, 2018, 2019, 2021 Albert Astals Cid <[email protected]> +// Copyright (C) 2008, 2018, 2019, 2021, 2022 Albert Astals Cid <[email protected]> // Copyright (C) 2009 Carlos Garcia Campos <[email protected]> // Copyright (C) 2015 André Guerreiro <[email protected]> // Copyright (C) 2015 André Esser <[email protected]> @@ -102,7 +102,7 @@ GooString *timeToDateString(const time_t *timeA) // calculate time zone offset by comparing local and gmtime time_t value for same // time. const time_t timeg = timegm(&localtime_tm); - const int offset = difftime(timeg, timet); // find time zone offset in seconds + const int offset = static_cast<int>(difftime(timeg, timet)); // find time zone offset in seconds if (offset > 0) { dateString->appendf("+{0:02d}'{1:02d}'", offset / 3600, (offset % 3600) / 60); } else if (offset < 0) { diff --git a/poppler/Form.cc b/poppler/Form.cc index e65c0862..43ae67ba 100644 --- a/poppler/Form.cc +++ b/poppler/Form.cc @@ -575,7 +575,7 @@ static bool hashFileRange(FILE *f, SignatureHandler *handler, Goffset start, Gof } int len = BUF_SIZE; if (end - start < len) { - len = end - start; + len = static_cast<int>(end - start); } if (fread(buf, 1, len, f) != static_cast<size_t>(len)) { delete[] buf; @@ -2259,8 +2259,8 @@ void FormFieldSignature::hashSignedDataBlock(SignatureHandler *handler, Goffset while (i < block_len) { Goffset bytes_left = block_len - i; if (bytes_left < BLOCK_SIZE) { - doc->getBaseStream()->doGetChars(bytes_left, signed_data_buffer); - handler->updateHash(signed_data_buffer, bytes_left); + doc->getBaseStream()->doGetChars(static_cast<int>(bytes_left), signed_data_buffer); + handler->updateHash(signed_data_buffer, static_cast<int>(bytes_left)); i = block_len; } else { doc->getBaseStream()->doGetChars(BLOCK_SIZE, signed_data_buffer); diff --git a/poppler/XRef.cc b/poppler/XRef.cc index e95c0450..b3fdf9de 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -992,7 +992,7 @@ bool XRef::constructXRef(bool *wasReconstructed, bool needCatalogDict) } else { char *endstream = strstr(p, "endstream"); if (endstream) { - int endstreamPos = endstream - p; + intptr_t endstreamPos = endstream - p; if ((endstreamPos == 0 || Lexer::isSpace(p[endstreamPos - 1] & 0xff)) // endstream is either at beginning or preceeded by space && (endstreamPos + 9 >= 256 || Lexer::isSpace(p[endstreamPos + 9] & 0xff))) // endstream is either at end or followed by space {
