diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2020-07-09 10:12:12 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-07-10 11:32:19 +0200 |
commit | c54c8fedeaff84e1c92147ae929d6beada95bcaf (patch) | |
tree | 1371322b61550f3852f12d33f133ba4b01943482 | |
parent | 12bfedfac3b141fe6c91b0e5ae5b3fb2ba817c48 (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/+/98403
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 4e1ea4b4c9f7..686635b5b5dc 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -587,7 +587,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))); @@ -614,7 +614,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))); @@ -1380,15 +1383,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); |