[Libreoffice-commits] core.git: 2 commits - include/vcl solenv/gbuild svx/source sw/source vcl/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 11 07:09:35 UTC 2020


 include/vcl/imap.hxx                 |    6 +++---
 include/vcl/imapobj.hxx              |   11 +++++++----
 solenv/gbuild/CppunitTest.mk         |    4 ++--
 svx/source/dialog/imapdlg.cxx        |   10 +++++-----
 sw/source/uibase/dochdl/swdtflvr.cxx |    2 +-
 vcl/source/treelist/imap2.cxx        |   26 +++++++++++++-------------
 6 files changed, 31 insertions(+), 28 deletions(-)

New commits:
commit 51f4691e7f4f3bceac1d5ec9cbbf37de7e71e471
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Sep 10 22:28:28 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Sep 11 09:08:57 2020 +0200

    Use { ... } for grouping that does not need a sub-shell
    
    ...in case that makes ever so small a difference, esp. on Windows (where
    spawning processes is known to be expensinve; but note that at least Bash seems
    to not spawn a sub-shell anyway when what is enclosed in ( ... ) is just a
    simple single process, which is commonly the case for these cppunittester
    invocations)
    
    Change-Id: Ie9200270743754e02fbfdb2b17239e9873031dab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102407
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index a2243dad3e31..a287fc513aa3 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -123,7 +123,7 @@ else
 		$(if $(gb_CppunitTest__interactive),, \
 			$(if $(value gb_CppunitTest_postprocess), \
 				rm -fr $@.core && mkdir $@.core && cd $@.core &&)) \
-		( \
+		{ \
 		$(if $(gb_CppunitTest_localized),for l in $(WITH_LANG_LIST) ; do LO_TEST_LOCALE="$$l" ) \
 		$(if $(gb_CppunitTest_PREGDBTRACE),$(gb_CppunitTest_PREGDBTRACE) &&) \
 		$(if $(gb_CppunitTest__vcl_no_svp), \
@@ -141,7 +141,7 @@ else
 		$(if $(gb_CppunitTest_POSTGDBTRACE), \
 			; RET=$$? && $(gb_CppunitTest_POSTGDBTRACE) && (exit $$RET)) \
 		$(if $(gb_CppunitTest_localized),|| exit $$?; done) \
-		) \
+		; } \
 		$(if $(gb_CppunitTest__interactive),, \
 			> $@.log 2>&1 \
 			|| ($(if $(value gb_CppunitTest_postprocess), \
commit b3e4ba69b70a30bbcc32ac59ce90e2eda2bc76de
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Thu Sep 10 21:23:13 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 11 09:08:47 2020 +0200

    convert IMAP_FORMAT to scoped enum
    
    Change-Id: I58090ced672267614ade2e3e81e6264d01b77901
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102405
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/vcl/imap.hxx b/include/vcl/imap.hxx
index 5cf03071b22a..02d8f2ddf96b 100644
--- a/include/vcl/imap.hxx
+++ b/include/vcl/imap.hxx
@@ -58,7 +58,7 @@ private:
     static OUString     ImpReadNCSAURL( const char** ppStr );
     static Point        ImpReadNCSACoords( const char** ppStr );
 
-    static sal_uLong    ImpDetectFormat( SvStream& rIStm );
+    static IMapFormat   ImpDetectFormat( SvStream& rIStm );
 
 public:
 
@@ -113,8 +113,8 @@ public:
     void                Write ( SvStream& rOStm ) const;
     void                Read( SvStream& rIStm );
 
-    void                Write( SvStream& rOStm, sal_uLong nFormat ) const;
-    sal_uLong           Read( SvStream& rIStm, sal_uLong nFormat );
+    void                Write( SvStream& rOStm, IMapFormat nFormat ) const;
+    sal_uLong           Read( SvStream& rIStm, IMapFormat nFormat );
 };
 
 class IMapCompat
diff --git a/include/vcl/imapobj.hxx b/include/vcl/imapobj.hxx
index 902b5f908cdf..982e350547e2 100644
--- a/include/vcl/imapobj.hxx
+++ b/include/vcl/imapobj.hxx
@@ -38,10 +38,13 @@ class SvStream;
 #define IMAP_MIRROR_HORZ    0x00000001L
 #define IMAP_MIRROR_VERT    0x00000002L
 
-#define IMAP_FORMAT_BIN     0x00000001L
-#define IMAP_FORMAT_CERN    0x00000002L
-#define IMAP_FORMAT_NCSA    0x00000004L
-#define IMAP_FORMAT_DETECT  0xffffffffL
+enum class IMapFormat
+{
+    Binary  = 1,
+    CERN    = 2,
+    NCSA    = 3,
+    Detect  = 15,
+};
 
 #define IMAP_ERR_OK         0x00000000L
 #define IMAP_ERR_FORMAT     0x00000001L
diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx
index 8c01116825bd..0a16d670002c 100644
--- a/svx/source/dialog/imapdlg.cxx
+++ b/svx/source/dialog/imapdlg.cxx
@@ -383,7 +383,7 @@ void SvxIMapDlg::DoOpen()
 
     if( pIStm )
     {
-        aLoadIMap.Read( *pIStm, IMAP_FORMAT_DETECT );
+        aLoadIMap.Read( *pIStm, IMapFormat::Detect );
 
         if( pIStm->GetError() )
         {
@@ -421,21 +421,21 @@ bool SvxIMapDlg::DoSave()
     {
         const OUString    aFilter( aDlg.GetCurrentFilter() );
         OUString          aExt;
-        sal_uLong         nFormat;
+        IMapFormat        nFormat;
 
         if ( aFilter == aBinFilter )
         {
-            nFormat = IMAP_FORMAT_BIN;
+            nFormat = IMapFormat::Binary;
             aExt = "sip";
         }
         else if ( aFilter == aCERNFilter )
         {
-            nFormat = IMAP_FORMAT_CERN;
+            nFormat = IMapFormat::CERN;
             aExt = "map";
         }
         else if ( aFilter == aNCSAFilter )
         {
-            nFormat = IMAP_FORMAT_NCSA;
+            nFormat = IMapFormat::NCSA;
             aExt = "map";
         }
         else
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 264f34c6d660..52c6b47d469f 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -2884,7 +2884,7 @@ bool SwTransferable::PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
         if( pStream != nullptr  &&
             !pStream->GetError()  &&
             // mba: no BaseURL for clipboard functionality
-            aMap.Read( *pStream, IMAP_FORMAT_DETECT ) == IMAP_ERR_OK &&
+            aMap.Read( *pStream, IMapFormat::Detect ) == IMAP_ERR_OK &&
             aMap.GetIMapObjectCount() )
         {
             SfxItemSet aSet( rSh.GetAttrPool(), svl::Items<RES_URL, RES_URL>{} );
diff --git a/vcl/source/treelist/imap2.cxx b/vcl/source/treelist/imap2.cxx
index 382a76c04822..5f8e8bb22531 100644
--- a/vcl/source/treelist/imap2.cxx
+++ b/vcl/source/treelist/imap2.cxx
@@ -139,13 +139,13 @@ void IMapPolygonObject::WriteNCSA( SvStream& rOStm  ) const
     rOStm.WriteLine(aStrBuf.makeStringAndClear());
 }
 
-void ImageMap::Write( SvStream& rOStm, sal_uLong nFormat ) const
+void ImageMap::Write( SvStream& rOStm, IMapFormat nFormat ) const
 {
     switch( nFormat )
     {
-        case IMAP_FORMAT_BIN : Write( rOStm ); break;
-        case IMAP_FORMAT_CERN : ImpWriteCERN( rOStm ); break;
-        case IMAP_FORMAT_NCSA : ImpWriteNCSA( rOStm ); break;
+        case IMapFormat::Binary : Write( rOStm ); break;
+        case IMapFormat::CERN : ImpWriteCERN( rOStm ); break;
+        case IMapFormat::NCSA : ImpWriteNCSA( rOStm ); break;
 
         default:
         break;
@@ -208,18 +208,18 @@ void ImageMap::ImpWriteNCSA( SvStream& rOStm  ) const
     }
 }
 
-sal_uLong ImageMap::Read( SvStream& rIStm, sal_uLong nFormat  )
+sal_uLong ImageMap::Read( SvStream& rIStm, IMapFormat nFormat  )
 {
     sal_uLong nRet = IMAP_ERR_FORMAT;
 
-    if ( nFormat == IMAP_FORMAT_DETECT )
+    if ( nFormat == IMapFormat::Detect )
         nFormat = ImpDetectFormat( rIStm );
 
     switch ( nFormat )
     {
-        case IMAP_FORMAT_BIN    : Read( rIStm ); break;
-        case IMAP_FORMAT_CERN   : ImpReadCERN( rIStm ); break;
-        case IMAP_FORMAT_NCSA   : ImpReadNCSA( rIStm ); break;
+        case IMapFormat::Binary : Read( rIStm ); break;
+        case IMapFormat::CERN   : ImpReadCERN( rIStm ); break;
+        case IMapFormat::NCSA   : ImpReadNCSA( rIStm ); break;
 
         default:
         break;
@@ -486,10 +486,10 @@ Point ImageMap::ImpReadNCSACoords( const char** ppStr )
     return aPt;
 }
 
-sal_uLong ImageMap::ImpDetectFormat( SvStream& rIStm )
+IMapFormat ImageMap::ImpDetectFormat( SvStream& rIStm )
 {
     sal_uInt64  nPos = rIStm.Tell();
-    sal_uLong   nRet = IMAP_FORMAT_BIN;
+    IMapFormat  nRet = IMapFormat::Binary;
     char    cMagic[6];
 
     rIStm.ReadBytes(cMagic, sizeof(cMagic));
@@ -513,10 +513,10 @@ sal_uLong ImageMap::ImpDetectFormat( SvStream& rIStm )
                 if ( ( aStr.indexOf('(') != -1 ) &&
                      ( aStr.indexOf(')') != -1 ) )
                 {
-                    nRet = IMAP_FORMAT_CERN;
+                    nRet = IMapFormat::CERN;
                 }
                 else
-                    nRet = IMAP_FORMAT_NCSA;
+                    nRet = IMapFormat::NCSA;
 
                 break;
             }


More information about the Libreoffice-commits mailing list