diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-01-19 15:10:10 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-01-20 09:06:54 +0100 |
commit | fe9d002ef55e30aa3629f4e1951beb18ebb692b0 (patch) | |
tree | 1c72b3d97c34801d23ab1d9509aa56081e4d401f /vcl | |
parent | f6cfe99d22041061b8042cdab05e57180c0ab70a (diff) |
Some more loplugin:cstylecast: vcl
Change-Id: I74d35630b9fcdaa97af0b1f1e6d1e5c72488964d
Diffstat (limited to 'vcl')
91 files changed, 410 insertions, 407 deletions
diff --git a/vcl/generic/fontmanager/fontconfig.cxx b/vcl/generic/fontmanager/fontconfig.cxx index 839a722aeda3..edc6035bf0af 100644 --- a/vcl/generic/fontmanager/fontconfig.cxx +++ b/vcl/generic/fontmanager/fontconfig.cxx @@ -137,7 +137,7 @@ namespace bool nHaveB = FcPatternGetString(b, FC_FAMILY, 0, &pNameB) == FcResultMatch; if (nHaveA && nHaveB) - return strcmp((const char*)pNameA, (const char*)pNameB); + return strcmp(reinterpret_cast<const char*>(pNameA), reinterpret_cast<const char*>(pNameB)); return int(nHaveA) - int(nHaveB); } @@ -275,7 +275,7 @@ namespace bool found_fallback_englishname = false; for( std::vector<lang_and_element>::const_iterator aIter = elements.begin(); aIter != aEnd; ++aIter ) { - const char *pLang = (const char*)aIter->first; + const char *pLang = reinterpret_cast<const char*>(aIter->first); if( rtl_str_compare( pLang, sFullMatch.getStr() ) == 0) { // both language and country match @@ -319,12 +319,12 @@ void FontCfgWrapper::cacheLocalizedFontNames(const FcChar8 *origfontname, const std::vector<lang_and_element>::const_iterator aEnd = lang_and_elements.end(); for (std::vector<lang_and_element>::const_iterator aIter = lang_and_elements.begin(); aIter != aEnd; ++aIter) { - const char *candidate = (const char*)(aIter->second); - if (rtl_str_compare(candidate, (const char*)bestfontname) != 0) - m_aFontNameToLocalized[OString(candidate)] = OString((const char*)bestfontname); + const char *candidate = reinterpret_cast<const char*>(aIter->second); + if (rtl_str_compare(candidate, reinterpret_cast<const char*>(bestfontname)) != 0) + m_aFontNameToLocalized[OString(candidate)] = OString(reinterpret_cast<const char*>(bestfontname)); } - if (rtl_str_compare((const char*)origfontname, (const char*)bestfontname) != 0) - m_aLocalizedToCanonical[OString((const char*)bestfontname)] = OString((const char*)origfontname); + if (rtl_str_compare(reinterpret_cast<const char*>(origfontname), reinterpret_cast<const char*>(bestfontname)) != 0) + m_aLocalizedToCanonical[OString(reinterpret_cast<const char*>(bestfontname))] = OString(reinterpret_cast<const char*>(origfontname)); } FcResult FontCfgWrapper::LocalizedElementFromPattern(FcPattern* pPattern, FcChar8 **element, @@ -544,7 +544,7 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int, OS // see if this font is already cached // update attributes std::list< PrintFont* > aFonts; - OString aDir, aBase, aOrgPath( (sal_Char*)file ); + OString aDir, aBase, aOrgPath( reinterpret_cast<char*>(file) ); splitPath( aOrgPath, aDir, aBase ); o_rVisitedPaths[aDir] = 1; @@ -559,7 +559,7 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int, OS // not described by fontconfig (e.g. alias names, PSName) if (eFormatRes != FcResultMatch) format = NULL; - analyzeFontFile( nDirID, aBase, aFonts, (const char*)format ); + analyzeFontFile( nDirID, aBase, aFonts, reinterpret_cast<char*>(format) ); #if OSL_DEBUG_LEVEL > 1 if( aFonts.empty() ) fprintf( stderr, "Warning: file \"%s\" is unusable to psprint\n", aOrgPath.getStr() ); @@ -577,7 +577,7 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int, OS continue; } - int nFamilyName = m_pAtoms->getAtom( ATOM_FAMILYNAME, OStringToOUString( OString( (sal_Char*)family ), RTL_TEXTENCODING_UTF8 ), true ); + int nFamilyName = m_pAtoms->getAtom( ATOM_FAMILYNAME, OStringToOUString( OString( reinterpret_cast<char*>(family) ), RTL_TEXTENCODING_UTF8 ), true ); PrintFont* pUpdate = aFonts.front(); std::list<PrintFont*>::const_iterator second_font = aFonts.begin(); ++second_font; @@ -630,7 +630,7 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int, OS pUpdate->m_eItalic = convertSlant(slant); if( eStyleRes == FcResultMatch ) { - pUpdate->m_aStyleName = OStringToOUString( OString( (sal_Char*)style ), RTL_TEXTENCODING_UTF8 ); + pUpdate->m_aStyleName = OStringToOUString( OString( reinterpret_cast<char*>(style) ), RTL_TEXTENCODING_UTF8 ); } // update font cache @@ -677,7 +677,7 @@ bool PrintFontManager::addFontconfigDir( const OString& rDirName ) if( nVersion <= 20400 ) return false; const char* pDirName = (const char*)rDirName.getStr(); - bool bDirOk = (FcConfigAppFontAddDir(FcConfigGetCurrent(), (FcChar8*)pDirName ) == FcTrue); + bool bDirOk = (FcConfigAppFontAddDir(FcConfigGetCurrent(), reinterpret_cast<FcChar8 const *>(pDirName) ) == FcTrue); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "FcConfigAppFontAddDir( \"%s\") => %d\n", pDirName, bDirOk ); @@ -693,7 +693,7 @@ bool PrintFontManager::addFontconfigDir( const OString& rDirName ) { fclose( pCfgFile); bool bCfgOk = FcConfigParseAndLoad(FcConfigGetCurrent(), - (FcChar8*)aConfFileName.getStr(), FcTrue); + reinterpret_cast<FcChar8 const *>(aConfFileName.getStr()), FcTrue); if( !bCfgOk ) fprintf( stderr, "FcConfigParseAndLoad( \"%s\") => %d\n", aConfFileName.getStr(), bCfgOk ); } @@ -771,7 +771,7 @@ static void addtopattern(FcPattern *pPattern, } FcPatternAddInteger(pPattern, FC_SPACING, nSpacing); if (nSpacing == FC_MONO) - FcPatternAddString(pPattern, FC_FAMILY, (FcChar8*)"monospace"); + FcPatternAddString(pPattern, FC_FAMILY, reinterpret_cast<FcChar8 const *>("monospace")); } } @@ -786,13 +786,13 @@ namespace OString sLangAttrib; sLangAttrib = OUStringToOString(rLangTag.getBcp47(), RTL_TEXTENCODING_UTF8).toAsciiLowerCase(); - if (FcStrSetMember(xLangSet.get(), (const FcChar8*)sLangAttrib.getStr())) + if (FcStrSetMember(xLangSet.get(), reinterpret_cast<const FcChar8*>(sLangAttrib.getStr()))) { return sLangAttrib; } sLangAttrib = OUStringToOString(rLangTag.getLanguageAndScript(), RTL_TEXTENCODING_UTF8).toAsciiLowerCase(); - if (FcStrSetMember(xLangSet.get(), (const FcChar8*)sLangAttrib.getStr())) + if (FcStrSetMember(xLangSet.get(), reinterpret_cast<const FcChar8*>(sLangAttrib.getStr()))) { return sLangAttrib; } @@ -803,13 +803,13 @@ namespace if (!sRegion.isEmpty()) { sLangAttrib = sLang + OString('-') + sRegion; - if (FcStrSetMember(xLangSet.get(), (const FcChar8*)sLangAttrib.getStr())) + if (FcStrSetMember(xLangSet.get(), reinterpret_cast<const FcChar8*>(sLangAttrib.getStr()))) { return sLangAttrib; } } - if (FcStrSetMember(xLangSet.get(), (const FcChar8*)sLang.getStr())) + if (FcStrSetMember(xLangSet.get(), reinterpret_cast<const FcChar8*>(sLang.getStr()))) { return sLang; } @@ -961,7 +961,7 @@ bool PrintFontManager::Substitute( FontSelectPattern &rPattern, OUString& rMissi FcPatternAddBool(pPattern, FC_SCALABLE, FcTrue); const OString aTargetName = OUStringToOString( rPattern.maTargetName, RTL_TEXTENCODING_UTF8 ); - const FcChar8* pTargetNameUtf8 = (FcChar8*)aTargetName.getStr(); + const FcChar8* pTargetNameUtf8 = reinterpret_cast<FcChar8 const *>(aTargetName.getStr()); FcPatternAddString(pPattern, FC_FAMILY, pTargetNameUtf8); LanguageTag aLangTag(rPattern.meLanguage); @@ -992,7 +992,7 @@ bool PrintFontManager::Substitute( FontSelectPattern &rPattern, OUString& rMissi } if (!aLangAttrib.isEmpty()) - FcPatternAddString(pPattern, FC_LANG, (FcChar8*)aLangAttrib.getStr()); + FcPatternAddString(pPattern, FC_LANG, reinterpret_cast<FcChar8 const *>(aLangAttrib.getStr())); addtopattern(pPattern, rPattern.GetSlant(), rPattern.GetWeight(), rPattern.GetWidthType(), rPattern.GetPitch()); @@ -1029,7 +1029,7 @@ bool PrintFontManager::Substitute( FontSelectPattern &rPattern, OUString& rMissi nCollectionEntry = 0; if( eFileRes == FcResultMatch ) { - OString aDir, aBase, aOrgPath( (sal_Char*)file ); + OString aDir, aBase, aOrgPath( reinterpret_cast<char*>(file) ); splitPath( aOrgPath, aDir, aBase ); int nDirID = getDirectoryAtom( aDir, true ); fontID aFont = findFontFileID( nDirID, aBase, nCollectionEntry ); @@ -1051,7 +1051,7 @@ bool PrintFontManager::Substitute( FontSelectPattern &rPattern, OUString& rMissi // get the family name if( eFamilyRes == FcResultMatch ) { - OString sFamily((sal_Char*)family); + OString sFamily(reinterpret_cast<char*>(family)); std::unordered_map< OString, OString, OStringHash >::const_iterator aI = rWrapper.m_aFontNameToLocalized.find(sFamily); if (aI != rWrapper.m_aFontNameToLocalized.end()) @@ -1185,7 +1185,7 @@ ImplFontOptions* PrintFontManager::getFontOptions( if (aI != rWrapper.m_aLocalizedToCanonical.end()) sFamily = aI->second; if( !sFamily.isEmpty() ) - FcPatternAddString(pPattern, FC_FAMILY, (FcChar8*)sFamily.getStr()); + FcPatternAddString(pPattern, FC_FAMILY, reinterpret_cast<FcChar8 const *>(sFamily.getStr())); addtopattern(pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch); FcPatternAddDouble(pPattern, FC_PIXEL_SIZE, nSize); @@ -1253,11 +1253,11 @@ bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star const LanguageTag aLangTag(rLocale); const OString aLangAttrib = mapToFontConfigLangTag(aLangTag); if (!aLangAttrib.isEmpty()) - FcPatternAddString(pPattern, FC_LANG, (FcChar8*)aLangAttrib.getStr()); + FcPatternAddString(pPattern, FC_LANG, reinterpret_cast<FcChar8 const *>(aLangAttrib.getStr())); OString aFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 ); if( !aFamily.isEmpty() ) - FcPatternAddString(pPattern, FC_FAMILY, (FcChar8*)aFamily.getStr()); + FcPatternAddString(pPattern, FC_FAMILY, reinterpret_cast<FcChar8 const *>(aFamily.getStr())); addtopattern(pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch); @@ -1282,7 +1282,7 @@ bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star nCollectionEntry = 0; if( eFileRes == FcResultMatch ) { - OString aDir, aBase, aOrgPath( (sal_Char*)file ); + OString aDir, aBase, aOrgPath( reinterpret_cast<char*>(file) ); splitPath( aOrgPath, aDir, aBase ); int nDirID = getDirectoryAtom( aDir, true ); fontID aFont = findFontFileID( nDirID, aBase, nCollectionEntry ); diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx index 142179fa1068..736513a46248 100644 --- a/vcl/generic/fontmanager/fontmanager.cxx +++ b/vcl/generic/fontmanager/fontmanager.cxx @@ -1019,7 +1019,7 @@ OUString PrintFontManager::convertTrueTypeName( void* pRecord ) const } else if( pNameRecord->platformID == 1 ) { - OString aName((const sal_Char*)(pNameRecord->sptr), pNameRecord->slen); + OString aName(reinterpret_cast<char*>(pNameRecord->sptr), pNameRecord->slen); rtl_TextEncoding eEncoding = RTL_TEXTENCODING_DONTKNOW; switch (pNameRecord->encodingID) { diff --git a/vcl/generic/fontmanager/helper.cxx b/vcl/generic/fontmanager/helper.cxx index aadfa0f29beb..ecd4cca6cfdc 100644 --- a/vcl/generic/fontmanager/helper.cxx +++ b/vcl/generic/fontmanager/helper.cxx @@ -264,8 +264,8 @@ bool psp::convertPfbToPfa( ::osl::File& rInFile, ::osl::File& rOutFile ) { // this might be a pfa font already if( ! rInFile.read( buffer+6, 9, nRead ) && nRead == 9 && - ( ! std::strncmp( (char*)buffer, "%!FontType1-", 12 ) || - ! std::strncmp( (char*)buffer, "%!PS-AdobeFont-", 15 ) ) ) + ( ! std::strncmp( reinterpret_cast<char*>(buffer), "%!FontType1-", 12 ) || + ! std::strncmp( reinterpret_cast<char*>(buffer), "%!PS-AdobeFont-", 15 ) ) ) { sal_uInt64 nWrite = 0; if( rOutFile.write( buffer, 15, nWrite ) || nWrite != 15 ) diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx index bdbc0b64146a..635abb30a671 100644 --- a/vcl/generic/glyphs/gcach_ftyp.cxx +++ b/vcl/generic/glyphs/gcach_ftyp.cxx @@ -169,7 +169,7 @@ bool FtFontFile::Map() return false; } mnFileSize = aStat.st_size; - mpFileMap = (const unsigned char*) + mpFileMap = (unsigned char*) mmap( NULL, mnFileSize, PROT_READ, MAP_SHARED, nFile, 0 ); if( mpFileMap == MAP_FAILED ) mpFileMap = NULL; @@ -184,7 +184,7 @@ void FtFontFile::Unmap() if( (--mnRefCount > 0) || (mpFileMap == NULL) ) return; - munmap( (char*)mpFileMap, mnFileSize ); + munmap( mpFileMap, mnFileSize ); mpFileMap = NULL; } @@ -1058,7 +1058,7 @@ bool ServerFont::GetGlyphBitmap1( sal_GlyphId aGlyphId, RawBitmap& rRawBitmap ) if( pGlyphFT->format != FT_GLYPH_FORMAT_BITMAP ) { if( pGlyphFT->format == FT_GLYPH_FORMAT_OUTLINE ) - ((FT_OutlineGlyphRec*)pGlyphFT)->outline.flags |= FT_OUTLINE_HIGH_PRECISION; + reinterpret_cast<FT_OutlineGlyphRec*>(pGlyphFT)->outline.flags |= FT_OUTLINE_HIGH_PRECISION; FT_Render_Mode nRenderMode = FT_RENDER_MODE_MONO; rc = FT_Glyph_To_Bitmap( &pGlyphFT, nRenderMode, NULL, true ); @@ -1176,7 +1176,7 @@ bool ServerFont::GetGlyphBitmap8( sal_GlyphId aGlyphId, RawBitmap& rRawBitmap ) } if( pGlyphFT->format == FT_GLYPH_FORMAT_OUTLINE ) - ((FT_OutlineGlyph)pGlyphFT)->outline.flags |= FT_OUTLINE_HIGH_PRECISION; + reinterpret_cast<FT_OutlineGlyph>(pGlyphFT)->outline.flags |= FT_OUTLINE_HIGH_PRECISION; bool bEmbedded = (pGlyphFT->format == FT_GLYPH_FORMAT_BITMAP); if( !bEmbedded ) diff --git a/vcl/generic/glyphs/gcach_ftyp.hxx b/vcl/generic/glyphs/gcach_ftyp.hxx index beee3328a867..590fb90d2727 100644 --- a/vcl/generic/glyphs/gcach_ftyp.hxx +++ b/vcl/generic/glyphs/gcach_ftyp.hxx @@ -48,7 +48,7 @@ private: FtFontFile( const OString& rNativeFileName ); const OString maNativeFileName; - const unsigned char* mpFileMap; + unsigned char* mpFileMap; int mnFileSize; int mnRefCount; int mnLangBoost; diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx index 8719844a3622..ae4a2f7d402e 100644 --- a/vcl/generic/glyphs/gcach_layout.cxx +++ b/vcl/generic/glyphs/gcach_layout.cxx @@ -137,7 +137,7 @@ static hb_blob_t *getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pU hb_blob_t* pBlob = NULL; if (pBuffer != NULL) - pBlob = hb_blob_create((const char*) pBuffer, nLength, HB_MEMORY_MODE_READONLY, (void*) pBuffer, NULL); + pBlob = hb_blob_create(reinterpret_cast<const char*>(pBuffer), nLength, HB_MEMORY_MODE_READONLY, (void*) pBuffer, NULL); return pBlob; } diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx index 1e63ab0faf31..f9a6e3a5bec0 100644 --- a/vcl/generic/print/genpspgraphics.cxx +++ b/vcl/generic/print/genpspgraphics.cxx @@ -424,20 +424,20 @@ void GenPspGraphics::drawRect( long nX, long nY, long nDX, long nDY ) void GenPspGraphics::drawPolyLine( sal_uInt32 nPoints, const SalPoint *pPtAry ) { - m_pPrinterGfx->DrawPolyLine (nPoints, (Point*)pPtAry); + m_pPrinterGfx->DrawPolyLine (nPoints, reinterpret_cast<Point const *>(pPtAry)); } void GenPspGraphics::drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) { // Point must be equal to SalPoint! see vcl/inc/salgtype.hxx - m_pPrinterGfx->DrawPolygon (nPoints, (Point*)pPtAry); + m_pPrinterGfx->DrawPolygon (nPoints, reinterpret_cast<Point const *>(pPtAry)); } void GenPspGraphics::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32 *pPoints, PCONSTSALPOINT *pPtAry ) { - m_pPrinterGfx->DrawPolyPolygon (nPoly, pPoints, (const Point**)pPtAry); + m_pPrinterGfx->DrawPolyPolygon (nPoly, pPoints, reinterpret_cast<const Point**>(pPtAry)); } bool GenPspGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double /*fTransparency*/ ) @@ -459,13 +459,13 @@ bool GenPspGraphics::drawPolyLine( bool GenPspGraphics::drawPolyLineBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ) { - m_pPrinterGfx->DrawPolyLineBezier (nPoints, (Point*)pPtAry, pFlgAry); + m_pPrinterGfx->DrawPolyLineBezier (nPoints, reinterpret_cast<Point const *>(pPtAry), pFlgAry); return true; } bool GenPspGraphics::drawPolygonBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ) { - m_pPrinterGfx->DrawPolygonBezier (nPoints, (Point*)pPtAry, pFlgAry); + m_pPrinterGfx->DrawPolygonBezier (nPoints, reinterpret_cast<Point const *>(pPtAry), pFlgAry); return true; } @@ -475,7 +475,7 @@ bool GenPspGraphics::drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt8* const* pFlgAry ) { // Point must be equal to SalPoint! see vcl/inc/salgtype.hxx - m_pPrinterGfx->DrawPolyPolygonBezier (nPoly, pPoints, (Point**)pPtAry, (sal_uInt8**)pFlgAry); + m_pPrinterGfx->DrawPolyPolygonBezier (nPoly, pPoints, reinterpret_cast<Point const * const *>(pPtAry), (sal_uInt8**)pFlgAry); return true; } diff --git a/vcl/generic/print/glyphset.cxx b/vcl/generic/print/glyphset.cxx index 30946a374ae3..b3314ab5e4ab 100644 --- a/vcl/generic/print/glyphset.cxx +++ b/vcl/generic/print/glyphset.cxx @@ -540,7 +540,7 @@ GlyphSet::ImplDrawText (PrinterGfx &rGfx, const Point& rPoint, OString aPSName( OUStringToOString( rGfx.GetFontMgr().getPSName( mnFontID ), RTL_TEXTENCODING_ISO_8859_1 ) ); OString aBytes( OUStringToOString( OUString( pStr, nLen ), mnBaseEncoding ) ); rGfx.PSSetFont( aPSName, mnBaseEncoding ); - rGfx.PSShowText( (const unsigned char*)aBytes.getStr(), nLen, aBytes.getLength() ); + rGfx.PSShowText( reinterpret_cast<const unsigned char*>(aBytes.getStr()), nLen, aBytes.getLength() ); return; } @@ -585,7 +585,7 @@ GlyphSet::ImplDrawText (PrinterGfx &rGfx, const Point& rPoint, OString aBytes( OUStringToOString( OUString( pStr, nLen ), mnBaseEncoding ) ); rGfx.PSMoveTo( rPoint ); rGfx.PSSetFont( aPSName, mnBaseEncoding ); - rGfx.PSShowText( (const unsigned char*)aBytes.getStr(), nLen, aBytes.getLength(), pDeltaArray ); + rGfx.PSShowText( reinterpret_cast<const unsigned char*>(aBytes.getStr()), nLen, aBytes.getLength(), pDeltaArray ); return; } diff --git a/vcl/generic/print/psputil.cxx b/vcl/generic/print/psputil.cxx index 9d47556fb3d4..ecea28f1b886 100644 --- a/vcl/generic/print/psputil.cxx +++ b/vcl/generic/print/psputil.cxx @@ -223,7 +223,7 @@ ConverterFactory::Convert (const sal_Unicode *pText, int nTextLen, rtl_UnicodeToTextContext aContext = rtl_createUnicodeToTextContext (aConverter); sal_Size nSize = rtl_convertUnicodeToText (aConverter, aContext, - pText, nTextLen, (sal_Char*)pBuffer, nBufferSize, + pText, nTextLen, reinterpret_cast<char*>(pBuffer), nBufferSize, nCvtFlags, &nCvtInfo, &nCvtChars); rtl_destroyUnicodeToTextContext (aConverter, aContext); diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx index 235c599ad8da..e890580b6544 100644 --- a/vcl/inc/unx/gtk/gtkdata.hxx +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -119,10 +119,7 @@ public: virtual void ErrorTrapPush() SAL_OVERRIDE; virtual bool ErrorTrapPop( bool bIgnoreError ) SAL_OVERRIDE; - inline GtkSalDisplay *GetGtkDisplay() const - { - return (GtkSalDisplay *)GetDisplay(); - } + inline GtkSalDisplay *GetGtkDisplay() const; }; class GtkSalFrame; @@ -193,6 +190,11 @@ inline GdkDisplay *GtkData::GetGdkDisplay() return GetGtkDisplay()->GetGdkDisplay(); } +GtkSalDisplay *GtkData::GetGtkDisplay() const +{ + return static_cast<GtkSalDisplay *>(GetDisplay()); +} + #endif // INCLUDED_VCL_INC_UNX_GTK_GTKDATA_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx index 10f0a40d8f13..a6330e4880c8 100644 --- a/vcl/qa/cppunit/complextext.cxx +++ b/vcl/qa/cppunit/complextext.cxx @@ -40,7 +40,7 @@ void VclComplexTextTest::testArabic() 0x86, 0x20, 0xd8, 0xab, 0xd9, 0x84, 0xd8, 0xa7, 0xd8, 0xab, 0xd8, 0xa9, 0xd9, 0x8c, 0x00 }; - OUString aOneTwoThree( (sal_Char *)pOneTwoThreeUTF8, + OUString aOneTwoThree( reinterpret_cast<char const *>(pOneTwoThreeUTF8), SAL_N_ELEMENTS( pOneTwoThreeUTF8 ) - 1, RTL_TEXTENCODING_UTF8 ); vcl::Window* pWin = new WorkWindow( (vcl::Window *)NULL ); diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx index a07b72010422..523b2f7674b7 100644 --- a/vcl/source/app/dbggui.cxx +++ b/vcl/source/app/dbggui.cxx @@ -460,7 +460,7 @@ void DbgDialogTest( vcl::Window* pWindow ) if ( !pGetChild ) return; - boost::scoped_array<Rectangle> pRectAry((Rectangle*)new long[(sizeof(Rectangle)*nChildCount)/sizeof(long)]); + boost::scoped_array<Rectangle> pRectAry(reinterpret_cast<Rectangle*>(new long[(sizeof(Rectangle)*nChildCount)/sizeof(long)])); memset( pRectAry.get(), 0, sizeof(Rectangle)*nChildCount ); if ( pWindow->IsDialog() ) diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index c02f0a93a138..19890e7c1e2a 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1384,7 +1384,7 @@ UnoWrapperBase* Application::GetUnoWrapper( bool bCreateIfNotExist ) aTkLib.loadRelative(&thisModule, aLibName, SAL_LOADMODULE_DEFAULT); if (aTkLib.is()) { - FN_TkCreateUnoWrapper fnCreateWrapper = (FN_TkCreateUnoWrapper)aTkLib.getFunctionSymbol("CreateUnoWrapper"); + FN_TkCreateUnoWrapper fnCreateWrapper = reinterpret_cast<FN_TkCreateUnoWrapper>(aTkLib.getFunctionSymbol("CreateUnoWrapper")); if ( fnCreateWrapper ) { pSVData->mpUnoWrapper = fnCreateWrapper(); diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 0a3c6be29298..0ca46985bd08 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -164,7 +164,7 @@ static void KillDirEntry( const OUString& rMainUrl ) // Helper functions -sal_uInt8* ImplSearchEntry( sal_uInt8* pSource, sal_uInt8* pDest, sal_uLong nComp, sal_uLong nSize ) +sal_uInt8* ImplSearchEntry( sal_uInt8* pSource, sal_uInt8 const * pDest, sal_uLong nComp, sal_uLong nSize ) { while ( nComp-- >= nSize ) { @@ -506,8 +506,8 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension, if( !bTest || rFormatExtension.startsWith( "EPS" ) ) { bSomethingTested = true; - if ( ( nFirstLong == 0xC5D0D3C6 ) || ( ImplSearchEntry( sFirstBytes, (sal_uInt8*)"%!PS-Adobe", 10, 10 ) && - ImplSearchEntry( &sFirstBytes[15], (sal_uInt8*)"EPS", 3, 3 ) ) ) + if ( ( nFirstLong == 0xC5D0D3C6 ) || ( ImplSearchEntry( sFirstBytes, reinterpret_cast<sal_uInt8 const *>("%!PS-Adobe"), 10, 10 ) && + ImplSearchEntry( &sFirstBytes[15], reinterpret_cast<sal_uInt8 const *>("EPS"), 3, 3 ) ) ) { rFormatExtension = "EPS"; return true; @@ -518,7 +518,7 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension, if( !bTest || rFormatExtension.startsWith( "DXF" ) ) { // Binary DXF File Format - if( strncmp( (const char*) sFirstBytes, "AutoCAD Binary DXF", 18 ) == 0 ) + if( strncmp( reinterpret_cast<char*>(sFirstBytes), "AutoCAD Binary DXF", 18 ) == 0 ) { rFormatExtension = "DXF"; return true; @@ -540,7 +540,7 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension, while( i<256 && sFirstBytes[i]<=32 ) ++i; - if (i+7<256 && (strncmp((const char*)(sFirstBytes+i),"SECTION",7)==0)) + if (i+7<256 && (strncmp(reinterpret_cast<char*>(sFirstBytes+i),"SECTION",7)==0)) { rFormatExtension = "DXF"; return true; @@ -604,7 +604,7 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension, if( !bTest ) { bSomethingTested = true; - if( ImplSearchEntry( sFirstBytes, (sal_uInt8*)"/* XPM */", 256, 9 ) ) + if( ImplSearchEntry( sFirstBytes, reinterpret_cast<sal_uInt8 const *>("/* XPM */"), 256, 9 ) ) { rFormatExtension = "XPM"; return true; @@ -624,11 +624,11 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension, rStream.Seek( nStreamPos ); rStream.Read( pBuf.get(), nSize ); - sal_uInt8* pPtr = ImplSearchEntry( pBuf.get(), (sal_uInt8*)"#define", nSize, 7 ); + sal_uInt8* pPtr = ImplSearchEntry( pBuf.get(), reinterpret_cast<sal_uInt8 const *>("#define"), nSize, 7 ); if( pPtr ) { - if( ImplSearchEntry( pPtr, (sal_uInt8*)"_width", pBuf.get() + nSize - pPtr, 6 ) ) + if( ImplSearchEntry( pPtr, reinterpret_cast<sal_uInt8 const *>("_width"), pBuf.get() + nSize - pPtr, 6 ) ) { rFormatExtension = "XBM"; return true; @@ -670,20 +670,20 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension, // check for Xml // #119176# SVG files which have no xml header at all have shown up this is optional - if( ImplSearchEntry(pCheckArray, (sal_uInt8*)"<?xml", nCheckSize, 5 ) // is it xml - && ImplSearchEntry(pCheckArray, (sal_uInt8*)"version", nCheckSize, 7 )) // does it have a version (required for xml) + if( ImplSearchEntry(pCheckArray, reinterpret_cast<sal_uInt8 const *>("<?xml"), nCheckSize, 5 ) // is it xml + && ImplSearchEntry(pCheckArray, reinterpret_cast<sal_uInt8 const *>("version"), nCheckSize, 7 )) // does it have a version (required for xml) { // check for DOCTYPE svg combination - if( ImplSearchEntry(pCheckArray, (sal_uInt8*)"DOCTYPE", nCheckSize, 7 ) // 'DOCTYPE' is there - && ImplSearchEntry(pCheckArray, (sal_uInt8*)"svg", nCheckSize, 3 )) // 'svg' is there + if( ImplSearchEntry(pCheckArray, reinterpret_cast<sal_uInt8 const *>("DOCTYPE"), nCheckSize, 7 ) // 'DOCTYPE' is there + && ImplSearchEntry(pCheckArray, reinterpret_cast<sal_uInt8 const *>("svg"), nCheckSize, 3 )) // 'svg' is there { bIsSvg = true; } } // check for svg element in 1st 256 bytes - if(!bIsSvg && ImplSearchEntry(pCheckArray, (sal_uInt8*)"<svg", nCheckSize, 4 )) // '<svg' + if(!bIsSvg && ImplSearchEntry(pCheckArray, reinterpret_cast<sal_uInt8 const *>("<svg"), nCheckSize, 4 )) // '<svg' { bIsSvg = true; } @@ -709,7 +709,7 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension, nCheckSize = rStream.Read(sExtendedOrDecompressedFirstBytes, nCheckSize); } - if(ImplSearchEntry(pCheckArray, (sal_uInt8*)"<svg", nCheckSize, 4)) // '<svg' + if(ImplSearchEntry(pCheckArray, reinterpret_cast<sal_uInt8 const *>("<svg"), nCheckSize, 4)) // '<svg' { bIsSvg = true; } @@ -984,7 +984,7 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction() if( !mpfnImport ) { #ifndef DISABLE_DYNLOADING - mpfnImport = (PFilterCall) maLibrary.getFunctionSymbol(OUString(IMPORT_FUNCTION_NAME)); + mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol(OUString(IMPORT_FUNCTION_NAME))); #else if( maFiltername.equalsAscii( "icd" ) ) mpfnImport = icdGraphicImport; @@ -2114,7 +2114,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString OUString aPhysicalName( ImpCreateFullFilterPath( aFilterPath.getToken(i, ';'), aFilterName ) ); osl::Module aLibrary( aPhysicalName ); - PFilterCall pFunc = (PFilterCall) aLibrary.getFunctionSymbol(OUString(EXPORT_FUNCTION_NAME)); + PFilterCall pFunc = reinterpret_cast<PFilterCall>(aLibrary.getFunctionSymbol(OUString(EXPORT_FUNCTION_NAME))); // Execute dialog in DLL #else PFilterCall pFunc = NULL; diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx index 4d8e5c32a81f..7f35629468cd 100644 --- a/vcl/source/filter/graphicfilter2.cxx +++ b/vcl/source/filter/graphicfilter2.cxx @@ -915,8 +915,8 @@ bool GraphicDescriptor::ImpDetectEPS( SvStream& rStm, bool ) rStm.Read( &nFirstBytes, 20 ); if ( ( nFirstLong == 0xC5D0D3C6 ) || aPathExt.startsWith( "eps" ) || - ( ImplSearchEntry( nFirstBytes, (sal_uInt8*)"%!PS-Adobe", 10, 10 ) - && ImplSearchEntry( &nFirstBytes[15], (sal_uInt8*)"EPS", 3, 3 ) ) ) + ( ImplSearchEntry( nFirstBytes, reinterpret_cast<sal_uInt8 const *>("%!PS-Adobe"), 10, 10 ) + && ImplSearchEntry( &nFirstBytes[15], reinterpret_cast<sal_uInt8 const *>("EPS"), 3, 3 ) ) ) { nFormat = GFF_EPS; bRet = true; diff --git a/vcl/source/filter/graphicfilter_internal.hxx b/vcl/source/filter/graphicfilter_internal.hxx index 3e27c30aa62b..8f3931ec2994 100644 --- a/vcl/source/filter/graphicfilter_internal.hxx +++ b/vcl/source/filter/graphicfilter_internal.hxx @@ -22,7 +22,7 @@ #include "tools/solar.h" -sal_uInt8* ImplSearchEntry( sal_uInt8* , sal_uInt8* , sal_uLong , sal_uLong ); +sal_uInt8* ImplSearchEntry( sal_uInt8*, sal_uInt8 const *, sal_uLong, sal_uLong ); extern bool isPCT(SvStream& rStream, sal_uLong nStreamPos, sal_uLong nStreamLen); diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx index 7b87230ced2c..0b14c77d820f 100644 --- a/vcl/source/filter/igif/gifread.cxx +++ b/vcl/source/filter/igif/gifread.cxx @@ -362,7 +362,7 @@ bool GIFReader::ReadLocalHeader() SvMemoryStream aMemStm; BitmapPalette* pPal; - aMemStm.SetBuffer( (char*) pBuf, 9, false, 9 ); + aMemStm.SetBuffer( pBuf, 9, false, 9 ); aMemStm.ReadUInt16( nImagePosX ); aMemStm.ReadUInt16( nImagePosY ); aMemStm.ReadUInt16( nImageWidth ); diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx index 81c13f210f74..06e1d97ea02d 100644 --- a/vcl/source/filter/ixpm/xpmread.cxx +++ b/vcl/source/filter/ixpm/xpmread.cxx @@ -346,7 +346,7 @@ bool XPMReader::ImplGetColSub( sal_uInt8* pDest ) if ( std::strlen(pRGBTable[i].name) > mnParaSize && pRGBTable[ i ].name[ mnParaSize ] == 0 ) { - if ( ImplCompare ( (unsigned char*)pRGBTable[ i ].name, + if ( ImplCompare ( reinterpret_cast<unsigned char const *>(pRGBTable[ i ].name), mpPara, mnParaSize, XPMCASENONSENSITIVE ) ) { bColStatus = true; @@ -456,7 +456,7 @@ sal_uLong XPMReader::ImplGetULONG( sal_uLong nPara ) else return 0; } -bool XPMReader::ImplCompare( sal_uInt8* pSource, sal_uInt8* pDest, sal_uLong nSize, sal_uLong nMode ) +bool XPMReader::ImplCompare( sal_uInt8 const * pSource, sal_uInt8 const * pDest, sal_uLong nSize, sal_uLong nMode ) { bool bRet = true; diff --git a/vcl/source/filter/ixpm/xpmread.hxx b/vcl/source/filter/ixpm/xpmread.hxx index ad9911a06c44..c8f7636bca7f 100644 --- a/vcl/source/filter/ixpm/xpmread.hxx +++ b/vcl/source/filter/ixpm/xpmread.hxx @@ -91,7 +91,7 @@ private: bool ImplGetColKey( sal_uInt8 ); void ImplGetRGBHex( sal_uInt8*, sal_uLong ); bool ImplGetPara( sal_uLong numb ); - bool ImplCompare( sal_uInt8*, sal_uInt8*, sal_uLong, sal_uLong nmode = XPMCASENONSENSITIVE ); + bool ImplCompare( sal_uInt8 const *, sal_uInt8 const *, sal_uLong, sal_uLong nmode = XPMCASENONSENSITIVE ); sal_uLong ImplGetULONG( sal_uLong nPara ); public: diff --git a/vcl/source/filter/jpeg/Exif.cxx b/vcl/source/filter/jpeg/Exif.cxx index a39c2dbda9fc..fc59664192cb 100644 --- a/vcl/source/filter/jpeg/Exif.cxx +++ b/vcl/source/filter/jpeg/Exif.cxx @@ -156,7 +156,7 @@ bool Exif::processIFD(sal_uInt8* pExifData, sal_uInt16 aLength, sal_uInt16 aOffs while (aOffset <= aLength - 12 && aNumberOfTags > 0) { - ifd = (ExifIFD*) &pExifData[aOffset]; + ifd = reinterpret_cast<ExifIFD*>(&pExifData[aOffset]); sal_uInt16 tag = ifd->tag; if (bSwap) { @@ -216,7 +216,7 @@ bool Exif::processExif(SvStream& rStream, sal_uInt16 aSectionLength, bool bSetVa // Exif detected mbExifPresent = true; - TiffHeader* aTiffHeader = (TiffHeader*) &aExifData[0]; + TiffHeader* aTiffHeader = reinterpret_cast<TiffHeader*>(&aExifData[0]); bool bIntel = aTiffHeader->byteOrder == 0x4949; //big-endian bool bMotorola = aTiffHeader->byteOrder == 0x4D4D; //little-endian diff --git a/vcl/source/filter/jpeg/JpegReader.cxx b/vcl/source/filter/jpeg/JpegReader.cxx index 1d400a5d55cb..78c2ae81b381 100644 --- a/vcl/source/filter/jpeg/JpegReader.cxx +++ b/vcl/source/filter/jpeg/JpegReader.cxx @@ -56,7 +56,7 @@ struct SourceManagerStruct { */ extern "C" void init_source (j_decompress_ptr cinfo) { - SourceManagerStruct * source = (SourceManagerStruct *) cinfo->src; + SourceManagerStruct * source = reinterpret_cast<SourceManagerStruct *>(cinfo->src); /* We reset the empty-input-file flag for each image, * but we don't clear the input buffer. @@ -90,7 +90,7 @@ long StreamRead( SvStream* pStream, void* pBuffer, long nBufferSize ) extern "C" boolean fill_input_buffer (j_decompress_ptr cinfo) { - SourceManagerStruct * source = (SourceManagerStruct *) cinfo->src; + SourceManagerStruct * source = reinterpret_cast<SourceManagerStruct *>(cinfo->src); size_t nbytes; nbytes = StreamRead(source->stream, source->buffer, BUFFER_SIZE); @@ -117,7 +117,7 @@ extern "C" boolean fill_input_buffer (j_decompress_ptr cinfo) extern "C" void skip_input_data (j_decompress_ptr cinfo, long numberOfBytes) { - SourceManagerStruct * source = (SourceManagerStruct *) cinfo->src; + SourceManagerStruct * source = reinterpret_cast<SourceManagerStruct *>(cinfo->src); /* Just a dumb implementation for now. Could use fseek() except * it doesn't work on pipes. Not clear that being smart is worth @@ -160,13 +160,13 @@ void jpeg_svstream_src (j_decompress_ptr cinfo, void* input) if (cinfo->src == NULL) { /* first time for this JPEG object? */ cinfo->src = (jpeg_source_mgr *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(SourceManagerStruct)); - source = (SourceManagerStruct *) cinfo->src; + (*cinfo->mem->alloc_small) (reinterpret_cast<j_common_ptr>(cinfo), JPOOL_PERMANENT, sizeof(SourceManagerStruct)); + source = reinterpret_cast<SourceManagerStruct *>(cinfo->src); source->buffer = (JOCTET *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, BUFFER_SIZE * sizeof(JOCTET)); + (*cinfo->mem->alloc_small) (reinterpret_cast<j_common_ptr>(cinfo), JPOOL_PERMANENT, BUFFER_SIZE * sizeof(JOCTET)); } - source = (SourceManagerStruct *) cinfo->src; + source = reinterpret_cast<SourceManagerStruct *>(cinfo->src); source->pub.init_source = init_source; source->pub.fill_input_buffer = fill_input_buffer; source->pub.skip_input_data = skip_input_data; diff --git a/vcl/source/filter/jpeg/JpegWriter.cxx b/vcl/source/filter/jpeg/JpegWriter.cxx index 09a52500e951..16e6ccf17d63 100644 --- a/vcl/source/filter/jpeg/JpegWriter.cxx +++ b/vcl/source/filter/jpeg/JpegWriter.cxx @@ -40,11 +40,11 @@ struct DestinationManagerStruct extern "C" void init_destination (j_compress_ptr cinfo) { - DestinationManagerStruct * destination = (DestinationManagerStruct *) cinfo->dest; + DestinationManagerStruct * destination = reinterpret_cast<DestinationManagerStruct *>(cinfo->dest); /* Allocate the output buffer -- it will be released when done with image */ destination->buffer = (JOCTET *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, BUFFER_SIZE * sizeof(JOCTET)); + (*cinfo->mem->alloc_small) (reinterpret_cast<j_common_ptr>(cinfo), JPOOL_IMAGE, BUFFER_SIZE * sizeof(JOCTET)); destination->pub.next_output_byte = destination->buffer; destination->pub.free_in_buffer = BUFFER_SIZE; @@ -52,7 +52,7 @@ extern "C" void init_destination (j_compress_ptr cinfo) extern "C" boolean empty_output_buffer (j_compress_ptr cinfo) { - DestinationManagerStruct * destination = (DestinationManagerStruct *) cinfo->dest; + DestinationManagerStruct * destination = reinterpret_cast<DestinationManagerStruct *>(cinfo->dest); if (destination->stream->Write(destination->buffer, BUFFER_SIZE) != (size_t) BUFFER_SIZE) { @@ -67,7 +67,7 @@ extern "C" boolean empty_output_buffer (j_compress_ptr cinfo) extern "C" void term_destination (j_compress_ptr cinfo) { - DestinationManagerStruct * destination = (DestinationManagerStruct *) cinfo->dest; + DestinationManagerStruct * destination = reinterpret_cast<DestinationManagerStruct *>(cinfo->dest); size_t datacount = BUFFER_SIZE - destination->pub.free_in_buffer; /* Write any data remaining in the buffer */ @@ -94,10 +94,10 @@ void jpeg_svstream_dest (j_compress_ptr cinfo, void* output) if (cinfo->dest == NULL) { /* first time for this JPEG object? */ cinfo->dest = (jpeg_destination_mgr*) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(DestinationManagerStruct)); + (*cinfo->mem->alloc_small) (reinterpret_cast<j_common_ptr>(cinfo), JPOOL_PERMANENT, sizeof(DestinationManagerStruct)); } - destination = (DestinationManagerStruct *) cinfo->dest; + destination = reinterpret_cast<DestinationManagerStruct *>(cinfo->dest); destination->pub.init_destination = init_destination; destination->pub.empty_output_buffer = empty_output_buffer; destination->pub.term_destination = term_destination; diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx index 411b17bd1644..2c9908b07d44 100644 --- a/vcl/source/filter/jpeg/jpegc.cxx +++ b/vcl/source/filter/jpeg/jpegc.cxx @@ -45,7 +45,7 @@ struct ErrorManagerStruct extern "C" void errorExit (j_common_ptr cinfo) { - ErrorManagerStruct * error = (ErrorManagerStruct *) cinfo->err; + ErrorManagerStruct * error = reinterpret_cast<ErrorManagerStruct *>(cinfo->err); (*cinfo->err->output_message) (cinfo); longjmp(error->setjmp_buffer, 1); } diff --git a/vcl/source/filter/sgfbram.cxx b/vcl/source/filter/sgfbram.cxx index 0d104922239e..57faee330d13 100644 --- a/vcl/source/filter/sgfbram.cxx +++ b/vcl/source/filter/sgfbram.cxx @@ -35,7 +35,7 @@ SgfHeader::SgfHeader() SvStream& ReadSgfHeader(SvStream& rIStream, SgfHeader& rHead) { - rIStream.Read((char*)&rHead.Magic,SgfHeaderSize); + rIStream.Read(&rHead.Magic, SgfHeaderSize); #if defined OSL_BIGENDIAN rHead.Magic =OSL_SWAPWORD(rHead.Magic ); rHead.Version=OSL_SWAPWORD(rHead.Version); @@ -65,7 +65,7 @@ SgfEntry::SgfEntry() SvStream& ReadSgfEntry(SvStream& rIStream, SgfEntry& rEntr) { - rIStream.Read((char*)&rEntr.Typ,SgfEntrySize); + rIStream.Read(&rEntr.Typ, SgfEntrySize); #if defined OSL_BIGENDIAN rEntr.Typ =OSL_SWAPWORD(rEntr.Typ ); rEntr.iFrei=OSL_SWAPWORD(rEntr.iFrei); @@ -82,7 +82,7 @@ sal_uInt32 SgfEntry::GetOffset() SvStream& ReadSgfVector(SvStream& rIStream, SgfVector& rVect) { - rIStream.Read((char*)&rVect,sizeof(rVect)); + rIStream.Read(&rVect, sizeof(rVect)); #if defined OSL_BIGENDIAN rVect.Flag =OSL_SWAPWORD(rVect.Flag ); rVect.x =OSL_SWAPWORD(rVect.x ); @@ -104,7 +104,7 @@ SvStream& WriteBmpFileHeader(SvStream& rOStream, BmpFileHeader& rHead) rHead.OfsLo =OSL_SWAPWORD(rHead.OfsLo ); rHead.OfsHi =OSL_SWAPWORD(rHead.OfsHi ); #endif - rOStream.Write((char*)&rHead,sizeof(rHead)); + rOStream.Write(&rHead, sizeof(rHead)); #if defined OSL_BIGENDIAN rHead.Typ =OSL_SWAPWORD(rHead.Typ ); rHead.SizeLo =OSL_SWAPWORD(rHead.SizeLo ); @@ -149,7 +149,7 @@ SvStream& WriteBmpInfoHeader(SvStream& rOStream, BmpInfoHeader& rInfo) rInfo.ColUsed =OSL_SWAPDWORD (rInfo.ColUsed ); rInfo.ColMust =OSL_SWAPDWORD (rInfo.ColMust ); #endif - rOStream.Write((char*)&rInfo,sizeof(rInfo)); + rOStream.Write(&rInfo, sizeof(rInfo)); #if defined OSL_BIGENDIAN rInfo.Size =OSL_SWAPDWORD (rInfo.Size ); rInfo.Width =OSL_SWAPDWORD (rInfo.Width ); @@ -168,7 +168,7 @@ SvStream& WriteBmpInfoHeader(SvStream& rOStream, BmpInfoHeader& rInfo) SvStream& WriteRGBQuad(SvStream& rOStream, const RGBQuad& rQuad) { - rOStream.Write((char*)&rQuad,sizeof(rQuad)); + rOStream.Write(&rQuad, sizeof(rQuad)); return rOStream; } @@ -190,10 +190,10 @@ sal_uInt8 PcxExpand::GetByte(SvStream& rInp) if (Count>0) { Count--; } else { - rInp.Read((char*)&Data,1); + rInp.Read(&Data, 1); if ((Data & 0xC0) == 0xC0) { Count=(Data & 0x3F) -1; - rInp.Read((char*)&Data,1); + rInp.Read(&Data, 1); } } return Data; @@ -247,14 +247,14 @@ bool SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntry&) WriteRGBQuad( rOut, RGBQuad(0xFF,0xFF,0xFF) ); // white nOfs=rOut.Tell(); for (j=0;j<rHead.Ysize;j++) - rOut.Write((char*)pBuf.get(),nWdtOut); // fill file with zeroes + rOut.Write(pBuf.get(), nWdtOut); // fill file with zeroes for (j=0;j<rHead.Ysize;j++) { for(i=0;i<nWdtInp;i++) { pBuf[i]=aPcx.GetByte(rInp); } for(i=nWdtInp;i<nWdtOut;i++) pBuf[i]=0; // up to 3 bytes rOut.Seek(nOfs+((sal_uLong)rHead.Ysize-j-1L)*(sal_uLong)nWdtOut); // write backwards - rOut.Write((char*)pBuf.get(),nWdtOut); + rOut.Write(pBuf.get(), nWdtOut); } } else if (nColors==16) { sal_uInt8 pl2= 0; // planes' masks @@ -278,7 +278,7 @@ bool SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntry&) nOfs=rOut.Tell(); for (j=0;j<rHead.Ysize;j++) - rOut.Write((char*)pBuf.get(),nWdtOut); // fill file with zeroes + rOut.Write(pBuf.get(), nWdtOut); // fill file with zeroes for (j=0;j<rHead.Ysize;j++) { memset(pBuf.get(),0,nWdtOut); for(k=0;k<4;k++) { @@ -302,27 +302,27 @@ bool SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntry&) } for(i=nWdtInp*4;i<nWdtOut;i++) pBuf[i]=0; // up to 3 bytes rOut.Seek(nOfs+((sal_uLong)rHead.Ysize-j-1L)*(sal_uLong)nWdtOut); // write backwards - rOut.Write((char*)pBuf.get(),nWdtOut); + rOut.Write(pBuf.get(), nWdtOut); } } else if (nColors==256) { cRGB[3]=0; // fourth palette entry for BMP for (i=0;i<256;i++) { // copy palette - rInp.Read((char*)cRGB,3); + rInp.Read(cRGB, 3); pl1=cRGB[0]; // switch red and blue cRGB[0]=cRGB[2]; cRGB[2]=pl1; - rOut.Write((char*)cRGB,4); + rOut.Write(cRGB, 4); } nOfs=rOut.Tell(); for (j=0;j<rHead.Ysize;j++) - rOut.Write((char*)pBuf.get(),nWdtOut); // fill file with zeroes + rOut.Write(pBuf.get(), nWdtOut); // fill file with zeroes for (j=0;j<rHead.Ysize;j++) { for(i=0;i<rHead.Xsize;i++) pBuf[i]=aPcx.GetByte(rInp); for(i=rHead.Xsize;i<nWdtOut;i++) pBuf[i]=0; // up to 3 bytes rOut.Seek(nOfs+((sal_uLong)rHead.Ysize-j-1L)*(sal_uLong)nWdtOut); // write backwards - rOut.Write((char*)pBuf.get(),nWdtOut); + rOut.Write(pBuf.get(), nWdtOut); } } return true; diff --git a/vcl/source/filter/sgvmain.cxx b/vcl/source/filter/sgvmain.cxx index 956b8c049f2d..4e130e5213e2 100644 --- a/vcl/source/filter/sgvmain.cxx +++ b/vcl/source/filter/sgvmain.cxx @@ -136,7 +136,7 @@ sal_uInt16 MulDiv(sal_uInt16 a, sal_uInt16 Mul, sal_uInt16 Div) SvStream& ReadDtHdType(SvStream& rIStream, DtHdType& rDtHd) { - rIStream.Read((char*)&rDtHd.Reserved[0],DtHdSize); + rIStream.Read(&rDtHd.Reserved[0], DtHdSize); return rIStream; } @@ -154,7 +154,7 @@ PageType::PageType() SvStream& ReadPageType(SvStream& rIStream, PageType& rPage) { - rIStream.Read((char*)&rPage.Next,PageSize); + rIStream.Read(&rPage.Next, PageSize); #if defined OSL_BIGENDIAN SWAPPAGE(rPage); #endif @@ -173,7 +173,7 @@ SvStream& ReadObjkType(SvStream& rInp, ObjkType& rObjk) // fileposition in stream is not changed! sal_uLong nPos; nPos=rInp.Tell(); - rInp.Read((char*)&rObjk.Last,ObjkSize); + rInp.Read(&rObjk.Last, ObjkSize); #if defined OSL_BIGENDIAN SWAPOBJK(rObjk); #endif @@ -182,7 +182,7 @@ SvStream& ReadObjkType(SvStream& rInp, ObjkType& rObjk) } SvStream& ReadStrkType(SvStream& rInp, StrkType& rStrk) { - rInp.Read((char*)&rStrk.Last,StrkSize); + rInp.Read(&rStrk.Last, StrkSize); #if defined OSL_BIGENDIAN SWAPOBJK (rStrk); SWAPLINE (rStrk.L); @@ -193,7 +193,7 @@ SvStream& ReadStrkType(SvStream& rInp, StrkType& rStrk) } SvStream& ReadRectType(SvStream& rInp, RectType& rRect) { - rInp.Read((char*)&rRect.Last,RectSize); + rInp.Read(&rRect.Last, RectSize); #if defined OSL_BIGENDIAN SWAPOBJK (rRect); SWAPLINE (rRect.L); @@ -208,7 +208,7 @@ SvStream& ReadRectType(SvStream& rInp, RectType& rRect) } SvStream& ReadPolyType(SvStream& rInp, PolyType& rPoly) { - rInp.Read((char*)&rPoly.Last,PolySize); + rInp.Read(&rPoly.Last, PolySize); #if defined OSL_BIGENDIAN SWAPOBJK (rPoly); SWAPLINE (rPoly.L); @@ -218,7 +218,7 @@ SvStream& ReadPolyType(SvStream& rInp, PolyType& rPoly) } SvStream& ReadSplnType(SvStream& rInp, SplnType& rSpln) { - rInp.Read((char*)&rSpln.Last,SplnSize); + rInp.Read(&rSpln.Last, SplnSize); #if defined OSL_BIGENDIAN SWAPOBJK (rSpln); SWAPLINE (rSpln.L); @@ -228,7 +228,7 @@ SvStream& ReadSplnType(SvStream& rInp, SplnType& rSpln) } SvStream& ReadCircType(SvStream& rInp, CircType& rCirc) { - rInp.Read((char*)&rCirc.Last,CircSize); + rInp.Read(&rCirc.Last, CircSize); #if defined OSL_BIGENDIAN SWAPOBJK (rCirc); SWAPLINE (rCirc.L); @@ -243,7 +243,7 @@ SvStream& ReadCircType(SvStream& rInp, CircType& rCirc) } SvStream& ReadTextType(SvStream& rInp, TextType& rText) { - rInp.Read((char*)&rText.Last,TextSize); + rInp.Read(&rText.Last, TextSize); #if defined OSL_BIGENDIAN SWAPOBJK (rText); SWAPTEXT (rText.T); @@ -261,7 +261,7 @@ SvStream& ReadTextType(SvStream& rInp, TextType& rText) } SvStream& ReadBmapType(SvStream& rInp, BmapType& rBmap) { - rInp.Read((char*)&rBmap.Last,BmapSize); + rInp.Read(&rBmap.Last, BmapSize); #if defined OSL_BIGENDIAN SWAPOBJK (rBmap); SWAPAREA (rBmap.F); @@ -275,7 +275,7 @@ SvStream& ReadBmapType(SvStream& rInp, BmapType& rBmap) } SvStream& ReadGrupType(SvStream& rInp, GrupType& rGrup) { - rInp.Read((char*)&rGrup.Last,GrupSize); + rInp.Read(&rGrup.Last, GrupSize); #if defined OSL_BIGENDIAN SWAPOBJK (rGrup); rGrup.SbLo =OSL_SWAPWORD(rGrup.SbLo ); @@ -710,7 +710,7 @@ void DrawObjkList( SvStream& rInp, OutputDevice& rOut ) ReadTextType( rInp, aText ); if (!rInp.GetError()) { aText.Buffer=new UCHAR[aText.BufSize+1]; // add one for LookAhead at CK-separation - rInp.Read((char* )aText.Buffer,aText.BufSize); + rInp.Read(aText.Buffer, aText.BufSize); if (!rInp.GetError()) aText.Draw(rOut); delete[] aText.Buffer; } @@ -727,7 +727,7 @@ void DrawObjkList( SvStream& rInp, OutputDevice& rOut ) ReadPolyType( rInp, aPoly ); if (!rInp.GetError()) { aPoly.EckP=new PointType[aPoly.nPoints]; - rInp.Read((char*)aPoly.EckP,4*aPoly.nPoints); + rInp.Read(aPoly.EckP, 4*aPoly.nPoints); #if defined OSL_BIGENDIAN for(short i=0;i<aPoly.nPoints;i++) SWAPPOINT(aPoly.EckP[i]); #endif @@ -740,7 +740,7 @@ void DrawObjkList( SvStream& rInp, OutputDevice& rOut ) ReadSplnType( rInp, aSpln ); if (!rInp.GetError()) { aSpln.EckP=new PointType[aSpln.nPoints]; - rInp.Read((char*)aSpln.EckP,4*aSpln.nPoints); + rInp.Read(aSpln.EckP, 4*aSpln.nPoints); #if defined OSL_BIGENDIAN for(short i=0;i<aSpln.nPoints;i++) SWAPPOINT(aSpln.EckP[i]); #endif diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index 1d22d09ea9af..0d8fb69971c7 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -1834,7 +1834,7 @@ void Type1Emitter::emitAllCrypted( void) // apply t1crypt for( char* p = maBuffer; p < mpPtr; ++p) { *p ^= (mnEECryptR >> 8); - mnEECryptR = (*(U8*)p + mnEECryptR) * 52845 + 22719; + mnEECryptR = (*reinterpret_cast<U8*>(p) + mnEECryptR) * 52845 + 22719; } // emit the t1crypt result diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 737a7a716f9b..921aa090b3ad 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -1096,12 +1096,12 @@ typedef struct _subHeader2 { } subHeader2; static sal_uInt32 getGlyph2(const sal_uInt8 *cmap, const sal_uInt32 nMaxCmapSize, sal_uInt32 c) { - sal_uInt16 *CMAP2 = (sal_uInt16 *) cmap; + sal_uInt16 const *CMAP2 = reinterpret_cast<sal_uInt16 const *>(cmap); sal_uInt8 theHighByte; sal_uInt8 theLowByte; - subHeader2* subHeader2s; - sal_uInt16* subHeader2Keys; + subHeader2 const * subHeader2s; + sal_uInt16 const * subHeader2Keys; sal_uInt16 firstCode; int k = -1; sal_uInt32 ToReturn; @@ -1109,24 +1109,24 @@ static sal_uInt32 getGlyph2(const sal_uInt8 *cmap, const sal_uInt32 nMaxCmapSize theHighByte = (sal_uInt8)((c >> 8) & 0x00ff); theLowByte = (sal_uInt8)(c & 0x00ff); subHeader2Keys = CMAP2 + 3; - subHeader2s = (subHeader2 *)(subHeader2Keys + 256); - if(reinterpret_cast<sal_uInt8*>(&subHeader2Keys[theHighByte]) - cmap < int(nMaxCmapSize - 2)) + subHeader2s = reinterpret_cast<subHeader2 const *>(subHeader2Keys + 256); + if(reinterpret_cast<sal_uInt8 const *>(&subHeader2Keys[theHighByte]) - cmap < int(nMaxCmapSize - 2)) { k = Int16FromMOTA(subHeader2Keys[theHighByte]) / 8; // check if the subheader record fits into available space - if((k >= 0) && (reinterpret_cast<sal_uInt8*>(&subHeader2s[k]) - cmap >= int(nMaxCmapSize - sizeof(subHeader2)))) + if((k >= 0) && (reinterpret_cast<sal_uInt8 const *>(&subHeader2s[k]) - cmap >= int(nMaxCmapSize - sizeof(subHeader2)))) k = -1; } if(k == 0) { firstCode = Int16FromMOTA(subHeader2s[0].firstCode); if(theLowByte >= firstCode && theLowByte < (firstCode + Int16FromMOTA(subHeader2s[k].entryCount))) { - sal_uInt16* const pGlyph = (&(subHeader2s[0].idRangeOffset)) + sal_uInt16 const * pGlyph = (&(subHeader2s[0].idRangeOffset)) + (Int16FromMOTA(subHeader2s[0].idRangeOffset)/2) /* + offset */ + theLowByte /* + to_look */ - firstCode ; - if (reinterpret_cast<sal_uInt8*>(pGlyph) - cmap < int(nMaxCmapSize) - 4) + if (reinterpret_cast<sal_uInt8 const *>(pGlyph) - cmap < int(nMaxCmapSize) - 4) return *pGlyph; else return MISSING_GLYPH_INDEX; @@ -1155,7 +1155,7 @@ static sal_uInt32 getGlyph2(const sal_uInt8 *cmap, const sal_uInt32 nMaxCmapSize static sal_uInt32 getGlyph6(const sal_uInt8 *cmap, sal_uInt32, sal_uInt32 c) { sal_uInt16 firstCode, lastCode, count; - sal_uInt16 *CMAP6 = (sal_uInt16 *) cmap; + sal_uInt16 const *CMAP6 = reinterpret_cast<sal_uInt16 const *>(cmap); firstCode = Int16FromMOTA(*(CMAP6 + 3)); count = Int16FromMOTA(*(CMAP6 + 4)); @@ -1167,7 +1167,7 @@ static sal_uInt32 getGlyph6(const sal_uInt8 *cmap, sal_uInt32, sal_uInt32 c) { } } -static sal_uInt16 GEbinsearch(sal_uInt16 *ar, sal_uInt16 length, sal_uInt16 toSearch) { +static sal_uInt16 GEbinsearch(sal_uInt16 const *ar, sal_uInt16 length, sal_uInt16 toSearch) { signed int low, high, lastfound = 0xffff; sal_uInt16 res; if(length == (sal_uInt16)0 || length == (sal_uInt16)0xFFFF) { @@ -1192,13 +1192,13 @@ static sal_uInt32 getGlyph4(const sal_uInt8 *cmap, const sal_uInt32 nMaxCmapSize sal_uInt16 i; int ToReturn; sal_uInt16 segCount; - sal_uInt16 * startCode; - sal_uInt16 * endCode; - sal_uInt16 * idDelta; + sal_uInt16 const * startCode; + sal_uInt16 const * endCode; + sal_uInt16 const * idDelta; /* sal_uInt16 * glyphIdArray; */ - sal_uInt16 * idRangeOffset; + sal_uInt16 const * idRangeOffset; /*sal_uInt16 * glyphIndexArray;*/ - sal_uInt16 *CMAP4 = (sal_uInt16 *) cmap; + sal_uInt16 const *CMAP4 = reinterpret_cast<sal_uInt16 const *>(cmap); /* sal_uInt16 GEbinsearch(sal_uInt16 *ar, sal_uInt16 length, sal_uInt16 toSearch); */ segCount = Int16FromMOTA(*(CMAP4 + 3))/2; @@ -1210,16 +1210,16 @@ static sal_uInt32 getGlyph4(const sal_uInt8 *cmap, const sal_uInt32 nMaxCmapSize } startCode = endCode + segCount + 1; - if((reinterpret_cast<sal_uInt8*>(&startCode[i]) - cmap >= int(nMaxCmapSize - 2)) || Int16FromMOTA(startCode[i]) > c) { + if((reinterpret_cast<sal_uInt8 const *>(&startCode[i]) - cmap >= int(nMaxCmapSize - 2)) || Int16FromMOTA(startCode[i]) > c) { return MISSING_GLYPH_INDEX; } idDelta = startCode + segCount; idRangeOffset = idDelta + segCount; /*glyphIndexArray = idRangeOffset + segCount;*/ - if((reinterpret_cast<sal_uInt8*>(&idRangeOffset[i]) - cmap < int(nMaxCmapSize - 2)) && Int16FromMOTA(idRangeOffset[i]) != 0) { - sal_uInt16 * pGlyphOffset = &(idRangeOffset[i]) + (Int16FromMOTA(idRangeOffset[i])/2 + (c - Int16FromMOTA(startCode[i]))); - if(reinterpret_cast<sal_uInt8*>(pGlyphOffset) - cmap >= int(nMaxCmapSize - 2)) + if((reinterpret_cast<sal_uInt8 const *>(&idRangeOffset[i]) - cmap < int(nMaxCmapSize - 2)) && Int16FromMOTA(idRangeOffset[i]) != 0) { + sal_uInt16 const * pGlyphOffset = &(idRangeOffset[i]) + (Int16FromMOTA(idRangeOffset[i])/2 + (c - Int16FromMOTA(startCode[i]))); + if(reinterpret_cast<sal_uInt8 const *>(pGlyphOffset) - cmap >= int(nMaxCmapSize - 2)) return MISSING_GLYPH_INDEX; c = Int16FromMOTA(*pGlyphOffset); } @@ -1229,7 +1229,7 @@ static sal_uInt32 getGlyph4(const sal_uInt8 *cmap, const sal_uInt32 nMaxCmapSize } static sal_uInt32 getGlyph12(const sal_uInt8 *pCmap, sal_uInt32, sal_uInt32 cChar) { - const sal_uInt32* pCMAP12 = (const sal_uInt32*)pCmap; + const sal_uInt32* pCMAP12 = reinterpret_cast<const sal_uInt32*>(pCmap); int nLength = Int32FromMOTA( pCMAP12[1] ); int nGroups = Int32FromMOTA( pCMAP12[3] ); int nLower = 0; @@ -1647,7 +1647,7 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t ) if( nDelta ) for( int j = 0; j < NUM_TAGS; ++j ) if( t->tables[j] ) - *(char**)&t->tables[j] -= nDelta; + *reinterpret_cast<char const **>(&t->tables[j]) -= nDelta; break; } } @@ -1747,7 +1747,7 @@ void CloseTTFont(TrueTypeFont *ttf) { #if !defined(WIN32) if( ttf->fname ) - munmap((char *) ttf->ptr, ttf->fsize); + munmap(ttf->ptr, ttf->fsize); #endif free(ttf->fname); free(ttf->goffsets); @@ -2008,7 +2008,7 @@ int CreateTTFromTTGlyphs(TrueTypeFont *ttf, newname.slen = name[i].slen + strlen(suffix); */ const sal_uInt8 ptr[] = {0,'T',0,'r',0,'u',0,'e',0,'T',0,'y',0,'p',0,'e',0,'S',0,'u',0,'b',0,'s',0,'e',0,'t'}; - NameRecord n1 = {1, 0, 0, 6, 14, (sal_uInt8*)"TrueTypeSubset"}; + NameRecord n1 = {1, 0, 0, 6, 14, const_cast<sal_uInt8 *>(reinterpret_cast<sal_uInt8 const *>("TrueTypeSubset"))}; NameRecord n2 = {3, 1, 1033, 6, 28, 0}; n2.sptr = (sal_uInt8 *) ptr; name = TrueTypeTableNew_name(0, 0); diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx index e65c7cc3f234..25c66d1e3ba2 100644 --- a/vcl/source/fontsubset/ttcr.cxx +++ b/vcl/source/fontsubset/ttcr.cxx @@ -201,7 +201,7 @@ void TrueTypeCreatorNewEmpty(sal_uInt32 tag, TrueTypeCreator **_this) TrueTypeCreator* ptr = (TrueTypeCreator*)smalloc(sizeof(TrueTypeCreator)); ptr->tables = listNewEmpty(); - listSetElementDtor(ptr->tables, (list_destructor)TrueTypeTableDispose); + listSetElementDtor(ptr->tables, reinterpret_cast<list_destructor>(TrueTypeTableDispose)); ptr->tag = tag; @@ -294,7 +294,7 @@ int StreamToMemory(TrueTypeCreator *_this, sal_uInt8 **ptr, sal_uInt32 *length) /* Table Directory */ for (int i = 0; i < numTables; ++i) { PutUInt32(te[i].tag, ttf + 12, 16 * i, 1); - PutUInt32(CheckSum((sal_uInt32 *) te[i].data, te[i].length), ttf + 12, 16 * i + 4, 1); + PutUInt32(CheckSum(reinterpret_cast<sal_uInt32 *>(te[i].data), te[i].length), ttf + 12, 16 * i + 4, 1); PutUInt32(offset, ttf + 12, 16 * i + 8, 1); PutUInt32(te[i].length, ttf + 12, 16 * i + 12, 1); @@ -309,7 +309,7 @@ int StreamToMemory(TrueTypeCreator *_this, sal_uInt8 **ptr, sal_uInt32 *length) free(te); - p = (sal_uInt32 *) ttf; + p = reinterpret_cast<sal_uInt32 *>(ttf); for (int i = 0; i < (int)s / 4; ++i) checkSumAdjustment += p[i]; PutUInt32(0xB1B0AFBA - checkSumAdjustment, head, 8, 1); diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index 050eaa5ea18f..5a8bad6f341f 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -1701,7 +1701,7 @@ bool Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors, memset( pTols, 0, nColorCount * sizeof( long ) ); } else - pTols = (long*) _pTols; + pTols = reinterpret_cast<long*>(_pTols); for( i = 0UL; i < nColorCount; i++ ) { diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index 211516045adb..83ce47fff5b0 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -2247,7 +2247,7 @@ bool Bitmap::ImplReduceMedian( sal_uInt16 nColCount ) const long nHeight = pWAcc->Height(); long nIndex = 0L; - memset( (HPBYTE) pColBuf, 0, nSize ); + memset( pColBuf, 0, nSize ); // create Buffer if( pRAcc->HasPalette() ) diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx index 32ca3cc4412d..a18b9c26b71e 100644 --- a/vcl/source/gdi/bitmap4.cxx +++ b/vcl/source/gdi/bitmap4.cxx @@ -127,9 +127,9 @@ bool Bitmap::ImplConvolute3( const long* pMatrix, long nDivisor, const long nHeight = pWriteAcc->Height(), nHeight2 = nHeight + 2; long* pColm = new long[ nWidth2 ]; long* pRows = new long[ nHeight2 ]; - BitmapColor* pColRow1 = (BitmapColor*) new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]; - BitmapColor* pColRow2 = (BitmapColor*) new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]; - BitmapColor* pColRow3 = (BitmapColor*) new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]; + BitmapColor* pColRow1 = reinterpret_cast<BitmapColor*>(new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]); + BitmapColor* pColRow2 = reinterpret_cast<BitmapColor*>(new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]); + BitmapColor* pColRow3 = reinterpret_cast<BitmapColor*>(new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]); BitmapColor* pRowTmp1 = pColRow1; BitmapColor* pRowTmp2 = pColRow2; BitmapColor* pRowTmp3 = pColRow3; @@ -228,9 +228,9 @@ bool Bitmap::ImplConvolute3( const long* pMatrix, long nDivisor, } delete[] pKoeff; - delete[] (sal_uInt8*) pColRow1; - delete[] (sal_uInt8*) pColRow2; - delete[] (sal_uInt8*) pColRow3; + delete[] reinterpret_cast<sal_uInt8*>(pColRow1); + delete[] reinterpret_cast<sal_uInt8*>(pColRow2); + delete[] reinterpret_cast<sal_uInt8*>(pColRow3); delete[] pColm; delete[] pRows; @@ -272,9 +272,9 @@ bool Bitmap::ImplMedianFilter( const BmpFilterParam* /*pFilterParam*/, const Lin const long nHeight = pWriteAcc->Height(), nHeight2 = nHeight + 2; long* pColm = new long[ nWidth2 ]; long* pRows = new long[ nHeight2 ]; - BitmapColor* pColRow1 = (BitmapColor*) new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]; - BitmapColor* pColRow2 = (BitmapColor*) new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]; - BitmapColor* pColRow3 = (BitmapColor*) new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]; + BitmapColor* pColRow1 = reinterpret_cast<BitmapColor*>(new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]); + BitmapColor* pColRow2 = reinterpret_cast<BitmapColor*>(new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]); + BitmapColor* pColRow3 = reinterpret_cast<BitmapColor*>(new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]); BitmapColor* pRowTmp1 = pColRow1; BitmapColor* pRowTmp2 = pColRow2; BitmapColor* pRowTmp3 = pColRow3; @@ -357,9 +357,9 @@ bool Bitmap::ImplMedianFilter( const BmpFilterParam* /*pFilterParam*/, const Lin } } - delete[] (sal_uInt8*) pColRow1; - delete[] (sal_uInt8*) pColRow2; - delete[] (sal_uInt8*) pColRow3; + delete[] reinterpret_cast<sal_uInt8*>(pColRow1); + delete[] reinterpret_cast<sal_uInt8*>(pColRow2); + delete[] reinterpret_cast<sal_uInt8*>(pColRow3); delete[] pColm; delete[] pRows; diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx index 9e4994c5dda4..7ad73870f664 100644 --- a/vcl/source/gdi/bmpacc.cxx +++ b/vcl/source/gdi/bmpacc.cxx @@ -299,7 +299,7 @@ void BitmapReadAccess::ImplZeroInitUnusedBits() nMask = OSL_SWAPDWORD( nMask ); #endif for( sal_uInt32 i = 0; i < nHeight; i++, pLast4Bytes += nScanSize ) - ( *(sal_uInt32*) pLast4Bytes ) &= nMask; + *reinterpret_cast<sal_uInt32*>(pLast4Bytes) &= nMask; } } } diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index cf290bbf3c16..9cc2543f0d14 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -457,7 +457,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) sal_Int16 nVersion; // read header - rIStm.Read( (char*) &aCode, sizeof( aCode ) ); // Identifier + rIStm.Read( aCode, sizeof( aCode ) ); // Identifier rIStm.ReadInt16( nSize ); // Size rIStm.ReadInt16( nVersion ); // Version sal_Int32 nTmp32(0); diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index 2e3779865411..1a9eb339aa19 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -611,7 +611,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r for( ; nCount--; nY += nI ) { - if (rIStm.Read( (char*)( pTmp16 = (sal_uInt16*) pBuf.get() ), nAlignedWidth ) + if (rIStm.Read( ( pTmp16 = reinterpret_cast<sal_uInt16*>(pBuf.get()) ), nAlignedWidth ) != nAlignedWidth) { return false; @@ -619,7 +619,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r for( long nX = 0L; nX < nWidth; nX++ ) { - aMask.GetColorFor16BitLSB( aColor, (sal_uInt8*) pTmp16++ ); + aMask.GetColorFor16BitLSB( aColor, reinterpret_cast<sal_uInt8*>(pTmp16++) ); rAcc.SetPixel( nY, nX, aColor ); } } @@ -662,7 +662,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r for( ; nCount--; nY += nI ) { - if (rIStm.Read( (char*)( pTmp32 = (sal_uInt32*) pBuf.get() ), nAlignedWidth ) + if (rIStm.Read( ( pTmp32 = reinterpret_cast<sal_uInt32*>(pBuf.get()) ), nAlignedWidth ) != nAlignedWidth) { return false; @@ -670,7 +670,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r for( long nX = 0L; nX < nWidth; nX++ ) { - aMask.GetColorAndAlphaFor32Bit( aColor, aAlpha, (sal_uInt8*) pTmp32++ ); + aMask.GetColorAndAlphaFor32Bit( aColor, aAlpha, reinterpret_cast<sal_uInt8*>(pTmp32++) ); rAcc.SetPixel( nY, nX, aColor ); pAccAlpha->SetPixelIndex(nY, nX, sal_uInt8(0xff) - aAlpha); rAlphaUsed |= bool(0xff != aAlpha); @@ -681,7 +681,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r { for( ; nCount--; nY += nI ) { - if (rIStm.Read( (char*)( pTmp32 = (sal_uInt32*) pBuf.get() ), nAlignedWidth ) + if (rIStm.Read( ( pTmp32 = reinterpret_cast<sal_uInt32*>(pBuf.get()) ), nAlignedWidth ) != nAlignedWidth) { return false; @@ -689,7 +689,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r for( long nX = 0L; nX < nWidth; nX++ ) { - aMask.GetColorFor32Bit( aColor, (sal_uInt8*) pTmp32++ ); + aMask.GetColorFor32Bit( aColor, reinterpret_cast<sal_uInt8*>(pTmp32++) ); rAcc.SetPixel( nY, nX, aColor ); } } @@ -793,7 +793,7 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLon // set decoded bytes to memory stream, // from which we will read the bitmap data pIStm = pMemStm = new SvMemoryStream; - pMemStm->SetBuffer( (char*) pData, nUncodedSize, false, nUncodedSize ); + pMemStm->SetBuffer( pData, nUncodedSize, false, nUncodedSize ); nOffset = 0; } else diff --git a/vcl/source/gdi/embeddedfontshelper.cxx b/vcl/source/gdi/embeddedfontshelper.cxx index 5706022a6bf2..43485d79ab41 100644 --- a/vcl/source/gdi/embeddedfontshelper.cxx +++ b/vcl/source/gdi/embeddedfontshelper.cxx @@ -114,7 +114,7 @@ bool EmbeddedFontsHelper::addEmbeddedFont( uno::Reference< io::XInputStream > st unsigned char *nakedPointerToUncompressedFont = NULL; libeot::EOTMetadata eotMetadata; libeot::EOTError uncompressError = - libeot::EOT2ttf_buffer( (const unsigned char *)&fontData[0], fontData.size(), &eotMetadata, &nakedPointerToUncompressedFont, &uncompressedFontSize ); + libeot::EOT2ttf_buffer( reinterpret_cast<unsigned char *>(&fontData[0]), fontData.size(), &eotMetadata, &nakedPointerToUncompressedFont, &uncompressedFontSize ); boost::shared_ptr<unsigned char> uncompressedFont( nakedPointerToUncompressedFont, libeot::EOTfreeBuffer ); if( uncompressError != libeot::EOT_SUCCESS ) { diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 8cf47471b8f3..65b353760563 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -507,7 +507,7 @@ void GDIMetaFile::ImplDelegate2PluggableRenderer( const MetaCommentAction* pAct, // delay intialization of XGraphic, to only expose // XGraphic-generating services to arbitrary binary data uno::Sequence< sal_Int8 > aSeq( - (sal_Int8*)pData, pEndData-pData ); + reinterpret_cast<sal_Int8 const *>(pData), pEndData-pData ); uno::Sequence<uno::Any> aGraphicsArgs(1); aGraphicsArgs[0] = makeAny(aSeq); xInit->initialize(aGraphicsArgs); diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx index 1c825bf09cc8..c352b81dfeb7 100644 --- a/vcl/source/gdi/gfxlink.cxx +++ b/vcl/source/gdi/gfxlink.cxx @@ -174,7 +174,7 @@ bool GfxLink::LoadNative( Graphic& rGraphic ) SvMemoryStream aMemStm; sal_uLong nCvtType; - aMemStm.SetBuffer( (char*) pData, mnBufSize, false, mnBufSize ); + aMemStm.SetBuffer( const_cast<sal_uInt8*>(pData), mnBufSize, false, mnBufSize ); switch( meType ) { diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx index 32727c46bdf8..b547380a78d0 100644 --- a/vcl/source/gdi/impvect.cxx +++ b/vcl/source/gdi/impvect.cxx @@ -157,7 +157,7 @@ void ImplPointArray::ImplSetSize( sal_uLong nSize ) rtl_freeMemory( mpArray ); mpArray = (Point*) rtl_allocateMemory( nTotal ); - memset( (HPBYTE) mpArray, 0, nTotal ); + memset( mpArray, 0, nTotal ); } inline Point& ImplPointArray::operator[]( sal_uLong nPos ) @@ -646,7 +646,7 @@ bool ImplVectorizer::ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, const long nHeight = pRAcc->Height(); const sal_uInt16 nColorCount = pRAcc->GetPaletteEntryCount(); sal_uInt16 n; - ImplColorSet* pColorSet = (ImplColorSet*) new sal_uInt8[ 256 * sizeof( ImplColorSet ) ]; + ImplColorSet* pColorSet = reinterpret_cast<ImplColorSet*>(new sal_uInt8[ 256 * sizeof( ImplColorSet ) ]); memset( pColorSet, 0, 256 * sizeof( ImplColorSet ) ); rMtf.Clear(); @@ -707,7 +707,7 @@ bool ImplVectorizer::ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, VECT_PROGRESS( pProgress, FRound( fPercent += fPercentStep_2 ) ); } - delete[] (sal_uInt8*) pColorSet; + delete[] reinterpret_cast<sal_uInt8*>(pColorSet); if( rMtf.GetActionSize() ) { diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx index f376d14a5262..b37b970b4803 100644 --- a/vcl/source/gdi/jobset.cxx +++ b/vcl/source/gdi/jobset.cxx @@ -232,7 +232,7 @@ SvStream& ReadJobSetup( SvStream& rIStream, JobSetup& rJobSetup ) rIStream.Read( pTempBuf.get(), nLen - sizeof( nLen ) - sizeof( nSystem ) ); if ( nLen >= sizeof(ImplOldJobSetupData)+4 ) { - ImplOldJobSetupData* pData = (ImplOldJobSetupData*)pTempBuf.get(); + ImplOldJobSetupData* pData = reinterpret_cast<ImplOldJobSetupData*>(pTempBuf.get()); if ( rJobSetup.mpData ) { if ( rJobSetup.mpData->mnRefCount == 1 ) @@ -254,7 +254,7 @@ SvStream& ReadJobSetup( SvStream& rIStream, JobSetup& rJobSetup ) if ( nSystem == JOBSET_FILE364_SYSTEM || nSystem == JOBSET_FILE605_SYSTEM ) { - Impl364JobSetupData* pOldJobData = (Impl364JobSetupData*)(pTempBuf.get() + sizeof( ImplOldJobSetupData )); + Impl364JobSetupData* pOldJobData = reinterpret_cast<Impl364JobSetupData*>(pTempBuf.get() + sizeof( ImplOldJobSetupData )); sal_uInt16 nOldJobDataSize = SVBT16ToShort( pOldJobData->nSize ); pJobData->mnSystem = SVBT16ToShort( pOldJobData->nSystem ); pJobData->mnDriverDataLen = SVBT32ToUInt32( pOldJobData->nDriverDataLen ); @@ -266,7 +266,7 @@ SvStream& ReadJobSetup( SvStream& rIStream, JobSetup& rJobSetup ) pJobData->mnPaperHeight = (long)SVBT32ToUInt32( pOldJobData->nPaperHeight ); if ( pJobData->mnDriverDataLen ) { - sal_uInt8* pDriverData = ((sal_uInt8*)pOldJobData) + nOldJobDataSize; + sal_uInt8* pDriverData = reinterpret_cast<sal_uInt8*>(pOldJobData) + nOldJobDataSize; pJobData->mpDriverData = (sal_uInt8*)rtl_allocateMemory( pJobData->mnDriverDataLen ); memcpy( pJobData->mpDriverData, pDriverData, pJobData->mnDriverDataLen ); } @@ -339,9 +339,9 @@ SvStream& WriteJobSetup( SvStream& rOStream, const JobSetup& rJobSetup ) int nPos = rOStream.Tell(); rOStream.WriteUInt16( nLen ); rOStream.WriteUInt16( nSystem ); - rOStream.Write( (char*)&aOldData, sizeof( aOldData ) ); - rOStream.Write( (char*)&aOldJobData, nOldJobDataSize ); - rOStream.Write( (char*)pJobData->mpDriverData, pJobData->mnDriverDataLen ); + rOStream.Write( &aOldData, sizeof( aOldData ) ); + rOStream.Write( &aOldJobData, nOldJobDataSize ); + rOStream.Write( pJobData->mpDriverData, pJobData->mnDriverDataLen ); std::unordered_map< OUString, OUString, OUStringHash >::const_iterator it; for( it = pJobData->maValueMap.begin(); it != pJobData->maValueMap.end(); ++it ) { diff --git a/vcl/source/gdi/mapmod.cxx b/vcl/source/gdi/mapmod.cxx index 2bf14e3fe112..ec568fa38483 100644 --- a/vcl/source/gdi/mapmod.cxx +++ b/vcl/source/gdi/mapmod.cxx @@ -100,9 +100,9 @@ MapMode::ImplMapMode::ImplGetStaticMapMode(MapUnit eUnit) // #i19496 check for out-of-bounds if( eUnit >= MAP_LASTENUMDUMMY ) - return (ImplMapMode*)aStaticImplMapModeAry; + return reinterpret_cast<ImplMapMode*>(aStaticImplMapModeAry); - ImplMapMode* pImplMapMode = ((ImplMapMode*)aStaticImplMapModeAry)+eUnit; + ImplMapMode* pImplMapMode = reinterpret_cast<ImplMapMode*>(aStaticImplMapModeAry)+eUnit; if ( !pImplMapMode->mbSimple ) { Fraction aDefFraction( 1, 1 ); diff --git a/vcl/source/gdi/octree.cxx b/vcl/source/gdi/octree.cxx index eac0f522fc84..1aac1ef17a97 100644 --- a/vcl/source/gdi/octree.cxx +++ b/vcl/source/gdi/octree.cxx @@ -269,7 +269,7 @@ InverseColorMap::InverseColorMap( const BitmapPalette& rPal ) : const long cginc = ( xsqr - ( cGreen << nBits ) ) << 1L; const long cbinc = ( xsqr - ( cBlue << nBits ) ) << 1L; - sal_uLong* cdp = (sal_uLong*) pBuffer; + sal_uLong* cdp = reinterpret_cast<sal_uLong*>(pBuffer); sal_uInt8* crgbp = pMap; for( r = 0, rxx = crinc; r < nColorMax; rdist += rxx, r++, rxx += xsqr2 ) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index a8c127d98927..ad79eb2ec39a 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2052,7 +2052,7 @@ inline void PDFWriterImpl::appendLiteralStringEncrypt( OStringBuffer& rInString, //encrypt the string in a buffer, then append it enableStringEncryption( nInObjectNumber ); rtl_cipher_encodeARCFOUR( m_aCipher, rInString.getStr(), nChars, m_pEncryptionBuffer, nChars ); - appendLiteralString( (const sal_Char*)m_pEncryptionBuffer, nChars, rOutBuffer ); + appendLiteralString( reinterpret_cast<sal_Char*>(m_pEncryptionBuffer), nChars, rOutBuffer ); } else appendLiteralString( rInString.getStr(), nChars , rOutBuffer ); @@ -3739,7 +3739,7 @@ sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8* pEncoding, ZCodec pCodec( 0x4000, 0x4000 ); SvMemoryStream aStream; pCodec.BeginCompression(); - pCodec.Write( aStream, (const sal_uInt8*)aContents.getStr(), aContents.getLength() ); + pCodec.Write( aStream, reinterpret_cast<const sal_uInt8*>(aContents.getStr()), aContents.getLength() ); pCodec.EndCompression(); #endif @@ -6779,9 +6779,9 @@ bool PDFWriterImpl::emitTrailer() // emit the owner password, must not be encrypted aLineS.append( "/O(" ); - appendLiteralString( (const sal_Char*)&m_aContext.Encryption.OValue[0], sal_Int32(m_aContext.Encryption.OValue.size()), aLineS ); + appendLiteralString( reinterpret_cast<char*>(&m_aContext.Encryption.OValue[0]), sal_Int32(m_aContext.Encryption.OValue.size()), aLineS ); aLineS.append( ")/U(" ); - appendLiteralString( (const sal_Char*)&m_aContext.Encryption.UValue[0], sal_Int32(m_aContext.Encryption.UValue.size()), aLineS ); + appendLiteralString( reinterpret_cast<char*>(&m_aContext.Encryption.UValue[0]), sal_Int32(m_aContext.Encryption.UValue.size()), aLineS ); aLineS.append( ")/P " );// the permission set aLineS.append( m_nAccessPermissions ); aLineS.append( ">>\nendobj\n\n" ); diff --git a/vcl/source/gdi/svgdata.cxx b/vcl/source/gdi/svgdata.cxx index 3a98b87d8b55..689ffd219fd9 100644 --- a/vcl/source/gdi/svgdata.cxx +++ b/vcl/source/gdi/svgdata.cxx @@ -105,7 +105,7 @@ void SvgData::ensureSequenceAndRange() maRange.reset(); // create stream - const uno::Sequence< sal_Int8 > aPostData((sal_Int8*)maSvgDataArray.get(), mnSvgDataArrayLength); + const uno::Sequence< sal_Int8 > aPostData(reinterpret_cast<sal_Int8*>(maSvgDataArray.get()), mnSvgDataArrayLength); const uno::Reference< io::XInputStream > myInputStream(new comphelper::SequenceInputStream(aPostData)); if(myInputStream.is()) diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index d9bf3c2a401e..06001aa392f4 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -598,11 +598,11 @@ GLXFBConfig* getFBConfig(Display* dpy, Window win, int& nBestFBC, bool bUseDoubl // glew needs an OpenGL context so we need to get the address manually void initOpenGLFunctionPointers() { - glXChooseFBConfig = (GLXFBConfig*(*)(Display *dpy, int screen, const int *attrib_list, int *nelements))glXGetProcAddressARB((GLubyte*)"glXChooseFBConfig"); - glXGetVisualFromFBConfig = (XVisualInfo*(*)(Display *dpy, GLXFBConfig config))glXGetProcAddressARB((GLubyte*)"glXGetVisualFromFBConfig"); // try to find a visual for the current set of attributes - glXGetFBConfigAttrib = (int(*)(Display *dpy, GLXFBConfig config, int attribute, int* value))glXGetProcAddressARB((GLubyte*)"glXGetFBConfigAttrib"); - glXCreateContextAttribsARB = (GLXContext(*) (Display*, GLXFBConfig, GLXContext, Bool, const int*)) glXGetProcAddressARB((const GLubyte *) "glXCreateContextAttribsARB");; - glXCreatePixmap = (GLXPixmap(*) (Display*, GLXFBConfig, Pixmap, const int*)) glXGetProcAddressARB((const GLubyte *) "glXCreatePixmap");; + glXChooseFBConfig = reinterpret_cast<GLXFBConfig*(*)(Display *dpy, int screen, const int *attrib_list, int *nelements)>(glXGetProcAddressARB(reinterpret_cast<GLubyte const *>("glXChooseFBConfig"))); + glXGetVisualFromFBConfig = reinterpret_cast<XVisualInfo*(*)(Display *dpy, GLXFBConfig config)>(glXGetProcAddressARB(reinterpret_cast<GLubyte const *>("glXGetVisualFromFBConfig"))); // try to find a visual for the current set of attributes + glXGetFBConfigAttrib = reinterpret_cast<int(*)(Display *dpy, GLXFBConfig config, int attribute, int* value)>(glXGetProcAddressARB(reinterpret_cast<GLubyte const *>("glXGetFBConfigAttrib"))); + glXCreateContextAttribsARB = reinterpret_cast<GLXContext(*)(Display*, GLXFBConfig, GLXContext, Bool, const int*)>(glXGetProcAddressARB(reinterpret_cast<const GLubyte *>("glXCreateContextAttribsARB"))); + glXCreatePixmap = reinterpret_cast<GLXPixmap(*)(Display*, GLXFBConfig, Pixmap, const int*)>(glXGetProcAddressARB(reinterpret_cast<const GLubyte *>("glXCreatePixmap"))); } Visual* getVisual(Display* dpy, Window win) @@ -795,7 +795,7 @@ bool OpenGLContext::ImplInit() { // enable vsync typedef GLint (*glXSwapIntervalProc)(GLint); - glXSwapIntervalProc glXSwapInterval = (glXSwapIntervalProc) glXGetProcAddress( (const GLubyte*) "glXSwapIntervalSGI" ); + glXSwapIntervalProc glXSwapInterval = reinterpret_cast<glXSwapIntervalProc>(glXGetProcAddress( reinterpret_cast<const GLubyte*>("glXSwapIntervalSGI") )); if( glXSwapInterval ) { TempErrorHandler(m_aGLWin.dpy, oglErrorHandler); @@ -1224,7 +1224,7 @@ void OpenGLContext::reset() glXMakeCurrent(m_aGLWin.dpy, None, NULL); if( glGetError() != GL_NO_ERROR ) { - SAL_WARN("vcl.opengl", "glError: " << (char *)gluErrorString(glGetError())); + SAL_WARN("vcl.opengl", "glError: " << reinterpret_cast<char const *>(gluErrorString(glGetError()))); } glXDestroyContext(m_aGLWin.dpy, m_aGLWin.ctx); diff --git a/vcl/source/outdev/curvedshapes.cxx b/vcl/source/outdev/curvedshapes.cxx index bca6c7489b80..92697fff1dd2 100644 --- a/vcl/source/outdev/curvedshapes.cxx +++ b/vcl/source/outdev/curvedshapes.cxx @@ -52,7 +52,7 @@ void OutputDevice::DrawEllipse( const Rectangle& rRect ) Polygon aRectPoly( aRect.Center(), aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 ); if ( aRectPoly.GetSize() >= 2 ) { - const SalPoint* pPtAry = (const SalPoint*)aRectPoly.GetConstPointAry(); + const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(aRectPoly.GetConstPointAry()); if ( !mbFillColor ) mpGraphics->DrawPolyLine( aRectPoly.GetSize(), pPtAry, this ); else @@ -101,7 +101,7 @@ void OutputDevice::DrawArc( const Rectangle& rRect, if ( aArcPoly.GetSize() >= 2 ) { - const SalPoint* pPtAry = (const SalPoint*)aArcPoly.GetConstPointAry(); + const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(aArcPoly.GetConstPointAry()); mpGraphics->DrawPolyLine( aArcPoly.GetSize(), pPtAry, this ); } @@ -143,7 +143,7 @@ void OutputDevice::DrawPie( const Rectangle& rRect, if ( aPiePoly.GetSize() >= 2 ) { - const SalPoint* pPtAry = (const SalPoint*)aPiePoly.GetConstPointAry(); + const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(aPiePoly.GetConstPointAry()); if ( !mbFillColor ) mpGraphics->DrawPolyLine( aPiePoly.GetSize(), pPtAry, this ); else @@ -192,7 +192,7 @@ void OutputDevice::DrawChord( const Rectangle& rRect, if ( aChordPoly.GetSize() >= 2 ) { - const SalPoint* pPtAry = (const SalPoint*)aChordPoly.GetConstPointAry(); + const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(aChordPoly.GetConstPointAry()); if ( !mbFillColor ) mpGraphics->DrawPolyLine( aChordPoly.GetSize(), pPtAry, this ); else diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index c2e820e4c0ab..d25a533f8d3d 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -402,7 +402,7 @@ void OutputDevice::ImplGetEmphasisMark( tools::PolyPolygon& rPolyPoly, bool& rPo else { Polygon aPoly( sizeof( aAccentPos ) / sizeof( long ) / 2, - (const Point*)aAccentPos, + reinterpret_cast<const Point*>(aAccentPos), aAccentPolyFlags ); double dScale = ((double)nDotSize)/1000.0; aPoly.Scale( dScale, dScale ); diff --git a/vcl/source/outdev/line.cxx b/vcl/source/outdev/line.cxx index 50e5a4740b51..08348eb762c1 100644 --- a/vcl/source/outdev/line.cxx +++ b/vcl/source/outdev/line.cxx @@ -238,7 +238,7 @@ void OutputDevice::drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const Lin if(!bDone) { const Polygon aPolygon(aCandidate); - mpGraphics->DrawPolyLine(aPolygon.GetSize(), (const SalPoint*)aPolygon.GetConstPointAry(), this); + mpGraphics->DrawPolyLine(aPolygon.GetSize(), reinterpret_cast<const SalPoint*>(aPolygon.GetConstPointAry()), this); } } } @@ -268,7 +268,7 @@ void OutputDevice::drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const Lin // need to subdivide, mpGraphics->DrawPolygon ignores curves aPolygon.AdaptiveSubdivide(aPolygon); - mpGraphics->DrawPolygon(aPolygon.GetSize(), (const SalPoint*)aPolygon.GetConstPointAry(), this); + mpGraphics->DrawPolygon(aPolygon.GetSize(), reinterpret_cast<const SalPoint*>(aPolygon.GetConstPointAry()), this); } } diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 82b80c3c62db..0305c947637d 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -300,7 +300,7 @@ SystemGraphicsData OutputDevice::GetSystemGfxData() const css::uno::Any OutputDevice::GetSystemGfxDataAny() const { const SystemGraphicsData aSysData = GetSystemGfxData(); - css::uno::Sequence< sal_Int8 > aSeq( (sal_Int8*)&aSysData, + css::uno::Sequence< sal_Int8 > aSeq( reinterpret_cast<sal_Int8 const *>(&aSysData), aSysData.nSize ); return css::uno::makeAny(aSeq); diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx index 03fa16888ea3..fdcb85227543 100644 --- a/vcl/source/outdev/polygon.cxx +++ b/vcl/source/outdev/polygon.cxx @@ -208,7 +208,7 @@ void OutputDevice::DrawPolygon( const Polygon& rPoly ) } Polygon aPoly = ImplLogicToDevicePixel( rPoly ); - const SalPoint* pPtAry = (const SalPoint*)aPoly.GetConstPointAry(); + const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(aPoly.GetConstPointAry()); // #100127# Forward beziers to sal, if any if( aPoly.HasFlags() ) @@ -217,7 +217,7 @@ void OutputDevice::DrawPolygon( const Polygon& rPoly ) if( !mpGraphics->DrawPolygonBezier( nPoints, pPtAry, pFlgAry, this ) ) { aPoly = Polygon::SubdivideBezier(aPoly); - pPtAry = (const SalPoint*)aPoly.GetConstPointAry(); + pPtAry = reinterpret_cast<const SalPoint*>(aPoly.GetConstPointAry()); mpGraphics->DrawPolygon( aPoly.GetSize(), pPtAry, this ); } } @@ -352,7 +352,7 @@ void OutputDevice::ImplDrawPolyPolygon( sal_uInt16 nPoly, const tools::PolyPolyg if ( nSize ) { pPointAry[j] = nSize; - pPointAryAry[j] = (PCONSTSALPOINT)rPoly.GetConstPointAry(); + pPointAryAry[j] = reinterpret_cast<PCONSTSALPOINT>(rPoly.GetConstPointAry()); pFlagAryAry[j] = rPoly.GetConstFlagAry(); last = i; @@ -373,7 +373,7 @@ void OutputDevice::ImplDrawPolyPolygon( sal_uInt16 nPoly, const tools::PolyPolyg if( !mpGraphics->DrawPolygonBezier( *pPointAry, *pPointAryAry, *pFlagAryAry, this ) ) { Polygon aPoly = Polygon::SubdivideBezier( rPolyPoly.GetObject( last ) ); - mpGraphics->DrawPolygon( aPoly.GetSize(), (const SalPoint*)aPoly.GetConstPointAry(), this ); + mpGraphics->DrawPolygon( aPoly.GetSize(), reinterpret_cast<const SalPoint*>(aPoly.GetConstPointAry()), this ); } } else @@ -419,7 +419,7 @@ void OutputDevice::ImplDrawPolygon( const Polygon& rPoly, const tools::PolyPolyg if ( nPoints < 2 ) return; - const SalPoint* pPtAry = (const SalPoint*)rPoly.GetConstPointAry(); + const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(rPoly.GetConstPointAry()); mpGraphics->DrawPolygon( nPoints, pPtAry, this ); } } @@ -444,7 +444,7 @@ void OutputDevice::ImplDrawPolyPolygon( const tools::PolyPolygon& rPolyPoly, con if( nSize >= 2 ) { - const SalPoint* pPtAry = (const SalPoint*)rPoly.GetConstPointAry(); + const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(rPoly.GetConstPointAry()); mpGraphics->DrawPolygon( nSize, pPtAry, this ); } } @@ -461,7 +461,7 @@ void OutputDevice::ImplDrawPolyPolygon( const tools::PolyPolygon& rPolyPoly, con if ( nSize ) { pPointAry[i] = nSize; - pPointAryAry[i] = (PCONSTSALPOINT)rPoly.GetConstPointAry(); + pPointAryAry[i] = reinterpret_cast<PCONSTSALPOINT>(rPoly.GetConstPointAry()); i++; } else diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx index 78eb139ac6b2..2c50d7243767 100644 --- a/vcl/source/outdev/polyline.cxx +++ b/vcl/source/outdev/polyline.cxx @@ -75,7 +75,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly ) } Polygon aPoly = ImplLogicToDevicePixel( rPoly ); - const SalPoint* pPtAry = (const SalPoint*)aPoly.GetConstPointAry(); + const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(aPoly.GetConstPointAry()); // #100127# Forward beziers to sal, if any if( aPoly.HasFlags() ) @@ -84,7 +84,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly ) if( !mpGraphics->DrawPolyLineBezier( nPoints, pPtAry, pFlgAry, this ) ) { aPoly = Polygon::SubdivideBezier(aPoly); - pPtAry = (const SalPoint*)aPoly.GetConstPointAry(); + pPtAry = reinterpret_cast<const SalPoint*>(aPoly.GetConstPointAry()); mpGraphics->DrawPolyLine( aPoly.GetSize(), pPtAry, this ); } } @@ -257,7 +257,7 @@ void OutputDevice::drawPolyLine(const Polygon& rPoly, const LineInfo& rLineInfo) nPoints = aPoly.GetSize(); } - mpGraphics->DrawPolyLine(nPoints, (const SalPoint*)aPoly.GetConstPointAry(), this); + mpGraphics->DrawPolyLine(nPoints, reinterpret_cast<const SalPoint*>(aPoly.GetConstPointAry()), this); } if( mpAlphaVDev ) diff --git a/vcl/source/outdev/rect.cxx b/vcl/source/outdev/rect.cxx index ac7c96c8d1cc..4606e7be28f6 100644 --- a/vcl/source/outdev/rect.cxx +++ b/vcl/source/outdev/rect.cxx @@ -108,7 +108,7 @@ void OutputDevice::DrawRect( const Rectangle& rRect, if ( aRoundRectPoly.GetSize() >= 2 ) { - const SalPoint* pPtAry = (const SalPoint*) aRoundRectPoly.GetConstPointAry(); + const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(aRoundRectPoly.GetConstPointAry()); if ( !mbFillColor ) mpGraphics->DrawPolyLine( aRoundRectPoly.GetSize(), pPtAry, this ); diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx index d3d7393a55f0..694cac55b75b 100644 --- a/vcl/source/outdev/transparent.cxx +++ b/vcl/source/outdev/transparent.cxx @@ -474,7 +474,7 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly, { const BitmapPalette& rPal = pW->GetPalette(); const sal_uInt16 nCount = rPal.GetEntryCount(); - BitmapColor* pMap = (BitmapColor*) new sal_uInt8[ nCount * sizeof( BitmapColor ) ]; + BitmapColor* pMap = reinterpret_cast<BitmapColor*>(new sal_uInt8[ nCount * sizeof( BitmapColor ) ]); for( sal_uInt16 i = 0; i < nCount; i++ ) { @@ -520,7 +520,7 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly, } } } - delete[] (sal_uInt8*) pMap; + delete[] reinterpret_cast<sal_uInt8*>(pMap); } else { diff --git a/vcl/source/window/abstdlg.cxx b/vcl/source/window/abstdlg.cxx index 869800ace32d..0b3101129df4 100644 --- a/vcl/source/window/abstdlg.cxx +++ b/vcl/source/window/abstdlg.cxx @@ -41,8 +41,8 @@ VclAbstractDialogFactory* VclAbstractDialogFactory::Create() aDialogLibrary.loadRelative(&thisModule, CUI_DLL_NAME, SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY)) { - fp = ( VclAbstractDialogFactory* (SAL_CALL*)() ) - aDialogLibrary.getFunctionSymbol( OUString("CreateDialogFactory") ); + fp = reinterpret_cast<VclAbstractDialogFactory* (SAL_CALL*)()>( + aDialogLibrary.getFunctionSymbol( OUString("CreateDialogFactory") ) ); } #else fp = CreateDialogFactory; diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index e6d675d4b547..29f4ca57cb56 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1685,9 +1685,9 @@ vcl::Window *VclBuilder::makeObject(vcl::Window *pParent, const OString &name, c pModule->loadRelative(&thisModule, sModule); aI = m_aModuleMap.insert(sModule, pModule).first; } - customMakeWidget pFunction = (customMakeWidget)aI->second->getFunctionSymbol(sFunction); + customMakeWidget pFunction = reinterpret_cast<customMakeWidget>(aI->second->getFunctionSymbol(sFunction)); #else - customMakeWidget pFunction = (customMakeWidget)osl_getFunctionSymbol((oslModule) RTLD_DEFAULT, sFunction.pData); + customMakeWidget pFunction = reinterpret_cast<customMakeWidget>(osl_getFunctionSymbol((oslModule) RTLD_DEFAULT, sFunction.pData)); #endif if (pFunction) pWindow = (*pFunction)(pParent, rMap); diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx index d930c3d7b543..2cc2d3adef69 100644 --- a/vcl/source/window/syschild.cxx +++ b/vcl/source/window/syschild.cxx @@ -225,7 +225,7 @@ sal_IntPtr SystemChildWindow::GetParentWindowHandle( bool bUseJava ) uno::Reference< java::XJavaVM > xJavaVM = java::JavaVirtualMachine::create(xContext);; uno::Sequence< sal_Int8 > aProcessID( 17 ); - rtl_getGlobalProcessId( (sal_uInt8*) aProcessID.getArray() ); + rtl_getGlobalProcessId( reinterpret_cast<sal_uInt8*>(aProcessID.getArray()) ); aProcessID[ 16 ] = 0; OSL_ENSURE(sizeof (sal_Int64) >= sizeof (jvmaccess::VirtualMachine *), "Pointer cannot be represented as sal_Int64"); sal_Int64 nPointer = reinterpret_cast< sal_Int64 >( static_cast< jvmaccess::VirtualMachine * >(0)); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index d402d52d4758..d63aaa0181e5 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -3888,7 +3888,7 @@ Any Window::GetSystemDataAny() const const SystemEnvData* pSysData = GetSystemData(); if( pSysData ) { - Sequence< sal_Int8 > aSeq( (sal_Int8*)pSysData, pSysData->nSize ); + Sequence< sal_Int8 > aSeq( reinterpret_cast<sal_Int8 const *>(pSysData), pSysData->nSize ); aRet <<= aSeq; } return aRet; diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 3f9df5e3b584..2fa48aeb8239 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -191,7 +191,7 @@ void Window::Invert( const Polygon& rPoly, sal_uInt16 nFlags ) nSalFlags |= SAL_INVERT_HIGHLIGHT; if ( nFlags & INVERT_50 ) nSalFlags |= SAL_INVERT_50; - const SalPoint* pPtAry = (const SalPoint*)aPoly.GetConstPointAry(); + const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(aPoly.GetConstPointAry()); mpGraphics->Invert( nPoints, pPtAry, nSalFlags, this ); } @@ -341,7 +341,7 @@ void Window::InvertTracking( const Polygon& rPoly, sal_uInt16 nFlags ) } } - const SalPoint* pPtAry = (const SalPoint*)aPoly.GetConstPointAry(); + const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(aPoly.GetConstPointAry()); pGraphics->Invert( nPoints, pPtAry, SAL_INVERT_TRACKFRAME, this ); } diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index 33515067570e..1f75bd63a5ec 100644 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx @@ -73,7 +73,7 @@ void WorkWindow::ImplInit( vcl::Window* pParent, WinBits nStyle, const ::com::su { ::com::sun::star::uno::Sequence< sal_Int8 > aSeq; aSystemWorkWindowToken >>= aSeq; - SystemParentData* pData = (SystemParentData*)aSeq.getArray(); + SystemParentData* pData = reinterpret_cast<SystemParentData*>(aSeq.getArray()); DBG_ASSERT( aSeq.getLength() == sizeof( SystemParentData ) && pData->nSize == sizeof( SystemParentData ), "WorkWindow::WorkWindow( vcl::Window*, const Any&, WinBits ) called with invalid Any" ); // init with style 0 as does WorkWindow::WorkWindow( SystemParentData* ); ImplInit( pParent, 0, pData ); diff --git a/vcl/unx/generic/app/i18n_cb.cxx b/vcl/unx/generic/app/i18n_cb.cxx index 015f226ed8fb..e025881f66df 100644 --- a/vcl/unx/generic/app/i18n_cb.cxx +++ b/vcl/unx/generic/app/i18n_cb.cxx @@ -42,7 +42,7 @@ int PreeditStartCallback ( XIC, XPointer client_data, XPointer ) { - preedit_data_t* pPreeditData = (preedit_data_t*)client_data; + preedit_data_t* pPreeditData = reinterpret_cast<preedit_data_t*>(client_data); if ( pPreeditData->eState == ePreeditStatusActivationRequired ) { pPreeditData->eState = ePreeditStatusActive; @@ -58,7 +58,7 @@ PreeditStartCallback ( XIC, XPointer client_data, XPointer ) void PreeditDoneCallback ( XIC, XPointer client_data, XPointer ) { - preedit_data_t* pPreeditData = (preedit_data_t*)client_data; + preedit_data_t* pPreeditData = reinterpret_cast<preedit_data_t*>(client_data); if (pPreeditData->eState == ePreeditStatusActive ) { if( pPreeditData->pFrame ) @@ -191,7 +191,7 @@ Preedit_InsertText(preedit_text_t *pText, XIMText *pInsertText, int where) } else { - pInsertTextString = (sal_Unicode*)pMBString; + pInsertTextString = reinterpret_cast<sal_Unicode*>(pMBString); } // enlarge target text-buffer if necessary @@ -303,7 +303,7 @@ void PreeditDrawCallback(XIC ic, XPointer client_data, XIMPreeditDrawCallbackStruct *call_data) { - preedit_data_t* pPreeditData = (preedit_data_t*)client_data; + preedit_data_t* pPreeditData = reinterpret_cast<preedit_data_t*>(client_data); // if there's nothing to change then change nothing if ( ( (call_data->text == NULL) && (call_data->chg_length == 0) ) @@ -377,7 +377,7 @@ PreeditDrawCallback(XIC ic, XPointer client_data, if (pPreeditData->aText.nLength == 0) pPreeditData->eState = ePreeditStatusStartPending; - GetPreeditSpotLocation(ic, (XPointer)pPreeditData); + GetPreeditSpotLocation(ic, reinterpret_cast<XPointer>(pPreeditData)); } void @@ -387,7 +387,7 @@ GetPreeditSpotLocation(XIC ic, XPointer client_data) // Send SalEventExtTextInputPos event to get spotlocation SalExtTextInputPosEvent mPosEvent; - preedit_data_t* pPreeditData = (preedit_data_t*)client_data; + preedit_data_t* pPreeditData = reinterpret_cast<preedit_data_t*>(client_data); if( pPreeditData->pFrame ) pPreeditData->pFrame->CallCallback(SALEVENT_EXTTEXTINPUTPOS, (void*)&mPosEvent); @@ -522,7 +522,7 @@ StatusDrawCallback (XIC, XPointer, XIMStatusDrawCallbackStruct *call_data) void SwitchIMCallback (XIC, XPointer, XPointer call_data) { - XIMSwitchIMNotifyCallbackStruct* pCallData = (XIMSwitchIMNotifyCallbackStruct*)call_data; + XIMSwitchIMNotifyCallbackStruct* pCallData = reinterpret_cast<XIMSwitchIMNotifyCallbackStruct*>(call_data); ::vcl::I18NStatus::get().changeIM( OStringToOUString(pCallData->to->name, RTL_TEXTENCODING_UTF8) ); } @@ -531,7 +531,7 @@ SwitchIMCallback (XIC, XPointer, XPointer call_data) void IC_IMDestroyCallback (XIM, XPointer client_data, XPointer) { - SalI18N_InputContext *pContext = (SalI18N_InputContext*)client_data; + SalI18N_InputContext *pContext = reinterpret_cast<SalI18N_InputContext*>(client_data); if (pContext != NULL) pContext->HandleDestroyIM(); } @@ -539,7 +539,7 @@ IC_IMDestroyCallback (XIM, XPointer client_data, XPointer) void IM_IMDestroyCallback (XIM, XPointer client_data, XPointer) { - SalI18N_InputMethod *pMethod = (SalI18N_InputMethod*)client_data; + SalI18N_InputMethod *pMethod = reinterpret_cast<SalI18N_InputMethod*>(client_data); if (pMethod != NULL) pMethod->HandleDestroyIM(); } diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx index 379243fbe846..c055ff44c2e2 100644 --- a/vcl/unx/generic/app/i18n_ic.cxx +++ b/vcl/unx/generic/app/i18n_ic.cxx @@ -201,12 +201,12 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : static XIMCallback aStatusDoneCallback; static XIMCallback aStatusDrawCallback; - aStatusStartCallback.callback = (XIMProc)StatusStartCallback; - aStatusStartCallback.client_data = (XPointer)&maClientData; - aStatusDoneCallback.callback = (XIMProc)StatusDoneCallback; - aStatusDoneCallback.client_data = (XPointer)&maClientData; - aStatusDrawCallback.callback = (XIMProc)StatusDrawCallback; - aStatusDrawCallback.client_data = (XPointer)&maClientData; + aStatusStartCallback.callback = reinterpret_cast<XIMProc>(StatusStartCallback); + aStatusStartCallback.client_data = reinterpret_cast<XPointer>(&maClientData); + aStatusDoneCallback.callback = reinterpret_cast<XIMProc>(StatusDoneCallback); + aStatusDoneCallback.client_data = reinterpret_cast<XPointer>(&maClientData); + aStatusDrawCallback.callback = reinterpret_cast<XIMProc>(StatusDrawCallback); + aStatusDrawCallback.client_data = reinterpret_cast<XPointer>(&maClientData); mpStatusAttributes = XVaCreateNestedList ( 0, @@ -235,14 +235,14 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : { case XIMPreeditCallbacks: - maPreeditCaretCallback.callback = (XIMProc)PreeditCaretCallback; - maPreeditStartCallback.callback = (XIMProc)PreeditStartCallback; - maPreeditDoneCallback.callback = (XIMProc)PreeditDoneCallback; - maPreeditDrawCallback.callback = (XIMProc)PreeditDrawCallback; - maPreeditCaretCallback.client_data = (XPointer)&maClientData; - maPreeditStartCallback.client_data = (XPointer)&maClientData; - maPreeditDoneCallback.client_data = (XPointer)&maClientData; - maPreeditDrawCallback.client_data = (XPointer)&maClientData; + maPreeditCaretCallback.callback = reinterpret_cast<XIMProc>(PreeditCaretCallback); + maPreeditStartCallback.callback = reinterpret_cast<XIMProc>(PreeditStartCallback); + maPreeditDoneCallback.callback = reinterpret_cast<XIMProc>(PreeditDoneCallback); + maPreeditDrawCallback.callback = reinterpret_cast<XIMProc>(PreeditDrawCallback); + maPreeditCaretCallback.client_data = reinterpret_cast<XPointer>(&maClientData); + maPreeditStartCallback.client_data = reinterpret_cast<XPointer>(&maClientData); + maPreeditDoneCallback.client_data = reinterpret_cast<XPointer>(&maClientData); + maPreeditDrawCallback.client_data = reinterpret_cast<XPointer>(&maClientData); mpPreeditAttributes = XVaCreateNestedList ( 0, @@ -357,7 +357,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : if ( maContext != NULL) { maDestroyCallback.callback = (XIMProc)IC_IMDestroyCallback; - maDestroyCallback.client_data = (XPointer)this; + maDestroyCallback.client_data = reinterpret_cast<XPointer>(this); XSetICValues( maContext, XNDestroyCallback, &maDestroyCallback, NULL ); diff --git a/vcl/unx/generic/app/i18n_im.cxx b/vcl/unx/generic/app/i18n_im.cxx index 795df4031f78..dcf11cde4cc5 100644 --- a/vcl/unx/generic/app/i18n_im.cxx +++ b/vcl/unx/generic/app/i18n_im.cxx @@ -368,7 +368,7 @@ SalI18N_InputMethod::CreateMethod ( Display *pDisplay ) #endif maDestroyCallback.callback = (XIMProc)IM_IMDestroyCallback; - maDestroyCallback.client_data = (XPointer)this; + maDestroyCallback.client_data = reinterpret_cast<XPointer>(this); if (mbUseable && maMethod != NULL) XSetIMValues(maMethod, XNDestroyCallback, &maDestroyCallback, NULL); diff --git a/vcl/unx/generic/app/i18n_xkb.cxx b/vcl/unx/generic/app/i18n_xkb.cxx index 3201d1539866..cfc3bef7f3be 100644 --- a/vcl/unx/generic/app/i18n_xkb.cxx +++ b/vcl/unx/generic/app/i18n_xkb.cxx @@ -90,12 +90,12 @@ SalI18N_KeyboardExtension::Dispatch( XEvent* pEvent ) // only handle state notify events for now, and only interested // in group details - sal_uInt32 nXKBType = ((XkbAnyEvent*)pEvent)->xkb_type; + sal_uInt32 nXKBType = reinterpret_cast<XkbAnyEvent*>(pEvent)->xkb_type; switch ( nXKBType ) { case XkbStateNotify: - mnGroup = ((XkbStateNotifyEvent*)pEvent)->group; + mnGroup = reinterpret_cast<XkbStateNotifyEvent*>(pEvent)->group; break; default: diff --git a/vcl/unx/generic/app/randrwrapper.cxx b/vcl/unx/generic/app/randrwrapper.cxx index 82e94a544b27..ecdfce34e736 100644 --- a/vcl/unx/generic/app/randrwrapper.cxx +++ b/vcl/unx/generic/app/randrwrapper.cxx @@ -280,7 +280,7 @@ int SalDisplay::processRandREvent( XEvent* pEvent ) { int nRet = 0; #ifdef USE_RANDR - XConfigureEvent* pCnfEvent=(XConfigureEvent*)pEvent; + XConfigureEvent* pCnfEvent=reinterpret_cast<XConfigureEvent*>(pEvent); if( m_bUseRandRWrapper && pWrapper && pWrapper->XRRRootToScreen(GetDisplay(),pCnfEvent->window) != -1 ) { nRet = pWrapper->XRRUpdateConfiguration( pEvent ); diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index ee922853686c..3c95b574d9a3 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -398,9 +398,9 @@ SalX11Display::SalX11Display( Display *display ) pXLib_ = GetX11SalData()->GetLib(); pXLib_->Insert( ConnectionNumber( pDisp_ ), this, - (YieldFunc) DisplayHasEvent, - (YieldFunc) DisplayQueue, - (YieldFunc) DisplayYield ); + reinterpret_cast<YieldFunc>(DisplayHasEvent), + reinterpret_cast<YieldFunc>(DisplayQueue), + reinterpret_cast<YieldFunc>(DisplayYield) ); } SalX11Display::~SalX11Display() @@ -477,7 +477,7 @@ SalDisplay::initScreen( SalX11Screen nXScreen ) const XA_WINDOW, 32, PropModeReplace, - (unsigned char*)&pSD->m_aRefWindow, + reinterpret_cast<unsigned char*>(&pSD->m_aRefWindow), 1 ); @@ -1398,12 +1398,12 @@ KeySym SalDisplay::GetKeySym( XKeyEvent *pEvent, { // XmbLookupString must not be called for KeyRelease events // Cannot enter space in c locale problem #89616# #88978# btraq #4478197 - *pLen = XLookupString( pEvent, (char*)pPrintable, 1, &nKeySym, NULL ); + *pLen = XLookupString( pEvent, reinterpret_cast<char*>(pPrintable), 1, &nKeySym, NULL ); } else { *pLen = XmbLookupString( aInputContext, - pEvent, (char*)pPrintable, *pLen - 1, &nKeySym, pStatusReturn ); + pEvent, reinterpret_cast<char*>(pPrintable), *pLen - 1, &nKeySym, pStatusReturn ); // Lookup the string again, now with appropriate size if ( *pStatusReturn == XBufferOverflow ) @@ -2319,7 +2319,7 @@ Time SalDisplay::GetLastUserEventTime( bool i_bAlwaysReget ) const nAtom, nAtom, 8, PropModeReplace, &c, 1 ); XFlush( GetDisplay() ); - if( ! XIfEventWithTimeout( &aEvent, (XPointer)this, timestamp_predicate ) ) + if( ! XIfEventWithTimeout( &aEvent, reinterpret_cast<XPointer>(const_cast<SalDisplay *>(this)), timestamp_predicate ) ) { // this should not happen at all; still sometimes it happens aEvent.xproperty.time = CurrentTime; diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx index aced86b81ed8..4ec1a40908c8 100644 --- a/vcl/unx/generic/app/salinst.cxx +++ b/vcl/unx/generic/app/salinst.cxx @@ -87,7 +87,7 @@ struct PredicateReturn extern "C" { Bool ImplPredicateEvent( Display *, XEvent *pEvent, char *pData ) { - PredicateReturn *pPre = (PredicateReturn *)pData; + PredicateReturn *pPre = reinterpret_cast<PredicateReturn *>(pData); if ( pPre->bRet ) return False; @@ -141,7 +141,7 @@ bool X11SalInstance::AnyInput(VclInputFlags nType) aInput.nType = nType; XCheckIfEvent(pDisplay, &aEvent, ImplPredicateEvent, - (char *)&aInput ); + reinterpret_cast<char *>(&aInput) ); bRet = aInput.bRet; } @@ -316,7 +316,7 @@ void X11SalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const OUS osl::Module module; module.loadRelative( &thisModule, LIB_RECENT_FILE ); if (module.is()) - add_to_recently_used_file_list = (PFUNC_ADD_TO_RECENTLY_USED_LIST)module.getFunctionSymbol(SYM_ADD_TO_RECENTLY_USED_FILE_LIST); + add_to_recently_used_file_list = reinterpret_cast<PFUNC_ADD_TO_RECENTLY_USED_LIST>(module.getFunctionSymbol(SYM_ADD_TO_RECENTLY_USED_FILE_LIST)); if (add_to_recently_used_file_list) add_to_recently_used_file_list(rFileUrl, rMimeType, rDocumentService); } diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index 146768bdc547..65522c6a41c9 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -469,7 +469,7 @@ void SessionManagerClient::open(SalSession * pSession) XA_STRING, 8, PropModeReplace, - (unsigned char*)m_aClientID.getStr(), + reinterpret_cast<unsigned char const *>(m_aClientID.getStr()), m_aClientID.getLength() ); } diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index 4fe74335a05e..58d34fe3928e 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -384,7 +384,7 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) : && nItems ) { - Atom* pAtoms = (Atom*)pProperty; + Atom* pAtoms = reinterpret_cast<Atom*>(pProperty); char** pAtomNames = (char**)alloca( sizeof(char*)*nItems ); if( XGetAtomNames( m_pDisplay, pAtoms, nItems, pAtomNames ) ) { @@ -442,7 +442,7 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) : && pProperty ) { - m_nDesktops = *(long*)pProperty; + m_nDesktops = *reinterpret_cast<long*>(pProperty); XFree( pProperty ); pProperty = NULL; // get work areas @@ -463,7 +463,7 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) : ) { m_aWMWorkAreas = ::std::vector< Rectangle > ( m_nDesktops ); - long* pValues = (long*)pProperty; + long* pValues = reinterpret_cast<long*>(pProperty); for( int i = 0; i < m_nDesktops; i++ ) { Point aPoint( pValues[4*i], @@ -556,7 +556,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) : && nItems != 0 ) { - aWMChild = *(::Window*)pProperty; + aWMChild = *reinterpret_cast< ::Window* >(pProperty); XFree( pProperty ); pProperty = NULL; ::Window aCheckWindow = None; @@ -580,7 +580,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) : { GetGenericData()->ErrorTrapPush(); - aCheckWindow = *(::Window*)pProperty; + aCheckWindow = *reinterpret_cast< ::Window* >(pProperty); XFree( pProperty ); pProperty = NULL; if( aCheckWindow == aWMChild ) @@ -642,7 +642,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) : && pProperty ) { - Atom* pAtoms = (Atom*)pProperty; + Atom* pAtoms = reinterpret_cast<Atom*>(pProperty); char** pAtomNames = (char**)alloca( sizeof(char*)*nItems ); if( XGetAtomNames( m_pDisplay, pAtoms, nItems, pAtomNames ) ) { @@ -706,7 +706,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) : && pProperty ) { - m_nDesktops = *(long*)pProperty; + m_nDesktops = *reinterpret_cast<long*>(pProperty); XFree( pProperty ); pProperty = NULL; } @@ -761,7 +761,7 @@ bool WMAdaptor::getNetWmName() && nItems != 0 ) { - aWMChild = *(::Window*)pProperty; + aWMChild = *reinterpret_cast< ::Window* >(pProperty); XFree( pProperty ); pProperty = NULL; ::Window aCheckWindow = None; @@ -784,7 +784,7 @@ bool WMAdaptor::getNetWmName() if ( ! GetGenericData()->ErrorTrapPop( false ) ) { GetGenericData()->ErrorTrapPush(); - aCheckWindow = *(::Window*)pProperty; + aCheckWindow = *reinterpret_cast< ::Window* >(pProperty); XFree( pProperty ); pProperty = NULL; if( aCheckWindow == aWMChild ) @@ -807,9 +807,9 @@ bool WMAdaptor::getNetWmName() ) { if (aRealType == m_aWMAtoms[ UTF8_STRING ]) - m_aWMName = OUString( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_UTF8 ); + m_aWMName = OUString( reinterpret_cast<char*>(pProperty), nItems, RTL_TEXTENCODING_UTF8 ); else if (aRealType == XA_STRING) - m_aWMName = OUString( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_ISO_8859_1 ); + m_aWMName = OUString( reinterpret_cast<char*>(pProperty), nItems, RTL_TEXTENCODING_ISO_8859_1 ); XFree( pProperty ); pProperty = NULL; @@ -841,7 +841,7 @@ bool WMAdaptor::getNetWmName() && nItems != 0 ) { - OUString aMetaVersion( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_UTF8 ); + OUString aMetaVersion( reinterpret_cast<char*>(pProperty), nItems, RTL_TEXTENCODING_UTF8 ); nVersionMajor = aMetaVersion.getToken(0, '.').toInt32(); nVersionMinor = aMetaVersion.getToken(1, '.').toInt32(); } @@ -1009,7 +1009,7 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) const &aProp ); } - unsigned char* pData = aProp.nitems ? aProp.value : (unsigned char*)aTitle.getStr(); + unsigned char const * pData = aProp.nitems ? aProp.value : reinterpret_cast<unsigned char const *>(aTitle.getStr()); Atom nType = aProp.nitems ? aProp.encoding : XA_STRING; int nFormat = aProp.nitems ? aProp.format : 8; int nBytes = aProp.nitems ? aProp.nitems : aTitle.getLength(); @@ -1036,7 +1036,7 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) const XA_STRING, 8, PropModeReplace, - (unsigned char*)aWMLocale.getStr(), + reinterpret_cast<unsigned char const *>(aWMLocale.getStr()), aWMLocale.getLength() ); if (aProp.value != NULL) XFree( aProp.value ); @@ -1062,7 +1062,7 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) con m_aWMAtoms[ UTF8_STRING ], 8, PropModeReplace, - (unsigned char*)aTitle.getStr(), + reinterpret_cast<unsigned char const *>(aTitle.getStr()), aTitle.getLength() ); if( m_aWMAtoms[ NET_WM_ICON_NAME ] ) XChangeProperty( m_pDisplay, @@ -1071,7 +1071,7 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) con m_aWMAtoms[ UTF8_STRING ], 8, PropModeReplace, - (unsigned char*)aTitle.getStr(), + reinterpret_cast<unsigned char const *>(aTitle.getStr()), aTitle.getLength() ); } @@ -1121,7 +1121,7 @@ void NetWMAdaptor::setNetWMState( X11SalFrame* pFrame ) const XA_ATOM, 32, PropModeReplace, - (unsigned char*)aStateAtoms, + reinterpret_cast<unsigned char*>(aStateAtoms), nStateAtoms ); } @@ -1216,7 +1216,7 @@ void GnomeWMAdaptor::setGnomeWMState( X11SalFrame* pFrame ) const XA_CARDINAL, 32, PropModeReplace, - (unsigned char*)&nWinWMState, + reinterpret_cast<unsigned char*>(&nWinWMState), 1 ); if( pFrame->mbMaximizedHorz @@ -1344,7 +1344,7 @@ void WMAdaptor::setFrameTypeAndDecoration( X11SalFrame* pFrame, WMWindowType eTy m_aWMAtoms[ MOTIF_WM_HINTS ], 32, PropModeReplace, - (unsigned char*)&aHint, + reinterpret_cast<unsigned char*>(&aHint), 5 ); } @@ -1429,7 +1429,7 @@ void NetWMAdaptor::setFrameTypeAndDecoration( X11SalFrame* pFrame, WMWindowType XA_ATOM, 32, PropModeReplace, - (unsigned char*)aWindowTypes, + reinterpret_cast<unsigned char*>(aWindowTypes), nWindowTypes ); } if( ( eType == windowType_ModalDialogue || @@ -1749,7 +1749,7 @@ void GnomeWMAdaptor::enableAlwaysOnTop( X11SalFrame* pFrame, bool bEnable ) cons XA_CARDINAL, 32, PropModeReplace, - (unsigned char*)&nNewLayer, + reinterpret_cast<unsigned char*>(&nNewLayer), 1 ); } @@ -1821,7 +1821,7 @@ int NetWMAdaptor::handlePropertyNotify( X11SalFrame* pFrame, XPropertyEvent* pEv { if( nType == XA_ATOM && nFormat == 32 && nItems > 0 ) { - pStates = (Atom*)pData; + pStates = reinterpret_cast<Atom*>(pData); for( unsigned long i = 0; i < nItems; i++ ) { if( pStates[i] == m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_VERT ] && m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_VERT ] ) @@ -1895,7 +1895,7 @@ int GnomeWMAdaptor::handlePropertyNotify( X11SalFrame* pFrame, XPropertyEvent* p { if( nType == XA_CARDINAL && nFormat == 32 && nItems == 1 ) { - sal_uInt32 nWinState = *(sal_uInt32*)pData; + sal_uInt32 nWinState = *reinterpret_cast<sal_uInt32*>(pData); if( nWinState & (1<<2) ) pFrame->mbMaximizedVert = true; if( nWinState & (1<<3) ) @@ -2130,7 +2130,7 @@ int WMAdaptor::getCurrentWorkArea() const && pProperty ) { - nCurrent = int(*(sal_Int32*)pProperty); + nCurrent = int(*reinterpret_cast<sal_Int32*>(pProperty)); XFree( pProperty ); } else if( pProperty ) @@ -2169,7 +2169,7 @@ int WMAdaptor::getWindowWorkArea( ::Window aWindow ) const && pProperty ) { - nCurrent = int(*(sal_Int32*)pProperty); + nCurrent = int(*reinterpret_cast<sal_Int32*>(pProperty)); XFree( pProperty ); } else if( pProperty ) @@ -2281,7 +2281,7 @@ void NetWMAdaptor::setFrameStruts( X11SalFrame* pFrame, XA_CARDINAL, 32, PropModeReplace, - (unsigned char*)&nData, + reinterpret_cast<unsigned char*>(&nData), nSetData ); } @@ -2307,7 +2307,7 @@ void NetWMAdaptor::setUserTime( X11SalFrame* i_pFrame, long i_nUserTime ) const XA_CARDINAL, 32, PropModeReplace, - (unsigned char*)&i_nUserTime, + reinterpret_cast<unsigned char*>(&i_nUserTime), 1 ); } @@ -2327,7 +2327,7 @@ void WMAdaptor::setPID( X11SalFrame* i_pFrame ) const XA_CARDINAL, 32, PropModeReplace, - (unsigned char*)&nPID, + reinterpret_cast<unsigned char*>(&nPID), 1 ); } @@ -2339,7 +2339,7 @@ void WMAdaptor::setPID( X11SalFrame* i_pFrame ) const void WMAdaptor::setClientMachine( X11SalFrame* i_pFrame ) const { OString aWmClient( OUStringToOString( GetGenericData()->GetHostname(), RTL_TEXTENCODING_ASCII_US ) ); - XTextProperty aClientProp = { (unsigned char*)aWmClient.getStr(), XA_STRING, 8, sal::static_int_cast<unsigned long>( aWmClient.getLength() ) }; + XTextProperty aClientProp = { reinterpret_cast<unsigned char *>(const_cast<char *>(aWmClient.getStr())), XA_STRING, 8, sal::static_int_cast<unsigned long>( aWmClient.getLength() ) }; XSetWMClientMachine( m_pDisplay, i_pFrame->GetShellWindow(), &aClientProp ); } diff --git a/vcl/unx/generic/desktopdetect/desktopdetector.cxx b/vcl/unx/generic/desktopdetect/desktopdetector.cxx index 386925e3f370..4a0838b5ba34 100644 --- a/vcl/unx/generic/desktopdetect/desktopdetector.cxx +++ b/vcl/unx/generic/desktopdetect/desktopdetector.cxx @@ -96,7 +96,7 @@ static bool is_gnome_desktop( Display* pDisplay ) &pProp ); if( pProp && nType == nUTFAtom ) { - OString aWMName( (sal_Char*)pProp ); + OString aWMName( reinterpret_cast<char*>(pProp) ); if ( (aWMName.equalsIgnoreAsciiCase("gnome-shell")) || (aWMName.equalsIgnoreAsciiCase("gnome-panel")) diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index 180758c8c166..a5c8387d21fb 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -538,7 +538,7 @@ OUString SelectionManager::convertFromCompound( const char* pText, int nLen ) int nTexts = 0; XTextProperty aProp; - aProp.value = (unsigned char*)pText; + aProp.value = reinterpret_cast<unsigned char *>(const_cast<char *>(pText)); aProp.encoding = m_nCOMPOUNDAtom; aProp.format = 8; aProp.nitems = nLen; @@ -575,7 +575,7 @@ OString SelectionManager::convertToCompound( const OUString& rText ) &aProp ); if( aProp.value ) { - aRet = (char*)aProp.value; + aRet = reinterpret_cast<char*>(aProp.value); XFree( aProp.value ); #ifdef SOLARIS /* @@ -630,7 +630,7 @@ bool SelectionManager::convertData( { OUString aString; aValue >>= aString; - rData = Sequence< sal_Int8 >( (sal_Int8*)aString.getStr(), aString.getLength() * sizeof( sal_Unicode ) ); + rData = Sequence< sal_Int8 >( reinterpret_cast<sal_Int8 const *>(aString.getStr()), aString.getLength() * sizeof( sal_Unicode ) ); bSuccess = true; } else if( aValue.getValueType() == getCppuType( (Sequence< sal_Int8 >*)0 ) ) @@ -657,7 +657,7 @@ bool SelectionManager::convertData( OUString aString; aValue >>= aString; OString aByteString( bCompoundText ? convertToCompound( aString ) : OUStringToOString( aString, aEncoding ) ); - rData = Sequence< sal_Int8 >( (sal_Int8*)aByteString.getStr(), aByteString.getLength() * sizeof( sal_Char ) ); + rData = Sequence< sal_Int8 >( reinterpret_cast<sal_Int8 const *>(aByteString.getStr()), aByteString.getLength() * sizeof( sal_Char ) ); bSuccess = true; } } @@ -1031,8 +1031,8 @@ bool SelectionManager::getPasteData( Atom selection, const OUString& rType, Sequ aData ) ) { - OUString aRet( (const sal_Char*)aData.getConstArray(), aData.getLength(), RTL_TEXTENCODING_UTF8 ); - rData = Sequence< sal_Int8 >( (sal_Int8*)aRet.getStr(), (aRet.getLength()+1)*sizeof( sal_Unicode ) ); + OUString aRet( reinterpret_cast<const char*>(aData.getConstArray()), aData.getLength(), RTL_TEXTENCODING_UTF8 ); + rData = Sequence< sal_Int8 >( reinterpret_cast<sal_Int8 const *>(aRet.getStr()), (aRet.getLength()+1)*sizeof( sal_Unicode ) ); bSuccess = true; } else if( it->second->m_bHaveCompound && @@ -1041,8 +1041,8 @@ bool SelectionManager::getPasteData( Atom selection, const OUString& rType, Sequ aData ) ) { - OUString aRet( convertFromCompound( (const char*)aData.getConstArray(), aData.getLength() ) ); - rData = Sequence< sal_Int8 >( (sal_Int8*)aRet.getStr(), (aRet.getLength()+1)*sizeof( sal_Unicode ) ); + OUString aRet( convertFromCompound( reinterpret_cast<const char*>(aData.getConstArray()), aData.getLength() ) ); + rData = Sequence< sal_Int8 >( reinterpret_cast<sal_Int8 const *>(aRet.getStr()), (aRet.getLength()+1)*sizeof( sal_Unicode ) ); bSuccess = true; } else @@ -1063,9 +1063,9 @@ bool SelectionManager::getPasteData( Atom selection, const OUString& rType, Sequ OUStringToOString( rType, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); #endif - OString aConvert( (sal_Char*)aData.getConstArray(), aData.getLength() ); + OString aConvert( reinterpret_cast<char const *>(aData.getConstArray()), aData.getLength() ); OUString aUTF( OStringToOUString( aConvert, aEncoding ) ); - rData = Sequence< sal_Int8 >( (sal_Int8*)aUTF.getStr(), (aUTF.getLength()+1)*sizeof( sal_Unicode ) ); + rData = Sequence< sal_Int8 >( reinterpret_cast<sal_Int8 const *>(aUTF.getStr()), (aUTF.getLength()+1)*sizeof( sal_Unicode ) ); bSuccess = true; break; } @@ -1100,14 +1100,14 @@ bool SelectionManager::getPasteData( Atom selection, const OUString& rType, Sequ XA_ATOM, 32, PropModeReplace, - (unsigned char*)pTypes, + reinterpret_cast<unsigned char*>(pTypes), 4 ); } // try MULTIPLE request if( getPasteData( selection, m_nMULTIPLEAtom, aData ) ) { - Atom* pReturnedTypes = (Atom*)aData.getArray(); + Atom* pReturnedTypes = reinterpret_cast<Atom*>(aData.getArray()); if( pReturnedTypes[0] == XA_PIXMAP && pReturnedTypes[1] == XA_PIXMAP ) { osl::MutexGuard aGuard(m_aMutex); @@ -1121,7 +1121,7 @@ bool SelectionManager::getPasteData( Atom selection, const OUString& rType, Sequ if( pReturn ) { if( type == XA_PIXMAP ) - aPixmap = *(Pixmap*)pReturn; + aPixmap = *reinterpret_cast<Pixmap*>(pReturn); XFree( pReturn ); pReturn = NULL; if( pReturnedTypes[2] == XA_COLORMAP && pReturnedTypes[3] == XA_COLORMAP ) @@ -1130,7 +1130,7 @@ bool SelectionManager::getPasteData( Atom selection, const OUString& rType, Sequ if( pReturn ) { if( type == XA_COLORMAP ) - aColormap = *(Colormap*)pReturn; + aColormap = *reinterpret_cast<Colormap*>(pReturn); XFree( pReturn ); } } @@ -1149,9 +1149,9 @@ bool SelectionManager::getPasteData( Atom selection, const OUString& rType, Sequ // perhaps two normal requests will work if( getPasteData( selection, XA_PIXMAP, aData ) ) { - aPixmap = *(Pixmap*)aData.getArray(); + aPixmap = *reinterpret_cast<Pixmap*>(aData.getArray()); if( aColormap == None && getPasteData( selection, XA_COLORMAP, aData ) ) - aColormap = *(Colormap*)aData.getArray(); + aColormap = *reinterpret_cast<Colormap*>(aData.getArray()); } } @@ -1288,7 +1288,7 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor > aAtoms.realloc( sizeof(Atom)*n ); for( i = 0, n = 0; i < 3; i++ ) if( m_aDropEnterEvent.data.l[2+i] ) - ((Atom*)aAtoms.getArray())[n++] = m_aDropEnterEvent.data.l[2+i]; + reinterpret_cast<Atom*>(aAtoms.getArray())[n++] = m_aDropEnterEvent.data.l[2+i]; } } } @@ -1300,7 +1300,7 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor > if( aAtoms.getLength() ) { sal_Int32 nAtoms = aAtoms.getLength() / sizeof(Atom); - Atom* pAtoms = (Atom*)aAtoms.getArray(); + Atom* pAtoms = reinterpret_cast<Atom*>(aAtoms.getArray()); rTypes.realloc( nAtoms ); aNativeTypes.resize( nAtoms ); DataFlavor* pFlavors = rTypes.getArray(); @@ -1459,7 +1459,7 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor, // the pixmap in another thread pPixmap = getPixmapHolder( selection ); // conversion succeeded, so aData contains image/bmp now - if( pPixmap->needsConversion( (const sal_uInt8*)aData.getConstArray() ) ) + if( pPixmap->needsConversion( reinterpret_cast<const sal_uInt8*>(aData.getConstArray()) ) ) { SAL_INFO( "vcl", "trying bitmap conversion" ); int depth = pPixmap->getDepth(); @@ -1470,7 +1470,7 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor, // get pixmap again since clearing the guard could have invalidated // the pixmap in another thread pPixmap = getPixmapHolder( selection ); - nValue = (XID)pPixmap->setBitmapData( (const sal_uInt8*)aData.getConstArray() ); + nValue = (XID)pPixmap->setBitmapData( reinterpret_cast<const sal_uInt8*>(aData.getConstArray()) ); } if( nValue == None ) return false; @@ -1485,7 +1485,7 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor, target, 32, PropModeReplace, - (const unsigned char*)&nValue, + reinterpret_cast<const unsigned char*>(&nValue), 1); return true; } @@ -1540,7 +1540,7 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor, long nMinSize = m_nIncrementalThreshold; XSelectInput( m_pDisplay, requestor, PropertyChangeMask ); XChangeProperty( m_pDisplay, requestor, property, - m_nINCRAtom, 32, PropModeReplace, (unsigned char*)&nMinSize, 1 ); + m_nINCRAtom, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&nMinSize), 1 ); XFlush( m_pDisplay ); } else @@ -1552,7 +1552,7 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor, target, nFormat, PropModeReplace, - (const unsigned char*)aData.getConstArray(), + reinterpret_cast<const unsigned char*>(aData.getConstArray()), aData.getLength()/nUnitSize ); } } @@ -1609,7 +1609,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest for( i = 0, it = aConversions.begin(); i < nTypes; i++, ++it ) pTypes[i] = *it; XChangeProperty( m_pDisplay, rRequest.requestor, rRequest.property, - XA_ATOM, 32, PropModeReplace, (const unsigned char*)pTypes, nTypes ); + XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char*>(pTypes), nTypes ); aNotify.xselection.property = rRequest.property; #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "sending type list:\n" ); @@ -1622,7 +1622,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest { long nTimeStamp = (long)m_aSelections[rRequest.selection]->m_nOrigTimestamp; XChangeProperty( m_pDisplay, rRequest.requestor, rRequest.property, - XA_INTEGER, 32, PropModeReplace, (const unsigned char*)&nTimeStamp, 1 ); + XA_INTEGER, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&nTimeStamp), 1 ); aNotify.xselection.property = rRequest.property; #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "sending timestamp: %d\n", (int)nTimeStamp ); @@ -1672,7 +1672,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest #endif bEventSuccess = true; bool bResetAtoms = false; - Atom* pAtoms = (Atom*)pData; + Atom* pAtoms = reinterpret_cast<Atom*>(pData); aGuard.clear(); for( unsigned int i = 0; i < nItems; i += 2 ) { @@ -1856,7 +1856,7 @@ bool SelectionManager::handleReceivePropertyNotify( XPropertyEvent& rNotify ) it->second->m_eState == Selection::WaitingForResponse ) { // copy data - it->second->m_aData = Sequence< sal_Int8 >( (sal_Int8*)pData, nItems*nUnitSize ); + it->second->m_aData = Sequence< sal_Int8 >( reinterpret_cast<sal_Int8*>(pData), nItems*nUnitSize ); it->second->m_eState = Selection::Inactive; it->second->m_aDataArrived.set(); } @@ -1960,7 +1960,7 @@ bool SelectionManager::handleSendPropertyNotify( XPropertyEvent& rNotify ) rInc.m_aTarget, rInc.m_nFormat, PropModeReplace, - (const unsigned char*)rInc.m_aData.getConstArray()+rInc.m_nBufferPos, + reinterpret_cast<const unsigned char*>(rInc.m_aData.getConstArray())+rInc.m_nBufferPos, nBytes/nUnitSize ); rInc.m_nBufferPos += nBytes; rInc.m_nTransferStartTime = nCurrentTime; @@ -2051,7 +2051,7 @@ bool SelectionManager::handleSelectionNotify( XSelectionEvent& rNotify ) } it->second->m_eState = Selection::Inactive; sal_Size nUnitSize = GetTrueFormatSize(nFormat); - it->second->m_aData = Sequence< sal_Int8 >((sal_Int8*)pData, nItems * nUnitSize); + it->second->m_aData = Sequence< sal_Int8 >(reinterpret_cast<sal_Int8*>(pData), nItems * nUnitSize); it->second->m_aDataArrived.set(); if( pData ) XFree( pData ); @@ -2917,7 +2917,7 @@ int SelectionManager::getXdndVersion( ::Window aWindow, ::Window& rProxy ) if( pBytes ) { if( nType == XA_WINDOW ) - rProxy = *(::Window*)pBytes; + rProxy = *reinterpret_cast< ::Window* >(pBytes); XFree( pBytes ); pBytes = NULL; if( rProxy != None ) @@ -2927,7 +2927,7 @@ int SelectionManager::getXdndVersion( ::Window aWindow, ::Window& rProxy ) &nType, &nFormat, &nItems, &nBytes, &pBytes ); if( pBytes ) { - if( nType == XA_WINDOW && *(::Window*)pBytes != rProxy ) + if( nType == XA_WINDOW && *reinterpret_cast< ::Window* >(pBytes) != rProxy ) rProxy = None; XFree( pBytes ); pBytes = NULL; @@ -2949,7 +2949,7 @@ int SelectionManager::getXdndVersion( ::Window aWindow, ::Window& rProxy ) if( pBytes ) { if( nType == XA_ATOM ) - nVersion = *(Atom*)pBytes; + nVersion = *reinterpret_cast<Atom*>(pBytes); XFree( pBytes ); } @@ -3296,7 +3296,7 @@ void SelectionManager::startDrag( for( int n = 0; n < nTypes; n++, ++type_it ) pTypes[n] = *type_it; - XChangeProperty( m_pDisplay, m_aWindow, m_nXdndTypeList, XA_ATOM, 32, PropModeReplace, (unsigned char*)pTypes, nTypes ); + XChangeProperty( m_pDisplay, m_aWindow, m_nXdndTypeList, XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char*>(pTypes), nTypes ); m_nSourceActions = sourceActions | DNDConstants::ACTION_DEFAULT; m_nUserDragAction = DNDConstants::ACTION_MOVE & m_nSourceActions; @@ -3491,7 +3491,7 @@ void SelectionManager::transferablesFlavorsChanged() Atom* pTypes = (Atom*)alloca( sizeof(Atom)*aConversions.size() ); for( i = 0, type_it = aConversions.begin(); type_it != aConversions.end(); ++type_it, i++ ) pTypes[i] = *type_it; - XChangeProperty( m_pDisplay, m_aWindow, m_nXdndTypeList, XA_ATOM, 32, PropModeReplace, (unsigned char*)pTypes, nTypes ); + XChangeProperty( m_pDisplay, m_aWindow, m_nXdndTypeList, XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char*>(pTypes), nTypes ); if( m_aCurrentDropWindow != None && m_nCurrentProtocolVersion >= 0 ) { @@ -3779,7 +3779,7 @@ sal_Bool SelectionManager::handleEvent(const Any& event) Sequence< sal_Int8 > aSeq; if( (event >>= aSeq) ) { - XEvent* pEvent = (XEvent*)aSeq.getArray(); + XEvent* pEvent = reinterpret_cast<XEvent*>(aSeq.getArray()); Time nTimestamp = CurrentTime; if( pEvent->type == ButtonPress || pEvent->type == ButtonRelease ) nTimestamp = pEvent->xbutton.time; @@ -3890,7 +3890,7 @@ void SelectionManager::registerDropTarget( ::Window aWindow, DropTarget* pTarget if( ! bWasError ) { // set XdndAware - XChangeProperty( m_pDisplay, aWindow, m_nXdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*)&nXdndProtocolRevision, 1 ); + XChangeProperty( m_pDisplay, aWindow, m_nXdndAware, XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char const *>(&nXdndProtocolRevision), 1 ); if( ! bWasError ) { // get root window of window (in 99.999% of all cases this will be diff --git a/vcl/unx/generic/dtrans/X11_transferable.cxx b/vcl/unx/generic/dtrans/X11_transferable.cxx index dd64fb7c13d9..ccc6fb51284b 100644 --- a/vcl/unx/generic/dtrans/X11_transferable.cxx +++ b/vcl/unx/generic/dtrans/X11_transferable.cxx @@ -63,9 +63,9 @@ Any SAL_CALL X11Transferable::getTransferData( const DataFlavor& rFlavor ) if( rFlavor.MimeType.equalsIgnoreAsciiCase( "text/plain;charset=utf-16" ) ) { int nLen = aData.getLength()/2; - if( ((sal_Unicode*)aData.getConstArray())[nLen-1] == 0 ) + if( reinterpret_cast<sal_Unicode const *>(aData.getConstArray())[nLen-1] == 0 ) nLen--; - OUString aString( (sal_Unicode*)aData.getConstArray(), nLen ); + OUString aString( reinterpret_cast<sal_Unicode const *>(aData.getConstArray()), nLen ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "X11Transferable::getTransferData( \"%s\" )\n -> \"%s\"\n", OUStringToOString( rFlavor.MimeType, RTL_TEXTENCODING_ISO_8859_1 ).getStr(), diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx index 5e084ceafb36..7eddf05f920c 100644 --- a/vcl/unx/generic/gdi/gdiimpl.cxx +++ b/vcl/unx/generic/gdi/gdiimpl.cxx @@ -887,7 +887,7 @@ bool X11SalGraphicsImpl::drawAlphaBitmap( const SalTwoRect& rTR, // an XImage needs its data top_down // TODO: avoid wrongly oriented images in upper layers! const int nImageSize = pAlphaBuffer->mnHeight * pAlphaBuffer->mnScanlineSize; - const char* pSrcBits = (char*)pAlphaBuffer->mpBits; + const char* pSrcBits = reinterpret_cast<char*>(pAlphaBuffer->mpBits); char* pAlphaBits = new char[ nImageSize ]; if( BMP_SCANLINE_ADJUSTMENT( pAlphaBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN ) memcpy( pAlphaBits, pSrcBits, nImageSize ); @@ -901,11 +901,11 @@ bool X11SalGraphicsImpl::drawAlphaBitmap( const SalTwoRect& rTR, // the alpha values need to be inverted for XRender // TODO: make upper layers use standard alpha - long* pLDst = (long*)pAlphaBits; + long* pLDst = reinterpret_cast<long*>(pAlphaBits); for( int i = nImageSize/sizeof(long); --i >= 0; ++pLDst ) *pLDst = ~*pLDst; - char* pCDst = (char*)pLDst; + char* pCDst = reinterpret_cast<char*>(pLDst); for( int i = nImageSize & (sizeof(long)-1); --i >= 0; ++pCDst ) *pCDst = ~*pCDst; @@ -924,7 +924,7 @@ bool X11SalGraphicsImpl::drawAlphaBitmap( const SalTwoRect& rTR, rTR.mnSrcX, rTR.mnSrcY, 0, 0, rTR.mnDestWidth, rTR.mnDestHeight ); XFreeGC( pXDisplay, aAlphaGC ); XFree( pAlphaImg ); - if( pAlphaBits != (char*)pAlphaBuffer->mpBits ) + if( pAlphaBits != reinterpret_cast<char*>(pAlphaBuffer->mpBits) ) delete[] pAlphaBits; const_cast<SalBitmap&>(rAlphaBmp).ReleaseBuffer( pAlphaBuffer, BITMAP_READ_ACCESS ); diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx index f6ac7369eeb7..8a38b1bfba6c 100644 --- a/vcl/unx/generic/gdi/salbmp.cxx +++ b/vcl/unx/generic/gdi/salbmp.cxx @@ -242,7 +242,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( aSrcBuf.mnHeight = nHeight; aSrcBuf.mnBitCount = pImage->bits_per_pixel; aSrcBuf.mnScanlineSize = pImage->bytes_per_line; - aSrcBuf.mpBits = (sal_uInt8*) pImage->data; + aSrcBuf.mpBits = reinterpret_cast<sal_uInt8*>(pImage->data); pImage->red_mask = pSalDisp->GetVisual( nScreen ).red_mask; pImage->green_mask = pSalDisp->GetVisual( nScreen ).green_mask; @@ -534,7 +534,7 @@ XImage* X11SalBitmap::ImplCreateXImage( blankExtraSpace(pDstBuf); #endif // set data in buffer as data member in pImage - pImage->data = (char*) pDstBuf->mpBits; + pImage->data = reinterpret_cast<char*>(pDstBuf->mpBits); // destroy buffer; don't destroy allocated data in buffer delete pDstBuf; diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx index 80b5acf44722..0b7be994be41 100644 --- a/vcl/unx/generic/plugadapt/salplug.cxx +++ b/vcl/unx/generic/plugadapt/salplug.cxx @@ -86,7 +86,7 @@ static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = fals SAL_LOADMODULE_DEFAULT ); if( aMod ) { - salFactoryProc aProc = (salFactoryProc)osl_getAsciiFunctionSymbol( aMod, "create_SalInstance" ); + salFactoryProc aProc = reinterpret_cast<salFactoryProc>(osl_getAsciiFunctionSymbol( aMod, "create_SalInstance" )); if( aProc ) { pInst = aProc(); @@ -148,8 +148,8 @@ static DesktopType get_desktop_environment() DesktopType ret = DESKTOP_UNKNOWN; if( aMod ) { - DesktopType (*pSym)() = (DesktopType(*)()) - osl_getAsciiFunctionSymbol( aMod, "get_desktop_environment" ); + DesktopType (*pSym)() = reinterpret_cast<DesktopType(*)()>( + osl_getAsciiFunctionSymbol( aMod, "get_desktop_environment" )); if( pSym ) ret = pSym(); } diff --git a/vcl/unx/generic/window/FWS.cxx b/vcl/unx/generic/window/FWS.cxx index 97a089d0c4cf..5d4ffd5282f4 100644 --- a/vcl/unx/generic/window/FWS.cxx +++ b/vcl/unx/generic/window/FWS.cxx @@ -102,7 +102,7 @@ WMSupportsFWS (Display *display, int screen) return False; } - fwsCommWindow = *(::Window *) propData; + fwsCommWindow = *reinterpret_cast< ::Window * >(propData); #if OSL_DEBUG_LEVEL > 1 fprintf (stderr, "Using fwsCommWindow = 0x%lx.\n", fwsCommWindow); #endif @@ -129,7 +129,7 @@ WMSupportsFWS (Display *display, int screen) for (i = 0; i < propItems; ++i) { - protocol = ((Atom *) propData)[i]; + protocol = reinterpret_cast<Atom *>(propData)[i]; if (protocol == FWS_STACK_UNDER) { fwsStackUnder = True; @@ -208,7 +208,7 @@ RegisterFwsWindow (Display *display, Window window) oldHandler = XSetErrorHandler (newHandler); XSendEvent (display, fwsCommWindow, False, NoEventMask, - (XEvent *) &msg); + reinterpret_cast<XEvent *>(&msg)); XSync (display, False); XSetErrorHandler (oldHandler); @@ -235,7 +235,7 @@ AddFwsProtocols (Display *display, Window window) fwsProtocols[ nProtos++ ] = FWS_PASS_ALL_INPUT; XChangeProperty (display, window, WM_PROTOCOLS, XA_ATOM, 32, PropModeAppend, - (unsigned char *) fwsProtocols, nProtos); + reinterpret_cast<unsigned char *>(fwsProtocols), nProtos); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index 52e10567b298..a018b5bde8d9 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -676,7 +676,7 @@ void X11SalFrame::Init( sal_uLong nSalFrameStyle, SalX11Screen nXScreen, SystemP XA_WINDOW, 32, PropModeReplace, - (unsigned char*)&aClientLeader, + reinterpret_cast<unsigned char*>(&aClientLeader), 1 ); } @@ -739,7 +739,7 @@ void X11SalFrame::Init( sal_uLong nSalFrameStyle, SalX11Screen nXScreen, SystemP if( !netwm_icon.empty() && GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON )) XChangeProperty( GetXDisplay(), mhWindow, GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON ), - XA_CARDINAL, 32, PropModeReplace, (unsigned char*)&netwm_icon.front(), netwm_icon.size()); + XA_CARDINAL, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&netwm_icon.front()), netwm_icon.size()); } m_nWorkArea = GetDisplay()->getWMAdaptor()->getCurrentWorkArea(); @@ -1094,7 +1094,7 @@ void X11SalFrame::SetIcon( sal_uInt16 nIcon ) if( !netwm_icon.empty() && GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON )) XChangeProperty( GetXDisplay(), mhWindow, GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON ), - XA_CARDINAL, 32, PropModeReplace, (unsigned char*)&netwm_icon.front(), netwm_icon.size()); + XA_CARDINAL, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&netwm_icon.front()), netwm_icon.size()); } } } @@ -1501,8 +1501,8 @@ void X11SalFrame::Center( ) pFrame->GetShellWindow(), &aRoot, &nScreenX, &nScreenY, - (unsigned int*)&nScreenWidth, - (unsigned int*)&nScreenHeight, + reinterpret_cast<unsigned int*>(&nScreenWidth), + reinterpret_cast<unsigned int*>(&nScreenHeight), &bw, &depth ); } else @@ -2231,7 +2231,7 @@ IsRunningXAutoLock( Display *p_display, ::Window a_window ) // get pid of running xautolock XGetWindowProperty (p_display, a_window, a_pidatom, 0L, 2L, False, AnyPropertyType, &a_type, &n_format, &n_items, &n_bytes_after, - (unsigned char**) &p_pid ); + reinterpret_cast<unsigned char**>(&p_pid) ); n_pid = *p_pid; XFree( p_pid ); @@ -2270,7 +2270,7 @@ MessageToXAutoLock( Display *p_display, int n_message ) a_messageatom = XInternAtom( p_display, p_atomname, False ); XChangeProperty (p_display, a_rootwindow, a_messageatom, XA_INTEGER, - 8, PropModeReplace, (unsigned char*)&n_message, sizeof(n_message) ); + 8, PropModeReplace, reinterpret_cast<unsigned char*>(&n_message), sizeof(n_message) ); return True; } @@ -3306,7 +3306,7 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) // convert to single byte text stream nSize = rtl_convertTextToUnicode( aConverter, aContext, - (char*)pPrintable, nLen, + reinterpret_cast<char*>(pPrintable), nLen, pBuffer, nBufferSize, RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE | RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE, @@ -3320,7 +3320,7 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) } else if (nLen > 0 /* nEncoding == RTL_TEXTENCODING_UNICODE */) { - pString = (sal_Unicode*)pPrintable; + pString = reinterpret_cast<sal_Unicode*>(pPrintable); nSize = nLen; } else @@ -3894,9 +3894,9 @@ long X11SalFrame::HandleStateEvent( XPropertyEvent *pEvent ) && 2 == nitems && 0 == bytes_after, "HandleStateEvent" ); - if( *(unsigned long*)prop == NormalState ) + if( *reinterpret_cast<unsigned long*>(prop) == NormalState ) nShowState_ = SHOWSTATE_NORMAL; - else if( *(unsigned long*)prop == IconicState ) + else if( *reinterpret_cast<unsigned long*>(prop) == IconicState ) nShowState_ = SHOWSTATE_MINIMIZED; XFree( prop ); @@ -3974,7 +3974,7 @@ Bool call_checkKeyReleaseForRepeat( Display* pDisplay, XEvent* pCheck, XPointer Bool X11SalFrame::checkKeyReleaseForRepeat( Display*, XEvent* pCheck, XPointer pX11SalFrame ) { - X11SalFrame* pThis = (X11SalFrame*)pX11SalFrame; + X11SalFrame* pThis = reinterpret_cast<X11SalFrame*>(pX11SalFrame); return pCheck->type == KeyPress && pCheck->xkey.state == pThis->nKeyState_ && @@ -4010,7 +4010,7 @@ long X11SalFrame::Dispatch( XEvent *pEvent ) { nReleaseTime_ = pEvent->xkey.time; XEvent aEvent; - if( XCheckIfEvent( pEvent->xkey.display, &aEvent, call_checkKeyReleaseForRepeat, (XPointer)this ) ) + if( XCheckIfEvent( pEvent->xkey.display, &aEvent, call_checkKeyReleaseForRepeat, reinterpret_cast<XPointer>(this) ) ) XPutBackEvent( pEvent->xkey.display, &aEvent ); else nRet = HandleKeyEvent( &pEvent->xkey ); diff --git a/vcl/unx/gtk/a11y/atkfactory.cxx b/vcl/unx/gtk/a11y/atkfactory.cxx index 54e0ac3e0b18..f960b4e65632 100644 --- a/vcl/unx/gtk/a11y/atkfactory.cxx +++ b/vcl/unx/gtk/a11y/atkfactory.cxx @@ -60,7 +60,7 @@ atk_noop_object_wrapper_get_type(void) sizeof (AtkNoOpObjectClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, - (GClassInitFunc) atk_noop_object_wrapper_class_init, + reinterpret_cast<GClassInitFunc>(atk_noop_object_wrapper_class_init), (GClassFinalizeFunc) NULL, NULL, sizeof (AtkObjectWrapper), @@ -156,7 +156,7 @@ wrapper_factory_get_type (void) static const GTypeInfo tinfo = { sizeof (AtkObjectFactoryClass), - NULL, NULL, (GClassInitFunc) wrapper_factory_class_init, + NULL, NULL, reinterpret_cast<GClassInitFunc>(wrapper_factory_class_init), NULL, NULL, sizeof (AtkObjectFactory), 0, NULL, NULL }; diff --git a/vcl/unx/gtk/a11y/atkhypertext.cxx b/vcl/unx/gtk/a11y/atkhypertext.cxx index c4c5a5383bed..1074dad8ad8a 100644 --- a/vcl/unx/gtk/a11y/atkhypertext.cxx +++ b/vcl/unx/gtk/a11y/atkhypertext.cxx @@ -36,7 +36,7 @@ typedef struct { static uno::Reference< accessibility::XAccessibleHyperlink > getHyperlink( AtkHyperlink *pHyperlink ) { - HyperLink *pLink = (HyperLink *) pHyperlink; + HyperLink *pLink = reinterpret_cast<HyperLink *>(pHyperlink); return pLink->xLink; } @@ -47,7 +47,7 @@ extern "C" { static void hyper_link_finalize (GObject *obj) { - HyperLink *hl = (HyperLink *) obj; + HyperLink *hl = reinterpret_cast<HyperLink *>(obj); hl->xLink.clear(); hyper_parent_class->finalize (obj); } @@ -164,7 +164,7 @@ hyper_link_get_type (void) sizeof (AtkHyperlinkClass), NULL, /* base init */ NULL, /* base finalize */ - (GClassInitFunc) hyper_link_class_init, + reinterpret_cast<GClassInitFunc>(hyper_link_class_init), NULL, /* class finalize */ NULL, /* class data */ sizeof (HyperLink), /* instance size */ @@ -174,7 +174,7 @@ hyper_link_get_type (void) }; static const GInterfaceInfo atk_action_info = { - (GInterfaceInitFunc) actionIfaceInit, + reinterpret_cast<GInterfaceInitFunc>(actionIfaceInit), (GInterfaceFinalizeFunc) NULL, NULL }; diff --git a/vcl/unx/gtk/a11y/atklistener.cxx b/vcl/unx/gtk/a11y/atklistener.cxx index 45c06022f990..dcf7ffd479f0 100644 --- a/vcl/unx/gtk/a11y/atklistener.cxx +++ b/vcl/unx/gtk/a11y/atklistener.cxx @@ -97,7 +97,7 @@ void AtkListener::disposing( const lang::EventObject& ) throw (uno::RuntimeExcep // global mutex atk_object_wrapper_dispose( mpWrapper ); - g_idle_add( (GSourceFunc) idle_defunc_state_change, + g_idle_add( reinterpret_cast<GSourceFunc>(idle_defunc_state_change), g_object_ref( G_OBJECT( atk_obj ) ) ); // Release the wrapper object so that it can vanish .. diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx index fe2f0d5e2f52..a7487c0f6e98 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.cxx +++ b/vcl/unx/gtk/a11y/atktextattributes.cxx @@ -1320,7 +1320,7 @@ attribute_set_map_to_property_values( sal_Int32 nIndex = 0; for( GSList * item = attribute_set; item != NULL; item = g_slist_next( item ) ) { - AtkAttribute* attribute = (AtkAttribute *) item; + AtkAttribute* attribute = reinterpret_cast<AtkAttribute *>(item); AtkTextAttribute text_attr = atk_text_attribute_for_name( attribute->name ); if( text_attr < g_TextAttrMapSize ) diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx index fb0d25897111..c108bb4272f9 100644 --- a/vcl/unx/gtk/a11y/atkutil.cxx +++ b/vcl/unx/gtk/a11y/atkutil.cxx @@ -597,8 +597,9 @@ static void handle_menu_highlighted(::VclMenuEvent const * pEvent) /*****************************************************************************/ -long WindowEventHandler(void *, ::VclSimpleEvent const * pEvent) +sal_IntPtr WindowEventHandler(void *, void * p) { + VclSimpleEvent * pEvent = reinterpret_cast<VclSimpleEvent *>(p); try { switch (pEvent->GetId()) @@ -675,7 +676,7 @@ long WindowEventHandler(void *, ::VclSimpleEvent const * pEvent) return 0; } -static Link g_aEventListenerLink( NULL, (PSTUB) WindowEventHandler ); +static Link g_aEventListenerLink( NULL, WindowEventHandler ); /*****************************************************************************/ @@ -743,7 +744,7 @@ ooo_atk_util_get_type (void) static_cast<guint16>(type_query.class_size), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, - (GClassInitFunc) ooo_atk_util_class_init, + reinterpret_cast<GClassInitFunc>(ooo_atk_util_class_init), (GClassFinalizeFunc) NULL, NULL, static_cast<guint16>(type_query.instance_size), diff --git a/vcl/unx/gtk/a11y/atkwindow.cxx b/vcl/unx/gtk/a11y/atkwindow.cxx index 0f39c0169f23..cd9bf9e49c74 100644 --- a/vcl/unx/gtk/a11y/atkwindow.cxx +++ b/vcl/unx/gtk/a11y/atkwindow.cxx @@ -295,7 +295,7 @@ ooo_window_wrapper_get_type (void) static_cast<guint16>(type_query.class_size), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, - (GClassInitFunc) ooo_window_wrapper_class_init, + reinterpret_cast<GClassInitFunc>(ooo_window_wrapper_class_init), (GClassFinalizeFunc) NULL, NULL, static_cast<guint16>(type_query.instance_size), diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx index 552c8e390cb1..4f34e0e84144 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.cxx +++ b/vcl/unx/gtk/a11y/atkwrapper.cxx @@ -636,12 +636,12 @@ atk_object_wrapper_get_type (void) sizeof (AtkObjectWrapperClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, - (GClassInitFunc) atk_object_wrapper_class_init, + reinterpret_cast<GClassInitFunc>(atk_object_wrapper_class_init), (GClassFinalizeFunc) NULL, NULL, sizeof (AtkObjectWrapper), 0, - (GInstanceInitFunc) atk_object_wrapper_init, + reinterpret_cast<GInstanceInitFunc>(atk_object_wrapper_init), NULL } ; type = g_type_register_static (ATK_TYPE_OBJECT, @@ -678,47 +678,47 @@ const struct { } aTypeTable[] = { // re-location heaven: { - "Comp", (GInterfaceInitFunc) componentIfaceInit, + "Comp", reinterpret_cast<GInterfaceInitFunc>(componentIfaceInit), atk_component_get_type, cppu::UnoType<accessibility::XAccessibleComponent>::get }, { - "Act", (GInterfaceInitFunc) actionIfaceInit, + "Act", reinterpret_cast<GInterfaceInitFunc>(actionIfaceInit), atk_action_get_type, cppu::UnoType<accessibility::XAccessibleAction>::get }, { - "Txt", (GInterfaceInitFunc) textIfaceInit, + "Txt", reinterpret_cast<GInterfaceInitFunc>(textIfaceInit), atk_text_get_type, cppu::UnoType<accessibility::XAccessibleText>::get }, { - "Val", (GInterfaceInitFunc) valueIfaceInit, + "Val", reinterpret_cast<GInterfaceInitFunc>(valueIfaceInit), atk_value_get_type, cppu::UnoType<accessibility::XAccessibleValue>::get }, { - "Tab", (GInterfaceInitFunc) tableIfaceInit, + "Tab", reinterpret_cast<GInterfaceInitFunc>(tableIfaceInit), atk_table_get_type, cppu::UnoType<accessibility::XAccessibleTable>::get }, { - "Edt", (GInterfaceInitFunc) editableTextIfaceInit, + "Edt", reinterpret_cast<GInterfaceInitFunc>(editableTextIfaceInit), atk_editable_text_get_type, cppu::UnoType<accessibility::XAccessibleEditableText>::get }, { - "Img", (GInterfaceInitFunc) imageIfaceInit, + "Img", reinterpret_cast<GInterfaceInitFunc>(imageIfaceInit), atk_image_get_type, cppu::UnoType<accessibility::XAccessibleImage>::get }, { - "Hyp", (GInterfaceInitFunc) hypertextIfaceInit, + "Hyp", reinterpret_cast<GInterfaceInitFunc>(hypertextIfaceInit), atk_hypertext_get_type, cppu::UnoType<accessibility::XAccessibleHypertext>::get }, { - "Sel", (GInterfaceInitFunc) selectionIfaceInit, + "Sel", reinterpret_cast<GInterfaceInitFunc>(selectionIfaceInit), atk_selection_get_type, cppu::UnoType<accessibility::XAccessibleSelection>::get } diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index 487d5e87c824..8e20f62c14ee 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -795,7 +795,7 @@ extern "C" { static gboolean sal_gtk_timeout_prepare( GSource *pSource, gint *nTimeoutMS ) { - SalGtkTimeoutSource *pTSource = (SalGtkTimeoutSource *)pSource; + SalGtkTimeoutSource *pTSource = reinterpret_cast<SalGtkTimeoutSource *>(pSource); GTimeVal aTimeNow; g_get_current_time( &aTimeNow ); @@ -805,7 +805,7 @@ extern "C" { static gboolean sal_gtk_timeout_check( GSource *pSource ) { - SalGtkTimeoutSource *pTSource = (SalGtkTimeoutSource *)pSource; + SalGtkTimeoutSource *pTSource = reinterpret_cast<SalGtkTimeoutSource *>(pSource); GTimeVal aTimeNow; g_get_current_time( &aTimeNow ); @@ -817,7 +817,7 @@ extern "C" { static gboolean sal_gtk_timeout_dispatch( GSource *pSource, GSourceFunc, gpointer ) { - SalGtkTimeoutSource *pTSource = (SalGtkTimeoutSource *)pSource; + SalGtkTimeoutSource *pTSource = reinterpret_cast<SalGtkTimeoutSource *>(pSource); if( !pTSource->pInstance ) return FALSE; @@ -848,7 +848,7 @@ static SalGtkTimeoutSource * create_sal_gtk_timeout( GtkSalTimer *pTimer ) { GSource *pSource = g_source_new( &sal_gtk_timeout_funcs, sizeof( SalGtkTimeoutSource ) ); - SalGtkTimeoutSource *pTSource = (SalGtkTimeoutSource *)pSource; + SalGtkTimeoutSource *pTSource = reinterpret_cast<SalGtkTimeoutSource *>(pSource); pTSource->pInstance = pTimer; // #i36226# timers should be executed with lower priority @@ -900,8 +900,8 @@ void GtkSalTimer::Stop() { if( m_pTimeout ) { - g_source_destroy( (GSource *)m_pTimeout ); - g_source_unref( (GSource *)m_pTimeout ); + g_source_destroy( &m_pTimeout->aParent ); + g_source_unref( &m_pTimeout->aParent ); m_pTimeout = NULL; } } diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx index 90114bcb9512..bda7c4a605d9 100644 --- a/vcl/unx/gtk/app/gtksys.cxx +++ b/vcl/unx/gtk/app/gtksys.cxx @@ -214,8 +214,8 @@ static int _get_primary_monitor (GdkScreen *pScreen) // Perhaps we have a newer gtk+ with this symbol: if (!get_fn) { - get_fn = (int(*)(GdkScreen*))osl_getAsciiFunctionSymbol(NULL, - "gdk_screen_get_primary_monitor"); + get_fn = reinterpret_cast<int(*)(GdkScreen*)>(osl_getAsciiFunctionSymbol(NULL, + "gdk_screen_get_primary_monitor")); } #if GTK_CHECK_VERSION(2,14,0) if (!get_fn) diff --git a/vcl/unx/gtk/fpicker/SalGtkPicker.cxx b/vcl/unx/gtk/fpicker/SalGtkPicker.cxx index f2e70b3e8ab1..ebadb962888c 100644 --- a/vcl/unx/gtk/fpicker/SalGtkPicker.cxx +++ b/vcl/unx/gtk/fpicker/SalGtkPicker.cxx @@ -134,7 +134,7 @@ void SAL_CALL RunDialog::windowOpened( const ::com::sun::star::lang::EventObject { SolarMutexGuard g; - g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, (GSourceFunc)canceldialog, this, NULL); + g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, reinterpret_cast<GSourceFunc>(canceldialog), this, NULL); } void SAL_CALL RunDialog::queryTermination( const ::com::sun::star::lang::EventObject& ) @@ -147,7 +147,7 @@ void SAL_CALL RunDialog::notifyTermination( const ::com::sun::star::lang::EventO { SolarMutexGuard g; - g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, (GSourceFunc)canceldialog, this, NULL); + g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, reinterpret_cast<GSourceFunc>(canceldialog), this, NULL); } void RunDialog::cancel() diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 5d257633171a..700308b385f3 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -4107,7 +4107,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) sal_Int32 nDispDPIY = GetDisplay()->GetResolution().B(); int nPointHeight = 0; static gboolean(*pAbso)(const PangoFontDescription*) = - (gboolean(*)(const PangoFontDescription*))osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "pango_font_description_get_size_is_absolute" ); + reinterpret_cast<gboolean(*)(const PangoFontDescription*)>(osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "pango_font_description_get_size_is_absolute" )); if( pAbso && pAbso( pStyle->font_desc ) ) nPointHeight = (nPangoHeight * 72 + nDispDPIY*PANGO_SCALE/2) / (nDispDPIY * PANGO_SCALE); diff --git a/vcl/unx/gtk/window/glomenu.cxx b/vcl/unx/gtk/window/glomenu.cxx index 780b6bfdab34..871692045590 100644 --- a/vcl/unx/gtk/window/glomenu.cxx +++ b/vcl/unx/gtk/window/glomenu.cxx @@ -43,7 +43,7 @@ struct item static void g_lo_menu_struct_item_init (struct item *menu_item) { - menu_item->attributes = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref); + menu_item->attributes = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, reinterpret_cast<GDestroyNotify>(g_variant_unref)); menu_item->links = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); } @@ -629,7 +629,7 @@ g_lo_menu_finalize (GObject *object) gint i; n_items = menu->items->len; - items = (struct item *) g_array_free (menu->items, FALSE); + items = reinterpret_cast<struct item *>(g_array_free (menu->items, FALSE)); for (i = 0; i < n_items; i++) g_lo_menu_clear_item (&items[i]); g_free (items); diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index 313386741e99..82c70e7cdd19 100644 --- a/vcl/unx/gtk/window/gtksalframe.cxx +++ b/vcl/unx/gtk/window/gtksalframe.cxx @@ -538,7 +538,7 @@ gdk_x11_window_set_utf8_property (GdkWindow *window, GDK_WINDOW_XID (window), gdk_x11_get_xatom_by_name_for_display (display, name), gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8, - PropModeReplace, (guchar *)value, strlen (value)); + PropModeReplace, reinterpret_cast<guchar const *>(value), strlen (value)); } else { @@ -1139,7 +1139,7 @@ static void lcl_set_accept_focus( GtkWindow* pWindow, gboolean bAccept, bool bBe if( bGetAcceptFocusFn ) { bGetAcceptFocusFn = false; - p_gtk_window_set_accept_focus = (setAcceptFn)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gtk_window_set_accept_focus" ); + p_gtk_window_set_accept_focus = reinterpret_cast<setAcceptFn>(osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gtk_window_set_accept_focus" )); } if( p_gtk_window_set_accept_focus && bBeforeRealize ) p_gtk_window_set_accept_focus( pWindow, bAccept ); @@ -1206,7 +1206,7 @@ static void lcl_set_user_time( GtkWindow* i_pWindow, guint32 i_nTime ) if( bGetSetUserTimeFn ) { bGetSetUserTimeFn = false; - p_gdk_x11_window_set_user_time = (setUserTimeFn)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_x11_window_set_user_time" ); + p_gdk_x11_window_set_user_time = reinterpret_cast<setUserTimeFn>(osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_x11_window_set_user_time" )); } bool bSet = false; if( p_gdk_x11_window_set_user_time ) @@ -1226,7 +1226,7 @@ static void lcl_set_user_time( GtkWindow* i_pWindow, guint32 i_nTime ) { XChangeProperty( pDisplay, widget_get_xid(GTK_WIDGET(i_pWindow)), nUserTime, XA_CARDINAL, 32, - PropModeReplace, (unsigned char*)&i_nTime, 1 ); + PropModeReplace, reinterpret_cast<unsigned char*>(&i_nTime), 1 ); } } #else @@ -1604,7 +1604,7 @@ bitmapToPixbuf( SalBitmap *pSalBitmap, SalBitmap *pSalAlpha ) GDK_COLORSPACE_RGB, true, 8, aSize.Width(), aSize.Height(), aSize.Width() * 4, - (GdkPixbufDestroyNotify) g_free, + reinterpret_cast<GdkPixbufDestroyNotify>(g_free), NULL ); } @@ -1679,7 +1679,7 @@ void GtkSalFrame::SetIcon( sal_uInt16 nIcon ) gtk_window_set_icon_list( GTK_WINDOW(m_pWindow), pIcons ); - g_list_foreach( pIcons, (GFunc) g_object_unref, NULL ); + g_list_foreach( pIcons, reinterpret_cast<GFunc>(g_object_unref), NULL ); g_list_free( pIcons ); } @@ -2453,7 +2453,7 @@ void GtkSalFrame::setAutoLock( bool bLock ) GDK_WINDOW_XID( pRootWin ), nAtom, XA_INTEGER, 8, PropModeReplace, - (unsigned char*)&nMessage, + reinterpret_cast<unsigned char*>(&nMessage), sizeof( nMessage ) ); } @@ -3245,7 +3245,7 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer gboolean GtkSalFrame::signalScroll( GtkWidget*, GdkEvent* pEvent, gpointer frame ) { GtkSalFrame* pThis = (GtkSalFrame*)frame; - GdkEventScroll* pSEvent = (GdkEventScroll*)pEvent; + GdkEventScroll* pSEvent = reinterpret_cast<GdkEventScroll*>(pEvent); static sal_uLong nLines = 0; if( ! nLines ) diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx index 67545b9f80fc..6a3a7b005e43 100644 --- a/vcl/unx/gtk/window/gtksalmenu.cxx +++ b/vcl/unx/gtk/window/gtksalmenu.cxx @@ -228,7 +228,7 @@ void RemoveUnusedCommands( GLOActionGroup* pActionGroup, GList* pOldCommandList, gpointer aCommand = g_list_nth_data( pNewCommand, 0 ); - GList* pOldCommand = g_list_find_custom( pOldCommandList, aCommand, (GCompareFunc) CompareStr ); + GList* pOldCommand = g_list_find_custom( pOldCommandList, aCommand, reinterpret_cast<GCompareFunc>(CompareStr) ); if ( pOldCommand != NULL ) { diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index 53bc1a310453..79e17d85107a 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -1424,7 +1424,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) const cairo_font_options_t* pNewOptions = NULL; static cairo_font_options_t* (*gdk_screen_get_font_options)(GdkScreen*) = - (cairo_font_options_t*(*)(GdkScreen*))osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_font_options" ); + reinterpret_cast<cairo_font_options_t*(*)(GdkScreen*)>(osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_font_options" )); if( gdk_screen_get_font_options != NULL ) pNewOptions = gdk_screen_get_font_options( pScreen ); aStyleSet.SetCairoFontOptions( pNewOptions ); diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx index 35cd62cedc2e..2ed9ac302368 100644 --- a/vcl/workben/svpclient.cxx +++ b/vcl/workben/svpclient.cxx @@ -197,7 +197,7 @@ OString MyWin::processCommand( const OString& rCommand ) addr.sin_family = AF_INET; addr.sin_port = htons(nPort); addr.sin_addr.s_addr = INADDR_ANY; - if( connect( nSocket, (const sockaddr*)&addr, sizeof(addr) ) ) + if( connect( nSocket, reinterpret_cast<sockaddr*>(&addr), sizeof(addr) ) ) { perror( "SvpElementContainer: connect() failed" ); } |