diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:13:01 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:13:01 +0100 |
commit | 8456c2ba408b3bed160d3e5f050738301b225bd5 (patch) | |
tree | f5b4ba22b4c1e1ccfef3c5430b627ffd0bfc9ec7 /include | |
parent | 8af176d7776938249f6e59dee3ed4f5c05edbebc (diff) |
More loplugin:cstylecast: tools
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files
Change-Id: Ifb9ebc9623c8df14ea0d4c907001bd16c5b9ae59
Diffstat (limited to 'include')
-rw-r--r-- | include/tools/b3dtrans.hxx | 2 | ||||
-rw-r--r-- | include/tools/bigint.hxx | 6 | ||||
-rw-r--r-- | include/tools/color.hxx | 6 | ||||
-rw-r--r-- | include/tools/colordata.hxx | 14 | ||||
-rw-r--r-- | include/tools/gen.hxx | 2 | ||||
-rw-r--r-- | include/tools/solar.h | 24 | ||||
-rw-r--r-- | include/tools/vcompat.hxx | 8 |
7 files changed, 31 insertions, 31 deletions
diff --git a/include/tools/b3dtrans.hxx b/include/tools/b3dtrans.hxx index 97b353f0c941..8dcd57e6da26 100644 --- a/include/tools/b3dtrans.hxx +++ b/include/tools/b3dtrans.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_TOOLS_B3DTRANS_HXX #define INCLUDED_TOOLS_B3DTRANS_HXX -#define ZBUFFER_DEPTH_RANGE ((double)(256L * 256L * 256L)) +#define ZBUFFER_DEPTH_RANGE (double(256L * 256L * 256L)) #include <basegfx/matrix/b3dhommatrix.hxx> #include <basegfx/range/b3drange.hxx> diff --git a/include/tools/bigint.hxx b/include/tools/bigint.hxx index 928ee7b77746..90fe56c8abce 100644 --- a/include/tools/bigint.hxx +++ b/include/tools/bigint.hxx @@ -132,7 +132,7 @@ public: inline BigInt::operator sal_Int16() const { if ( !bIsBig && nVal >= SAL_MIN_INT16 && nVal <= SAL_MAX_INT16 ) - return (sal_Int16)nVal; + return static_cast<sal_Int16>(nVal); assert(false && "out of range"); return 0; } @@ -140,7 +140,7 @@ inline BigInt::operator sal_Int16() const inline BigInt::operator sal_uInt16() const { if ( !bIsBig && nVal >= 0 && nVal <= SAL_MAX_UINT16 ) - return (sal_uInt16)nVal; + return static_cast<sal_uInt16>(nVal); assert(false && "out of range"); return 0; } @@ -156,7 +156,7 @@ inline BigInt::operator sal_Int32() const inline BigInt::operator sal_uInt32() const { if ( !bIsBig && nVal >= 0 ) - return (sal_uInt32)nVal; + return static_cast<sal_uInt32>(nVal); assert(false && "out of range"); return 0; } diff --git a/include/tools/color.hxx b/include/tools/color.hxx index 1d0d239d5af5..5e1b603aa461 100644 --- a/include/tools/color.hxx +++ b/include/tools/color.hxx @@ -157,13 +157,13 @@ public: inline void Color::SetRed( sal_uInt8 nRed ) { mnColor &= 0xFF00FFFF; - mnColor |= ((sal_uInt32)nRed)<<16; + mnColor |= static_cast<sal_uInt32>(nRed)<<16; } inline void Color::SetGreen( sal_uInt8 nGreen ) { mnColor &= 0xFFFF00FF; - mnColor |= ((sal_uInt16)nGreen)<<8; + mnColor |= static_cast<sal_uInt16>(nGreen)<<8; } inline void Color::SetBlue( sal_uInt8 nBlue ) @@ -175,7 +175,7 @@ inline void Color::SetBlue( sal_uInt8 nBlue ) inline void Color::SetTransparency( sal_uInt8 nTransparency ) { mnColor &= 0x00FFFFFF; - mnColor |= ((sal_uInt32)nTransparency)<<24; + mnColor |= static_cast<sal_uInt32>(nTransparency)<<24; } inline bool Color::IsRGBEqual( const Color& rColor ) const diff --git a/include/tools/colordata.hxx b/include/tools/colordata.hxx index 6008d0c0fc24..b77dea1af881 100644 --- a/include/tools/colordata.hxx +++ b/include/tools/colordata.hxx @@ -35,11 +35,11 @@ constexpr ColorData RGB_COLORDATA(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b) { return sal_uInt32(b) | (sal_uInt32(g) << 8) | (sal_uInt32(r) << 16); } -#define COLORDATA_RED( n ) ((sal_uInt8)((n)>>16)) -#define COLORDATA_GREEN( n ) ((sal_uInt8)(((sal_uInt16)(n)) >> 8)) -#define COLORDATA_BLUE( n ) ((sal_uInt8)(n)) -#define COLORDATA_TRANSPARENCY( n ) ((sal_uInt8)((n)>>24)) -#define COLORDATA_RGB( n ) ((ColorData)((n) & 0x00FFFFFF)) +#define COLORDATA_RED( n ) (static_cast<sal_uInt8>((n)>>16)) +#define COLORDATA_GREEN( n ) (static_cast<sal_uInt8>((static_cast<sal_uInt16>(n)) >> 8)) +#define COLORDATA_BLUE( n ) (static_cast<sal_uInt8>(n)) +#define COLORDATA_TRANSPARENCY( n ) (static_cast<sal_uInt8>((n)>>24)) +#define COLORDATA_RGB( n ) (static_cast<ColorData>((n) & 0x00FFFFFF)) #define COL_BLACK RGB_COLORDATA( 0x00, 0x00, 0x00 ) #define COL_BLUE RGB_COLORDATA( 0x00, 0x00, 0x80 ) @@ -63,7 +63,7 @@ constexpr ColorData RGB_COLORDATA(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b) { #define COL_YELLOW_HIGHLIGHT RGB_COLORDATA( 0xFF, 0xF2, 0x00 ) #define COL_WHITE RGB_COLORDATA( 0xFF, 0xFF, 0xFF ) #define COL_TRANSPARENT TRGB_COLORDATA( 0xFF, 0xFF, 0xFF, 0xFF ) -#define COL_AUTO (ColorData)0xFFFFFFFF +#define COL_AUTO ColorData(0xFFFFFFFF) #define COL_AUTHOR1_DARK RGB_COLORDATA(198, 146, 0) #define COL_AUTHOR1_NORMAL RGB_COLORDATA(255, 255, 158) #define COL_AUTHOR1_LIGHT RGB_COLORDATA(255, 255, 195) @@ -94,7 +94,7 @@ constexpr ColorData RGB_COLORDATA(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b) { constexpr sal_uInt8 ColorChannelMerge(sal_uInt8 nDst, sal_uInt8 nSrc, sal_uInt8 nSrcTrans) { - return (sal_uInt8) ((((sal_Int32)nDst-nSrc)*nSrcTrans+((nSrc<<8)|nDst))>>8); + return static_cast<sal_uInt8>(((static_cast<sal_Int32>(nDst)-nSrc)*nSrcTrans+((nSrc<<8)|nDst))>>8); }; #endif diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index 2db20125d499..1f72a32078bb 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -327,7 +327,7 @@ inline std::basic_ostream<charT, traits> & operator <<( } // Rectangle -#define RECT_EMPTY ((short)-32767) +#define RECT_EMPTY (short(-32767)) #define RECT_MAX LONG_MAX #define RECT_MIN LONG_MIN diff --git a/include/tools/solar.h b/include/tools/solar.h index a1b10d6e9f01..9ee55c4ad5de 100644 --- a/include/tools/solar.h +++ b/include/tools/solar.h @@ -47,13 +47,13 @@ typedef sal_uInt8 SVBT64[8]; #ifdef __cplusplus inline sal_uInt16 SVBT16ToShort( const SVBT16 p ) { return static_cast<sal_uInt16> - ((sal_uInt16)p[0] - + ((sal_uInt16)p[1] << 8)); } + (static_cast<sal_uInt16>(p[0]) + + (static_cast<sal_uInt16>(p[1]) << 8)); } inline sal_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return static_cast<sal_uInt32> - ((sal_uInt32)p[0] - + ((sal_uInt32)p[1] << 8) - + ((sal_uInt32)p[2] << 16) - + ((sal_uInt32)p[3] << 24)); } + (static_cast<sal_uInt32>(p[0]) + + (static_cast<sal_uInt32>(p[1]) << 8) + + (static_cast<sal_uInt32>(p[2]) << 16) + + (static_cast<sal_uInt32>(p[3]) << 24)); } #if defined OSL_LITENDIAN inline double SVBT64ToDouble( const SVBT64 p ) { double n; reinterpret_cast<sal_uInt8*>(&n)[0] = p[0]; @@ -78,12 +78,12 @@ inline double SVBT64ToDouble( const SVBT64 p ) { double n; return n; } #endif -inline void ShortToSVBT16( sal_uInt16 n, SVBT16 p ) { p[0] = (sal_uInt8) n; - p[1] = (sal_uInt8)(n >> 8); } -inline void UInt32ToSVBT32 ( sal_uInt32 n, SVBT32 p ) { p[0] = (sal_uInt8) n; - p[1] = (sal_uInt8)(n >> 8); - p[2] = (sal_uInt8)(n >> 16); - p[3] = (sal_uInt8)(n >> 24); } +inline void ShortToSVBT16( sal_uInt16 n, SVBT16 p ) { p[0] = static_cast<sal_uInt8>(n); + p[1] = static_cast<sal_uInt8>(n >> 8); } +inline void UInt32ToSVBT32 ( sal_uInt32 n, SVBT32 p ) { p[0] = static_cast<sal_uInt8>(n); + p[1] = static_cast<sal_uInt8>(n >> 8); + p[2] = static_cast<sal_uInt8>(n >> 16); + p[3] = static_cast<sal_uInt8>(n >> 24); } #if defined OSL_LITENDIAN inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = reinterpret_cast<sal_uInt8*>(&n)[0]; p[1] = reinterpret_cast<sal_uInt8*>(&n)[1]; diff --git a/include/tools/vcompat.hxx b/include/tools/vcompat.hxx index 0adf6913ea86..85e3b1d44240 100644 --- a/include/tools/vcompat.hxx +++ b/include/tools/vcompat.hxx @@ -24,10 +24,10 @@ inline sal_uInt32 COMPAT_FORMAT( char char1, char char2, char char3, char char4 ) { return - ((sal_uInt32)char1) | - (((sal_uInt32)char2) << 8) | - (((sal_uInt32)char3) << 16) | - (((sal_uInt32)char4) << 24); + static_cast<sal_uInt32>(char1) | + (static_cast<sal_uInt32>(char2) << 8) | + (static_cast<sal_uInt32>(char3) << 16) | + (static_cast<sal_uInt32>(char4) << 24); }; class SvStream; |