sw/source/ui/dbui/dbmgr.cxx |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit a4688cde5b7295ca5f5f1ff2fc6e615139c467cf
Author: Pierre-Eric Pelloux-Prayer <pierre-e...@lanedo.com>
Date:   Wed Jun 12 13:01:20 2013 +0200

    mail merge: properly increment indexing counter (was const)
    
    Change-Id: I1d780a5369c04a93e7fe16b41bff5f37d641e60c
    Reviewed-on: https://gerrit.libreoffice.org/4857
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index ee75876..b0bbc15 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -1289,21 +1289,22 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* 
pSourceShell,
                     // printing should be done synchronously otherwise the 
document
                     // might already become invalid during the process
                     uno::Sequence< beans::PropertyValue > aOptions( 
rMergeDescriptor.aPrintOptions );
-                    const sal_Int32 nOpts = aOptions.getLength();
-                    aOptions.realloc( nOpts + 1 );
-                    aOptions[ nOpts ].Name = OUString("Wait");
-                    aOptions[ nOpts ].Value <<= sal_True ;
+
+                    aOptions.realloc( 1 );
+                    aOptions[ 0 ].Name = OUString("Wait");
+                    aOptions[ 0 ].Value <<= sal_True ;
                     // move print options
                     const beans::PropertyValue* pPrintOptions = 
rMergeDescriptor.aPrintOptions.getConstArray();
-                    for( sal_Int32 nOption = 0; nOption < 
rMergeDescriptor.aPrintOptions.getLength(); ++nOption)
+                    for( sal_Int32 nOption = 0, nIndex = 1 ; nOption < 
rMergeDescriptor.aPrintOptions.getLength(); ++nOption)
                     {
                         if( pPrintOptions[nOption].Name == "CopyCount" || 
pPrintOptions[nOption].Name == "FileName"
                             || pPrintOptions[nOption].Name == "Collate" || 
pPrintOptions[nOption].Name == "Pages"
                             || pPrintOptions[nOption].Name == "Wait" )
                         {
-                            aOptions.realloc( nOpts + 1 );
-                            aOptions[ nOpts ].Name = 
pPrintOptions[nOption].Name;
-                            aOptions[ nOpts ].Value = 
pPrintOptions[nOption].Value ;
+                            // add an option
+                            aOptions.realloc( nIndex + 1 );
+                            aOptions[ nIndex ].Name = 
pPrintOptions[nOption].Name;
+                            aOptions[ nIndex++ ].Value = 
pPrintOptions[nOption].Value ;
                         }
                     }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to