[Libreoffice-commits] core.git: filter/source

Dr. David Alan Gilbert (via logerrit) logerrit at kemper.freedesktop.org
Sat Jan 30 07:14:06 UTC 2021


 filter/source/msfilter/msvbahelper.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8f69a05ad7404590f2e4a1ba8d4d69fe896523ce
Author:     Dr. David Alan Gilbert <dave at treblig.org>
AuthorDate: Sun Jan 24 01:14:39 2021 +0000
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jan 30 08:13:13 2021 +0100

    msfilter: msvbahelper, applyShortCutKeyBinding typo'd variable name
    
    (Spotted by cppcheck)
    There's a warning that MacroName is overwritten without being used,
    and I think it's right; to me it looks like a typo, however I have
    exactly zero understanding of VBA macros.
    
    The function starts with:
    
        OUString MacroName( rMacroName );
        if ( !MacroName.isEmpty() )
        {
            OUString aMacroName = MacroName.trim();
            if( aMacroName.startsWith("!") )
    733         MacroName = aMacroName.copy(1).trim();
            .....
            MacroResolvedInfo aMacroInfo = resolveVBAMacro( pShell, aMacroName );
            if( !aMacroInfo.mbFound )
                throw uno::RuntimeException( "The procedure doesn't exist" );
    745     MacroName = aMacroInfo.msResolvedMacro;
    
    cppcheck is complaining MacroName written at 733 is always overwritten
    at 745 without being used;  I think this is a typo and it should be
    'aMacroName' that's assigned at 733.
    
    Change-Id: Iac568fea4cb6d1a5430bc32a6cf08311edcb1003
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109849
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
index d6e4442c2584..6d29cd972fae 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -730,7 +730,7 @@ void applyShortCutKeyBinding ( const uno::Reference< frame::XModel >& rxModel, c
     {
         OUString aMacroName = MacroName.trim();
         if( aMacroName.startsWith("!") )
-            MacroName = aMacroName.copy(1).trim();
+            aMacroName = aMacroName.copy(1).trim();
         SfxObjectShell* pShell = nullptr;
         if ( rxModel.is() )
         {


More information about the Libreoffice-commits mailing list