diff options
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/core/xmluconv.cxx | 20 | ||||
-rw-r--r-- | xmloff/source/text/txtlists.cxx | 2 |
2 files changed, 15 insertions, 7 deletions
diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx index 1f2fe2446f38..fa34a3006f6b 100644 --- a/xmloff/source/core/xmluconv.cxx +++ b/xmloff/source/core/xmluconv.cxx @@ -375,21 +375,29 @@ void SvXMLUnitConverter::convertDateTime( OUStringBuffer& rBuffer, aDate += 1; } } - sal_uInt16 nTemp = aDate.GetYear(); - if (nTemp < 1000) + sal_Int16 nTempYear = aDate.GetYear(); + assert(nTempYear != 0); + if (nTempYear < 0) + { + rBuffer.append( '-'); + nTempYear = -nTempYear; + } + if (nTempYear < 1000) rBuffer.append( '0'); - if (nTemp < 100) + if (nTempYear < 100) rBuffer.append( '0'); - if (nTemp < 10) + if (nTempYear < 10) rBuffer.append( '0'); - rBuffer.append( sal_Int32( nTemp)); + rBuffer.append( sal_Int32( nTempYear)); rBuffer.append( '-'); - nTemp = aDate.GetMonth(); + sal_uInt16 nTemp = aDate.GetMonth(); + assert(1 <= nTemp && nTemp <= 12); if (nTemp < 10) rBuffer.append( '0'); rBuffer.append( sal_Int32( nTemp)); rBuffer.append( '-'); nTemp = aDate.GetDay(); + assert(1 <= nTemp && nTemp <= 31); if (nTemp < 10) rBuffer.append( '0'); rBuffer.append( sal_Int32( nTemp)); diff --git a/xmloff/source/text/txtlists.cxx b/xmloff/source/text/txtlists.cxx index 3fd31e514b4b..09c62c7f742c 100644 --- a/xmloff/source/text/txtlists.cxx +++ b/xmloff/source/text/txtlists.cxx @@ -225,7 +225,7 @@ OUString XMLTextListsHelper::GenerateNewListId() const { // Value of xml:id in element <text:list> has to be a valid ID type (#i92478#) sal_Int64 n = ::tools::Time( ::tools::Time::SYSTEM ).GetTime(); - n += Date( Date::SYSTEM ).GetDate(); + n += Date( Date::SYSTEM ).GetDateUnsigned(); n += comphelper::rng::uniform_int_distribution(0, std::numeric_limits<int>::max()); // Value of xml:id in element <text:list> has to be a valid ID type (#i92478#) sTmpStr += OUString::number( n ); |