[Libreoffice-commits] .: 3 commits - sw/source

Caolán McNamara caolan at kemper.freedesktop.org
Thu Jun 16 01:17:28 PDT 2011


 sw/source/core/layout/dumpfilter.cxx   |    4 +-
 sw/source/core/swg/SwXMLTextBlocks.cxx |   21 +++++-----
 sw/source/core/txtnode/fmtatr2.cxx     |    4 +-
 sw/source/filter/ww8/ww8par.cxx        |   19 +++++----
 sw/source/filter/xml/xmltexte.cxx      |    2 -
 sw/source/ui/app/docsh2.cxx            |    2 -
 sw/source/ui/dbui/dbmgr.cxx            |   64 +++++++++++++++++----------------
 sw/source/ui/vba/vbadocument.cxx       |    4 +-
 sw/source/ui/vba/vbafield.cxx          |    3 +
 9 files changed, 64 insertions(+), 59 deletions(-)

New commits:
commit 552e634c9c0fcd33ff3b1c14014d7d7927bce9d0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 16 09:04:39 2011 +0100

    use an OString

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index b876f3c..d75f8cc 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4834,23 +4834,24 @@ namespace
         {
             String sUniPassword = QueryPasswordForMedium( rMedium );
 
-            ByteString sPassword(sUniPassword, WW8Fib::GetFIBCharset( pWwFib->chseTables ) );
+            rtl::OString sPassword(rtl::OUStringToOString(sUniPassword,
+                WW8Fib::GetFIBCharset(pWwFib->chseTables)));
 
-            xub_StrLen nLen = sPassword.Len();
+            sal_Int32 nLen = sPassword.getLength();
             if( nLen <= 15 )
             {
                 sal_uInt8 pPassword[16];
-                memset( pPassword, 0, sizeof( pPassword ) );
-
-                for (xub_StrLen nChar = 0; nChar < sPassword.Len(); ++nChar )
-                    pPassword[nChar] = sPassword.GetChar(nChar);
+                memcpy(pPassword, sPassword.getStr(), nLen);
+                memset(pPassword+nLen, 0, sizeof(pPassword)-nLen);
 
                 rCodec.InitKey( pPassword );
                 aEncryptionData = rCodec.GetEncryptionData();
 
-                // the export supports RC4 algorithm only, so we have to generate the related EncryptionData as well,
-                // so that Save can export the document without asking for a password;
-                // as result there will be EncryptionData for both algorithms in the MediaDescriptor
+                // the export supports RC4 algorithm only, so we have to
+                // generate the related EncryptionData as well, so that Save
+                // can export the document without asking for a password;
+                // as result there will be EncryptionData for both algorithms
+                // in the MediaDescriptor
                 ::msfilter::MSCodec_Std97 aCodec97;
 
                 // Generate random number with a seed of time as salt.
commit f5c2cadf999e71069c58d3b90528234544d2f6ca
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 15 23:57:49 2011 +0100

    fix comment typo

diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx
index b3009a1..fa56013 100755
--- a/sw/source/ui/app/docsh2.cxx
+++ b/sw/source/ui/app/docsh2.cxx
@@ -830,7 +830,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
                         }
 
                         bool bError = false;
-                        // catch expception if wrong filter is selected - should not happen anymore
+                        // catch exception if wrong filter is selected - should not happen anymore
                         try
                         {
                             xFltMgr->setCurrentFilter( pOwnFlt->GetUIName() );
commit df9c201ed62918f38a285d55d8959a6bee607005
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 15 23:56:45 2011 +0100

    catch by const reference

diff --git a/sw/source/core/layout/dumpfilter.cxx b/sw/source/core/layout/dumpfilter.cxx
index 6fe482b..b5ee4ee 100644
--- a/sw/source/core/layout/dumpfilter.cxx
+++ b/sw/source/core/layout/dumpfilter.cxx
@@ -77,7 +77,7 @@ namespace
             strncpy( ( char * ) seq.getArray() , sBuffer, nLen );
             xOut->writeBytes( seq );
         }
-        catch ( uno::Exception )
+        catch (const uno::Exception&)
         {
             written = -1;
         }
@@ -94,7 +94,7 @@ namespace
             uno::Reference< io::XOutputStream > xOut( pObj, uno::UNO_QUERY_THROW );
             xOut->closeOutput( );
         }
-        catch ( uno::Exception )
+        catch (const uno::Exception&)
         {
             result = -1;
         }
diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx
index 744b389..8a1db92 100644
--- a/sw/source/core/swg/SwXMLTextBlocks.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks.cxx
@@ -89,7 +89,7 @@ SwXMLTextBlocks::SwXMLTextBlocks( const String& rFile )
         refStg  = comphelper::OStorageHelper::GetStorageFromURL( rFile, embed::ElementModes::READWRITE );
         bReadOnly = sal_False;
     }
-    catch( const uno::Exception& )
+    catch(const uno::Exception&)
     {
         //couldn't open the file - maybe it's readonly
     }
@@ -99,7 +99,7 @@ SwXMLTextBlocks::SwXMLTextBlocks( const String& rFile )
         {
             refStg = comphelper::OStorageHelper::GetStorageFromURL( rFile, embed::ElementModes::READ );
         }
-        catch( const uno::Exception& )
+        catch(const uno::Exception&)
         {
             OSL_FAIL("exception while creating AutoText storage");
         }
@@ -194,7 +194,7 @@ sal_uLong SwXMLTextBlocks::Delete( sal_uInt16 n )
                 xTrans->commit();
             return 0;
         }
-        catch ( uno::Exception)
+        catch (const uno::Exception&)
         {
             return ERR_SWG_WRITE_ERROR;
         }
@@ -230,9 +230,8 @@ sal_uLong SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const String& rNewShort, con
         {
             xBlkRoot->renameElement ( aOldName, aPackageName );
         }
-        catch( const container::ElementExistException& rEx )
+        catch(const container::ElementExistException&)
         {
-            (void)rEx;
         }
     }
     uno::Reference < embed::XTransactedObject > xTrans( xBlkRoot, uno::UNO_QUERY );
@@ -279,7 +278,7 @@ sal_uLong SwXMLTextBlocks::CopyBlock( SwImpBlocks& rDestImp, String& rShort,
         uno::Reference < embed::XStorage > rDestRoot = ((SwXMLTextBlocks&)rDestImp).xBlkRoot->openStorageElement( sDestShortName, embed::ElementModes::READWRITE );
         rSourceRoot->copyToStorage( rDestRoot );
     }
-    catch ( uno::Exception& )
+    catch (const uno::Exception&)
     {
         nError = ERR_SWG_WRITE_ERROR;
     }
@@ -311,7 +310,7 @@ sal_uLong SwXMLTextBlocks::StartPutBlock( const String& rShort, const String& rP
         ::rtl::OUString aMime( SotExchange::GetFormatMimeType( SOT_FORMATSTR_ID_STARWRITER_8 ) );
         xRootProps->setPropertyValue( aPropName, uno::makeAny( aMime ) );
     }
-    catch (uno::Exception&)
+    catch (const uno::Exception&)
     {
     }
     return 0;
@@ -372,7 +371,7 @@ sal_uLong SwXMLTextBlocks::PutBlock( SwPaM& , const String& )
                 xTempStorage->copyToStorage( xRoot );
                 bOK = bTmpOK;
             }
-            catch( uno::Exception& )
+            catch(const uno::Exception&)
             {
             }
 
@@ -397,7 +396,7 @@ sal_uLong SwXMLTextBlocks::PutBlock( SwPaM& , const String& )
                 xTmpTrans->commit();
         }
     }
-    catch (uno::Exception&)
+    catch (const uno::Exception&)
     {
     }
 
@@ -465,7 +464,7 @@ sal_Bool SwXMLTextBlocks::PutMuchEntries( sal_Bool bOn )
                 bInPutMuchBlocks = sal_False;
                 bRet = sal_True;
             }
-            catch (uno::Exception&)
+            catch (const uno::Exception&)
             {
             }
         }
@@ -484,7 +483,7 @@ sal_uLong SwXMLTextBlocks::OpenFile( sal_Bool bRdOnly )
                 bRdOnly ? embed::ElementModes::READ : embed::ElementModes::READWRITE );
         InitBlockMode ( refStg );
     }
-    catch ( uno::Exception& )
+    catch (const uno::Exception&)
     {
         //TODO/LATER: error handling
         nRet = 1;
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index e5f6624..810c98e 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -814,7 +814,9 @@ void MetaField::GetPrefixAndSuffix(
                 (pShell) ? pShell->GetModel() : 0,  uno::UNO_SET_THROW);
             getPrefixAndSuffix(xModel, xMetaField, o_pPrefix, o_pSuffix);
         }
-    } catch (uno::Exception) {
+    }
+    catch (const uno::Exception&)
+    {
         OSL_FAIL("exception?");
     }
 }
diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx
index bdceb25..ba505b1 100644
--- a/sw/source/filter/xml/xmltexte.cxx
+++ b/sw/source/filter/xml/xmltexte.cxx
@@ -506,7 +506,7 @@ void SwXMLTextParagraphExport::_exportTextEmbedded(
                     if ( bIsOwnLink )
                         sURL = xLinkage->getLinkURL();
                 }
-                catch( uno::Exception )
+                catch(const uno::Exception&)
                 {
                     // TODO/LATER: error handling
                     OSL_FAIL( "Link detection or retrieving of the URL of OOo link is failed!\n" );
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index 3de945a..b8d9ac0 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -188,7 +188,7 @@ bool lcl_getCountFromResultSet( sal_Int32& rCount, const uno::Reference<XResultS
             if( aCount >>= rCount )
                 return true;
         }
-        catch(Exception&)
+        catch(const Exception&)
         {
         }
     }
@@ -282,7 +282,7 @@ sal_Bool lcl_MoveAbsolute(SwDSParam* pParam, long nAbsPos)
             OSL_FAIL("no absolute positioning available");
         }
     }
-    catch(Exception aExcept)
+    catch(const Exception&)
     {
     }
     return bRet;
@@ -297,7 +297,7 @@ sal_Bool lcl_GetColumnCnt(SwDSParam* pParam,
     {
         xCols = xColsSupp->getColumns();
     }
-    catch( lang::DisposedException& )
+    catch(const lang::DisposedException&)
     {
     }
     if(!xCols.is() || !xCols->hasByName(rColumnName))
@@ -377,7 +377,7 @@ sal_Bool SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc )
                 if(xComponent.is())
                     xComponent->addEventListener(pImpl->xDisposeListener);
             }
-            catch(Exception&)
+            catch(const Exception&)
             {
             }
         }
@@ -403,7 +403,7 @@ sal_Bool SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc )
             pImpl->pMergeData->CheckEndOfDB();
         }
     }
-    catch(Exception&)
+    catch(const Exception&)
     {
         pImpl->pMergeData->bEndOfDB = sal_True;
         pImpl->pMergeData->CheckEndOfDB();
@@ -744,7 +744,7 @@ SwNewDBMgr::~SwNewDBMgr()
                 if(xComp.is())
                     xComp->dispose();
             }
-            catch(const RuntimeException& )
+            catch(const RuntimeException&)
             {
                 //may be disposed already since multiple entries may have used the same connection
             }
@@ -1427,7 +1427,7 @@ sal_uLong SwNewDBMgr::GetColumnFmt( const String& rDBName,
             {
                 xCols = xColsSupp->getColumns();
             }
-            catch(Exception&)
+            catch(const Exception&)
             {
                 OSL_FAIL("Exception in getColumns()");
             }
@@ -1524,7 +1524,7 @@ sal_uLong SwNewDBMgr::GetColumnFmt( uno::Reference< XDataSource> xSource,
                 }
             }
         }
-        catch( const Exception& )
+        catch(const Exception&)
         {
             OSL_FAIL("no FormatKey property found");
         }
@@ -1595,7 +1595,9 @@ uno::Reference< sdbc::XConnection> SwNewDBMgr::GetConnection(const String& rData
                 xConnection = xComplConnection->connectWithCompletion( xHandler );
         }
     }
-    catch(Exception&) {}
+    catch(const Exception&)
+    {
+    }
 
     return xConnection;
 }
@@ -1641,7 +1643,7 @@ uno::Reference< sdbcx::XColumnsSupplier> SwNewDBMgr::GetColumnSupplier(uno::Refe
         xRowSet->execute();
         xRet = Reference<XColumnsSupplier>( xRowSet, UNO_QUERY );
     }
-    catch( const uno::Exception& )
+    catch(const uno::Exception&)
     {
         OSL_FAIL("Exception in SwDBMgr::GetColumnSupplier");
     }
@@ -1671,7 +1673,7 @@ String SwNewDBMgr::GetDBField(uno::Reference<XPropertySet> xColumnProps,
             {
                 sRet = xColumn->getString();
             }
-            catch( SQLException& )
+            catch(const SQLException&)
             {
             }
         break;
@@ -1708,7 +1710,7 @@ String SwNewDBMgr::GetDBField(uno::Reference<XPropertySet> xColumnProps,
                     }
                 }
             }
-            catch(Exception& )
+            catch(const Exception&)
             {
                 OSL_FAIL("exception caught");
             }
@@ -1800,7 +1802,7 @@ sal_Bool SwNewDBMgr::GetColumnCnt(const String& rSourceName, const String& rTabl
         {
             nOldRow = pFound->xResultSet->getRow();
         }
-        catch(const Exception& )
+        catch(const Exception&)
         {
             return sal_False;
         }
@@ -1895,7 +1897,7 @@ sal_Bool SwNewDBMgr::ToNextRecord(SwDSParam* pParam)
             ++pParam->nSelectionIndex;
         }
     }
-    catch(Exception&)
+    catch(const Exception&)
     {
     }
     return bRet;
@@ -1921,7 +1923,7 @@ sal_uInt32 	SwNewDBMgr::GetSelectedRecordId()
     {
         nRet = pImpl->pMergeData->xResultSet->getRow();
     }
-    catch(Exception& )
+    catch(const Exception&)
     {
     }
     return nRet;
@@ -1975,7 +1977,7 @@ sal_Bool SwNewDBMgr::OpenDataSource(const String& rDataSource, const String& rTa
                 pFound->bScrollable = xMetaData
                         ->supportsResultSetType((sal_Int32)ResultSetType::SCROLL_INSENSITIVE);
             }
-            catch(Exception&)
+            catch(const Exception&)
             {
                 // DB driver may not be ODBC 3.0 compliant
                 pFound->bScrollable = sal_True;
@@ -1995,7 +1997,7 @@ sal_Bool SwNewDBMgr::OpenDataSource(const String& rDataSource, const String& rTa
             pFound->CheckEndOfDB();
             ++pFound->nSelectionIndex;
         }
-        catch (Exception&)
+        catch (const Exception&)
         {
             pFound->xResultSet = 0;
             pFound->xStatement = 0;
@@ -2018,7 +2020,7 @@ uno::Reference< XConnection> SwNewDBMgr::RegisterConnection(rtl::OUString& rData
             if(xComponent.is())
                 xComponent->addEventListener(pImpl->xDisposeListener);
         }
-        catch(Exception&)
+        catch(const Exception&)
         {
         }
     }
@@ -2057,7 +2059,9 @@ sal_uInt32      SwNewDBMgr::GetSelectedRecordId(
                 else
                     nRet = pFound->xResultSet->getRow();
             }
-            catch(Exception&){}
+            catch(const Exception&)
+            {
+            }
         }
     }
     return nRet;
@@ -2082,7 +2086,7 @@ void	SwNewDBMgr::CloseAll(sal_Bool bIncludingMerge)
                 if(!bInMerge && pParam->xResultSet.is())
                     pParam->xResultSet->first();
             }
-            catch(Exception& )
+            catch(const Exception&)
             {}
         }
     }
@@ -2129,7 +2133,7 @@ SwDSParam* SwNewDBMgr::FindDSData(const SwDBData& rData, sal_Bool bCreate)
                 if(xComponent.is())
                     xComponent->addEventListener(pImpl->xDisposeListener);
             }
-            catch(Exception&)
+            catch(const Exception&)
             {
             }
         }
@@ -2166,7 +2170,7 @@ SwDSParam*  SwNewDBMgr::FindDSConnection(const rtl::OUString& rDataSource, sal_B
             if(xComponent.is())
                 xComponent->addEventListener(pImpl->xDisposeListener);
         }
-        catch(Exception&)
+        catch(const Exception&)
         {
         }
     }
@@ -2377,7 +2381,7 @@ String SwNewDBMgr::LoadAndRegisterDataSource()
             xNaming->registerObject( sFind, xNewInstance );
 
         }
-        catch(Exception&)
+        catch(const Exception&)
         {
         }
     }
@@ -2459,9 +2463,8 @@ void SwNewDBMgr::ExecuteFormLetter(	SwWrtShell& rSh,
                 sTempURL = URIHelper::SmartRel2Abs( INetURLObject(), utl::TempFile::CreateTempName() );
                 xStore->storeToURL( sTempURL, aValues );
             }
-            catch( const uno::Exception& rEx )
+            catch(const uno::Exception&)
             {
-                (void) rEx;
             }
             if( xDocShell->GetError() )
             {
@@ -2507,7 +2510,7 @@ void SwNewDBMgr::ExecuteFormLetter(	SwWrtShell& rSh,
                             //! I.e. now that object is responsible for closing the model and doc shell.
                             xClose->close( sal_True );
                         }
-                        catch ( const uno::Exception& )
+                        catch (const uno::Exception&)
                         {
                         }
                     }
@@ -2535,7 +2538,7 @@ void SwNewDBMgr::ExecuteFormLetter(	SwWrtShell& rSh,
                     if(xComp.is())
                         xComp->dispose();
                 }
-                catch(const RuntimeException& )
+                catch(const RuntimeException&)
                 {
                     //may be disposed already since multiple entries may have used the same connection
                 }
@@ -2608,7 +2611,7 @@ void SwNewDBMgr::InsertText(SwWrtShell& rSh,
         {
             pDlg->DataToDoc( aSelection , xSource, xConnection, xResSet);
         }
-        catch(Exception& )
+        catch(const Exception&)
         {
             OSL_FAIL("exception caught");
         }
@@ -2721,7 +2724,7 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
             pImpl->pMergeData->CheckEndOfDB();
         }
     }
-    catch(Exception&)
+    catch(const Exception&)
     {
         pImpl->pMergeData->bEndOfDB = sal_True;
         pImpl->pMergeData->CheckEndOfDB();
@@ -2945,9 +2948,8 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
         pTargetShell->SttDoc();
 
     }
-    catch( Exception& rEx)
+    catch(const Exception&)
     {
-        (void)rEx;
         OSL_FAIL("exception caught in SwNewDBMgr::MergeDocuments");
     }
     DELETEZ(pImpl->pMergeData);
diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx
index 36b9d8e..119becf 100644
--- a/sw/source/ui/vba/vbadocument.cxx
+++ b/sw/source/ui/vba/vbadocument.cxx
@@ -126,7 +126,7 @@ SwVbaDocument::Range( const uno::Any& rStart, const uno::Any& rEnd ) throw ( uno
             xStart = mxTextDocument->getText()->getStart();
             xEnd = mxTextDocument->getText()->getEnd();
         }
-        catch( uno::Exception )
+        catch(const uno::Exception&)
         {
             DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
         }    
@@ -503,7 +503,7 @@ SwVbaDocument::getFormControls()
         // implementation detail
         xFormControls.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW );
     }
-    catch( uno::Exception& )
+    catch(const uno::Exception&)
     {
     }
     return xFormControls;
diff --git a/sw/source/ui/vba/vbafield.cxx b/sw/source/ui/vba/vbafield.cxx
index 0ff4295..27a682e 100644
--- a/sw/source/ui/vba/vbafield.cxx
+++ b/sw/source/ui/vba/vbafield.cxx
@@ -556,7 +556,8 @@ sal_Int32 SAL_CALL SwVbaFields::Update() throw (uno::RuntimeException)
         uno::Reference< util::XRefreshable > xRef( xSupp->getTextFields(), uno::UNO_QUERY_THROW );
         xRef->refresh();
         nUpdate = 0;
-    }catch( uno::Exception )
+    }
+    catch(const uno::Exception&)
     {
         nUpdate = 1;
     }


More information about the Libreoffice-commits mailing list