[Libreoffice-commits] core.git: tools/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 22 14:41:04 UTC 2020


 tools/source/datetime/tdate.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit ce43004ca4234010c5b7243e7bb90daa6a9b7f56
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jan 22 15:55:41 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jan 22 15:40:26 2020 +0100

     don't warn about 0/0/0 year, commonly used as a default-value/no-value
    
    Change-Id: I2f6dc371f99d6963753ffaf5365a7d69ca866ca8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87190
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx
index 1fdebaac55bb..e3fd7eff5bbe 100644
--- a/tools/source/datetime/tdate.cxx
+++ b/tools/source/datetime/tdate.cxx
@@ -99,7 +99,9 @@ sal_uInt16 ImplDaysInMonth( sal_uInt16 nMonth, sal_Int16 nYear )
 
 void Date::setDateFromDMY( sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear )
 {
-    SAL_WARN_IF( nYear == 0, "tools.datetime", "Date::setDateFromDMY - sure about 0 year? It's not in the calendar.");
+    // don't warn about 0/0/0, commonly used as a default-value/no-value
+    SAL_WARN_IF( nYear == 0 && !(nYear == 0 && nMonth == 0 && nDay == 0),
+        "tools.datetime", "Date::setDateFromDMY - sure about 0 year? It's not in the calendar.");
     assert( nMonth < 100 && "nMonth % 100 not representable" );
     assert(   nDay < 100 && "nDay % 100 not representable" );
     if (nYear < 0)


More information about the Libreoffice-commits mailing list