[Libreoffice-commits] core.git: sc/qa

Tor Lillqvist tml at iki.fi
Tue Mar 19 23:27:03 PDT 2013


 sc/qa/unit/ucalc.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit e7419364c4ef7986657974382076a52094aeb7dc
Author: Tor Lillqvist <tml at iki.fi>
Date:   Wed Mar 20 08:20:35 2013 +0200

    'size_t' is not the same as 'unsigned long'
    
    So using %lu to printf 'size_t' is not 100% portable either. At least in
    64-bit Windows code 'size_t' is 64 bits but 'unsigned long' is 32 bits.
    
    Let's just use 'unsigned' for the loop indexes here (and %u as the
    format). After all, they are single-digit numbers.
    
    Alternatively, could just use C++ stream output for this purely informative
    printout.
    
    Change-Id: I604e1c6c6a910c86b5f1408bee1d9c2c7a8b76ff

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index cd8cf1f..75b671b 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -6243,16 +6243,16 @@ void Test::testFormulaGrouping()
 
     m_pDoc->InsertTab( 0, "sheet" );
 
-    for (size_t i = 0; i < SAL_N_ELEMENTS( aGroupTests ); i++)
+    for (unsigned i = 0; i < SAL_N_ELEMENTS( aGroupTests ); i++)
     {
-        for (size_t j = 0; j < SAL_N_ELEMENTS( aGroupTests[0].pFormula ); j++)
+        for (unsigned j = 0; j < SAL_N_ELEMENTS( aGroupTests[0].pFormula ); j++)
         {
             OUString aFormula = OUString::createFromAscii(aGroupTests[i].pFormula[j]);
             m_pDoc->SetString(0, (SCROW)j, 0, aFormula);
         }
         m_pDoc->RebuildFormulaGroups();
 
-        for (size_t j = 0; j < SAL_N_ELEMENTS( aGroupTests[0].pFormula ); j++)
+        for (unsigned j = 0; j < SAL_N_ELEMENTS( aGroupTests[0].pFormula ); j++)
         {
             ScBaseCell *pCell = NULL;
             m_pDoc->GetCell( 0, (SCROW)j, 0, pCell );
@@ -6268,7 +6268,7 @@ void Test::testFormulaGrouping()
 
             if( !!pCur->GetCellGroup().get() ^ aGroupTests[i].bGroup[j] )
             {
-                printf("expected group test %lu at row %lu to be %d but is %d\n",
+                printf("expected group test %u at row %u to be %d but is %d\n",
                        i, j, aGroupTests[i].bGroup[j], !!pCur->GetCellGroup().get());
                 CPPUNIT_ASSERT_MESSAGE("Failed", false);
             }


More information about the Libreoffice-commits mailing list