[Libreoffice-commits] core.git: vcl/win

Takeshi Abe tabe at fixedpoint.jp
Tue Nov 17 06:16:09 PST 2015


 vcl/win/source/gdi/gdiimpl.cxx     |   21 +++++++--------------
 vcl/win/source/window/salframe.cxx |    4 ++--
 2 files changed, 9 insertions(+), 16 deletions(-)

New commits:
commit 703f3f452b470687bdc3041abe4f3d75230ac8c1
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Tue Oct 20 15:42:33 2015 +0900

    vcl: These can be static assertions
    
    Change-Id: I220ae4732f221c7798f162653cad01717afb659f
    Reviewed-on: https://gerrit.libreoffice.org/20011
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/vcl/win/source/gdi/gdiimpl.cxx b/vcl/win/source/gdi/gdiimpl.cxx
index ad5f22e..c888c2a 100644
--- a/vcl/win/source/gdi/gdiimpl.cxx
+++ b/vcl/win/source/gdi/gdiimpl.cxx
@@ -981,8 +981,7 @@ void WinSalGraphicsImpl::invert( sal_uInt32 nPoints, const SalPoint* pPtAry, Sal
 
     POINT* pWinPtAry;
     // for NT, we can handover the array directly
-    DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
-                "WinSalGraphicsImpl::DrawPolyLine(): POINT != SalPoint" );
+    static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same size" );
 
     pWinPtAry = (POINT*)pPtAry;
     // for Windows 95 and its maximum number of points
@@ -1648,8 +1647,7 @@ void WinSalGraphicsImpl::drawRect( long nX, long nY, long nWidth, long nHeight )
 void WinSalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry )
 {
     // for NT, we can handover the array directly
-    DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
-                "WinSalGraphicsImpl::DrawPolyLine(): POINT != SalPoint" );
+    static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same size" );
 
     POINT* pWinPtAry = (POINT*)pPtAry;
 
@@ -1695,8 +1693,7 @@ void WinSalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAr
 void WinSalGraphicsImpl::drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry )
 {
     // for NT, we can handover the array directly
-    DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
-                "WinSalGraphicsImpl::DrawPolygon(): POINT != SalPoint" );
+    static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same size" );
 
     POINT* pWinPtAry = (POINT*)pPtAry;
     // for Windows 95 and its maximum number of points
@@ -1732,8 +1729,7 @@ void WinSalGraphicsImpl::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pP
     else
         pWinPointAryAry = new POINT[nPolyPolyPoints];
     // for NT, we can handover the array directly
-   DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
-                "WinSalGraphicsImpl::DrawPolyPolygon(): POINT != SalPoint" );
+    static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same size" );
     UINT            n = 0;
     for ( i = 0; i < (UINT)nPoly; i++ )
     {
@@ -1774,8 +1770,7 @@ bool WinSalGraphicsImpl::drawPolyLineBezier( sal_uInt32 nPoints, const SalPoint*
 {
 #ifdef USE_GDI_BEZIERS
     // for NT, we can handover the array directly
-    DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
-                "WinSalGraphicsImpl::DrawPolyLineBezier(): POINT != SalPoint" );
+    static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same size" );
 
     ImplRenderPath( mrParent.getHDC(), nPoints, pPtAry, pFlgAry );
 
@@ -1789,8 +1784,7 @@ bool WinSalGraphicsImpl::drawPolygonBezier( sal_uInt32 nPoints, const SalPoint*
 {
 #ifdef USE_GDI_BEZIERS
     // for NT, we can handover the array directly
-    DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
-                "WinSalGraphicsImpl::DrawPolygonBezier(): POINT != SalPoint" );
+    static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same size" );
 
     POINT   aStackAry1[SAL_POLY_STACKBUF];
     BYTE    aStackAry2[SAL_POLY_STACKBUF];
@@ -1840,8 +1834,7 @@ bool WinSalGraphicsImpl::drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt
 {
 #ifdef USE_GDI_BEZIERS
     // for NT, we can handover the array directly
-    DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
-                "WinSalGraphicsImpl::DrawPolyPolygonBezier(): POINT != SalPoint" );
+    static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same size" );
 
     sal_uLong nCurrPoly, nTotalPoints;
     const sal_uInt32* pCurrPoints = pPoints;
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 705335f..697efae 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -1066,7 +1066,7 @@ bool WinSalFrame::PostEvent(ImplSVEvent* pData)
 
 void WinSalFrame::SetTitle( const OUString& rTitle )
 {
-    DBG_ASSERT( sizeof( WCHAR ) == sizeof( sal_Unicode ), "WinSalFrame::SetTitle(): WCHAR != sal_Unicode" );
+    static_assert( sizeof( WCHAR ) == sizeof( sal_Unicode ), "must be the same size" );
 
     SetWindowTextW( mhWnd, reinterpret_cast<LPCWSTR>(rTitle.getStr()) );
 }
@@ -2297,7 +2297,7 @@ static void ImplGetKeyNameText( LONG lParam, sal_Unicode* pBuf,
                                 UINT& rCount, UINT nMaxSize,
                                 const sal_Char* pReplace )
 {
-    DBG_ASSERT( sizeof( WCHAR ) == sizeof( sal_Unicode ), "WinSalFrame::ImplGetKeyNameTextW(): WCHAR != sal_Unicode" );
+    static_assert( sizeof( WCHAR ) == sizeof( sal_Unicode ), "must be the same size" );
 
     static const int nMaxKeyLen = 350;
     WCHAR aKeyBuf[ nMaxKeyLen ];


More information about the Libreoffice-commits mailing list