summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/pdfwriter_impl.cxx
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2020-07-09 10:12:12 +0200
committerTomaž Vajngerl <quikee@gmail.com>2020-07-10 11:32:48 +0200
commit9cd5645f3be28b45cb704ac06c89cb3b3c3ae0f5 (patch)
treec340fef2eaca4c5f6716ae20929a32babf9229ed /vcl/source/gdi/pdfwriter_impl.cxx
parentf15ed9ef890b13394de9b2673c010086063d6e7a (diff)
pdfwriter: nDelta is a signed number appendPdfTimeDate
includes cid#1465240: DEADCODE See https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf 7.9.4 Dates "O shall be the relationship of local time to Universal Time (UT), and shall be denoted by one of the characters PLUS SIGN (U+002B) (+), HYPHEN-MINUS (U+002D) (-), or LATIN CAPITAL LETTER Z (U+005A) (Z) (see below) ... A PLUS SIGN as the value of the O field signifies that local time is later than UT, a HYPHEN-MINUS signifies that local time is earlier than UT, and the LATIN CAPITAL LETTER Z signifies that local time is equal to UT. If no UT information is specified, the relationship of the specified time to UT shall be considered to be GMT. Regardless of whether the time zone is specified, the rest of the date shall be specified in local time." Change-Id: If9ce87752afd00866a426a1196fafa7e0942270e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98454 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/source/gdi/pdfwriter_impl.cxx')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx15
1 files changed, 5 insertions, 10 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index ea3058f5f616..75ce97166652 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -739,7 +739,7 @@ namespace
{
void appendPdfTimeDate(OStringBuffer & rBuffer,
- sal_Int16 year, sal_uInt16 month, sal_uInt16 day, sal_uInt16 hours, sal_uInt16 minutes, sal_uInt16 seconds, sal_uInt32 tzDelta)
+ sal_Int16 year, sal_uInt16 month, sal_uInt16 day, sal_uInt16 hours, sal_uInt16 minutes, sal_uInt16 seconds, sal_Int32 tzDelta)
{
rBuffer.append("D:");
rBuffer.append(char('0' + ((year / 1000) % 10)));
@@ -766,7 +766,10 @@ void appendPdfTimeDate(OStringBuffer & rBuffer,
if (tzDelta > 0 )
rBuffer.append("+");
else
+ {
rBuffer.append("-");
+ tzDelta = -tzDelta;
+ }
rBuffer.append(char('0' + ((tzDelta / 36000) % 10)));
rBuffer.append(char('0' + ((tzDelta / 3600) % 10)));
@@ -1508,15 +1511,7 @@ OString PDFWriter::GetDateTime()
osl_getLocalTimeFromSystemTime(&aGMT, &aTVal);
osl_getDateTimeFromTimeValue(&aTVal, &aDT);
- sal_uInt32 nDelta = 0;
- if (aGMT.Seconds > aTVal.Seconds)
- {
- nDelta = aGMT.Seconds-aTVal.Seconds;
- }
- else if (aGMT.Seconds < aTVal.Seconds)
- {
- nDelta = aTVal.Seconds-aGMT.Seconds;
- }
+ sal_Int32 nDelta = aTVal.Seconds-aGMT.Seconds;
appendPdfTimeDate(aRet, aDT.Year, aDT.Month, aDT.Day, aDT.Hours, aDT.Minutes, aDT.Seconds, nDelta);