[Libreoffice-commits] .: unotools/source

Eike Rathke erack at kemper.freedesktop.org
Wed Jun 20 05:53:49 PDT 2012


 unotools/source/i18n/localedatawrapper.cxx |   21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

New commits:
commit 209f1cdc933e42d097c03b35cbf8a6f7d52314b4
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Jun 20 14:49:56 2012 +0200

    adapt callers of getCurrFormatsImpl() to changes
    
    06e2005ed83567452783003e3113ad6a92190c2d changed String to OUString and
    initialized some variables with -1 instead of STRING_NOTFOUND, which was
    unsigned 0xffff so var1<var2 was true if var1 had a value other than
    default and var2 was default. After the change the comparison had logic
    reversed and the result was a default negative currency format with
    parentheses for all locales.
    
    Change-Id: I3fe49fed7c1047618dc653fce992eb01582c398d

diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index f4714b6..0c130ec 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -801,21 +801,20 @@ void LocaleDataWrapper::getCurrFormatsImpl()
         const ::rtl::OUString& rCode = pFormatArr[nNeg].Code;
         sal_Int32 nDelim = rCode.indexOf(';');
         scanCurrFormatImpl( rCode, nDelim+1, nSign, nPar, nNum, nBlank, nSym );
-        if (areChecksEnabled() && (nNum == -1 ||
-                    nSym == -1 || (nPar == -1 &&
-                        nSign == -1)))
+        if (areChecksEnabled() && (nNum == -1 || nSym == -1 || (nPar == -1 && nSign == -1)))
         {
             rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM(
                         "LocaleDataWrapper::getCurrFormatsImpl: CurrNegativeFormat?"));
             outputCheckMessage( appendLocaleInfo( aMsg ) );
         }
+        // NOTE: one of nPar or nSign are allowed to be -1
         if (nBlank == -1)
         {
             if ( nSym < nNum )
             {
-                if ( nPar < nSym )
+                if ( -1 < nPar && nPar < nSym )
                     nCurrNegativeFormat = 0;    // ($1)
-                else if ( nSign < nSym )
+                else if ( -1 < nSign && nSign < nSym )
                     nCurrNegativeFormat = 1;    // -$1
                 else if ( nNum < nSign )
                     nCurrNegativeFormat = 3;    // $1-
@@ -824,9 +823,9 @@ void LocaleDataWrapper::getCurrFormatsImpl()
             }
             else
             {
-                if ( nPar < nNum )
+                if ( -1 < nPar && nPar < nNum )
                     nCurrNegativeFormat = 4;    // (1$)
-                else if ( nSign < nNum )
+                else if ( -1 < nSign && nSign < nNum )
                     nCurrNegativeFormat = 5;    // -1$
                 else if ( nSym < nSign )
                     nCurrNegativeFormat = 7;    // 1$-
@@ -838,9 +837,9 @@ void LocaleDataWrapper::getCurrFormatsImpl()
         {
             if ( nSym < nNum )
             {
-                if ( nPar < nSym )
+                if ( -1 < nPar && nPar < nSym )
                     nCurrNegativeFormat = 14;   // ($ 1)
-                else if ( nSign < nSym )
+                else if ( -1 < nSign && nSign < nSym )
                     nCurrNegativeFormat = 9;    // -$ 1
                 else if ( nNum < nSign )
                     nCurrNegativeFormat = 12;   // $ 1-
@@ -849,9 +848,9 @@ void LocaleDataWrapper::getCurrFormatsImpl()
             }
             else
             {
-                if ( nPar < nNum )
+                if ( -1 < nPar && nPar < nNum )
                     nCurrNegativeFormat = 15;   // (1 $)
-                else if ( nSign < nNum )
+                else if ( -1 < nSign && nSign < nNum )
                     nCurrNegativeFormat = 8;    // -1 $
                 else if ( nSym < nSign )
                     nCurrNegativeFormat = 10;   // 1 $-


More information about the Libreoffice-commits mailing list