[Libreoffice-commits] .: 6 commits - toolkit/inc tools/bootstrp tools/Executable_mkunroll.mk tools/inc tools/source tools/StaticLibrary_toolshelpers.mk

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


 toolkit/inc/toolkit/helper/macros.hxx |   12 +++----
 tools/Executable_mkunroll.mk          |    4 --
 tools/StaticLibrary_toolshelpers.mk   |    1 
 tools/bootstrp/appdef.cxx             |   54 ----------------------------------
 tools/bootstrp/md5.cxx                |   13 +++++---
 tools/bootstrp/md5.hxx                |    4 +-
 tools/bootstrp/so_checksum.cxx        |   12 +++----
 tools/inc/bootstrp/appdef.hxx         |   49 ------------------------------
 tools/source/ref/globname.cxx         |   39 +++++++++++++-----------
 9 files changed, 43 insertions(+), 145 deletions(-)

New commits:
commit 598b4faa54883bbf03c18a75b56bfc4b5e33d1b5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 16 01:10:39 2011 +0100

    catch by const reference

diff --git a/toolkit/inc/toolkit/helper/macros.hxx b/toolkit/inc/toolkit/helper/macros.hxx
index 0ed4fbf..079f177 100644
--- a/toolkit/inc/toolkit/helper/macros.hxx
+++ b/toolkit/inc/toolkit/helper/macros.hxx
@@ -189,13 +189,13 @@ void ClassName::disposing( const ::com::sun::star::lang::EventObject& ) throw(::
         { \
             xListener->MethodName( aMulti, aMulti2 ); \
         } \
-        catch( ::com::sun::star::lang::DisposedException e ) \
+        catch(const ::com::sun::star::lang::DisposedException& e) \
         { \
             OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \
             if ( e.Context == xListener || !e.Context.is() ) \
                 aIt.remove(); \
         } \
-        catch( ::com::sun::star::uno::RuntimeException e ) \
+        catch(const ::com::sun::star::uno::RuntimeException& e) \
         { \
             DISPLAY_EXCEPTION( ClassName, MethodName, e ) \
         } \
@@ -214,13 +214,13 @@ void ClassName::disposing( const ::com::sun::star::lang::EventObject& ) throw(::
         { \
             xListener->MethodName( aMulti ); \
         } \
-        catch( ::com::sun::star::lang::DisposedException e ) \
+        catch(const ::com::sun::star::lang::DisposedException& e) \
         { \
             OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \
             if ( e.Context == xListener || !e.Context.is() ) \
                 aIt.remove(); \
         } \
-        catch( ::com::sun::star::uno::RuntimeException e ) \
+        catch(const ::com::sun::star::uno::RuntimeException& e) \
         { \
             DISPLAY_EXCEPTION( ClassName, MethodName, e ) \
         } \
@@ -240,13 +240,13 @@ void ClassName::disposing( const ::com::sun::star::lang::EventObject& ) throw(::
         { \
             xListener->MethodName( aMulti ); \
         } \
-        catch( ::com::sun::star::lang::DisposedException e ) \
+        catch(const ::com::sun::star::lang::DisposedException& e) \
         { \
             OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \
             if ( e.Context == xListener || !e.Context.is() ) \
                 aIt.remove(); \
         } \
-        catch( ::com::sun::star::uno::RuntimeException e ) \
+        catch(const ::com::sun::star::uno::RuntimeException& e) \
         { \
             DISPLAY_EXCEPTION( ClassName, MethodName, e ) \
         } \
commit eb8d5a3e7a583a2bb542da80bd8ff6406e854b3e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 15 23:47:04 2011 +0100

    ByteString -> rtl::OString

diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx
index c23d571..f16818d 100644
--- a/tools/source/ref/globname.cxx
+++ b/tools/source/ref/globname.cxx
@@ -33,6 +33,8 @@
 #include <stdio.h>
 #include <string.h>
 
+#include <rtl/strbuf.hxx>
+
 #include <tools/stream.hxx>
 #include <tools/globname.hxx>
 
@@ -262,8 +264,9 @@ void SvGlobalName::MakeFromMemory( void * pData )
 *************************************************************************/
 sal_Bool SvGlobalName::MakeId( const String & rIdStr )
 {
-    ByteString aStr( rIdStr, RTL_TEXTENCODING_ASCII_US );
-    const sal_Char * pStr = (sal_Char *)aStr.GetBuffer();
+    rtl::OString aStr(rtl::OUStringToOString(rIdStr,
+        RTL_TEXTENCODING_ASCII_US));
+    const sal_Char *pStr = aStr.getStr();
     if( rIdStr.Len() == 36
       && '-' == pStr[ 8 ]  && '-' == pStr[ 13 ]
       && '-' == pStr[ 18 ] && '-' == pStr[ 23 ] )
@@ -342,29 +345,29 @@ sal_Bool SvGlobalName::MakeId( const String & rIdStr )
 *************************************************************************/
 String SvGlobalName::GetctorName() const
 {
-    ByteString aRet;
+    rtl::OStringBuffer aStrBuffer;
 
     sal_Char buf[ 20 ];
     sal_uInt32 Data1;
     memcpy(&Data1, pImp->szData, sizeof(sal_uInt32));
     sprintf( buf, "0x%8.8" SAL_PRIXUINT32, Data1 );
-    aRet += buf;
+    aStrBuffer.append(buf);
     sal_uInt16 i;
     for( i = 4; i < 8; i += 2 )
     {
-        aRet += ',';
+        aStrBuffer.append(',');
         sal_uInt16 Data2;
         memcpy(&Data2, pImp->szData+i, sizeof(sal_uInt16));
         sprintf( buf, "0x%4.4X", Data2 );
-        aRet += buf;
+        aStrBuffer.append(buf);
     }
     for( i = 8; i < 16; i++ )
     {
-        aRet += ',';
+        aStrBuffer.append(',');
         sprintf( buf, "0x%2.2x", pImp->szData[ i ] );
-        aRet += buf;
+        aStrBuffer.append(buf);
     }
-    return String( aRet, RTL_TEXTENCODING_ASCII_US );
+    return rtl::OStringToOUString(aStrBuffer.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US);
 }
 
 /*************************************************************************
@@ -372,35 +375,35 @@ String SvGlobalName::GetctorName() const
 *************************************************************************/
 String SvGlobalName::GetHexName() const
 {
-    ByteString aRet;
+    rtl::OStringBuffer aHexBuffer;
 
     sal_Char buf[ 10 ];
     sal_uInt32 Data1;
     memcpy(&Data1, pImp->szData, sizeof(sal_uInt32));
     sprintf( buf, "%8.8" SAL_PRIXUINT32, Data1 );
-    aRet += buf;
-    aRet += '-';
+    aHexBuffer.append(buf);
+    aHexBuffer.append('-');
     sal_uInt16 i ;
     for( i = 4; i < 8; i += 2 )
     {
         sal_uInt16 Data2;
         memcpy(&Data2, pImp->szData+i, sizeof(sal_uInt16));
         sprintf( buf, "%4.4X", Data2 );
-        aRet += buf;
-        aRet += '-';
+        aHexBuffer.append(buf);
+        aHexBuffer.append('-');
     }
     for( i = 8; i < 10; i++ )
     {
         sprintf( buf, "%2.2x", pImp->szData[ i ] );
-        aRet += buf;
+        aHexBuffer.append(buf);
     }
-    aRet += '-';
+    aHexBuffer.append('-');
     for( i = 10; i < 16; i++ )
     {
         sprintf( buf, "%2.2x", pImp->szData[ i ] );
-        aRet += buf;
+        aHexBuffer.append(buf);
     }
-    return String( aRet, RTL_TEXTENCODING_ASCII_US );
+    return rtl::OStringToOUString(aHexBuffer.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US);
 }
 
 /************** SvGlobalNameList ****************************************/
commit b12cf49be528d845742c3209e03a1cb6f9190538
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 15 23:34:45 2011 +0100

    can be const

diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx
index 1163ced..c23d571 100644
--- a/tools/source/ref/globname.cxx
+++ b/tools/source/ref/globname.cxx
@@ -262,8 +262,8 @@ void SvGlobalName::MakeFromMemory( void * pData )
 *************************************************************************/
 sal_Bool SvGlobalName::MakeId( const String & rIdStr )
 {
-    ByteString	aStr( rIdStr, RTL_TEXTENCODING_ASCII_US );
-    sal_Char * pStr = (sal_Char *)aStr.GetBuffer();
+    ByteString aStr( rIdStr, RTL_TEXTENCODING_ASCII_US );
+    const sal_Char * pStr = (sal_Char *)aStr.GetBuffer();
     if( rIdStr.Len() == 36
       && '-' == pStr[ 8 ]  && '-' == pStr[ 13 ]
       && '-' == pStr[ 18 ] && '-' == pStr[ 23 ] )
commit d0490eab48095fb33319c831a14278bc296c7faf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 15 23:32:08 2011 +0100

    ByteString -> rtl::OString

diff --git a/tools/bootstrp/md5.cxx b/tools/bootstrp/md5.cxx
index d3f5243..d055f42 100644
--- a/tools/bootstrp/md5.cxx
+++ b/tools/bootstrp/md5.cxx
@@ -34,7 +34,7 @@
 #include <cstddef>
 #include <stdio.h>
 
-#include <tools/string.hxx>
+#include <rtl/strbuf.hxx>
 
 #ifdef WNT
 #define FILE_OPEN_READ	"rb"
@@ -93,13 +93,14 @@ void normalize_pe_image(sal_uInt8* buffer, size_t nBufferSize)
     }
 }
 
-rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum )
+rtlDigestError calc_md5_checksum(const char *filename, rtl::OString &rChecksum)
 {
     const size_t BUFFER_SIZE  = 0x1000;
     const size_t MINIMAL_SIZE = 512;
 
     sal_uInt8 checksum[RTL_DIGEST_LENGTH_MD5];
-    rtlDigestError	error = rtl_Digest_E_None;
+    rtlDigestError error = rtl_Digest_E_None;
+    rtl::OStringBuffer aChecksumBuf;
 
     FILE *fp = fopen( filename, FILE_OPEN_READ );
 
@@ -136,8 +137,8 @@ rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum )
             for ( std::size_t i = 0; i < sizeof(checksum); i++ )
             {
                 if ( checksum[i] < 16 )
-                    aChecksum.Append( "0" ); 
-                aChecksum += ByteString::CreateFromInt32( checksum[i], 16 );
+                    aChecksumBuf.append('0');
+                aChecksumBuf.append(checksum[i], 16);
             }
         }
 
@@ -146,6 +147,8 @@ rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum )
     else
         error = rtl_Digest_E_Unknown;
 
+    rChecksum = aChecksumBuf.makeStringAndClear();
+
     return error;
 }
 
diff --git a/tools/bootstrp/md5.hxx b/tools/bootstrp/md5.hxx
index 9db4a73..68d175d 100644
--- a/tools/bootstrp/md5.hxx
+++ b/tools/bootstrp/md5.hxx
@@ -27,8 +27,8 @@
  ************************************************************************/
 
 #include <rtl/digest.h>
-class ByteString;
+#include <rtl/string.hxx>
 
-rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum );
+rtlDigestError calc_md5_checksum(const char *filename, rtl::OString &rChecksum);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/bootstrp/so_checksum.cxx b/tools/bootstrp/so_checksum.cxx
index 0b22689..8eb0a76 100644
--- a/tools/bootstrp/so_checksum.cxx
+++ b/tools/bootstrp/so_checksum.cxx
@@ -31,20 +31,20 @@
 
 #include "md5.hxx"
 
-#include <stdio.h>
+#include <rtl/string.hxx>
 
-#include <tools/string.hxx>
+#include <stdio.h>
 
 int main( int argc, char * argv[] )
 {
-    for ( int n = 1; n < argc; n++ )
+    for (int n = 1; n < argc; ++n)
     {
-        ByteString aChecksum;
-        rtlDigestError error = calc_md5_checksum( argv[n], aChecksum );
+        rtl::OString aChecksum;
+        rtlDigestError error = calc_md5_checksum(argv[n], aChecksum);
 
         if ( rtl_Digest_E_None == error )
         {
-            printf( "%s  %s\n", aChecksum.GetBuffer(), argv[n] );
+            printf( "%s  %s\n", aChecksum.getStr(), argv[n] );
         }
         else
             printf( "ERROR: Unable to calculate MD5 checksum for %s\n", argv[n] );
commit 5ce37d98613e11fdd179058e6ac21a6fec47f9f7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 15 23:17:08 2011 +0100

    remove appdef.hxx

diff --git a/tools/StaticLibrary_toolshelpers.mk b/tools/StaticLibrary_toolshelpers.mk
index a63ac47..94ba4f7 100644
--- a/tools/StaticLibrary_toolshelpers.mk
+++ b/tools/StaticLibrary_toolshelpers.mk
@@ -40,7 +40,6 @@ $(eval $(call gb_StaticLibrary_set_cxxflags,toolshelpers,\
 ))
 
 $(eval $(call gb_StaticLibrary_add_exception_objects,toolshelpers,\
-    tools/bootstrp/appdef \
     tools/bootstrp/cppdep \
     tools/bootstrp/prj \
 ))
diff --git a/tools/bootstrp/appdef.cxx b/tools/bootstrp/appdef.cxx
deleted file mode 100644
index 787a358..0000000
--- a/tools/bootstrp/appdef.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_tools.hxx"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "bootstrp/appdef.hxx"
-
-const char* GetEnv( const char *pVar )
-{
-    char const *pRet = getenv( pVar );
-    if ( !pRet )
-        pRet = "";
-    return pRet;
-}
-
-const char* GetEnv( const char *pVar, const char *pDefault )
-{
-    char *pRet = getenv( pVar );
-    if ( !pRet )
-        return pDefault;
-    return pRet;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/inc/bootstrp/appdef.hxx b/tools/inc/bootstrp/appdef.hxx
deleted file mode 100644
index ae6441e..0000000
--- a/tools/inc/bootstrp/appdef.hxx
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _MHAPPDEF_HXX
-#define _MHAPPDEF_HXX
-
-
-#ifdef UNX
-#define PATH_SEPARATOR		'/'
-#define S_PATH_SEPARATOR 	"/"
-#else
-#define PATH_SEPARATOR		'\\'
-#define S_PATH_SEPARATOR	"\\"
-#endif
-
-// path conversion
-
-const char* GetEnv( const char *pVar );
-const char* GetEnv( const char *pVar, const char *pDefault );
-
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit e36ab95bcd8fbd821a8ed27fca70a8a2dcd1927c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 15 22:35:28 2011 +0100

    rscdep not related to mkunroll

diff --git a/tools/Executable_mkunroll.mk b/tools/Executable_mkunroll.mk
index 3aa74bc..6936b70 100644
--- a/tools/Executable_mkunroll.mk
+++ b/tools/Executable_mkunroll.mk
@@ -50,8 +50,4 @@ $(eval $(call gb_Executable_add_exception_objects,mkunroll,\
     tools/bootstrp/mkunroll/mkunroll \
 ))
 
-$(eval $(call gb_Executable_add_linked_static_libs,rscdep,\
-	toolshelpers \
-))
-
 # vim: set noet sw=4 ts=4:


More information about the Libreoffice-commits mailing list