[Libreoffice-commits] .: 2 commits - vcl/win

Caolán McNamara caolan at kemper.freedesktop.org
Mon Apr 18 13:32:11 PDT 2011


 vcl/win/source/window/salframe.cxx |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

New commits:
commit 5012a47bfd8923184e917f470bfd62b4fa03ec2d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 18 21:29:37 2011 +0100

    don't drop unused errs, but log them

diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 9de5860..4d42d30 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -4755,7 +4755,7 @@ static WinSalMenuItem* ImplGetSalMenuItem( HMENU hMenu, UINT nPos, sal_Bool bByP
     mi.cbSize = sizeof( mi );
     mi.fMask = MIIM_DATA;
     if( !GetMenuItemInfoW( hMenu, nPos, bByPosition, &mi) )
-       DWORD err = GetLastError();
+        ImplWriteLastError( GetLastError(), "ImplGetSalMenuItem" );
 
     return (WinSalMenuItem *) mi.dwItemData;
 }
@@ -4773,7 +4773,7 @@ static int ImplGetSelectedIndex( HMENU hMenu )
         for(int i=0; i<n; i++ )
         {
             if( !GetMenuItemInfoW( hMenu, i, TRUE, &mi) )
-                DWORD err = GetLastError();
+                ImplWriteLastError( GetLastError(), "ImplGetSelectedIndex" );
             else
             {
                 if( mi.fState & MFS_HILITE )
@@ -4883,7 +4883,6 @@ static int ImplMeasureItem( HWND hWnd, WPARAM wParam, LPARAM lParam )
 static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam )
 {
     int nRet = 0;
-    DWORD err = 0;
     if( !wParam )
     {
         // request was sent by a menu
@@ -4923,7 +4922,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam )
 
         // Fill background
         if(!PatBlt( pDI->hDC, aRect.left, aRect.top, aRect.right-aRect.left, aRect.bottom-aRect.top, PATCOPY ))
-            err = GetLastError();
+            ImplWriteLastError(GetLastError(), "ImplDrawItem");
 
         int lineHeight = aRect.bottom-aRect.top;
 
@@ -5007,7 +5006,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam )
             (LPARAM)(LPWSTR) aStr.GetBuffer(),
             (WPARAM)0, aRect.left, aRect.top + (lineHeight - strSize.cy)/2, 0, 0,
             DST_PREFIXTEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) ) )
-            err = GetLastError();
+            ImplWriteLastError(GetLastError(), "ImplDrawItem");
 
         if( pSalMenuItem->mAccelText.Len() )
         {
@@ -5024,7 +5023,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam )
                 (LPARAM)(LPWSTR) aStr.GetBuffer(),
                 (WPARAM)0, aRect.right-strSizeA.cx-tm.tmMaxCharWidth, aRect.top + (lineHeight - strSizeA.cy)/2, 0, 0,
                 DST_TEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) ) )
-                err = GetLastError();
+                ImplWriteLastError(GetLastError(), "ImplDrawItem");
         }
 
         // Restore the original font and colors.
commit 77ec6c1afd9fb375ccfff242670ad654ee8ebc6d
Author: Kayo Hamid <kayo.hamid at gekkolinux.com.br>
Date:   Mon Apr 18 21:22:54 2011 +0100

    fixes for some cppcheck warnings

diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 609d48e..9de5860 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -4750,14 +4750,12 @@ static int ImplHandleMinMax( HWND hWnd, LPARAM lParam )
 // if bByPosition is FALSE then nPos denotes a menu id instead of a position
 static WinSalMenuItem* ImplGetSalMenuItem( HMENU hMenu, UINT nPos, sal_Bool bByPosition=TRUE )
 {
-    DWORD err=0;
-
     MENUITEMINFOW mi;
     memset(&mi, 0, sizeof(mi));
     mi.cbSize = sizeof( mi );
     mi.fMask = MIIM_DATA;
     if( !GetMenuItemInfoW( hMenu, nPos, bByPosition, &mi) )
-        err = GetLastError();
+       DWORD err = GetLastError();
 
     return (WinSalMenuItem *) mi.dwItemData;
 }
@@ -4765,8 +4763,6 @@ static WinSalMenuItem* ImplGetSalMenuItem( HMENU hMenu, UINT nPos, sal_Bool bByP
 // returns the index of the currently selected item if any or -1
 static int ImplGetSelectedIndex( HMENU hMenu )
 {
-    DWORD err=0;
-
     MENUITEMINFOW mi;
     memset(&mi, 0, sizeof(mi));
     mi.cbSize = sizeof( mi );
@@ -4777,7 +4773,7 @@ static int ImplGetSelectedIndex( HMENU hMenu )
         for(int i=0; i<n; i++ )
         {
             if( !GetMenuItemInfoW( hMenu, i, TRUE, &mi) )
-                err = GetLastError();
+                DWORD err = GetLastError();
             else
             {
                 if( mi.fState & MFS_HILITE )


More information about the Libreoffice-commits mailing list