From 18804c92e10c7f4572b9698b1cf6dc86db8d6f32 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Sat, 28 Mar 2015 19:08:26 +0100 Subject: Clean up C-style casts from pointers to void Change-Id: Iad602cece6e328c7f5d5f36adb294c97b152ade3 --- include/vcl/cmdevt.hxx | 20 ++-- include/vcl/event.hxx | 8 +- include/vcl/opengl/OpenGLContext.hxx | 2 +- vcl/generic/fontmanager/fontconfig.cxx | 4 +- vcl/generic/fontmanager/fontmanager.cxx | 6 +- vcl/generic/fontmanager/parseAFM.cxx | 32 +++--- vcl/generic/glyphs/gcach_ftyp.cxx | 10 +- vcl/generic/glyphs/gcach_layout.cxx | 12 +-- vcl/generic/print/common_gfx.cxx | 2 +- vcl/generic/print/genprnpsp.cxx | 4 +- vcl/generic/print/genpspgraphics.cxx | 4 +- vcl/generic/print/glyphset.cxx | 12 +-- vcl/generic/print/printerjob.cxx | 2 +- vcl/generic/print/prtsetup.cxx | 8 +- vcl/generic/print/text_gfx.cxx | 20 ++-- vcl/headless/svpprn.cxx | 2 +- vcl/opengl/x11/gdiimpl.cxx | 2 +- vcl/source/app/svmain.cxx | 4 +- vcl/source/control/button.cxx | 4 +- vcl/source/control/field.cxx | 4 +- vcl/source/control/fixed.cxx | 4 +- vcl/source/filter/graphicfilter.cxx | 2 +- vcl/source/filter/igif/decode.cxx | 4 +- vcl/source/filter/jpeg/JpegReader.cxx | 10 +- vcl/source/filter/jpeg/JpegWriter.cxx | 10 +- vcl/source/filter/jpeg/jpegc.cxx | 2 +- vcl/source/filter/wmf/winmtf.cxx | 22 ++--- vcl/source/filter/wmf/winmtf.hxx | 6 +- vcl/source/filter/wmf/wmfwr.cxx | 2 +- vcl/source/font/PhysicalFontCollection.cxx | 2 +- vcl/source/fontsubset/gsub.cxx | 6 +- vcl/source/fontsubset/list.cxx | 4 +- vcl/source/fontsubset/sft.cxx | 56 +++++------ vcl/source/fontsubset/ttcr.cxx | 150 ++++++++++++++--------------- vcl/source/gdi/animate.cxx | 2 +- vcl/source/gdi/bitmap3.cxx | 6 +- vcl/source/gdi/bitmap4.cxx | 4 +- vcl/source/gdi/configsettings.cxx | 2 +- vcl/source/gdi/dibtools.cxx | 4 +- vcl/source/gdi/gdimtf.cxx | 38 ++++---- vcl/source/gdi/image.cxx | 16 +-- vcl/source/gdi/impvect.cxx | 10 +- vcl/source/gdi/jobset.cxx | 4 +- vcl/source/gdi/octree.cxx | 4 +- vcl/source/gdi/pdfwriter_impl.cxx | 16 +-- vcl/source/gdi/pdfwriter_impl2.cxx | 4 +- vcl/source/gdi/pngwrite.cxx | 2 +- vcl/source/gdi/sallayout.cxx | 12 +-- vcl/source/helper/strhelper.cxx | 8 +- vcl/source/helper/xconnection.cxx | 8 +- vcl/source/opengl/OpenGLContext.cxx | 2 +- vcl/source/outdev/hatch.cxx | 8 +- vcl/source/outdev/text.cxx | 8 +- vcl/source/window/accel.cxx | 12 +-- vcl/source/window/debug.cxx | 2 +- vcl/source/window/debugevent.cxx | 2 +- vcl/source/window/menu.cxx | 16 +-- vcl/source/window/resource.cxx | 2 +- vcl/source/window/syschild.cxx | 2 +- vcl/source/window/toolbox.cxx | 8 +- vcl/source/window/toolbox2.cxx | 8 +- vcl/source/window/winproc.cxx | 70 +++++++------- vcl/unx/generic/app/i18n_cb.cxx | 14 +-- vcl/unx/generic/app/i18n_ic.cxx | 8 +- vcl/unx/generic/app/i18n_status.cxx | 24 ++--- vcl/unx/generic/app/saldisp.cxx | 2 +- vcl/unx/generic/app/sm.cxx | 14 +-- vcl/unx/generic/app/wmadaptor.cxx | 14 +-- vcl/unx/generic/dtrans/X11_selection.cxx | 10 +- vcl/unx/generic/dtrans/bmp.cxx | 6 +- vcl/unx/generic/dtrans/config.cxx | 2 +- vcl/unx/generic/gdi/cairo_xlib_cairo.cxx | 22 ++--- vcl/unx/generic/gdi/cairotextrender.cxx | 6 +- vcl/unx/generic/printer/cupsmgr.cxx | 32 +++--- vcl/unx/generic/printer/jobdata.cxx | 2 +- vcl/unx/generic/window/salframe.cxx | 6 +- vcl/unx/generic/window/salobj.cxx | 32 +++--- vcl/unx/gtk/a11y/atkfactory.cxx | 2 +- vcl/unx/gtk/a11y/atkhypertext.cxx | 4 +- vcl/unx/gtk/a11y/atktextattributes.cxx | 10 +- vcl/unx/gtk/a11y/atkwindow.cxx | 2 +- vcl/unx/gtk/a11y/atkwrapper.cxx | 4 +- vcl/unx/gtk/app/gtkdata.cxx | 10 +- vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx | 2 +- vcl/unx/gtk/window/gloactiongroup.cxx | 4 +- vcl/unx/gtk/window/gtkobject.cxx | 6 +- vcl/unx/gtk/window/gtksalframe.cxx | 48 ++++----- vcl/unx/gtk/window/gtksalmenu.cxx | 4 +- vcl/unx/gtk/window/hudawareness.cxx | 6 +- vcl/unx/kde/kdedata.cxx | 2 +- 90 files changed, 510 insertions(+), 510 deletions(-) diff --git a/include/vcl/cmdevt.hxx b/include/vcl/cmdevt.hxx index 851c5d9aec1e..ad6a9dc72d25 100644 --- a/include/vcl/cmdevt.hxx +++ b/include/vcl/cmdevt.hxx @@ -447,7 +447,7 @@ inline CommandEvent::CommandEvent( const Point& rMousePos, inline const CommandExtTextInputData* CommandEvent::GetExtTextInputData() const { if ( mnCommand == COMMAND_EXTTEXTINPUT ) - return (const CommandExtTextInputData*)mpData; + return static_cast(mpData); else return NULL; } @@ -455,7 +455,7 @@ inline const CommandExtTextInputData* CommandEvent::GetExtTextInputData() const inline const CommandInputContextData* CommandEvent::GetInputContextChangeData() const { if ( mnCommand == COMMAND_INPUTCONTEXTCHANGE ) - return (const CommandInputContextData*)mpData; + return static_cast(mpData); else return NULL; } @@ -463,7 +463,7 @@ inline const CommandInputContextData* CommandEvent::GetInputContextChangeData() inline const CommandWheelData* CommandEvent::GetWheelData() const { if ( mnCommand == COMMAND_WHEEL ) - return (const CommandWheelData*)mpData; + return static_cast(mpData); else return NULL; } @@ -471,7 +471,7 @@ inline const CommandWheelData* CommandEvent::GetWheelData() const inline const CommandScrollData* CommandEvent::GetAutoScrollData() const { if ( mnCommand == COMMAND_AUTOSCROLL ) - return (const CommandScrollData*)mpData; + return static_cast(mpData); else return NULL; } @@ -479,7 +479,7 @@ inline const CommandScrollData* CommandEvent::GetAutoScrollData() const inline const CommandModKeyData* CommandEvent::GetModKeyData() const { if( mnCommand == COMMAND_MODKEYCHANGE ) - return (const CommandModKeyData*)mpData; + return static_cast(mpData); else return NULL; } @@ -487,7 +487,7 @@ inline const CommandModKeyData* CommandEvent::GetModKeyData() const inline const CommandDialogData* CommandEvent::GetDialogData() const { if( mnCommand == COMMAND_SHOWDIALOG ) - return (const CommandDialogData*)mpData; + return static_cast(mpData); else return NULL; } @@ -495,7 +495,7 @@ inline const CommandDialogData* CommandEvent::GetDialogData() const inline CommandMediaData* CommandEvent::GetMediaData() const { if( mnCommand == COMMAND_MEDIA ) - return (CommandMediaData*)(mpData); + return static_cast(mpData); else return NULL; } @@ -503,7 +503,7 @@ inline CommandMediaData* CommandEvent::GetMediaData() const inline const CommandSelectionChangeData* CommandEvent::GetSelectionChangeData() const { if( mnCommand == COMMAND_SELECTIONCHANGE ) - return (const CommandSelectionChangeData*)mpData; + return static_cast(mpData); else return NULL; } @@ -511,7 +511,7 @@ inline const CommandSelectionChangeData* CommandEvent::GetSelectionChangeData() inline const CommandSwipeData* CommandEvent::GetSwipeData() const { if( mnCommand == COMMAND_SWIPE ) - return (const CommandSwipeData*)(mpData); + return static_cast(mpData); else return NULL; } @@ -519,7 +519,7 @@ inline const CommandSwipeData* CommandEvent::GetSwipeData() const inline const CommandLongPressData* CommandEvent::GetLongPressData() const { if( mnCommand == COMMAND_LONGPRESS ) - return (const CommandLongPressData*)(mpData); + return static_cast(mpData); else return NULL; } diff --git a/include/vcl/event.hxx b/include/vcl/event.hxx index 990a7ec0033b..8ad67fb0efdc 100644 --- a/include/vcl/event.hxx +++ b/include/vcl/event.hxx @@ -455,7 +455,7 @@ inline NotifyEvent::NotifyEvent( MouseNotifyEvent nEventType, vcl::Window* pWind inline const KeyEvent* NotifyEvent::GetKeyEvent() const { if ( (mnEventType == MouseNotifyEvent::KEYINPUT) || (mnEventType == MouseNotifyEvent::KEYUP) ) - return (const KeyEvent*)mpData; + return static_cast(mpData); else return NULL; } @@ -463,7 +463,7 @@ inline const KeyEvent* NotifyEvent::GetKeyEvent() const inline const MouseEvent* NotifyEvent::GetMouseEvent() const { if ( (mnEventType >= MouseNotifyEvent::MOUSEBUTTONDOWN) && (mnEventType <= MouseNotifyEvent::MOUSEMOVE) ) - return (const MouseEvent*)mpData; + return static_cast(mpData); else return NULL; } @@ -471,7 +471,7 @@ inline const MouseEvent* NotifyEvent::GetMouseEvent() const inline const CommandEvent* NotifyEvent::GetCommandEvent() const { if ( mnEventType == MouseNotifyEvent::COMMAND ) - return (const CommandEvent*)mpData; + return static_cast(mpData); else return NULL; } @@ -529,7 +529,7 @@ inline DataChangedEvent::DataChangedEvent( DataChangedEventType nType, inline const AllSettings* DataChangedEvent::GetOldSettings() const { if ( mnType == DataChangedEventType::SETTINGS ) - return (const AllSettings*)mpData; + return static_cast(mpData); else return NULL; } diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx index 0e98da6a6878..8be646e913b9 100644 --- a/include/vcl/opengl/OpenGLContext.hxx +++ b/include/vcl/opengl/OpenGLContext.hxx @@ -81,7 +81,7 @@ struct GLWindow return GL_FALSE; } - deleteThis=lookHere=(char*)malloc(strlen(reinterpret_cast(extString))+1); + deleteThis=lookHere=static_cast(malloc(strlen(reinterpret_cast(extString))+1)); if (lookHere==NULL) { return GL_FALSE; diff --git a/vcl/generic/fontmanager/fontconfig.cxx b/vcl/generic/fontmanager/fontconfig.cxx index 2a354cca4cf4..f872164e9a63 100644 --- a/vcl/generic/fontmanager/fontconfig.cxx +++ b/vcl/generic/fontmanager/fontconfig.cxx @@ -919,7 +919,7 @@ IMPL_LINK_NOARG(PrintFontManager, autoInstallFontLangSupport) return -1; } - gchar **fonts = (gchar**)g_malloc((m_aCurrentRequests.size() + 1) * sizeof(gchar*)); + gchar **fonts = static_cast(g_malloc((m_aCurrentRequests.size() + 1) * sizeof(gchar*))); gchar **font = fonts; for (std::vector::const_iterator aI = m_aCurrentRequests.begin(); aI != m_aCurrentRequests.end(); ++aI) *font++ = const_cast(aI->getStr()); @@ -1088,7 +1088,7 @@ bool PrintFontManager::Substitute( FontSelectPattern &rPattern, OUString& rMissi // update rMissingCodes by removing resolved unicodes if( !rMissingCodes.isEmpty() ) { - sal_uInt32* pRemainingCodes = (sal_uInt32*)alloca( rMissingCodes.getLength() * sizeof(sal_uInt32) ); + sal_uInt32* pRemainingCodes = static_cast(alloca( rMissingCodes.getLength() * sizeof(sal_uInt32) )); int nRemainingLen = 0; FcCharSet* unicodes; if (!FcPatternGetCharSet(pSet->fonts[0], FC_CHARSET, 0, &unicodes)) diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx index c98ccc522d3c..f2b67d1aca84 100644 --- a/vcl/generic/fontmanager/fontmanager.cxx +++ b/vcl/generic/fontmanager/fontmanager.cxx @@ -472,7 +472,7 @@ bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider, // first transform the character codes to unicode // note: this only works with single byte encodings - sal_Unicode* pUnicodes = (sal_Unicode*)alloca( pInfo->numOfChars * sizeof(sal_Unicode)); + sal_Unicode* pUnicodes = static_cast(alloca( pInfo->numOfChars * sizeof(sal_Unicode))); CharMetricInfo* pChar = pInfo->cmi; int i; @@ -979,7 +979,7 @@ std::vector PrintFontManager::findFontFileIDs( int nDirID, const OString OUString PrintFontManager::convertTrueTypeName( void* pRecord ) const { - NameRecord* pNameRecord = (NameRecord*)pRecord; + NameRecord* pNameRecord = static_cast(pRecord); OUString aValue; if( ( pNameRecord->platformID == 3 && ( pNameRecord->encodingID == 0 || pNameRecord->encodingID == 1 ) ) // MS, Unicode @@ -1128,7 +1128,7 @@ void PrintFontManager::analyzeTrueTypeFamilyName( void* pTTFont, ::std::list< OU ::std::set< OUString > aSet; NameRecord* pNameRecords = NULL; - int nNameRecords = GetTTNameRecords( (TrueTypeFont*)pTTFont, &pNameRecords ); + int nNameRecords = GetTTNameRecords( static_cast(pTTFont), &pNameRecords ); if( nNameRecords && pNameRecords ) { LanguageTag aSystem(""); diff --git a/vcl/generic/fontmanager/parseAFM.cxx b/vcl/generic/fontmanager/parseAFM.cxx index e3a3170a14ab..267ef1c2c248 100644 --- a/vcl/generic/fontmanager/parseAFM.cxx +++ b/vcl/generic/fontmanager/parseAFM.cxx @@ -120,7 +120,7 @@ FileInputStream::FileInputStream(const char* pFilename) struct stat aStat; if (!fstat(fileno(fp), &aStat) && S_ISREG(aStat.st_mode) && aStat.st_size > 0) { - m_pMemory = (char*)rtl_allocateMemory( aStat.st_size ); + m_pMemory = static_cast(rtl_allocateMemory( aStat.st_size )); m_nLen = (unsigned int)fread( m_pMemory, 1, aStat.st_size, fp ); } fclose( fp ); @@ -666,7 +666,7 @@ reallocFontMetrics( void **pp_fontmetrics, int *p_oldcount, int n_newcount, unsi if (*p_oldcount == n_newcount) return ok; - p_tmpmetrics = (char*)realloc(*pp_fontmetrics, n_newcount * n_size); + p_tmpmetrics = static_cast(realloc(*pp_fontmetrics, n_newcount * n_size)); if (p_tmpmetrics == NULL) return storageProblem; @@ -816,7 +816,7 @@ static int parseCharMetrics( FileInputStream* fp, FontInfo* fi) tail = &(node->next); } - *tail = (Ligature *) calloc(1, sizeof(Ligature)); + *tail = static_cast(calloc(1, sizeof(Ligature))); if ((keyword = token(fp,tokenlen)) != NULL) (*tail)->succ = (char *)strdup(keyword); if ((keyword = token(fp,tokenlen)) != NULL) @@ -1169,8 +1169,8 @@ static int parseCompCharData( FileInputStream* fp, FontInfo* fi) fi->ccd[pos].ccName = strdup( keyword ); if ((keyword = token(fp,tokenlen)) != NULL) fi->ccd[pos].numOfPieces = atoi(keyword); - fi->ccd[pos].pieces = (Pcc *) - calloc(fi->ccd[pos].numOfPieces, sizeof(Pcc)); + fi->ccd[pos].pieces = static_cast( + calloc(fi->ccd[pos].numOfPieces, sizeof(Pcc))); j = 0; ccount++; } @@ -1252,12 +1252,12 @@ int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags) char *keyword; /* used to store a token */ - (*fi) = (FontInfo *) calloc(1, sizeof(FontInfo)); + (*fi) = static_cast(calloc(1, sizeof(FontInfo))); if ((*fi) == NULL) { error = storageProblem; return error; } if (flags & P_G) { - (*fi)->gfi = (GlobalFontInfo *) calloc(1, sizeof(GlobalFontInfo)); + (*fi)->gfi = static_cast(calloc(1, sizeof(GlobalFontInfo))); if ((*fi)->gfi == NULL) { error = storageProblem; return error; } } @@ -1281,8 +1281,8 @@ int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags) (*fi)->numOfChars = atoi(keyword); if (flags & (P_M ^ P_W)) { - (*fi)->cmi = (CharMetricInfo *) - calloc((*fi)->numOfChars, sizeof(CharMetricInfo)); + (*fi)->cmi = static_cast( + calloc((*fi)->numOfChars, sizeof(CharMetricInfo))); if ((*fi)->cmi == NULL) { error = storageProblem; return error; } code = parseCharMetrics(&aFile, *fi); } @@ -1290,7 +1290,7 @@ int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags) { if (flags & P_W) { - (*fi)->cwi = (int *) calloc(256, sizeof(int)); + (*fi)->cwi = static_cast(calloc(256, sizeof(int))); if ((*fi)->cwi == NULL) { error = storageProblem; @@ -1331,8 +1331,8 @@ int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags) if ((flags & P_T) && keyword) { (*fi)->numOfTracks = atoi(keyword); - (*fi)->tkd = (TrackKernData *) - calloc((*fi)->numOfTracks, sizeof(TrackKernData)); + (*fi)->tkd = static_cast( + calloc((*fi)->numOfTracks, sizeof(TrackKernData))); if ((*fi)->tkd == NULL) { error = storageProblem; @@ -1346,8 +1346,8 @@ int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags) if ((flags & P_P) && keyword) { (*fi)->numOfPairs = atoi(keyword); - (*fi)->pkd = (PairKernData *) - calloc((*fi)->numOfPairs, sizeof(PairKernData)); + (*fi)->pkd = static_cast( + calloc((*fi)->numOfPairs, sizeof(PairKernData))); if ((*fi)->pkd == NULL) { error = storageProblem; @@ -1361,8 +1361,8 @@ int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags) if ((flags & P_C) && keyword) { (*fi)->numOfComps = atoi(keyword); - (*fi)->ccd = (CompCharData *) - calloc((*fi)->numOfComps, sizeof(CompCharData)); + (*fi)->ccd = static_cast( + calloc((*fi)->numOfComps, sizeof(CompCharData))); if ((*fi)->ccd == NULL) { error = storageProblem; diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx index 887b5f4fb482..93a79b1649ac 100644 --- a/vcl/generic/glyphs/gcach_ftyp.cxx +++ b/vcl/generic/glyphs/gcach_ftyp.cxx @@ -169,8 +169,8 @@ bool FtFontFile::Map() return false; } mnFileSize = aStat.st_size; - mpFileMap = (unsigned char*) - mmap( NULL, mnFileSize, PROT_READ, MAP_SHARED, nFile, 0 ); + mpFileMap = static_cast( + mmap( NULL, mnFileSize, PROT_READ, MAP_SHARED, nFile, 0 )); if( mpFileMap == MAP_FAILED ) mpFileMap = NULL; close( nFile ); @@ -548,7 +548,7 @@ ServerFont::ServerFont( const FontSelectPattern& rFSD, FtFontInfo* pFI ) //static const int TT_CODEPAGE_RANGE_950 = (1L << 20); // Chinese: Traditional //static const int TT_CODEPAGE_RANGE_1361 = (1L << 21); // Korean Johab static const int TT_CODEPAGE_RANGES1_CJKT = 0x3F0000; // all of the above - const TT_OS2* pOs2 = (const TT_OS2*)FT_Get_Sfnt_Table( maFaceFT, ft_sfnt_os2 ); + const TT_OS2* pOs2 = static_cast(FT_Get_Sfnt_Table( maFaceFT, ft_sfnt_os2 )); if ((pOs2) && (pOs2->ulCodePageRange1 & TT_CODEPAGE_RANGES1_CJKT ) && rFSD.mnHeight < 20) mbUseGamma = true; @@ -652,7 +652,7 @@ void ServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor ) const rFactor = 0x100; - const TT_OS2* pOS2 = (const TT_OS2*)FT_Get_Sfnt_Table( maFaceFT, ft_sfnt_os2 ); + const TT_OS2* pOS2 = static_cast(FT_Get_Sfnt_Table( maFaceFT, ft_sfnt_os2 )); const double fScale = (double)GetFontSelData().mnHeight / maFaceFT->units_per_EM; rTo.mnAscent = 0; @@ -676,7 +676,7 @@ void ServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor ) const } else { - const TT_HoriHeader* pHHea = (const TT_HoriHeader*)FT_Get_Sfnt_Table(maFaceFT, ft_sfnt_hhea); + const TT_HoriHeader* pHHea = static_cast(FT_Get_Sfnt_Table(maFaceFT, ft_sfnt_hhea)); if (pHHea) { rTo.mnAscent = pHHea->Ascender * fScale + 0.5; diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx index 8e9deeb4f226..94486a1a8813 100644 --- a/vcl/generic/glyphs/gcach_layout.cxx +++ b/vcl/generic/glyphs/gcach_layout.cxx @@ -126,7 +126,7 @@ static hb_blob_t *getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pU pTagName[3] = (char)(nTableTag); pTagName[4] = 0; - ServerFont* pFont = (ServerFont*) pUserData; + ServerFont* pFont = static_cast(pUserData); SAL_INFO("vcl.harfbuzz", "getFontTable(" << pFont << ", " << pTagName << ")"); @@ -145,7 +145,7 @@ static hb_bool_t getFontGlyph(hb_font_t* /*font*/, void* pFontData, hb_codepoint_t* nGlyphIndex, void* /*pUserData*/) { - ServerFont* pFont = (ServerFont*) pFontData; + ServerFont* pFont = static_cast(pFontData); *nGlyphIndex = pFont->GetRawGlyphIndex(ch, vs); return *nGlyphIndex != 0; @@ -155,7 +155,7 @@ static hb_position_t getGlyphAdvanceH(hb_font_t* /*font*/, void* pFontData, hb_codepoint_t nGlyphIndex, void* /*pUserData*/) { - ServerFont* pFont = (ServerFont*) pFontData; + ServerFont* pFont = static_cast(pFontData); const GlyphMetric& rGM = pFont->GetGlyphMetric(nGlyphIndex); return rGM.GetCharWidth() << 6; } @@ -192,7 +192,7 @@ static hb_position_t getGlyphKerningH(hb_font_t* /*font*/, void* pFontData, { // This callback is for old style 'kern' table, GPOS kerning is handled by HarfBuzz directly - ServerFont* pFont = (ServerFont*) pFontData; + ServerFont* pFont = static_cast(pFontData); FT_Face aFace = pFont->GetFtFace(); SAL_INFO("vcl.harfbuzz", "getGlyphKerningH(" << pFont << ", " << nGlyphIndex1 << ", " << nGlyphIndex2 << ")"); @@ -223,7 +223,7 @@ static hb_bool_t getGlyphExtents(hb_font_t* /*font*/, void* pFontData, hb_glyph_extents_t* pExtents, void* /*pUserData*/) { - ServerFont* pFont = (ServerFont*) pFontData; + ServerFont* pFont = static_cast(pFontData); FT_Face aFace = pFont->GetFtFace(); SAL_INFO("vcl.harfbuzz", "getGlyphExtents(" << pFont << ", " << nGlyphIndex << ")"); @@ -247,7 +247,7 @@ static hb_bool_t getGlyphContourPoint(hb_font_t* /*font*/, void* pFontData, void* /*pUserData*/) { bool ret = false; - ServerFont* pFont = (ServerFont*) pFontData; + ServerFont* pFont = static_cast(pFontData); FT_Face aFace = pFont->GetFtFace(); SAL_INFO("vcl.harfbuzz", "getGlyphContourPoint(" << pFont << ", " << nGlyphIndex << ", " << nPointIndex << ")"); diff --git a/vcl/generic/print/common_gfx.cxx b/vcl/generic/print/common_gfx.cxx index cc7c4d992f9c..769bb9893507 100644 --- a/vcl/generic/print/common_gfx.cxx +++ b/vcl/generic/print/common_gfx.cxx @@ -1219,7 +1219,7 @@ PrinterGfx::DrawEPS( const Rectangle& rBoundingBox, void* pPtr, sal_uInt32 nSize bSuccess = nOutLength == nSize; // corresponding EndDocument - if( ((char*)pPtr)[ nSize-1 ] != '\n' ) + if( static_cast(pPtr)[ nSize-1 ] != '\n' ) WritePS( mpPageBody, "\n" ); WritePS( mpPageBody, "%%EndDocument\n" ); diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx index 0eb63379c35a..7a0ab922eca8 100644 --- a/vcl/generic/print/genprnpsp.cxx +++ b/vcl/generic/print/genprnpsp.cxx @@ -232,7 +232,7 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData ) if( rData.getStreamBuffer( pBuffer, nBytes ) ) { pJobSetup->mnDriverDataLen = nBytes; - pJobSetup->mpDriverData = (sal_uInt8*)pBuffer; + pJobSetup->mpDriverData = static_cast(pBuffer); } else { @@ -563,7 +563,7 @@ bool PspSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pJobSetup ) void* pBuffer = NULL; aInfo.getStreamBuffer( pBuffer, nBytes ); pJobSetup->mnDriverDataLen = nBytes; - pJobSetup->mpDriverData = (sal_uInt8*)pBuffer; + pJobSetup->mpDriverData = static_cast(pBuffer); // copy everything to job setup copyJobDataToJobSetup( pJobSetup, aInfo ); diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx index af73d8a9c77e..d121ba6ca2eb 100644 --- a/vcl/generic/print/genpspgraphics.cxx +++ b/vcl/generic/print/genpspgraphics.cxx @@ -1248,7 +1248,7 @@ void GenPspGraphics::DoFreeEmbedFontData( const void* pData, long nLen ) { #if defined( UNX ) if( pData ) - munmap( (char*)pData, nLen ); + munmap( const_cast(pData), nLen ); #else (void)nLen; rtl_freeMemory( (void *)pData ); @@ -1332,7 +1332,7 @@ const void* GenPspGraphics::DoGetEmbedFontData( psp::fontID aFont, const sal_Ucs rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF; break; case psp::fonttype::Type1: { - const bool bPFA = ((*(unsigned char*)pFile) < 0x80); + const bool bPFA = *static_cast(pFile) < 0x80; rInfo.m_nFontType = bPFA ? FontSubsetInfo::TYPE1_PFA : FontSubsetInfo::TYPE1_PFB; } break; diff --git a/vcl/generic/print/glyphset.cxx b/vcl/generic/print/glyphset.cxx index 3ac8d8dd28e9..37bd752525f8 100644 --- a/vcl/generic/print/glyphset.cxx +++ b/vcl/generic/print/glyphset.cxx @@ -448,8 +448,8 @@ void GlyphSet::DrawGlyphs( const sal_Int32* pDeltaArray, const bool bUseGlyphs) { - unsigned char *pGlyphID = (unsigned char*)alloca (nLen * sizeof(unsigned char)); - sal_Int32 *pGlyphSetID = (sal_Int32*)alloca (nLen * sizeof(sal_Int32)); + unsigned char *pGlyphID = static_cast(alloca (nLen * sizeof(unsigned char))); + sal_Int32 *pGlyphSetID = static_cast(alloca (nLen * sizeof(sal_Int32))); std::set< sal_Int32 > aGlyphSet; // convert unicode to font glyph id and font subset @@ -464,8 +464,8 @@ void GlyphSet::DrawGlyphs( // loop over all glyph sets to detect substrings that can be xshown together // without changing the postscript font - sal_Int32 *pDeltaSubset = (sal_Int32*)alloca (nLen * sizeof(sal_Int32)); - unsigned char *pGlyphSubset = (unsigned char*)alloca (nLen * sizeof(unsigned char)); + sal_Int32 *pDeltaSubset = static_cast(alloca (nLen * sizeof(sal_Int32))); + unsigned char *pGlyphSubset = static_cast(alloca (nLen * sizeof(unsigned char))); std::set< sal_Int32 >::iterator aSet; for (aSet = aGlyphSet.begin(); aSet != aGlyphSet.end(); ++aSet) @@ -545,8 +545,8 @@ GlyphSet::ImplDrawText (PrinterGfx &rGfx, const Point& rPoint, } int nChar; - unsigned char *pGlyphID = (unsigned char*)alloca (nLen * sizeof(unsigned char)); - sal_Int32 *pGlyphSetID = (sal_Int32*)alloca (nLen * sizeof(sal_Int32)); + unsigned char *pGlyphID = static_cast(alloca (nLen * sizeof(unsigned char))); + sal_Int32 *pGlyphSetID = static_cast(alloca (nLen * sizeof(sal_Int32))); // convert unicode to glyph id and char set (font subset) for (nChar = 0; nChar < nLen; nChar++) diff --git a/vcl/generic/print/printerjob.cxx b/vcl/generic/print/printerjob.cxx index 7cfeeade1273..f3aa39df8125 100644 --- a/vcl/generic/print/printerjob.cxx +++ b/vcl/generic/print/printerjob.cxx @@ -66,7 +66,7 @@ AppendPS (FILE* pDst, osl::File* pSrc, unsigned char* pBuffer, if (nBlockSize == 0) nBlockSize = nBLOCKSIZE; if (pBuffer == NULL) - pBuffer = (unsigned char*)alloca (nBlockSize); + pBuffer = static_cast(alloca (nBlockSize)); sal_uInt64 nIn = 0; sal_uInt64 nOut = 0; diff --git a/vcl/generic/print/prtsetup.cxx b/vcl/generic/print/prtsetup.cxx index ed598b6cb19b..cbe60c35f3f5 100644 --- a/vcl/generic/print/prtsetup.cxx +++ b/vcl/generic/print/prtsetup.cxx @@ -258,7 +258,7 @@ IMPL_LINK( RTSPaperPage, SelectHdl, ListBox*, pBox ) } if( pKey ) { - PPDValue* pValue = (PPDValue*)pBox->GetSelectEntryData(); + PPDValue* pValue = static_cast(pBox->GetSelectEntryData()); m_pParent->m_aJobData.m_aContext.setValue( pKey, pValue ); update(); } @@ -412,13 +412,13 @@ IMPL_LINK( RTSDevicePage, SelectHdl, ListBox*, pBox ) { if( pBox == m_pPPDKeyBox ) { - const PPDKey* pKey = (PPDKey*)m_pPPDKeyBox->GetSelectEntryData(); + const PPDKey* pKey = static_cast(m_pPPDKeyBox->GetSelectEntryData()); FillValueBox( pKey ); } else if( pBox == m_pPPDValueBox ) { - const PPDKey* pKey = (PPDKey*)m_pPPDKeyBox->GetSelectEntryData(); - const PPDValue* pValue = (PPDValue*)m_pPPDValueBox->GetSelectEntryData(); + const PPDKey* pKey = static_cast(m_pPPDKeyBox->GetSelectEntryData()); + const PPDValue* pValue = static_cast(m_pPPDValueBox->GetSelectEntryData()); if (pKey && pValue) { m_pParent->m_aJobData.m_aContext.setValue( pKey, pValue ); diff --git a/vcl/generic/print/text_gfx.cxx b/vcl/generic/print/text_gfx.cxx index dec130475a41..569a10e4ed35 100644 --- a/vcl/generic/print/text_gfx.cxx +++ b/vcl/generic/print/text_gfx.cxx @@ -197,9 +197,9 @@ void PrinterGfx::DrawGlyphs( // vertical glyphs can have an additional rotation ... sigh. // so break up text in chunks of normal glyphs and print out // specially rotated glyphs extra - sal_GlyphId* pTempGlyphIds = (sal_GlyphId*)alloca(sizeof(sal_Int32)*nLen); - sal_Int32* pTempDelta = (sal_Int32*)alloca(sizeof(sal_Int32)*nLen); - sal_Unicode* pTempUnicodes = (sal_Unicode*)alloca(sizeof(sal_Unicode)*nLen); + sal_GlyphId* pTempGlyphIds = static_cast(alloca(sizeof(sal_Int32)*nLen)); + sal_Int32* pTempDelta = static_cast(alloca(sizeof(sal_Int32)*nLen)); + sal_Unicode* pTempUnicodes = static_cast(alloca(sizeof(sal_Unicode)*nLen)); sal_Int16 nTempLen = 0; sal_Int32 nTempFirstDelta = 0; Point aRotPoint; @@ -314,7 +314,7 @@ PrinterGfx::DrawText ( sal_Unicode *pEffectiveStr; if ( aFont.IsSymbolFont() ) { - pEffectiveStr = (sal_Unicode*)alloca(nLen * sizeof(pStr[0])); + pEffectiveStr = static_cast(alloca(nLen * sizeof(pStr[0]))); for (int i = 0; i < nLen; i++) pEffectiveStr[i] = pStr[i] < 256 ? pStr[i] + 0xF000 : pStr[i]; } @@ -323,8 +323,8 @@ PrinterGfx::DrawText ( pEffectiveStr = const_cast(pStr); } - fontID *pFontMap = (fontID*) alloca(nLen * sizeof(fontID)); - sal_Int32 *pCharWidth = (sal_Int32*) alloca(nLen * sizeof(sal_Int32)); + fontID *pFontMap = static_cast(alloca(nLen * sizeof(fontID))); + sal_Int32 *pCharWidth = static_cast(alloca(nLen * sizeof(sal_Int32))); for( int n = 0; n < nLen; n++ ) { @@ -335,7 +335,7 @@ PrinterGfx::DrawText ( } // setup a new delta array, use virtual resolution of 1000 - sal_Int32* pNewDeltaArray = (sal_Int32*)alloca( sizeof( sal_Int32 )*nLen ); + sal_Int32* pNewDeltaArray = static_cast(alloca( sizeof( sal_Int32 )*nLen )); if ( pDeltaArray != 0) { for (int i = 0; i < nLen - 1; i++) @@ -438,7 +438,7 @@ bool PrinterGfx::drawVerticalizedText( if (!rMgr.getFontInfo(mnFontID, aInfo)) return false; - sal_Int32* pDelta = (sal_Int32*)alloca( nLen * sizeof(sal_Int32) ); + sal_Int32* pDelta = static_cast(alloca( nLen * sizeof(sal_Int32) )); int nTextScale = maVirtualStatus.mnTextWidth ? maVirtualStatus.mnTextWidth : maVirtualStatus.mnTextHeight; int nNormalAngle = mnTextAngle; @@ -447,7 +447,7 @@ bool PrinterGfx::drawVerticalizedText( double fSin = sin( -2.0*M_PI*nNormalAngle/3600 ); double fCos = cos( -2.0*M_PI*nNormalAngle/3600 ); - bool* pGsubFlags = (bool*)alloca( nLen * sizeof(bool) ); + bool* pGsubFlags = static_cast(alloca( nLen * sizeof(bool) )); rMgr.hasVerticalSubstitutions( mnFontID, pStr, nLen, pGsubFlags ); Point aPoint( rPoint ); @@ -546,7 +546,7 @@ PrinterGfx::LicenseWarning(const Point& rPoint, const sal_Unicode* pStr, PSSetFont (aFontName, RTL_TEXTENCODING_ISO_8859_1); sal_Size nSize = 4 * nLen; - unsigned char* pBuffer = (unsigned char*)alloca (nSize* sizeof(unsigned char)); + unsigned char* pBuffer = static_cast(alloca (nSize* sizeof(unsigned char))); ConverterFactory &rCvt = GetConverterFactory (); nSize = rCvt.Convert (pStr, nLen, pBuffer, nSize, RTL_TEXTENCODING_ISO_8859_1); diff --git a/vcl/headless/svpprn.cxx b/vcl/headless/svpprn.cxx index ea481e344c2b..cc7034930bd0 100644 --- a/vcl/headless/svpprn.cxx +++ b/vcl/headless/svpprn.cxx @@ -144,7 +144,7 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData ) if( rData.getStreamBuffer( pBuffer, nBytes ) ) { pJobSetup->mnDriverDataLen = nBytes; - pJobSetup->mpDriverData = (sal_uInt8*)pBuffer; + pJobSetup->mpDriverData = static_cast(pBuffer); } else { diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx index bbc68b9d7dce..1d453dabf007 100644 --- a/vcl/opengl/x11/gdiimpl.cxx +++ b/vcl/opengl/x11/gdiimpl.cxx @@ -93,7 +93,7 @@ bool X11OpenGLSalGraphicsImpl::FillPixmapFromScreen( X11Pixmap* pPixmap, int nX, glXWaitX(); // TODO: lfrb: What if offscreen? - pData = (char*) malloc( pPixmap->GetWidth() * pPixmap->GetHeight() * 4 ); + pData = static_cast(malloc( pPixmap->GetWidth() * pPixmap->GetHeight() * 4 )); glPixelStorei( GL_PACK_ALIGNMENT, 1 ); glReadPixels( nX, GetHeight() - nY, pPixmap->GetWidth(), pPixmap->GetHeight(), GL_RGBA, GL_UNSIGNED_BYTE, pData ); diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index fdf2b9f28a34..aee0b9123edd 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -595,8 +595,8 @@ extern "C" { static void SAL_CALL MainWorkerFunction( void* pArgs ) { - ((WorkerThreadData*)pArgs)->pWorker( ((WorkerThreadData*)pArgs)->pThreadData ); - delete (WorkerThreadData*)pArgs; + static_cast(pArgs)->pWorker( static_cast(pArgs)->pThreadData ); + delete static_cast(pArgs); hThreadID = 0; } } // extern "C" diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index f4ca6e633a97..5b9c8c2ab1e0 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -3742,8 +3742,8 @@ ImageButton::ImageButton( vcl::Window* pParent, const ResId& rResId ) : if ( RSC_IMAGEBUTTON_IMAGE & nObjMask ) { - SetModeImage( Image( ResId( (RSHEADER_TYPE*)GetClassRes(), *rResId.GetResMgr() ) ) ); - IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); + SetModeImage( Image( ResId( static_cast(GetClassRes()), *rResId.GetResMgr() ) ) ); + IncrementRes( GetObjSizeRes( static_cast(GetClassRes()) ) ); } if ( RSC_IMAGEBUTTON_SYMBOL & nObjMask ) diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 8a9cbedea66d..c71b7265c32e 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -828,7 +828,7 @@ bool NumericField::set_property(const OString &rKey, const OString &rValue) void NumericField::ImplLoadRes( const ResId& rResId ) { SpinField::ImplLoadRes( rResId ); - NumericFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes(), *rResId.GetResMgr() ) ); + NumericFormatter::ImplLoadRes( ResId( static_cast(GetClassRes()), *rResId.GetResMgr() ) ); sal_uLong nMask = ReadLongRes(); @@ -1663,7 +1663,7 @@ bool MetricField::set_property(const OString &rKey, const OString &rValue) void MetricField::ImplLoadRes( const ResId& rResId ) { SpinField::ImplLoadRes( rResId ); - MetricFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes(), *rResId.GetResMgr() ) ); + MetricFormatter::ImplLoadRes( ResId( static_cast(GetClassRes()), *rResId.GetResMgr() ) ); sal_uLong nMask = ReadLongRes(); diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index f8e36dad4a6f..62c6135438b6 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -892,8 +892,8 @@ void FixedImage::ImplLoadRes( const ResId& rResId ) if ( RSC_FIXEDIMAGE_IMAGE & nObjMask ) { - maImage = Image( ResId( (RSHEADER_TYPE*)GetClassRes(), *rResId.GetResMgr() ) ); - IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); + maImage = Image( ResId( static_cast(GetClassRes()), *rResId.GetResMgr() ) ); + IncrementRes( GetObjSizeRes( static_cast(GetClassRes()) ) ); } } diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 21e643e7af34..907205258112 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -2095,7 +2095,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString xActiveDataSource->setOutputStream( css::uno::Reference< css::io::XOutputStream >( xStmIf, css::uno::UNO_QUERY ) ); - css::uno::Sequence< sal_Int8 > aMtfSeq( (sal_Int8*) aMemStm.GetData(), aMemStm.Tell() ); + css::uno::Sequence< sal_Int8 > aMtfSeq( static_cast(aMemStm.GetData()), aMemStm.Tell() ); xSVGWriter->write( xSaxWriter, aMtfSeq ); } } diff --git a/vcl/source/filter/igif/decode.cxx b/vcl/source/filter/igif/decode.cxx index d50ac7c3bd15..46a666f812ae 100644 --- a/vcl/source/filter/igif/decode.cxx +++ b/vcl/source/filter/igif/decode.cxx @@ -68,7 +68,7 @@ HPBYTE GIFLZWDecompressor::DecompressBlock( HPBYTE pSrc, sal_uInt8 cBufSize, { sal_uLong nTargetSize = 4096; sal_uLong nCount = 0; - HPBYTE pTarget = (HPBYTE) rtl_allocateMemory( nTargetSize ); + HPBYTE pTarget = static_cast(rtl_allocateMemory( nTargetSize )); HPBYTE pTmpTarget = pTarget; nBlockBufSize = cBufSize; @@ -83,7 +83,7 @@ HPBYTE GIFLZWDecompressor::DecompressBlock( HPBYTE pSrc, sal_uInt8 cBufSize, { sal_uLong nNewSize = nTargetSize << 1; sal_uLong nOffset = pTmpTarget - pTarget; - HPBYTE pTmp = (HPBYTE) rtl_allocateMemory( nNewSize ); + HPBYTE pTmp = static_cast(rtl_allocateMemory( nNewSize )); memcpy( pTmp, pTarget, nTargetSize ); rtl_freeMemory( pTarget ); diff --git a/vcl/source/filter/jpeg/JpegReader.cxx b/vcl/source/filter/jpeg/JpegReader.cxx index 0450bc602b4d..03c3ce918b30 100644 --- a/vcl/source/filter/jpeg/JpegReader.cxx +++ b/vcl/source/filter/jpeg/JpegReader.cxx @@ -147,7 +147,7 @@ extern "C" void term_source (j_decompress_ptr) void jpeg_svstream_src (j_decompress_ptr cinfo, void* input) { SourceManagerStruct * source; - SvStream* stream = (SvStream*)input; + SvStream* stream = static_cast(input); /* The source object and input buffer are made permanent so that a series * of JPEG images can be read from the same file by calling jpeg_stdio_src @@ -159,11 +159,11 @@ 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) (reinterpret_cast(cinfo), JPOOL_PERMANENT, sizeof(SourceManagerStruct)); + cinfo->src = static_cast( + (*cinfo->mem->alloc_small) (reinterpret_cast(cinfo), JPOOL_PERMANENT, sizeof(SourceManagerStruct))); source = reinterpret_cast(cinfo->src); - source->buffer = (JOCTET *) - (*cinfo->mem->alloc_small) (reinterpret_cast(cinfo), JPOOL_PERMANENT, BUFFER_SIZE * sizeof(JOCTET)); + source->buffer = static_cast( + (*cinfo->mem->alloc_small) (reinterpret_cast(cinfo), JPOOL_PERMANENT, BUFFER_SIZE * sizeof(JOCTET))); } source = reinterpret_cast(cinfo->src); diff --git a/vcl/source/filter/jpeg/JpegWriter.cxx b/vcl/source/filter/jpeg/JpegWriter.cxx index 179d3533fe45..45fd8ceceb41 100644 --- a/vcl/source/filter/jpeg/JpegWriter.cxx +++ b/vcl/source/filter/jpeg/JpegWriter.cxx @@ -43,8 +43,8 @@ extern "C" void init_destination (j_compress_ptr cinfo) DestinationManagerStruct * destination = reinterpret_cast(cinfo->dest); /* Allocate the output buffer -- it will be released when done with image */ - destination->buffer = (JOCTET *) - (*cinfo->mem->alloc_small) (reinterpret_cast(cinfo), JPOOL_IMAGE, BUFFER_SIZE * sizeof(JOCTET)); + destination->buffer = static_cast( + (*cinfo->mem->alloc_small) (reinterpret_cast(cinfo), JPOOL_IMAGE, BUFFER_SIZE * sizeof(JOCTET))); destination->pub.next_output_byte = destination->buffer; destination->pub.free_in_buffer = BUFFER_SIZE; @@ -82,7 +82,7 @@ extern "C" void term_destination (j_compress_ptr cinfo) void jpeg_svstream_dest (j_compress_ptr cinfo, void* output) { - SvStream* stream = (SvStream*) output; + SvStream* stream = static_cast(output); DestinationManagerStruct * destination; /* The destination object is made permanent so that multiple JPEG images @@ -93,8 +93,8 @@ 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) (reinterpret_cast(cinfo), JPOOL_PERMANENT, sizeof(DestinationManagerStruct)); + cinfo->dest = static_cast( + (*cinfo->mem->alloc_small) (reinterpret_cast(cinfo), JPOOL_PERMANENT, sizeof(DestinationManagerStruct))); } destination = reinterpret_cast(cinfo->dest); diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx index 0aed0f2b4a1c..2d171d839876 100644 --- a/vcl/source/filter/jpeg/jpegc.cxx +++ b/vcl/source/filter/jpeg/jpegc.cxx @@ -290,7 +290,7 @@ bool WriteJPEG( JPEGWriter* pJPEGWriter, void* pOutputStream, if( pScanline ) { - jpeg_write_scanlines( &cinfo, (JSAMPARRAY) &pScanline, 1 ); + jpeg_write_scanlines( &cinfo, reinterpret_cast(&pScanline), 1 ); } if( status.is() ) diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx index 8d40354ba89a..72c20cb0ac25 100644 --- a/vcl/source/filter/wmf/winmtf.cxx +++ b/vcl/source/filter/wmf/winmtf.cxx @@ -593,16 +593,16 @@ void WinMtfOutput::SelectObject( sal_Int32 nIndex ) switch( pGDIObj->eType ) { case GDI_PEN : - maLineStyle = (WinMtfLineStyle*)pGDIObj->pStyle; + maLineStyle = static_cast(pGDIObj->pStyle); break; case GDI_BRUSH : { - maFillStyle = (WinMtfFillStyle*)pGDIObj->pStyle; + maFillStyle = static_cast(pGDIObj->pStyle); mbFillStyleSelected = true; } break; case GDI_FONT : - maFont = ((WinMtfFontStyle*)pGDIObj->pStyle)->aFont; + maFont = static_cast(pGDIObj->pStyle)->aFont; break; default: break; // -Wall many options not handled. @@ -678,14 +678,14 @@ void WinMtfOutput::CreateObject( GDIObjectType eType, void* pStyle ) { if ( eType == GDI_FONT ) { - WinMtfFontStyle* pFontStyle = (WinMtfFontStyle*) pStyle; + WinMtfFontStyle* pFontStyle = static_cast(pStyle); if (pFontStyle->aFont.GetHeight() == 0) pFontStyle->aFont.SetHeight(423); ImplMap(pFontStyle->aFont); // defaulting to 12pt } else if ( eType == GDI_PEN ) { - WinMtfLineStyle* pLineStyle = (WinMtfLineStyle*) pStyle; + WinMtfLineStyle* pLineStyle = static_cast(pStyle); Size aSize(pLineStyle->aLineInfo.GetWidth(), 0); aSize = ImplMap(aSize); pLineStyle->aLineInfo.SetWidth(aSize.Width()); @@ -712,14 +712,14 @@ void WinMtfOutput::CreateObject( sal_Int32 nIndex, GDIObjectType eType, void* pS { if ( eType == GDI_FONT ) { - WinMtfFontStyle* pFontStyle = (WinMtfFontStyle*) pStyle; + WinMtfFontStyle* pFontStyle = static_cast(pStyle); if (pFontStyle->aFont.GetHeight() == 0) pFontStyle->aFont.SetHeight(423); ImplMap(pFontStyle->aFont); } else if ( eType == GDI_PEN ) { - WinMtfLineStyle* pLineStyle = (WinMtfLineStyle*) pStyle; + WinMtfLineStyle* pLineStyle = static_cast(pStyle); Size aSize(pLineStyle->aLineInfo.GetWidth(), 0); aSize = ImplMap(aSize); pLineStyle->aLineInfo.SetWidth(aSize.Width()); @@ -738,13 +738,13 @@ void WinMtfOutput::CreateObject( sal_Int32 nIndex, GDIObjectType eType, void* pS switch ( eType ) { case GDI_PEN : - delete (WinMtfLineStyle*)pStyle; + delete static_cast(pStyle); break; case GDI_BRUSH : - delete (WinMtfFillStyle*)pStyle; + delete static_cast(pStyle); break; case GDI_FONT : - delete (WinMtfFontStyle*)pStyle; + delete static_cast(pStyle); break; default: @@ -2116,7 +2116,7 @@ void WinMtfOutput::PassEMFPlusHeaderInfo() // on windows where the function parameters are probably resolved in reverse order mem.Flush(); - mpGDIMetaFile->AddAction( new MetaCommentAction( "EMF_PLUS_HEADER_INFO", 0, (const sal_uInt8*) mem.GetData(), mem.GetEndOfData() ) ); + mpGDIMetaFile->AddAction( new MetaCommentAction( "EMF_PLUS_HEADER_INFO", 0, static_cast(mem.GetData()), mem.GetEndOfData() ) ); mpGDIMetaFile->UseCanvas( true ); } diff --git a/vcl/source/filter/wmf/winmtf.hxx b/vcl/source/filter/wmf/winmtf.hxx index c9a8f2d69ea3..af06cd7bb2dd 100644 --- a/vcl/source/filter/wmf/winmtf.hxx +++ b/vcl/source/filter/wmf/winmtf.hxx @@ -514,13 +514,13 @@ struct GDIObj switch (eType) { case GDI_PEN : - delete (WinMtfLineStyle*)pStyle; + delete static_cast(pStyle); break; case GDI_BRUSH : - delete (WinMtfFillStyle*)pStyle; + delete static_cast(pStyle); break; case GDI_FONT : - delete (WinMtfFontStyle*)pStyle; + delete static_cast(pStyle); break; default: diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx index e0a659779999..9dcf64459367 100644 --- a/vcl/source/filter/wmf/wmfwr.cxx +++ b/vcl/source/filter/wmf/wmfwr.cxx @@ -518,7 +518,7 @@ bool WMFWriter::WMFRecord_Escape_Unicode( const Point& rPoint, const OUString& r for ( i = 0; i < nDXCount; i++ ) aMemoryStream.WriteInt32( pDXAry[ i ] ); aMemoryStream.WriteUInt32( nSkipActions ); - WMFRecord_Escape( PRIVATE_ESCAPE_UNICODE, nStrmLen, (const sal_Int8*)aMemoryStream.GetData() ); + WMFRecord_Escape( PRIVATE_ESCAPE_UNICODE, nStrmLen, static_cast(aMemoryStream.GetData()) ); std::vector::iterator aIter( aPolyPolyVec.begin() ); while ( aIter != aPolyPolyVec.end() ) diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx index 5f51a3f6e345..f1050353d673 100644 --- a/vcl/source/font/PhysicalFontCollection.cxx +++ b/vcl/source/font/PhysicalFontCollection.cxx @@ -243,7 +243,7 @@ PhysicalFontFamily* PhysicalFontCollection::GetGlyphFallbackFont( FontSelectPatt // there is a matching fallback in the cache // so update rMissingCodes with codepoints not yet resolved by this fallback int nRemainingLength = 0; - sal_UCS4* pRemainingCodes = (sal_UCS4*)alloca( rMissingCodes.getLength() * sizeof(sal_UCS4) ); + sal_UCS4* pRemainingCodes = static_cast(alloca( rMissingCodes.getLength() * sizeof(sal_UCS4) )); OUString aFontName; while( nStrIndex < rMissingCodes.getLength() ) diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx index 6ff77a44fa04..77706e065583 100644 --- a/vcl/source/fontsubset/gsub.cxx +++ b/vcl/source/fontsubset/gsub.cxx @@ -318,14 +318,14 @@ bool ReadGSUB( struct _TrueTypeFont* pTTFile, void ReleaseGSUB(struct _TrueTypeFont* pTTFile) { - GlyphSubstitution* pGlyphSubstitution = (GlyphSubstitution*)pTTFile->pGSubstitution; + GlyphSubstitution* pGlyphSubstitution = static_cast(pTTFile->pGSubstitution); if( pGlyphSubstitution ) delete pGlyphSubstitution; } int UseGSUB( struct _TrueTypeFont* pTTFile, int nGlyph ) { - GlyphSubstitution* pGlyphSubstitution = (GlyphSubstitution*)pTTFile->pGSubstitution; + GlyphSubstitution* pGlyphSubstitution = static_cast(pTTFile->pGSubstitution); if( pGlyphSubstitution != 0 ) { GlyphSubstitution::const_iterator it( pGlyphSubstitution->find( sal::static_int_cast(nGlyph) ) ); @@ -338,7 +338,7 @@ int UseGSUB( struct _TrueTypeFont* pTTFile, int nGlyph ) int HasVerticalGSUB( struct _TrueTypeFont* pTTFile ) { - GlyphSubstitution* pGlyphSubstitution = (GlyphSubstitution*)pTTFile->pGSubstitution; + GlyphSubstitution* pGlyphSubstitution = static_cast(pTTFile->pGSubstitution); return pGlyphSubstitution ? +1 : 0; } diff --git a/vcl/source/fontsubset/list.cxx b/vcl/source/fontsubset/list.cxx index 500015bfecfd..e9cbe5dc5b26 100644 --- a/vcl/source/fontsubset/list.cxx +++ b/vcl/source/fontsubset/list.cxx @@ -49,7 +49,7 @@ struct _list { static lnode *newNode(void *el) { - lnode *ptr = (lnode *)rtl_allocateMemory(sizeof(lnode)); + lnode *ptr = static_cast(rtl_allocateMemory(sizeof(lnode))); assert(ptr != 0); ptr->value = el; @@ -84,7 +84,7 @@ static lnode *appendPrim(list pThis, void *el) /*- public methods */ list listNewEmpty(void) /*- default ctor */ { - list pThis = (list)rtl_allocateMemory(sizeof(struct _list)); + list pThis = static_cast(rtl_allocateMemory(sizeof(struct _list))); assert(pThis != 0); pThis->aCount = 0; diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index ead68e157cfd..dfd5d2056c99 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -314,7 +314,7 @@ static const char HexChars[] = "0123456789ABCDEF"; static HexFmt *HexFmtNew(FILE *outf) { - HexFmt* res = (HexFmt*)smalloc(sizeof(HexFmt)); + HexFmt* res = static_cast(smalloc(sizeof(HexFmt))); res->bufpos = res->total = 0; res->o = outf; return res; @@ -360,7 +360,7 @@ static void HexFmtBlockWrite(HexFmt *_this, const void *ptr, sal_uInt32 size) HexFmtOpenString(_this); } for (i=0; i(ptr)[i]; _this->buffer[_this->bufpos++] = HexChars[Ch >> 4]; _this->buffer[_this->bufpos++] = HexChars[Ch & 0xF]; if (_this->bufpos == HFORMAT_LINELEN) { @@ -463,7 +463,7 @@ static int GetSimpleTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoin return 0; } - ControlPoint* pa = (ControlPoint*)calloc(palen, sizeof(ControlPoint)); + ControlPoint* pa = static_cast(calloc(palen, sizeof(ControlPoint))); i = 0; while (i <= lastPoint) { @@ -670,7 +670,7 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo np = myPoints.size(); - pa = (ControlPoint*)calloc(np, sizeof(ControlPoint)); + pa = static_cast(calloc(np, sizeof(ControlPoint))); assert(pa != 0); if (np > 0) @@ -846,7 +846,7 @@ static int BSplineToPSPath(ControlPoint *srcA, int srcCount, PSPathElement **pat if( (nPathCount = (int)aPathList.size()) > 0) { - *path = (PSPathElement*)calloc(nPathCount, sizeof(PSPathElement)); + *path = static_cast(calloc(nPathCount, sizeof(PSPathElement))); assert(*path != 0); memcpy( *path, &aPathList[0], nPathCount * sizeof(PSPathElement) ); } @@ -877,20 +877,20 @@ static char *nameExtract( const sal_uInt8* name, int nTableSize, int n, int dbFl if( ucs2result ) *ucs2result = NULL; if (dbFlag) { - res = (char*)malloc(1 + len/2); + res = static_cast(malloc(1 + len/2)); assert(res != 0); for (int i = 0; i < len/2; i++) res[i] = *(ptr + i * 2 + 1); res[len/2] = 0; if( ucs2result ) { - *ucs2result = (sal_uInt16*)malloc( len+2 ); + *ucs2result = static_cast(malloc( len+2 )); for (int i = 0; i < len/2; i++ ) (*ucs2result)[i] = GetUInt16( ptr, 2*i, 1 ); (*ucs2result)[len/2] = 0; } } else { - res = (char*)malloc(1 + len); + res = static_cast(malloc(1 + len)); assert(res != 0); memcpy(res, ptr, len); res[len] = 0; @@ -1395,7 +1395,7 @@ static void GetKern(TrueTypeFont *ttf) ttf->nkern = nMaxRecords; } - ttf->kerntables = (const sal_uInt8**)calloc(ttf->nkern, sizeof(sal_uInt8 *)); + ttf->kerntables = static_cast(calloc(ttf->nkern, sizeof(sal_uInt8 *))); assert(ttf->kerntables != 0); for( unsigned i = 0; i < ttf->nkern; ++i) { @@ -1427,7 +1427,7 @@ static void GetKern(TrueTypeFont *ttf) ttf->nkern = nMaxRecords; } - ttf->kerntables = (const sal_uInt8**)calloc(ttf->nkern, sizeof(sal_uInt8 *)); + ttf->kerntables = static_cast(calloc(ttf->nkern, sizeof(sal_uInt8 *))); assert(ttf->kerntables != 0); for( unsigned i = 0; i < ttf->nkern; ++i) { @@ -1469,7 +1469,7 @@ int CountTTCFonts(const char* fname) static void allocTrueTypeFont( TrueTypeFont** ttf ) { - *ttf = (TrueTypeFont*)calloc(1,sizeof(TrueTypeFont)); + *ttf = static_cast(calloc(1,sizeof(TrueTypeFont))); if( *ttf != NULL ) { (*ttf)->tag = 0; @@ -1526,7 +1526,7 @@ int OpenTTFontFile( const char* fname, sal_uInt32 facenum, TrueTypeFont** ttf ) goto cleanup; } - if (((*ttf)->ptr = (sal_uInt8 *) mmap(0, (*ttf)->fsize, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) { + if (((*ttf)->ptr = static_cast(mmap(0, (*ttf)->fsize, PROT_READ, MAP_SHARED, fd, 0))) == MAP_FAILED) { ret = SF_MEMORY; goto cleanup; } @@ -1552,7 +1552,7 @@ int OpenTTFontBuffer(const void* pBuffer, sal_uInt32 nLen, sal_uInt32 facenum, T (*ttf)->fname = NULL; (*ttf)->fsize = nLen; - (*ttf)->ptr = (sal_uInt8*)pBuffer; + (*ttf)->ptr = const_cast(static_cast(pBuffer)); return doOpenTTFont( facenum, *ttf ); } @@ -1593,9 +1593,9 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t ) if( t->ntables >= 128 ) return SF_TTFORMAT; - t->tables = (const sal_uInt8**)calloc(NUM_TAGS, sizeof(sal_uInt8 *)); + t->tables = static_cast(calloc(NUM_TAGS, sizeof(sal_uInt8 *))); assert(t->tables != 0); - t->tlens = (sal_uInt32*)calloc(NUM_TAGS, sizeof(sal_uInt32)); + t->tlens = static_cast(calloc(NUM_TAGS, sizeof(sal_uInt32))); assert(t->tlens != 0); /* parse the tables */ @@ -1715,13 +1715,13 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t ) t->nglyphs = k; table = getTable(t, O_loca); - t->goffsets = (sal_uInt32 *) calloc(1+t->nglyphs, sizeof(sal_uInt32)); + t->goffsets = static_cast(calloc(1+t->nglyphs, sizeof(sal_uInt32))); assert(t->goffsets != 0); for( i = 0; i <= (int)t->nglyphs; ++i ) t->goffsets[i] = indexfmt ? GetUInt32(table, i << 2, 1) : (sal_uInt32)GetUInt16(table, i << 1, 1) << 1; } else if( getTable(t, O_CFF) ) { /* PS-OpenType */ - t->goffsets = (sal_uInt32 *) calloc(1+t->nglyphs, sizeof(sal_uInt32)); + t->goffsets = static_cast(calloc(1+t->nglyphs, sizeof(sal_uInt32))); /* TODO: implement to get subsetting */ assert(t->goffsets != 0); } else { @@ -2051,7 +2051,7 @@ int CreateTTFromTTGlyphs(TrueTypeFont *ttf, /** glyf **/ glyf = TrueTypeTableNew_glyf(); - sal_uInt32* gID = (sal_uInt32*)scalloc(nGlyphs, sizeof(sal_uInt32)); + sal_uInt32* gID = static_cast(scalloc(nGlyphs, sizeof(sal_uInt32))); for (i = 0; i < nGlyphs; i++) { gID[i] = glyfAdd(glyf, GetTTRawGlyphData(ttf, glyphArray[i]), ttf); @@ -2117,7 +2117,7 @@ int CreateTTFromTTGlyphs(TrueTypeFont *ttf, #ifndef NO_TYPE42 static GlyphOffsets *GlyphOffsetsNew(sal_uInt8 *sfntP, sal_uInt32 sfntLen) { - GlyphOffsets* res = (GlyphOffsets*)smalloc(sizeof(GlyphOffsets)); + GlyphOffsets* res = static_cast(smalloc(sizeof(GlyphOffsets))); sal_uInt8 *loca = NULL; sal_uInt16 i, numTables = GetUInt16(sfntP, 4, 1); sal_uInt32 locaLen = 0; @@ -2155,7 +2155,7 @@ static GlyphOffsets *GlyphOffsetsNew(sal_uInt8 *sfntP, sal_uInt32 sfntLen) res->nGlyphs = locaLen / ((indexToLocFormat == 1) ? 4 : 2); assert(res->nGlyphs != 0); - res->offs = (sal_uInt32*)scalloc(res->nGlyphs, sizeof(sal_uInt32)); + res->offs = static_cast(scalloc(res->nGlyphs, sizeof(sal_uInt32))); for (i = 0; i < res->nGlyphs; i++) { if (indexToLocFormat == 1) { @@ -2202,7 +2202,7 @@ static void DumpSfnts(FILE *outf, sal_uInt8 *sfntP, sal_uInt32 sfntLen) assert(numTables <= 9); /* Type42 has 9 required tables */ - sal_uInt32* offs = (sal_uInt32*)scalloc(numTables, sizeof(sal_uInt32)); + sal_uInt32* offs = static_cast(scalloc(numTables, sizeof(sal_uInt32))); fputs("/sfnts [", outf); HexFmtOpenString(h); @@ -2321,7 +2321,7 @@ int CreateT42FromTTGlyphs(TrueTypeFont *ttf, /** glyf **/ glyf = TrueTypeTableNew_glyf(); - sal_uInt16* gID = (sal_uInt16*)scalloc(nGlyphs, sizeof(sal_uInt32)); + sal_uInt16* gID = static_cast(scalloc(nGlyphs, sizeof(sal_uInt32))); for (i = 0; i < nGlyphs; i++) { gID[i] = (sal_uInt16)glyfAdd(glyf, GetTTRawGlyphData(ttf, glyphArray[i]), ttf); @@ -2497,7 +2497,7 @@ TTSimpleGlyphMetrics *GetTTSimpleGlyphMetrics(TrueTypeFont *ttf, sal_uInt16 *gly if (!nGlyphs || !glyphArray) return 0; /* invalid parameters */ if (!n || !pTable) return 0; /* the font does not contain the requested metrics */ - TTSimpleGlyphMetrics* res = (TTSimpleGlyphMetrics*)calloc(nGlyphs, sizeof(TTSimpleGlyphMetrics)); + TTSimpleGlyphMetrics* res = static_cast(calloc(nGlyphs, sizeof(TTSimpleGlyphMetrics))); assert(res != 0); const int UPEm = ttf->unitsPerEm; @@ -2538,7 +2538,7 @@ TTSimpleGlyphMetrics *GetTTSimpleCharMetrics(TrueTypeFont * ttf, sal_uInt16 firs TTSimpleGlyphMetrics *res = 0; int i, n; - sal_uInt16* str = (sal_uInt16*)malloc(nChars * 2); + sal_uInt16* str = static_cast(malloc(nChars * 2)); assert(str != 0); for (i=0; igoffsets[glyphID+1] - ttf->goffsets[glyphID]; - GlyphData* d = (GlyphData*)malloc(sizeof(GlyphData)); assert(d != 0); + GlyphData* d = static_cast(malloc(sizeof(GlyphData))); assert(d != 0); if (length > 0) { const sal_uInt8* srcptr = glyf + ttf->goffsets[glyphID]; - d->ptr = (sal_uInt8*)malloc((length + 1) & ~1); assert(d->ptr != 0); + d->ptr = static_cast(malloc((length + 1) & ~1)); assert(d->ptr != 0); memcpy( d->ptr, srcptr, length ); d->compflag = (GetInt16( srcptr, 0, 1 ) < 0); } else { @@ -2718,7 +2718,7 @@ int GetTTNameRecords(TrueTypeFont *ttf, NameRecord **nr) n = nMaxRecords; } - NameRecord* rec = (NameRecord*)calloc(n, sizeof(NameRecord)); + NameRecord* rec = static_cast(calloc(n, sizeof(NameRecord))); for (i = 0; i < n; i++) { int nLargestFixedOffsetPos = 6 + 10 + 12 * i; @@ -2750,7 +2750,7 @@ int GetTTNameRecords(TrueTypeFont *ttf, NameRecord **nr) const size_t available_space = rec_string > end_table ? 0 : (end_table - rec_string); if (rec[i].slen <= available_space) { - rec[i].sptr = (sal_uInt8 *) malloc(rec[i].slen); assert(rec[i].sptr != 0); + rec[i].sptr = static_cast(malloc(rec[i].slen)); assert(rec[i].sptr != 0); memcpy(rec[i].sptr, rec_string, rec[i].slen); } else diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx index 5e54061ea6bb..d4aa5a6fee63 100644 --- a/vcl/source/fontsubset/ttcr.cxx +++ b/vcl/source/fontsubset/ttcr.cxx @@ -155,8 +155,8 @@ static int TableEntryCompareF(const void *l, const void *r) static int NameRecordCompareF(const void *l, const void *r) { - NameRecord *ll = (NameRecord *) l; - NameRecord *rr = (NameRecord *) r; + NameRecord const *ll = static_cast(l); + NameRecord const *rr = static_cast(r); if (ll->platformID != rr->platformID) { return (ll->platformID < rr->platformID) ? -1 : 1; @@ -200,7 +200,7 @@ _inline void *scalloc(sal_uInt32 n, sal_uInt32 size) void TrueTypeCreatorNewEmpty(sal_uInt32 tag, TrueTypeCreator **_this) { - TrueTypeCreator* ptr = (TrueTypeCreator*)smalloc(sizeof(TrueTypeCreator)); + TrueTypeCreator* ptr = static_cast(smalloc(sizeof(TrueTypeCreator))); ptr->tables = listNewEmpty(); listSetElementDtor(ptr->tables, reinterpret_cast(TrueTypeTableDispose)); @@ -225,7 +225,7 @@ void RemoveTable(TrueTypeCreator *_this, sal_uInt32 tag) listToFirst(_this->tables); int done = 0; do { - if (((TrueTypeTable *) listCurrent(_this->tables))->tag == tag) + if (static_cast(listCurrent(_this->tables))->tag == tag) { listRemove(_this->tables); } @@ -257,12 +257,12 @@ int StreamToMemory(TrueTypeCreator *_this, sal_uInt8 **ptr, sal_uInt32 *length) sal_uInt16 numTables = listCount(_this->tables); - TableEntry* te = (TableEntry*)scalloc(numTables, sizeof(TableEntry)); + TableEntry* te = static_cast(scalloc(numTables, sizeof(TableEntry))); TableEntry* e = te; listToFirst(_this->tables); do { - GetRawData((TrueTypeTable *)listCurrent(_this->tables), &e->data, &e->length, &e->tag); + GetRawData(static_cast(listCurrent(_this->tables)), &e->data, &e->length, &e->tag); ++e; } while (listNext(_this->tables)); @@ -284,7 +284,7 @@ int StreamToMemory(TrueTypeCreator *_this, sal_uInt8 **ptr, sal_uInt32 *length) /* if ((te[i].length & 3) != 0) s += (4 - (te[i].length & 3)) & 3; */ } - sal_uInt8* ttf = (sal_uInt8*)smalloc(s); + sal_uInt8* ttf = static_cast(smalloc(s)); /* Offset Table */ PutUInt32(_this->tag, ttf, 0, 1); @@ -412,7 +412,7 @@ static sal_uInt8 *ttmalloc(sal_uInt32 nbytes) sal_uInt32 n; n = (nbytes + 3) & (sal_uInt32) ~3; - sal_uInt8* res = (sal_uInt8*)malloc(n); + sal_uInt8* res = static_cast(malloc(n)); assert(res != 0); memset(res, 0, n); @@ -421,7 +421,7 @@ static sal_uInt8 *ttmalloc(sal_uInt32 nbytes) static void FreeGlyphData(void *ptr) { - GlyphData *p = (GlyphData *) ptr; + GlyphData *p = static_cast(ptr); if (p->ptr) free(p->ptr); free(p); } @@ -430,7 +430,7 @@ static void TrueTypeTableDispose_generic(TrueTypeTable *_this) { if (_this) { if (_this->data) { - tdata_generic *pdata = (tdata_generic *) _this->data; + tdata_generic *pdata = static_cast(_this->data); if (pdata->nbytes) free(pdata->ptr); free(_this->data); } @@ -458,7 +458,7 @@ static void TrueTypeTableDispose_loca(TrueTypeTable *_this) { if (_this) { if (_this->data) { - tdata_loca *p = (tdata_loca *) _this->data; + tdata_loca *p = static_cast(_this->data); if (p->ptr) free(p->ptr); free(_this->data); } @@ -477,7 +477,7 @@ static void TrueTypeTableDispose_maxp(TrueTypeTable *_this) static void TrueTypeTableDispose_glyf(TrueTypeTable *_this) { if (_this) { - if (_this->data) listDispose((list) _this->data); + if (_this->data) listDispose(static_cast(_this->data)); free(_this); } } @@ -485,7 +485,7 @@ static void TrueTypeTableDispose_glyf(TrueTypeTable *_this) static void TrueTypeTableDispose_cmap(TrueTypeTable *_this) { if (_this) { - table_cmap *t = (table_cmap *) _this->data; + table_cmap *t = static_cast(_this->data); if (t) { CmapSubTable *s = t->s; if (s) { @@ -504,7 +504,7 @@ static void TrueTypeTableDispose_cmap(TrueTypeTable *_this) static void TrueTypeTableDispose_name(TrueTypeTable *_this) { if (_this) { - if (_this->data) listDispose((list) _this->data); + if (_this->data) listDispose(static_cast(_this->data)); free(_this); } } @@ -512,7 +512,7 @@ static void TrueTypeTableDispose_name(TrueTypeTable *_this) static void TrueTypeTableDispose_post(TrueTypeTable *_this) { if (_this) { - tdata_post *p = (tdata_post *) _this->data; + tdata_post *p = static_cast(_this->data); if (p) { if (p->format == 0x00030000) { /* do nothing */ @@ -549,9 +549,9 @@ static int GetRawData_generic(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 assert(_this != 0); assert(_this->data != 0); - *ptr = ((tdata_generic *) _this->data)->ptr; - *len = ((tdata_generic *) _this->data)->nbytes; - *tag = ((tdata_generic *) _this->data)->tag; + *ptr = static_cast(_this->data)->ptr; + *len = static_cast(_this->data)->nbytes; + *tag = static_cast(_this->data)->tag; return TTCR_OK; } @@ -559,7 +559,7 @@ static int GetRawData_generic(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 static int GetRawData_head(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *len, sal_uInt32 *tag) { *len = TABLESIZE_head; - *ptr = (sal_uInt8 *) _this->data; + *ptr = static_cast(_this->data); *tag = T_head; return TTCR_OK; @@ -568,7 +568,7 @@ static int GetRawData_head(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le static int GetRawData_hhea(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *len, sal_uInt32 *tag) { *len = TABLESIZE_hhea; - *ptr = (sal_uInt8 *) _this->data; + *ptr = static_cast(_this->data); *tag = T_hhea; return TTCR_OK; @@ -580,7 +580,7 @@ static int GetRawData_loca(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le assert(_this->data != 0); - p = (tdata_loca *) _this->data; + p = static_cast(_this->data); if (p->nbytes == 0) return TTCR_ZEROGLYPHS; @@ -594,7 +594,7 @@ static int GetRawData_loca(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le static int GetRawData_maxp(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *len, sal_uInt32 *tag) { *len = TABLESIZE_maxp; - *ptr = (sal_uInt8 *) _this->data; + *ptr = static_cast(_this->data); *tag = T_maxp; return TTCR_OK; @@ -603,7 +603,7 @@ static int GetRawData_maxp(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le static int GetRawData_glyf(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *len, sal_uInt32 *tag) { sal_uInt32 n, nbytes = 0; - list l = (list) _this->data; + list l = static_cast(_this->data); /* sal_uInt16 curID = 0; */ /* to check if glyph IDs are sequential and start from zero */ sal_uInt8 *p; @@ -616,16 +616,16 @@ static int GetRawData_glyf(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le listToFirst(l); do { /* if (((GlyphData *) listCurrent(l))->glyphID != curID++) return TTCR_GLYPHSEQ; */ - nbytes += ((GlyphData *) listCurrent(l))->nbytes; + nbytes += static_cast(listCurrent(l))->nbytes; } while (listNext(l)); p = _this->rawdata = ttmalloc(nbytes); listToFirst(l); do { - n = ((GlyphData *) listCurrent(l))->nbytes; + n = static_cast(listCurrent(l))->nbytes; if (n != 0) { - memcpy(p, ((GlyphData *) listCurrent(l))->ptr, n); + memcpy(p, static_cast(listCurrent(l))->ptr, n); p += n; } } while (listNext(l)); @@ -640,7 +640,7 @@ static int GetRawData_glyf(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le /* cmap packers */ static sal_uInt8 *PackCmapType0(CmapSubTable *s, sal_uInt32 *length) { - sal_uInt8* ptr = (sal_uInt8*)smalloc(262); + sal_uInt8* ptr = static_cast(smalloc(262)); sal_uInt8 *p = ptr + 6; sal_uInt32 i, j; sal_uInt16 g; @@ -664,7 +664,7 @@ static sal_uInt8 *PackCmapType0(CmapSubTable *s, sal_uInt32 *length) static sal_uInt8 *PackCmapType6(CmapSubTable *s, sal_uInt32 *length) { - sal_uInt8* ptr = (sal_uInt8*)smalloc(s->n*2 + 10); + sal_uInt8* ptr = static_cast(smalloc(s->n*2 + 10)); sal_uInt8 *p = ptr + 10; sal_uInt32 i, j; sal_uInt16 g; @@ -708,12 +708,12 @@ static int GetRawData_cmap(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le sal_uInt32 coffset; assert(_this != 0); - t = (table_cmap *) _this->data; + t = static_cast(_this->data); assert(t != 0); assert(t->n != 0); - sal_uInt8** subtables = (sal_uInt8**)scalloc(t->n, sizeof(sal_uInt8 *)); - sal_uInt32* sizes = (sal_uInt32*)scalloc(t->n, sizeof(sal_uInt32)); + sal_uInt8** subtables = static_cast(scalloc(t->n, sizeof(sal_uInt8 *))); + sal_uInt32* sizes = static_cast(scalloc(t->n, sizeof(sal_uInt32))); for (i = 0; i < t->n; i++) { subtables[i] = PackCmap(t->s+i, &l); @@ -759,12 +759,12 @@ static int GetRawData_name(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le *tag = 0; assert(_this != 0); - l = (list) _this->data; + l = static_cast(_this->data); assert(l != 0); if ((n = (sal_Int16)listCount(l)) == 0) return TTCR_NONAMES; - NameRecord* nr = (NameRecord*)scalloc(n, sizeof(NameRecord)); + NameRecord* nr = static_cast(scalloc(n, sizeof(NameRecord))); listToFirst(l); @@ -818,7 +818,7 @@ static int GetRawData_name(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le static int GetRawData_post(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *len, sal_uInt32 *tag) { - tdata_post *p = (tdata_post *) _this->data; + tdata_post *p = static_cast(_this->data); sal_uInt8 *post = 0; sal_uInt32 postLen = 0; int ret; @@ -882,8 +882,8 @@ TrueTypeTable *TrueTypeTableNew(sal_uInt32 tag, sal_uInt32 nbytes, const sal_uInt8* ptr) { - TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); - tdata_generic* pdata = (tdata_generic*)smalloc(sizeof(tdata_generic)); + TrueTypeTable* table = static_cast(smalloc(sizeof(TrueTypeTable))); + tdata_generic* pdata = static_cast(smalloc(sizeof(tdata_generic))); pdata->nbytes = nbytes; pdata->tag = tag; if (nbytes) { @@ -910,7 +910,7 @@ TrueTypeTable *TrueTypeTableNew_head(sal_uInt32 fontRevision, { assert(created != 0); - TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); + TrueTypeTable* table = static_cast(smalloc(sizeof(TrueTypeTable))); sal_uInt8* ptr = (sal_uInt8*)ttmalloc(TABLESIZE_head); PutUInt32(0x00010000, ptr, 0, 1); /* version */ @@ -938,7 +938,7 @@ TrueTypeTable *TrueTypeTableNew_hhea(sal_Int16 ascender, sal_Int16 caretSlopeRise, sal_Int16 caretSlopeRun) { - TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); + TrueTypeTable* table = static_cast(smalloc(sizeof(TrueTypeTable))); sal_uInt8* ptr = (sal_uInt8*)ttmalloc(TABLESIZE_hhea); PutUInt32(0x00010000, ptr, 0, 1); /* version */ @@ -963,11 +963,11 @@ TrueTypeTable *TrueTypeTableNew_hhea(sal_Int16 ascender, TrueTypeTable *TrueTypeTableNew_loca(void) { - TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); + TrueTypeTable* table = static_cast(smalloc(sizeof(TrueTypeTable))); table->data = smalloc(sizeof(tdata_loca)); - ((tdata_loca *)table->data)->nbytes = 0; - ((tdata_loca *)table->data)->ptr = 0; + static_cast(table->data)->nbytes = 0; + static_cast(table->data)->ptr = 0; table->tag = T_loca; table->rawdata = 0; @@ -977,7 +977,7 @@ TrueTypeTable *TrueTypeTableNew_loca(void) TrueTypeTable *TrueTypeTableNew_maxp( const sal_uInt8* maxp, int size) { - TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); + TrueTypeTable* table = static_cast(smalloc(sizeof(TrueTypeTable))); table->data = ttmalloc(TABLESIZE_maxp); if (maxp && size == TABLESIZE_maxp) { @@ -992,7 +992,7 @@ TrueTypeTable *TrueTypeTableNew_maxp( const sal_uInt8* maxp, int size) TrueTypeTable *TrueTypeTableNew_glyf(void) { - TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); + TrueTypeTable* table = static_cast(smalloc(sizeof(TrueTypeTable))); list l = listNewEmpty(); assert(l != 0); @@ -1008,12 +1008,12 @@ TrueTypeTable *TrueTypeTableNew_glyf(void) TrueTypeTable *TrueTypeTableNew_cmap(void) { - TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); - table_cmap* cmap = (table_cmap*)smalloc(sizeof(table_cmap)); + TrueTypeTable* table = static_cast(smalloc(sizeof(TrueTypeTable))); + table_cmap* cmap = static_cast(smalloc(sizeof(table_cmap))); cmap->n = 0; cmap->m = CMAP_SUBTABLE_INIT; - cmap->s = (CmapSubTable *) scalloc(CMAP_SUBTABLE_INIT, sizeof(CmapSubTable)); + cmap->s = static_cast(scalloc(CMAP_SUBTABLE_INIT, sizeof(CmapSubTable))); memset(cmap->s, 0, sizeof(CmapSubTable) * CMAP_SUBTABLE_INIT); table->data = (table_cmap *) cmap; @@ -1027,7 +1027,7 @@ TrueTypeTable *TrueTypeTableNew_cmap(void) static void DisposeNameRecord(void *ptr) { if (ptr != 0) { - NameRecord *nr = (NameRecord *) ptr; + NameRecord *nr = static_cast(ptr); if (nr->sptr) free(nr->sptr); free(ptr); } @@ -1035,12 +1035,12 @@ static void DisposeNameRecord(void *ptr) static NameRecord* NameRecordNewCopy(NameRecord *nr) { - NameRecord* p = (NameRecord*)smalloc(sizeof(NameRecord)); + NameRecord* p = static_cast(smalloc(sizeof(NameRecord))); memcpy(p, nr, sizeof(NameRecord)); if (p->slen) { - p->sptr = (sal_uInt8*)smalloc(p->slen); + p->sptr = static_cast(smalloc(p->slen)); memcpy(p->sptr, nr->sptr, p->slen); } @@ -1049,7 +1049,7 @@ static NameRecord* NameRecordNewCopy(NameRecord *nr) TrueTypeTable *TrueTypeTableNew_name(int n, NameRecord *nr) { - TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); + TrueTypeTable* table = static_cast(smalloc(sizeof(TrueTypeTable))); list l = listNewEmpty(); assert(l != 0); @@ -1077,8 +1077,8 @@ TrueTypeTable *TrueTypeTableNew_post(sal_uInt32 format, sal_uInt32 isFixedPitch) { assert(format == 0x00030000); /* Only format 3.0 is supported at this time */ - TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); - tdata_post* post = (tdata_post*)smalloc(sizeof(tdata_post)); + TrueTypeTable* table = static_cast(smalloc(sizeof(TrueTypeTable))); + tdata_post* post = static_cast(smalloc(sizeof(tdata_post))); post->format = format; post->italicAngle = italicAngle; @@ -1129,7 +1129,7 @@ void cmapAdd(TrueTypeTable *table, sal_uInt32 id, sal_uInt32 c, sal_uInt32 g) assert(table != 0); assert(table->tag == T_cmap); - t = (table_cmap *) table->data; assert(t != 0); + t = static_cast(table->data); assert(t != 0); s = t->s; assert(s != 0); found = 0; @@ -1143,7 +1143,7 @@ void cmapAdd(TrueTypeTable *table, sal_uInt32 id, sal_uInt32 c, sal_uInt32 g) if (!found) { if (t->n == t->m) { - CmapSubTable* tmp = (CmapSubTable*)scalloc(t->m + CMAP_SUBTABLE_INCR, sizeof(CmapSubTable)); + CmapSubTable* tmp = static_cast(scalloc(t->m + CMAP_SUBTABLE_INCR, sizeof(CmapSubTable))); memset(tmp, 0, t->m + CMAP_SUBTABLE_INCR * sizeof(CmapSubTable)); memcpy(tmp, s, sizeof(CmapSubTable) * t->m); t->m += CMAP_SUBTABLE_INCR; @@ -1165,13 +1165,13 @@ void cmapAdd(TrueTypeTable *table, sal_uInt32 id, sal_uInt32 c, sal_uInt32 g) s[i].id = id; s[i].n = 0; s[i].m = CMAP_PAIR_INIT; - s[i].xc = (sal_uInt32*)scalloc(CMAP_PAIR_INIT, sizeof(sal_uInt32)); - s[i].xg = (sal_uInt32*)scalloc(CMAP_PAIR_INIT, sizeof(sal_uInt32)); + s[i].xc = static_cast(scalloc(CMAP_PAIR_INIT, sizeof(sal_uInt32))); + s[i].xg = static_cast(scalloc(CMAP_PAIR_INIT, sizeof(sal_uInt32))); } if (s[i].n == s[i].m) { - sal_uInt32* tmp1 = (sal_uInt32*)scalloc(s[i].m + CMAP_PAIR_INCR, sizeof(sal_uInt32)); - sal_uInt32* tmp2 = (sal_uInt32*)scalloc(s[i].m + CMAP_PAIR_INCR, sizeof(sal_uInt32)); + sal_uInt32* tmp1 = static_cast(scalloc(s[i].m + CMAP_PAIR_INCR, sizeof(sal_uInt32))); + sal_uInt32* tmp2 = static_cast(scalloc(s[i].m + CMAP_PAIR_INCR, sizeof(sal_uInt32))); assert(tmp1 != 0); assert(tmp2 != 0); memcpy(tmp1, s[i].xc, sizeof(sal_uInt32) * s[i].m); @@ -1203,10 +1203,10 @@ sal_uInt32 glyfAdd(TrueTypeTable *table, GlyphData *glyphdata, TrueTypeFont *fnt ncomponents = GetTTGlyphComponents(fnt, glyphdata->glyphID, glyphlist); - l = (list) table->data; + l = static_cast(table->data); if (listCount(l) > 0) { listToLast(l); - ret = n = ((GlyphData *) listCurrent(l))->newID + 1; + ret = n = static_cast(listCurrent(l))->newID + 1; } else { ret = n = 0; } @@ -1225,7 +1225,7 @@ sal_uInt32 glyfAdd(TrueTypeTable *table, GlyphData *glyphdata, TrueTypeFont *fnt /* XXX expensive! should be rewritten with sorted arrays! */ listToFirst(l); do { - if (((GlyphData *) listCurrent(l))->glyphID == currentID) { + if (static_cast(listCurrent(l))->glyphID == currentID) { found = 1; break; } @@ -1246,7 +1246,7 @@ sal_uInt32 glyfCount(const TrueTypeTable *table) { assert(table != 0); assert(table->tag == T_glyf); - return listCount((list) table->data); + return listCount(static_cast(table->data)); } void nameAdd(TrueTypeTable *table, NameRecord *nr) @@ -1256,7 +1256,7 @@ void nameAdd(TrueTypeTable *table, NameRecord *nr) assert(table != 0); assert(table->tag == T_name); - l = (list) table->data; + l = static_cast(table->data); listAppend(l, NameRecordNewCopy(nr)); } @@ -1268,8 +1268,8 @@ static TrueTypeTable *FindTable(TrueTypeCreator *tt, sal_uInt32 tag) listToFirst(tt->tables); do { - if (((TrueTypeTable *) listCurrent(tt->tables))->tag == tag) { - return (TrueTypeTable*)listCurrent(tt->tables); + if (static_cast(listCurrent(tt->tables))->tag == tag) { + return static_cast(listCurrent(tt->tables)); } } while (listNext(tt->tables)); @@ -1307,10 +1307,10 @@ static void ProcessTables(TrueTypeCreator *tt) sal_uInt32 *gid; /* array of old glyphIDs */ glyf = FindTable(tt, T_glyf); - glyphlist = (list) glyf->data; + glyphlist = static_cast(glyf->data); nGlyphs = listCount(glyphlist); assert(nGlyphs != 0); - gid = (sal_uInt32*)scalloc(nGlyphs, sizeof(sal_uInt32)); + gid = static_cast(scalloc(nGlyphs, sizeof(sal_uInt32))); RemoveTable(tt, T_loca); RemoveTable(tt, T_hmtx); @@ -1319,7 +1319,7 @@ static void ProcessTables(TrueTypeCreator *tt) listToFirst(glyphlist); do { - GlyphData *gd = (GlyphData *) listCurrent(glyphlist); + GlyphData *gd = static_cast(listCurrent(glyphlist)); sal_Int16 z; glyfLen += gd->nbytes; /* XXX if (gd->nbytes & 1) glyfLen++; */ @@ -1359,14 +1359,14 @@ static void ProcessTables(TrueTypeCreator *tt) sal_uInt8* glyfPtr = ttmalloc(glyfLen); sal_uInt8* locaPtr = ttmalloc(locaLen); - TTSimpleGlyphMetrics* met = (TTSimpleGlyphMetrics*)scalloc(nGlyphs, sizeof(TTSimpleGlyphMetrics)); + TTSimpleGlyphMetrics* met = static_cast(scalloc(nGlyphs, sizeof(TTSimpleGlyphMetrics))); i = 0; listToFirst(glyphlist); p1 = glyfPtr; p2 = locaPtr; do { - GlyphData *gd = (GlyphData *) listCurrent(glyphlist); + GlyphData *gd = static_cast(listCurrent(glyphlist)); if (gd->compflag) { /* re-number all components */ sal_uInt16 flags, index; @@ -1432,13 +1432,13 @@ static void ProcessTables(TrueTypeCreator *tt) glyf->rawdata = glyfPtr; loca = TrueTypeTableNew_loca(); assert(loca != 0); - ((tdata_loca *) loca->data)->ptr = locaPtr; - ((tdata_loca *) loca->data)->nbytes = locaLen; + static_cast(loca->data)->ptr = locaPtr; + static_cast(loca->data)->nbytes = locaLen; AddTable(tt, loca); head = FindTable(tt, T_head); - sal_uInt8* const pHeadData = (sal_uInt8*)head->data; + sal_uInt8* const pHeadData = static_cast(head->data); PutInt16(xMin, pHeadData, 36, 1); PutInt16(yMin, pHeadData, 38, 1); PutInt16(xMax, pHeadData, 40, 1); @@ -1447,7 +1447,7 @@ static void ProcessTables(TrueTypeCreator *tt) maxp = FindTable(tt, T_maxp); - sal_uInt8* const pMaxpData = (sal_uInt8*)maxp->data; + sal_uInt8* const pMaxpData = static_cast(maxp->data); PutUInt16((sal_uInt16)nGlyphs, pMaxpData, 4, 1); PutUInt16(maxPoints, pMaxpData, 6, 1); PutUInt16(maxContours, pMaxpData, 8, 1); @@ -1458,7 +1458,7 @@ static void ProcessTables(TrueTypeCreator *tt) * Generate an htmx table and update hhea table */ hhea = FindTable(tt, T_hhea); assert(hhea != 0); - hheaPtr = (sal_uInt8 *) hhea->data; + hheaPtr = static_cast(hhea->data); if (nGlyphs > 2) { for (i = nGlyphs - 1; i > 0; i--) { if (met[i].adv != met[i-1].adv) break; diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx index 9efb7fe33c9d..f4ba559074a8 100644 --- a/vcl/source/gdi/animate.cxx +++ b/vcl/source/gdi/animate.cxx @@ -383,7 +383,7 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl) maViewList.push_back( pView ); } else - pView = (ImplAnimView*) pAInfo->pViewData; + pView = static_cast(pAInfo->pViewData); pView->pause( pAInfo->bPause ); pView->setMarked( true ); diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index bfd25a63226d..d8e18af5252e 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -2065,9 +2065,9 @@ extern "C" int SAL_CALL ImplPopularCmpFnc( const void* p1, const void* p2 ) { int nRet; - if( ( (PopularColorCount*) p1 )->mnCount < ( (PopularColorCount*) p2 )->mnCount ) + if( static_cast(p1)->mnCount < static_cast(p2)->mnCount ) nRet = 1; - else if( ( (PopularColorCount*) p1 )->mnCount == ( (PopularColorCount*) p2 )->mnCount ) + else if( static_cast(p1)->mnCount == static_cast(p2)->mnCount ) nRet = 0; else nRet = -1; @@ -2243,7 +2243,7 @@ bool Bitmap::ImplReduceMedian( sal_uInt16 nColCount ) if( pWAcc ) { const sal_uLong nSize = 32768UL * sizeof( sal_uLong ); - sal_uLong* pColBuf = (sal_uLong*) rtl_allocateMemory( nSize ); + sal_uLong* pColBuf = static_cast(rtl_allocateMemory( nSize )); const long nWidth = pWAcc->Width(); const long nHeight = pWAcc->Height(); long nIndex = 0L; diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx index bb588b54d373..e4b15f14793c 100644 --- a/vcl/source/gdi/bitmap4.cxx +++ b/vcl/source/gdi/bitmap4.cxx @@ -931,9 +931,9 @@ extern "C" int SAL_CALL ImplPopArtCmpFnc( const void* p1, const void* p2 ) { int nRet; - if( ( (PopArtEntry*) p1 )->mnCount < ( (PopArtEntry*) p2 )->mnCount ) + if( static_cast(p1)->mnCount < static_cast(p2)->mnCount ) nRet = 1; - else if( ( (PopArtEntry*) p1 )->mnCount == ( (PopArtEntry*) p2 )->mnCount ) + else if( static_cast(p1)->mnCount == static_cast(p2)->mnCount ) nRet = 0; else nRet = -1; diff --git a/vcl/source/gdi/configsettings.cxx b/vcl/source/gdi/configsettings.cxx index 1e33a4819e89..4f31f7f39b1b 100644 --- a/vcl/source/gdi/configsettings.cxx +++ b/vcl/source/gdi/configsettings.cxx @@ -119,7 +119,7 @@ void SettingsConfigItem::getValues() { if( pValue->getValueTypeClass() == TypeClass_STRING ) { - const OUString* pLine = (const OUString*)pValue->getValue(); + const OUString* pLine = static_cast(pValue->getValue()); if( !pLine->isEmpty() ) m_aSettings[ aKeyName ][ pFrom[i] ] = *pLine; #if OSL_DEBUG_LEVEL > 2 diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index d79622f082fd..d4f5447cce22 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -770,7 +770,7 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLon // read coding information rIStm.ReadUInt32( nCodedSize ).ReadUInt32( nUncodedSize ).ReadUInt32( aHeader.nCompression ); - pData = (sal_uInt8*) rtl_allocateMemory( nUncodedSize ); + pData = static_cast(rtl_allocateMemory( nUncodedSize )); // decode buffer nCodedPos = rIStm.Tell(); @@ -1380,7 +1380,7 @@ bool ImplWriteDIBBody(const Bitmap& rBitmap, SvStream& rOStm, BitmapReadAccess& // write compressed data aCodec.BeginCompression(3); - aCodec.Write(rOStm, (sal_uInt8*)aMemStm.GetData(), nUncodedSize); + aCodec.Write(rOStm, static_cast(aMemStm.GetData()), nUncodedSize); aCodec.EndCompression(); // update compress info ( coded size, uncoded size, uncoded compression ) diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 3193269f3f3a..a761a5d07516 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -1822,15 +1822,15 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai Color GDIMetaFile::ImplColAdjustFnc( const Color& rColor, const void* pColParam ) { return Color( rColor.GetTransparency(), - ( (const ImplColAdjustParam*) pColParam )->pMapR[ rColor.GetRed() ], - ( (const ImplColAdjustParam*) pColParam )->pMapG[ rColor.GetGreen() ], - ( (const ImplColAdjustParam*) pColParam )->pMapB[ rColor.GetBlue() ] ); + static_cast(pColParam)->pMapR[ rColor.GetRed() ], + static_cast(pColParam)->pMapG[ rColor.GetGreen() ], + static_cast(pColParam)->pMapB[ rColor.GetBlue() ] ); } BitmapEx GDIMetaFile::ImplBmpAdjustFnc( const BitmapEx& rBmpEx, const void* pBmpParam ) { - const ImplBmpAdjustParam* p = (const ImplBmpAdjustParam*) pBmpParam; + const ImplBmpAdjustParam* p = static_cast(pBmpParam); BitmapEx aRet( rBmpEx ); aRet.Adjust( p->nLuminancePercent, p->nContrastPercent, @@ -1844,7 +1844,7 @@ Color GDIMetaFile::ImplColConvertFnc( const Color& rColor, const void* pColParam { sal_uInt8 cLum = rColor.GetLuminance(); - if( MTF_CONVERSION_1BIT_THRESHOLD == ( (const ImplColConvertParam*) pColParam )->eConversion ) + if( MTF_CONVERSION_1BIT_THRESHOLD == static_cast(pColParam)->eConversion ) cLum = ( cLum < 128 ) ? 0 : 255; return Color( rColor.GetTransparency(), cLum, cLum, cLum ); @@ -1854,14 +1854,14 @@ BitmapEx GDIMetaFile::ImplBmpConvertFnc( const BitmapEx& rBmpEx, const void* pBm { BitmapEx aRet( rBmpEx ); - aRet.Convert( ( (const ImplBmpConvertParam*) pBmpParam )->eConversion ); + aRet.Convert( static_cast(pBmpParam)->eConversion ); return aRet; } Color GDIMetaFile::ImplColMonoFnc( const Color&, const void* pColParam ) { - return ( (const ImplColMonoParam*) pColParam )->aColor; + return static_cast(pColParam)->aColor; } BitmapEx GDIMetaFile::ImplBmpMonoFnc( const BitmapEx& rBmpEx, const void* pBmpParam ) @@ -1870,10 +1870,10 @@ BitmapEx GDIMetaFile::ImplBmpMonoFnc( const BitmapEx& rBmpEx, const void* pBmpPa aPal[ 0 ] = Color( COL_BLACK ); aPal[ 1 ] = Color( COL_WHITE ); - aPal[ 2 ] = ( (const ImplBmpMonoParam*) pBmpParam )->aColor; + aPal[ 2 ] = static_cast(pBmpParam)->aColor; Bitmap aBmp( rBmpEx.GetSizePixel(), 4, &aPal ); - aBmp.Erase( ( (const ImplBmpMonoParam*) pBmpParam )->aColor ); + aBmp.Erase( static_cast(pBmpParam)->aColor ); if( rBmpEx.IsAlpha() ) return BitmapEx( aBmp, rBmpEx.GetAlpha() ); @@ -1887,16 +1887,16 @@ Color GDIMetaFile::ImplColReplaceFnc( const Color& rColor, const void* pColParam { const sal_uLong nR = rColor.GetRed(), nG = rColor.GetGreen(), nB = rColor.GetBlue(); - for( sal_uLong i = 0; i < ( (const ImplColReplaceParam*) pColParam )->nCount; i++ ) + for( sal_uLong i = 0; i < static_cast(pColParam)->nCount; i++ ) { - if( ( ( (const ImplColReplaceParam*) pColParam )->pMinR[ i ] <= nR ) && - ( ( (const ImplColReplaceParam*) pColParam )->pMaxR[ i ] >= nR ) && - ( ( (const ImplColReplaceParam*) pColParam )->pMinG[ i ] <= nG ) && - ( ( (const ImplColReplaceParam*) pColParam )->pMaxG[ i ] >= nG ) && - ( ( (const ImplColReplaceParam*) pColParam )->pMinB[ i ] <= nB ) && - ( ( (const ImplColReplaceParam*) pColParam )->pMaxB[ i ] >= nB ) ) + if( ( static_cast(pColParam)->pMinR[ i ] <= nR ) && + ( static_cast(pColParam)->pMaxR[ i ] >= nR ) && + ( static_cast(pColParam)->pMinG[ i ] <= nG ) && + ( static_cast(pColParam)->pMaxG[ i ] >= nG ) && + ( static_cast(pColParam)->pMinB[ i ] <= nB ) && + ( static_cast(pColParam)->pMaxB[ i ] >= nB ) ) { - return ( (const ImplColReplaceParam*) pColParam )->pDstCols[ i ]; + return static_cast(pColParam)->pDstCols[ i ]; } } @@ -1905,7 +1905,7 @@ Color GDIMetaFile::ImplColReplaceFnc( const Color& rColor, const void* pColParam BitmapEx GDIMetaFile::ImplBmpReplaceFnc( const BitmapEx& rBmpEx, const void* pBmpParam ) { - const ImplBmpReplaceParam* p = (const ImplBmpReplaceParam*) pBmpParam; + const ImplBmpReplaceParam* p = static_cast(pBmpParam); BitmapEx aRet( rBmpEx ); aRet.Replace( p->pSrcCols, p->pDstCols, p->nCount, p->pTols ); @@ -2964,7 +2964,7 @@ MetaCommentAction* makePluggableRendererAction( const OUString& rRendererService const void* _pData, sal_uInt32 nDataSize ) { - const sal_uInt8* pData=(sal_uInt8*)_pData; + const sal_uInt8* pData=static_cast(_pData); // FIXME: Data gets copied twice, unfortunately OString aRendererServiceName( diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx index 5c0b0dcb4610..6e335118da62 100644 --- a/vcl/source/gdi/image.cxx +++ b/vcl/source/gdi/image.cxx @@ -62,30 +62,30 @@ Image::Image( const ResId& rResId ) : if( nObjMask & RSC_IMAGE_IMAGEBITMAP ) { - aBmpEx = BitmapEx( ResId( (RSHEADER_TYPE*)pResMgr->GetClass(), *pResMgr ) ); - pResMgr->Increment( ResMgr::GetObjSize( (RSHEADER_TYPE*)pResMgr->GetClass() ) ); + aBmpEx = BitmapEx( ResId( static_cast(pResMgr->GetClass()), *pResMgr ) ); + pResMgr->Increment( ResMgr::GetObjSize( static_cast(pResMgr->GetClass()) ) ); } if( nObjMask & RSC_IMAGE_MASKBITMAP ) { if( !aBmpEx.IsEmpty() && aBmpEx.GetTransparentType() == TRANSPARENT_NONE ) { - const Bitmap aMaskBitmap( ResId( (RSHEADER_TYPE*)pResMgr->GetClass(), *pResMgr ) ); + const Bitmap aMaskBitmap( ResId( static_cast(pResMgr->GetClass()), *pResMgr ) ); aBmpEx = BitmapEx( aBmpEx.GetBitmap(), aMaskBitmap ); } - pResMgr->Increment( ResMgr::GetObjSize( (RSHEADER_TYPE*)pResMgr->GetClass() ) ); + pResMgr->Increment( ResMgr::GetObjSize( static_cast(pResMgr->GetClass()) ) ); } if( nObjMask & RSC_IMAGE_MASKCOLOR ) { if( !aBmpEx.IsEmpty() && aBmpEx.GetTransparentType() == TRANSPARENT_NONE ) { - const Color aMaskColor( ResId( (RSHEADER_TYPE*)pResMgr->GetClass(), *pResMgr ) ); + const Color aMaskColor( ResId( static_cast(pResMgr->GetClass()), *pResMgr ) ); aBmpEx = BitmapEx( aBmpEx.GetBitmap(), aMaskColor ); } - pResMgr->Increment( ResMgr::GetObjSize( (RSHEADER_TYPE*)pResMgr->GetClass() ) ); + pResMgr->Increment( ResMgr::GetObjSize( static_cast(pResMgr->GetClass()) ) ); } if( ! aBmpEx.IsEmpty() ) ImplInit( aBmpEx ); @@ -303,9 +303,9 @@ ImageList::ImageList( const ResId& rResId ) : std::unique_ptr< Color > xMaskColor; if( nObjMask & RSC_IMAGE_MASKCOLOR ) - xMaskColor.reset( new Color( ResId( (RSHEADER_TYPE*)pResMgr->GetClass(), *pResMgr ) ) ); + xMaskColor.reset( new Color( ResId( static_cast(pResMgr->GetClass()), *pResMgr ) ) ); - pResMgr->Increment( ResMgr::GetObjSize( (RSHEADER_TYPE*)pResMgr->GetClass() ) ); + pResMgr->Increment( ResMgr::GetObjSize( static_cast(pResMgr->GetClass()) ) ); if( nObjMask & RSC_IMAGELIST_IDLIST ) { diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx index 61ef2ea3971c..30cc1021fbf4 100644 --- a/vcl/source/gdi/impvect.cxx +++ b/vcl/source/gdi/impvect.cxx @@ -90,8 +90,8 @@ struct ImplColorSet extern "C" int SAL_CALL ImplColorSetCmpFnc( const void* p1, const void* p2 ) { - ImplColorSet* pSet1 = (ImplColorSet*) p1; - ImplColorSet* pSet2 = (ImplColorSet*) p2; + ImplColorSet const * pSet1 = static_cast(p1); + ImplColorSet const * pSet2 = static_cast(p2); int nRet; if( pSet1->mbSet && pSet2->mbSet ) @@ -156,7 +156,7 @@ void ImplPointArray::ImplSetSize( sal_uLong nSize ) if( mpArray ) rtl_freeMemory( mpArray ); - mpArray = (Point*) rtl_allocateMemory( nTotal ); + mpArray = static_cast(rtl_allocateMemory( nTotal )); memset( mpArray, 0, nTotal ); } @@ -209,10 +209,10 @@ ImplVectMap::ImplVectMap( long nWidth, long nHeight ) : { const long nWidthAl = ( nWidth >> 2L ) + 1L; const long nSize = nWidthAl * nHeight; - Scanline pTmp = mpBuf = (Scanline) rtl_allocateMemory( nSize ); + Scanline pTmp = mpBuf = static_cast(rtl_allocateMemory( nSize )); memset( mpBuf, 0, nSize ); - mpScan = (Scanline*) rtl_allocateMemory( nHeight * sizeof( Scanline ) ); + mpScan = static_cast(rtl_allocateMemory( nHeight * sizeof( Scanline ) )); for( long nY = 0L; nY < nHeight; pTmp += nWidthAl ) mpScan[ nY++ ] = pTmp; diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx index df3f47cc043a..623d7be7647f 100644 --- a/vcl/source/gdi/jobset.cxx +++ b/vcl/source/gdi/jobset.cxx @@ -78,7 +78,7 @@ ImplJobSetup::ImplJobSetup( const ImplJobSetup& rJobSetup ) : mnDriverDataLen = rJobSetup.mnDriverDataLen; if ( rJobSetup.mpDriverData ) { - mpDriverData = (sal_uInt8*)rtl_allocateMemory( mnDriverDataLen ); + mpDriverData = static_cast(rtl_allocateMemory( mnDriverDataLen )); memcpy( mpDriverData, rJobSetup.mpDriverData, mnDriverDataLen ); } else @@ -272,7 +272,7 @@ SvStream& ReadJobSetup( SvStream& rIStream, JobSetup& rJobSetup ) if ( pJobData->mnDriverDataLen ) { sal_uInt8* pDriverData = reinterpret_cast(pOldJobData) + nOldJobDataSize; - pJobData->mpDriverData = (sal_uInt8*)rtl_allocateMemory( pJobData->mnDriverDataLen ); + pJobData->mpDriverData = static_cast(rtl_allocateMemory( pJobData->mnDriverDataLen )); memcpy( pJobData->mpDriverData, pDriverData, pJobData->mnDriverDataLen ); } if( nSystem == JOBSET_FILE605_SYSTEM ) diff --git a/vcl/source/gdi/octree.cxx b/vcl/source/gdi/octree.cxx index 1aac1ef17a97..1de20edf9dfe 100644 --- a/vcl/source/gdi/octree.cxx +++ b/vcl/source/gdi/octree.cxx @@ -298,10 +298,10 @@ void InverseColorMap::ImplCreateBuffers( const sal_uLong nMax ) const sal_uLong nCount = nMax * nMax * nMax; const sal_uLong nSize = nCount * sizeof( sal_uLong ); - pMap = (sal_uInt8*) rtl_allocateMemory( nCount ); + pMap = static_cast(rtl_allocateMemory( nCount )); memset( pMap, 0x00, nCount ); - pBuffer = (sal_uInt8*) rtl_allocateMemory( nSize ); + pBuffer = static_cast(rtl_allocateMemory( nSize )); memset( pBuffer, 0xff, nSize ); } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index b1fd8f60364c..5e3cc6fea52f 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2126,7 +2126,7 @@ bool PDFWriterImpl::compressStream( SvMemoryStream* pStream ) ZCodec pCodec( 0x4000, 0x4000 ); SvMemoryStream aStream; pCodec.BeginCompression(); - pCodec.Write( aStream, (const sal_uInt8*)pStream->GetData(), nEndPos ); + pCodec.Write( aStream, static_cast(pStream->GetData()), nEndPos ); pCodec.EndCompression(); nEndPos = aStream.Tell(); pStream->Seek( STREAM_SEEK_TO_BEGIN ); @@ -2195,7 +2195,7 @@ bool PDFWriterImpl::writeBuffer( const void* pBuffer, sal_uInt64 nBytes ) /* implement the encryption part of the PDF spec encryption algorithm 3.1 */ if( ( buffOK = checkEncryptionBufferSize( static_cast(nBytes) ) ) ) rtl_cipher_encodeARCFOUR( m_aCipher, - (sal_uInt8*)pBuffer, static_cast(nBytes), + pBuffer, static_cast(nBytes), m_pEncryptionBuffer, static_cast(nBytes) ); } @@ -2989,7 +2989,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const PhysicalFo sal_Int32 pEncWidths[256]; //TODO: surely this is utterly broken because GetEmbedFontData loops over the uninitialized nEncodedCodes as input - pFontData = (const unsigned char*)pGraphics->GetEmbedFontData( pFont, nEncodedCodes, pEncWidths, 256, aInfo, &nFontLen ); + pFontData = static_cast(pGraphics->GetEmbedFontData( pFont, nEncodedCodes, pEncWidths, 256, aInfo, &nFontLen )); if( pFontData ) { @@ -3196,7 +3196,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const Physical sal_Int32 nLength1, nLength2; try { - if( (pFontData = (const unsigned char*)pGraphics->GetEmbedFontData(pFont, nEncodedCodes, pWidths, 256, aInfo, &nFontLen)) != NULL ) + if( (pFontData = static_cast(pGraphics->GetEmbedFontData(pFont, nEncodedCodes, pWidths, 256, aInfo, &nFontLen))) != NULL ) { if( (aInfo.m_nFontType & FontSubsetInfo::ANY_TYPE1) == 0 ) throw FontException(); @@ -6045,7 +6045,7 @@ namespace { char *PDFSigningPKCS7PasswordCallback(PK11SlotInfo * /*slot*/, PRBool /*retry*/, void *arg) { - return PL_strdup((char *)arg); + return PL_strdup(static_cast(arg)); } class HashContextScope { @@ -6579,16 +6579,16 @@ my_NSS_CMSArray_Add(PLArenaPool *poolp, void ***array, void *obj) return SECFailure; if (*array == NULL) { - dest = (void **)PORT_ArenaAlloc(poolp, 2 * sizeof(void *)); + dest = static_cast(PORT_ArenaAlloc(poolp, 2 * sizeof(void *))); n = 0; } else { n = 0; p = *array; while (*p++) n++; - dest = (void **)PORT_ArenaGrow (poolp, + dest = static_cast(PORT_ArenaGrow (poolp, *array, (n + 1) * sizeof(void *), - (n + 2) * sizeof(void *)); + (n + 2) * sizeof(void *))); } if (dest == NULL) diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 475bcb00912c..403d3e5b54aa 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -1139,7 +1139,7 @@ bool PDFWriterImpl::checkEncryptionBufferSize( register sal_Int32 newSize ) { /* reallocate the buffer, the used function allocate as rtl_allocateMemory if the pointer parameter is NULL */ - m_pEncryptionBuffer = (sal_uInt8*)rtl_reallocateMemory( m_pEncryptionBuffer, newSize ); + m_pEncryptionBuffer = static_cast(rtl_reallocateMemory( m_pEncryptionBuffer, newSize )); if( m_pEncryptionBuffer ) m_nEncryptionBufferSize = newSize; else @@ -1963,7 +1963,7 @@ void PDFWriterImpl::writeG4Stream( BitmapReadAccess* i_pBitmap ) BitStreamState aBitState; // the first reference line is virtual and completely empty - const Scanline pFirstRefLine = (Scanline)rtl_allocateZeroMemory( nW/8 + 1 ); + const Scanline pFirstRefLine = static_cast(rtl_allocateZeroMemory( nW/8 + 1 )); Scanline pRefLine = pFirstRefLine; for( long nY = 0; nY < nH; nY++ ) { diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx index ac9bdd2da454..0b61f75eeb5e 100644 --- a/vcl/source/gdi/pngwrite.cxx +++ b/vcl/source/gdi/pngwrite.cxx @@ -474,7 +474,7 @@ void PNGWriterImpl::ImplWriteIDAT() { nBytes = nBytesToWrite <= mnMaxChunkSize ? nBytesToWrite : mnMaxChunkSize; ImplOpenChunk(PNGCHUNK_IDAT); - ImplWriteChunk((unsigned char*)aOStm.GetData() + (nIDATSize - nBytesToWrite), nBytes); + ImplWriteChunk(const_cast(static_cast(aOStm.GetData())) + (nIDATSize - nBytesToWrite), nBytes); nBytesToWrite -= nBytes; } } diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index c6897f20c76f..82d87c322caf 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -1032,7 +1032,7 @@ void GenericSalLayout::ApplyDXArray( ImplLayoutArgs& rArgs ) // determine cluster boundaries and x base offset const int nCharCount = rArgs.mnEndCharPos - rArgs.mnMinCharPos; - int* pLogCluster = (int*)alloca( nCharCount * sizeof(int) ); + int* pLogCluster = static_cast(alloca( nCharCount * sizeof(int) )); size_t i; int n,p; long nBasePointX = -1; @@ -1067,7 +1067,7 @@ void GenericSalLayout::ApplyDXArray( ImplLayoutArgs& rArgs ) } // calculate adjusted cluster widths - long* pNewGlyphWidths = (long*)alloca( m_GlyphItems.size() * sizeof(long) ); + long* pNewGlyphWidths = static_cast(alloca( m_GlyphItems.size() * sizeof(long) )); for( i = 0; i < m_GlyphItems.size(); ++i ) pNewGlyphWidths[ i ] = 0; @@ -1330,7 +1330,7 @@ void GenericSalLayout::GetCaretPositions( int nMaxIndex, long* pCaretXArray ) co sal_Int32 GenericSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor ) const { int nCharCapacity = mnEndCharPos - mnMinCharPos; - DeviceCoordinate* pCharWidths = (DeviceCoordinate*)alloca( nCharCapacity * sizeof(DeviceCoordinate) ); + DeviceCoordinate* pCharWidths = static_cast(alloca( nCharCapacity * sizeof(DeviceCoordinate) )); if( !GetCharWidths( pCharWidths ) ) return -1; @@ -1965,7 +1965,7 @@ sal_Int32 MultiSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoordi return mpLayouts[0]->GetTextBreak( nMaxWidth, nCharExtra, nFactor ); int nCharCount = mnEndCharPos - mnMinCharPos; - DeviceCoordinate* pCharWidths = (DeviceCoordinate*)alloca( 2*nCharCount * sizeof(DeviceCoordinate) ); + DeviceCoordinate* pCharWidths = static_cast(alloca( 2*nCharCount * sizeof(DeviceCoordinate) )); mpLayouts[0]->FillDXArray( pCharWidths ); for( int n = 1; n < mnLevel; ++n ) @@ -2005,7 +2005,7 @@ DeviceCoordinate MultiSalLayout::FillDXArray( DeviceCoordinate* pCharWidths ) co { for( int i = 0; i < nCharCount; ++i ) pCharWidths[i] = 0; - pTempWidths = (DeviceCoordinate*)alloca( nCharCount * sizeof(DeviceCoordinate) ); + pTempWidths = static_cast(alloca( nCharCount * sizeof(DeviceCoordinate) )); } for( int n = mnLevel; --n >= 0; ) @@ -2047,7 +2047,7 @@ void MultiSalLayout::GetCaretPositions( int nMaxIndex, long* pCaretXArray ) cons if( mnLevel > 1 ) { - long* pTempPos = (long*)alloca( nMaxIndex * sizeof(long) ); + long* pTempPos = static_cast(alloca( nMaxIndex * sizeof(long) )); for( int n = 1; n < mnLevel; ++n ) { mpLayouts[ n ]->GetCaretPositions( nMaxIndex, pTempPos ); diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx index 1e22186ea66d..ea08f22b8317 100644 --- a/vcl/source/helper/strhelper.cxx +++ b/vcl/source/helper/strhelper.cxx @@ -104,7 +104,7 @@ OUString GetCommandLineToken( int nToken, const OUString& rLine ) return OUString(); int nActualToken = 0; - sal_Unicode* pBuffer = (sal_Unicode*)alloca( sizeof(sal_Unicode)*( nLen + 1 ) ); + sal_Unicode* pBuffer = static_cast(alloca( sizeof(sal_Unicode)*( nLen + 1 ) )); const sal_Unicode* pRun = rLine.getStr(); sal_Unicode* pLeap = NULL; @@ -154,7 +154,7 @@ OString GetCommandLineToken(int nToken, const OString& rLine) return rLine; int nActualToken = 0; - char* pBuffer = (char*)alloca( nLen + 1 ); + char* pBuffer = static_cast(alloca( nLen + 1 )); const char* pRun = rLine.getStr(); char* pLeap = NULL; @@ -253,7 +253,7 @@ OUString WhitespaceToSpace( const OUString& rLine, bool bProtect ) if( ! nLen ) return OUString(); - sal_Unicode *pBuffer = (sal_Unicode*)alloca( sizeof(sal_Unicode)*(nLen + 1) ); + sal_Unicode *pBuffer = static_cast(alloca( sizeof(sal_Unicode)*(nLen + 1) )); const sal_Unicode *pRun = rLine.getStr(); sal_Unicode *pLeap = pBuffer; @@ -309,7 +309,7 @@ OString WhitespaceToSpace(const OString& rLine, bool bProtect) if (!nLen) return rLine; - char *pBuffer = (char*)alloca( nLen + 1 ); + char *pBuffer = static_cast(alloca( nLen + 1 )); const char *pRun = rLine.getStr(); char *pLeap = pBuffer; diff --git a/vcl/source/helper/xconnection.cxx b/vcl/source/helper/xconnection.cxx index 6c86f8327c95..5b64d8624d2c 100644 --- a/vcl/source/helper/xconnection.cxx +++ b/vcl/source/helper/xconnection.cxx @@ -36,10 +36,10 @@ DisplayConnection::DisplayConnection() switch( eType ) { case SalInstance::AsciiCString: - m_aAny <<= OUString::createFromAscii( (sal_Char*)pBytes ); + m_aAny <<= OUString::createFromAscii( static_cast(pBytes) ); break; case SalInstance::Blob: - m_aAny <<= Sequence< sal_Int8 >( (sal_Int8*)pBytes, nBytes ); + m_aAny <<= Sequence< sal_Int8 >( static_cast(pBytes), nBytes ); break; } } @@ -110,7 +110,7 @@ bool DisplayConnection::dispatchEvent( void* pData, int nBytes ) { SolarMutexReleaser aRel; - Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes ); + Sequence< sal_Int8 > aSeq( static_cast(pData), nBytes ); Any aEvent; aEvent <<= aSeq; ::std::list< css::uno::Reference< XEventHandler > > handlers; @@ -128,7 +128,7 @@ bool DisplayConnection::dispatchErrorEvent( void* pData, int nBytes ) { SolarMutexReleaser aRel; - Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes ); + Sequence< sal_Int8 > aSeq( static_cast(pData), nBytes ); Any aEvent; aEvent <<= aSeq; ::std::list< css::uno::Reference< XEventHandler > > handlers; diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index 09b02579a876..ec1b255eb454 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -1161,7 +1161,7 @@ bool OpenGLContext::initWindow() m_aGLWin.win = pChildSysData->aWindow; m_aGLWin.screen = pChildSysData->nScreen; - Visual* pVisual = (Visual*)pChildSysData->pVisual; + Visual* pVisual = static_cast(pChildSysData->pVisual); initGLWindow(pVisual); return true; diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx index 9d337ca2e622..834c6e73953b 100644 --- a/vcl/source/outdev/hatch.cxx +++ b/vcl/source/outdev/hatch.cxx @@ -33,10 +33,10 @@ extern "C" int SAL_CALL HatchCmpFnc( const void* p1, const void* p2 ) { - const long nX1 = ( (Point*) p1 )->X(); - const long nX2 = ( (Point*) p2 )->X(); - const long nY1 = ( (Point*) p1 )->Y(); - const long nY2 = ( (Point*) p2 )->Y(); + const long nX1 = static_cast(p1)->X(); + const long nX2 = static_cast(p2)->X(); + const long nY1 = static_cast(p1)->Y(); + const long nY2 = static_cast(p2)->Y(); return ( nX1 > nX2 ? 1 : nX1 == nX2 ? nY1 > nY2 ? 1: nY1 == nY2 ? 0 : -1 : -1 ); } diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 6dfe1098e5c2..8f25c4ca72c0 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1352,7 +1352,7 @@ SalLayout* OutputDevice::ImplLayout(const OUString& rOrigStr, if(mbMap) { // convert from logical units to font units using a temporary array - pDXPixelArray = (DeviceCoordinate*)alloca( nLen * sizeof(DeviceCoordinate) ); + pDXPixelArray = static_cast(alloca( nLen * sizeof(DeviceCoordinate) )); // using base position for better rounding a.k.a. "dancing characters" DeviceCoordinate nPixelXOfs = LogicWidthToDeviceCoordinate( rLogicalPos.X() ); for( int i = 0; i < nLen; ++i ) @@ -1688,7 +1688,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r long nMnemonicY; DeviceCoordinate nMnemonicWidth; - long* pCaretXArray = (long*) alloca( 2 * sizeof(long) * nLineLen ); + long* pCaretXArray = static_cast(alloca( 2 * sizeof(long) * nLineLen )); /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray, nIndex, nLineLen ); long lc_x1 = pCaretXArray[2*(nMnemonicPos - nIndex)]; @@ -1757,7 +1757,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r DeviceCoordinate nMnemonicWidth = 0; if ( nMnemonicPos != -1 ) { - long* pCaretXArray = (long*) alloca( 2 * sizeof(long) * aStr.getLength() ); + long* pCaretXArray = static_cast(alloca( 2 * sizeof(long) * aStr.getLength() )); /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray, 0, aStr.getLength() ); long lc_x1 = pCaretXArray[2*(nMnemonicPos)]; long lc_x2 = pCaretXArray[2*(nMnemonicPos)+1]; @@ -2204,7 +2204,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr, nMnemonicPos = nLen-1; } - long* pCaretXArray = (long*)alloca( 2 * sizeof(long) * nLen ); + long* pCaretXArray = static_cast(alloca( 2 * sizeof(long) * nLen )); /*sal_Bool bRet =*/ GetCaretPositions( aStr, pCaretXArray, nIndex, nLen ); long lc_x1 = pCaretXArray[ 2*(nMnemonicPos - nIndex) ]; long lc_x2 = pCaretXArray[ 2*(nMnemonicPos - nIndex)+1 ]; diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx index 97bacbf3bb3b..a3b7c0f8d061 100644 --- a/vcl/source/window/accel.cxx +++ b/vcl/source/window/accel.cxx @@ -281,8 +281,8 @@ void Accelerator::ImplLoadRes( const ResId& rResId ) for( sal_uLong i = 0; i < nObjFollows; i++ ) { - InsertItem( ResId( (RSHEADER_TYPE *)GetClassRes(), *rResId.GetResMgr() ) ); - IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) ); + InsertItem( ResId( static_cast(GetClassRes()), *rResId.GetResMgr() ) ); + IncrementRes( GetObjSizeRes( static_cast(GetClassRes()) ) ); } } @@ -334,16 +334,16 @@ void Accelerator::InsertItem( const ResId& rResId ) if ( nObjMask & ACCELITEM_KEY ) { // new context was created - RSHEADER_TYPE * pKeyCodeRes = (RSHEADER_TYPE *)GetClassRes(); + RSHEADER_TYPE * pKeyCodeRes = static_cast(GetClassRes()); ResId aResId( pKeyCodeRes, *rResId.GetResMgr()); aKeyCode = vcl::KeyCode( aResId ); - IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) ); + IncrementRes( GetObjSizeRes( static_cast(GetClassRes()) ) ); } if ( nObjMask & ACCELITEM_ACCEL ) { - pAutoAccel = new Accelerator( ResId( (RSHEADER_TYPE *)GetClassRes(), *rResId.GetResMgr() ) ); - IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) ); + pAutoAccel = new Accelerator( ResId( static_cast(GetClassRes()), *rResId.GetResMgr() ) ); + IncrementRes( GetObjSizeRes( static_cast(GetClassRes()) ) ); } ImplInsertAccel( nAccelKeyId, aKeyCode, !bDisable, pAutoAccel ); diff --git a/vcl/source/window/debug.cxx b/vcl/source/window/debug.cxx index 70e50ef5d5f9..e1d48fc876e7 100644 --- a/vcl/source/window/debug.cxx +++ b/vcl/source/window/debug.cxx @@ -27,7 +27,7 @@ const char* ImplDbgCheckWindow( const void* pObj ) { DBG_TESTSOLARMUTEX(); - const vcl::Window* pWindow = (vcl::Window*)pObj; + const vcl::Window* pWindow = static_cast(pObj); if ( (pWindow->GetType() < WINDOW_FIRST) || (pWindow->GetType() > WINDOW_LAST) ) return "Window data overwrite"; diff --git a/vcl/source/window/debugevent.cxx b/vcl/source/window/debugevent.cxx index a1c19e779fda..f2f037513dd5 100644 --- a/vcl/source/window/debugevent.cxx +++ b/vcl/source/window/debugevent.cxx @@ -109,7 +109,7 @@ void DebugEventInjector::InjectMenuEvent() SAL_INFO( "vcl.debugevent", "Injected menu event " << aEvent.mpMenu << " (" << aEvent.mnId << ") '" - << ((Menu *)aEvent.mpMenu)->GetItemText( aEvent.mnId ) << "' -> " + << static_cast(aEvent.mpMenu)->GetItemText( aEvent.mnId ) << "' -> " << bHandled ); } diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index f719d27d758c..b1cc88b06c87 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -453,14 +453,14 @@ void Menu::InsertItem( const ResId& rResId, sal_uInt16 nPos ) { if ( !bSep ) { - Bitmap aBmp( ResId( (RSHEADER_TYPE*)GetClassRes(), *pMgr ) ); + Bitmap aBmp( ResId( static_cast(GetClassRes()), *pMgr ) ); Image const aImg(aBmp); if ( !aText.isEmpty() ) InsertItem( nItemId, aText, aImg, nStatus, OString(), nPos ); else InsertItem( nItemId, aImg, nStatus, OString(), nPos ); } - IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); + IncrementRes( GetObjSizeRes( static_cast(GetClassRes()) ) ); } else if ( !bSep ) InsertItem(nItemId, aText, nStatus, OString(), nPos); @@ -488,8 +488,8 @@ void Menu::InsertItem( const ResId& rResId, sal_uInt16 nPos ) if ( nObjMask & RSC_MENUITEM_KEYCODE ) { if ( !bSep ) - SetAccelKey( nItemId, KeyCode( ResId( (RSHEADER_TYPE*)GetClassRes(), *pMgr ) ) ); - IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); + SetAccelKey( nItemId, KeyCode( ResId( static_cast(GetClassRes()), *pMgr ) ) ); + IncrementRes( GetObjSizeRes( static_cast(GetClassRes()) ) ); } if( nObjMask & RSC_MENUITEM_CHECKED ) { @@ -514,14 +514,14 @@ void Menu::InsertItem( const ResId& rResId, sal_uInt16 nPos ) MenuItemData* pData = GetItemList()->GetData( nItemId ); if ( pData ) { - PopupMenu* pSubMenu = new PopupMenu( ResId( (RSHEADER_TYPE*)GetClassRes(), *pMgr ) ); + PopupMenu* pSubMenu = new PopupMenu( ResId( static_cast(GetClassRes()), *pMgr ) ); pData->pAutoSubMenu = pSubMenu; // #111060# keep track of this pointer, may be it will be deleted from outside pSubMenu->pRefAutoSubMenu = &pData->pAutoSubMenu; SetPopupMenu( nItemId, pSubMenu ); } } - IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); + IncrementRes( GetObjSizeRes( static_cast(GetClassRes()) ) ); } delete mpLayoutData, mpLayoutData = NULL; } @@ -2717,8 +2717,8 @@ PopupMenu::PopupMenu( const ResId& rResId ) // insert menu items for( sal_uLong i = 0; i < nObjFollows; i++ ) { - InsertItem( ResId( (RSHEADER_TYPE*)GetClassRes(), *pMgr ) ); - IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); + InsertItem( ResId( static_cast(GetClassRes()), *pMgr ) ); + IncrementRes( GetObjSizeRes( static_cast(GetClassRes()) ) ); } } diff --git a/vcl/source/window/resource.cxx b/vcl/source/window/resource.cxx index abcc150b7cb4..9c8ce32f15e9 100644 --- a/vcl/source/window/resource.cxx +++ b/vcl/source/window/resource.cxx @@ -40,7 +40,7 @@ WinBits Window::ImplInitRes( const ResId& rResId ) { GetRes( rResId ); - char* pRes = (char*)GetClassRes(); + char* pRes = static_cast(GetClassRes()); pRes += 8; sal_uInt32 nStyle = (sal_uInt32)GetLongRes( (void*)pRes ); rResId.SetWinBits( nStyle ); diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx index 2cc2d3adef69..50bdd7e0ba08 100644 --- a/vcl/source/window/syschild.cxx +++ b/vcl/source/window/syschild.cxx @@ -52,7 +52,7 @@ using namespace ::com::sun::star; long ImplSysChildProc( void* pInst, SalObject* /* pObject */, sal_uInt16 nEvent, const void* /* pEvent */ ) { - SystemChildWindow* pWindow = (SystemChildWindow*)pInst; + SystemChildWindow* pWindow = static_cast(pInst); long nRet = 0; ImplDelData aDogTag( pWindow ); diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 1e92d1d00d1b..7cf7a23b0c76 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -1524,8 +1524,8 @@ void ToolBox::ImplLoadRes( const ResId& rResId ) if ( nObjMask & RSC_TOOLBOX_ITEMIMAGELIST ) { - maImageList = ImageList( ResId( (RSHEADER_TYPE*)GetClassRes(), *pMgr ) ); - IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); + maImageList = ImageList( ResId( static_cast(GetClassRes()), *pMgr ) ); + IncrementRes( GetObjSizeRes( static_cast(GetClassRes()) ) ); } if ( nObjMask & RSC_TOOLBOX_ITEMLIST ) @@ -1535,8 +1535,8 @@ void ToolBox::ImplLoadRes( const ResId& rResId ) // insert item for ( sal_uLong i = 0; i < nEle; i++ ) { - InsertItem( ResId( (RSHEADER_TYPE *)GetClassRes(), *pMgr ) ); - IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) ); + InsertItem( ResId( static_cast(GetClassRes()), *pMgr ) ); + IncrementRes( GetObjSizeRes( static_cast(GetClassRes()) ) ); } } } diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 0bf058322410..7fbdb39ddbd3 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -489,15 +489,15 @@ void ToolBox::InsertItem( const ResId& rResId, sal_uInt16 nPos ) if ( nObjMask & RSC_TOOLBOXITEM_BITMAP ) { - Bitmap aBmp = Bitmap( ResId( (RSHEADER_TYPE*)GetClassRes(), *rResId.GetResMgr() ) ); - IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); + Bitmap aBmp = Bitmap( ResId( static_cast(GetClassRes()), *rResId.GetResMgr() ) ); + IncrementRes( GetObjSizeRes( static_cast(GetClassRes()) ) ); aItem.maImage = Image( aBmp, IMAGE_STDBTN_COLOR ); bImage = true; } if ( nObjMask & RSC_TOOLBOXITEM_IMAGE ) { - aItem.maImage = Image( ResId( (RSHEADER_TYPE*)GetClassRes(), *rResId.GetResMgr() ) ); - IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); + aItem.maImage = Image( ResId( static_cast(GetClassRes()), *rResId.GetResMgr() ) ); + IncrementRes( GetObjSizeRes( static_cast(GetClassRes()) ) ); bImage = true; } if ( nObjMask & RSC_TOOLBOXITEM_DISABLE ) diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index cb0f3e7e2863..d3df6d03729d 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -250,7 +250,7 @@ struct ContextMenuEvent static sal_IntPtr ContextMenuEventLink( void* pCEvent, void* ) { - ContextMenuEvent* pEv = (ContextMenuEvent*)pCEvent; + ContextMenuEvent* pEv = static_cast(pCEvent); if( ! pEv->aDelData.IsDead() ) { @@ -1978,7 +1978,7 @@ struct DelayedCloseEvent static sal_IntPtr DelayedCloseEventLink( void* pCEvent, void* ) { - DelayedCloseEvent* pEv = (DelayedCloseEvent*)pCEvent; + DelayedCloseEvent* pEv = static_cast(pCEvent); if( ! pEv->aDelData.IsDead() ) { @@ -2160,19 +2160,19 @@ static bool ImplHandleMenuEvent( vcl::Window* pWindow, SalMenuEvent* pEvent, sal switch( nEvent ) { case SALEVENT_MENUACTIVATE: - nRet = pMenuBar->HandleMenuActivateEvent( (Menu*) pEvent->mpMenu ); + nRet = pMenuBar->HandleMenuActivateEvent( static_cast(pEvent->mpMenu) ); break; case SALEVENT_MENUDEACTIVATE: - nRet = pMenuBar->HandleMenuDeActivateEvent( (Menu*) pEvent->mpMenu ); + nRet = pMenuBar->HandleMenuDeActivateEvent( static_cast(pEvent->mpMenu) ); break; case SALEVENT_MENUHIGHLIGHT: - nRet = pMenuBar->HandleMenuHighlightEvent( (Menu*) pEvent->mpMenu, pEvent->mnId ); + nRet = pMenuBar->HandleMenuHighlightEvent( static_cast(pEvent->mpMenu), pEvent->mnId ); break; case SALEVENT_MENUBUTTONCOMMAND: - nRet = pMenuBar->HandleMenuButtonEvent( (Menu*) pEvent->mpMenu, pEvent->mnId ); + nRet = pMenuBar->HandleMenuButtonEvent( static_cast(pEvent->mpMenu), pEvent->mnId ); break; case SALEVENT_MENUCOMMAND: - nRet = pMenuBar->HandleMenuCommandEvent( (Menu*) pEvent->mpMenu, pEvent->mnId ); + nRet = pMenuBar->HandleMenuCommandEvent( static_cast(pEvent->mpMenu), pEvent->mnId ); break; default: break; @@ -2428,11 +2428,11 @@ bool ImplWindowFrameProc( vcl::Window* pWindow, SalFrame* /*pFrame*/, switch ( nEvent ) { case SALEVENT_MOUSEMOVE: - nRet = ImplHandleSalMouseMove( pWindow, (SalMouseEvent*)pEvent ); + nRet = ImplHandleSalMouseMove( pWindow, const_cast(static_cast(pEvent)) ); break; case SALEVENT_EXTERNALMOUSEMOVE: { - MouseEvent* pMouseEvt = (MouseEvent*) pEvent; + MouseEvent const * pMouseEvt = static_cast(pEvent); SalMouseEvent aSalMouseEvent; aSalMouseEvent.mnTime = tools::Time::GetSystemTicks(); @@ -2445,14 +2445,14 @@ bool ImplWindowFrameProc( vcl::Window* pWindow, SalFrame* /*pFrame*/, } break; case SALEVENT_MOUSELEAVE: - nRet = ImplHandleSalMouseLeave( pWindow, (SalMouseEvent*)pEvent ); + nRet = ImplHandleSalMouseLeave( pWindow, const_cast(static_cast(pEvent)) ); break; case SALEVENT_MOUSEBUTTONDOWN: - nRet = ImplHandleSalMouseButtonDown( pWindow, (SalMouseEvent*)pEvent ); + nRet = ImplHandleSalMouseButtonDown( pWindow, const_cast(static_cast(pEvent)) ); break; case SALEVENT_EXTERNALMOUSEBUTTONDOWN: { - MouseEvent* pMouseEvt = (MouseEvent*) pEvent; + MouseEvent const * pMouseEvt = static_cast(pEvent); SalMouseEvent aSalMouseEvent; aSalMouseEvent.mnTime = tools::Time::GetSystemTicks(); @@ -2465,11 +2465,11 @@ bool ImplWindowFrameProc( vcl::Window* pWindow, SalFrame* /*pFrame*/, } break; case SALEVENT_MOUSEBUTTONUP: - nRet = ImplHandleSalMouseButtonUp( pWindow, (SalMouseEvent*)pEvent ); + nRet = ImplHandleSalMouseButtonUp( pWindow, const_cast(static_cast(pEvent)) ); break; case SALEVENT_EXTERNALMOUSEBUTTONUP: { - MouseEvent* pMouseEvt = (MouseEvent*) pEvent; + MouseEvent const * pMouseEvt = static_cast(pEvent); SalMouseEvent aSalMouseEvent; aSalMouseEvent.mnTime = tools::Time::GetSystemTicks(); @@ -2486,34 +2486,34 @@ bool ImplWindowFrameProc( vcl::Window* pWindow, SalFrame* /*pFrame*/, break; case SALEVENT_KEYINPUT: { - SalKeyEvent* pKeyEvt = (SalKeyEvent*)pEvent; + SalKeyEvent const * pKeyEvt = static_cast(pEvent); nRet = ImplHandleKey( pWindow, MouseNotifyEvent::KEYINPUT, pKeyEvt->mnCode, pKeyEvt->mnCharCode, pKeyEvt->mnRepeat, true ); } break; case SALEVENT_EXTERNALKEYINPUT: { - KeyEvent* pKeyEvt = (KeyEvent*) pEvent; + KeyEvent const * pKeyEvt = static_cast(pEvent); nRet = ImplHandleKey( pWindow, MouseNotifyEvent::KEYINPUT, pKeyEvt->GetKeyCode().GetFullCode(), pKeyEvt->GetCharCode(), pKeyEvt->GetRepeat(), false ); } break; case SALEVENT_KEYUP: { - SalKeyEvent* pKeyEvt = (SalKeyEvent*)pEvent; + SalKeyEvent const * pKeyEvt = static_cast(pEvent); nRet = ImplHandleKey( pWindow, MouseNotifyEvent::KEYUP, pKeyEvt->mnCode, pKeyEvt->mnCharCode, pKeyEvt->mnRepeat, true ); } break; case SALEVENT_EXTERNALKEYUP: { - KeyEvent* pKeyEvt = (KeyEvent*) pEvent; + KeyEvent const * pKeyEvt = static_cast(pEvent); nRet = ImplHandleKey( pWindow, MouseNotifyEvent::KEYUP, pKeyEvt->GetKeyCode().GetFullCode(), pKeyEvt->GetCharCode(), pKeyEvt->GetRepeat(), false ); } break; case SALEVENT_KEYMODCHANGE: - ImplHandleSalKeyMod( pWindow, (SalKeyModEvent*)pEvent ); + ImplHandleSalKeyMod( pWindow, const_cast(static_cast(pEvent)) ); break; case SALEVENT_INPUTLANGUAGECHANGE: @@ -2525,22 +2525,22 @@ bool ImplWindowFrameProc( vcl::Window* pWindow, SalFrame* /*pFrame*/, case SALEVENT_MENUHIGHLIGHT: case SALEVENT_MENUCOMMAND: case SALEVENT_MENUBUTTONCOMMAND: - nRet = ImplHandleMenuEvent( pWindow, (SalMenuEvent*)pEvent, nEvent ); + nRet = ImplHandleMenuEvent( pWindow, const_cast(static_cast(pEvent)), nEvent ); break; case SALEVENT_WHEELMOUSE: - nRet = ImplHandleWheelEvent( pWindow, *(const SalWheelMouseEvent*)pEvent); + nRet = ImplHandleWheelEvent( pWindow, *static_cast(pEvent)); break; case SALEVENT_PAINT: { - SalPaintEvent* pPaintEvt = (SalPaintEvent*)pEvent; + SalPaintEvent const * pPaintEvt = static_cast(pEvent); if( Application::GetSettings().GetLayoutRTL() ) { // --- RTL --- (mirror paint rect) SalFrame* pSalFrame = pWindow->ImplGetWindowImpl()->mpFrame; - pPaintEvt->mnBoundX = pSalFrame->maGeometry.nWidth-pPaintEvt->mnBoundWidth-pPaintEvt->mnBoundX; + const_cast(pPaintEvt)->mnBoundX = pSalFrame->maGeometry.nWidth-pPaintEvt->mnBoundWidth-pPaintEvt->mnBoundX; } Rectangle aBoundRect( Point( pPaintEvt->mnBoundX, pPaintEvt->mnBoundY ), @@ -2615,12 +2615,12 @@ bool ImplWindowFrameProc( vcl::Window* pWindow, SalFrame* /*pFrame*/, break; case SALEVENT_USEREVENT: - ImplHandleUserEvent( (ImplSVEvent*)pEvent ); + ImplHandleUserEvent( const_cast(static_cast(pEvent)) ); break; case SALEVENT_EXTTEXTINPUT: { - SalExtTextInputEvent* pEvt = (SalExtTextInputEvent*)pEvent; + SalExtTextInputEvent const * pEvt = static_cast(pEvent); nRet = ImplHandleExtTextInput( pWindow, pEvt->maText, pEvt->mpTextAttr, pEvt->mnCursorPos, pEvt->mnCursorFlags ); @@ -2630,10 +2630,10 @@ bool ImplWindowFrameProc( vcl::Window* pWindow, SalFrame* /*pFrame*/, nRet = ImplHandleEndExtTextInput( pWindow ); break; case SALEVENT_EXTTEXTINPUTPOS: - ImplHandleSalExtTextInputPos( pWindow, (SalExtTextInputPosEvent*)pEvent ); + ImplHandleSalExtTextInputPos( pWindow, const_cast(static_cast(pEvent)) ); break; case SALEVENT_INPUTCONTEXTCHANGE: - nRet = ImplHandleInputContextChange( pWindow, ((SalInputContextChangeEvent*)pEvent)->meLanguage ); + nRet = ImplHandleInputContextChange( pWindow, static_cast(pEvent)->meLanguage ); break; case SALEVENT_SHOWDIALOG: { @@ -2642,12 +2642,12 @@ bool ImplWindowFrameProc( vcl::Window* pWindow, SalFrame* /*pFrame*/, } break; case SALEVENT_SURROUNDINGTEXTREQUEST: - ImplHandleSalSurroundingTextRequest( pWindow, (SalSurroundingTextRequestEvent*)pEvent ); + ImplHandleSalSurroundingTextRequest( pWindow, const_cast(static_cast(pEvent)) ); break; case SALEVENT_SURROUNDINGTEXTSELECTIONCHANGE: { - SalSurroundingTextSelectionChangeEvent* pEvt - = (SalSurroundingTextSelectionChangeEvent*)pEvent; + SalSurroundingTextSelectionChangeEvent const * pEvt + = static_cast(pEvent); ImplHandleSurroundingTextSelectionChange( pWindow, pEvt->mnStart, pEvt->mnEnd ); @@ -2658,7 +2658,7 @@ bool ImplWindowFrameProc( vcl::Window* pWindow, SalFrame* /*pFrame*/, break; case SALEVENT_EXTERNALZOOM: { - ZoomEvent* pZoomEvent = (ZoomEvent*) pEvent; + ZoomEvent const * pZoomEvent = static_cast(pEvent); SalWheelMouseEvent aSalWheelMouseEvent; aSalWheelMouseEvent.mnTime = tools::Time::GetSystemTicks(); aSalWheelMouseEvent.mnX = pZoomEvent->GetCenter().getX(); @@ -2674,7 +2674,7 @@ bool ImplWindowFrameProc( vcl::Window* pWindow, SalFrame* /*pFrame*/, break; case SALEVENT_EXTERNALSCROLL: { - ScrollEvent* pScrollEvent = (ScrollEvent*) pEvent; + ScrollEvent const * pScrollEvent = static_cast(pEvent); SalWheelMouseEvent aSalWheelMouseEvent; aSalWheelMouseEvent.mnTime = tools::Time::GetSystemTicks(); aSalWheelMouseEvent.mbDeltaIsPixel = true; @@ -2689,15 +2689,15 @@ bool ImplWindowFrameProc( vcl::Window* pWindow, SalFrame* /*pFrame*/, } break; case SALEVENT_QUERYCHARPOSITION: - ImplHandleSalQueryCharPosition( pWindow, (SalQueryCharPositionEvent*)pEvent ); + ImplHandleSalQueryCharPosition( pWindow, const_cast(static_cast(pEvent)) ); break; case SALEVENT_SWIPE: - nRet = ImplHandleSwipe(pWindow, *(const SalSwipeEvent*)pEvent); + nRet = ImplHandleSwipe(pWindow, *static_cast(pEvent)); break; case SALEVENT_LONGPRESS: - nRet = ImplHandleLongPress(pWindow, *(const SalLongPressEvent*)pEvent); + nRet = ImplHandleLongPress(pWindow, *static_cast(pEvent)); break; diff --git a/vcl/unx/generic/app/i18n_cb.cxx b/vcl/unx/generic/app/i18n_cb.cxx index e025881f66df..496c5769b902 100644 --- a/vcl/unx/generic/app/i18n_cb.cxx +++ b/vcl/unx/generic/app/i18n_cb.cxx @@ -127,10 +127,10 @@ enlarge_buffer ( preedit_text_t *ptext, int nnewlimit ) nnewsize *= 2; ptext->nSize = nnewsize; - ptext->pUnicodeBuffer = (sal_Unicode*)realloc((void*)ptext->pUnicodeBuffer, - nnewsize * sizeof(sal_Unicode)); - ptext->pCharStyle = (XIMFeedback*)realloc((void*)ptext->pCharStyle, - nnewsize * sizeof(XIMFeedback)); + ptext->pUnicodeBuffer = static_cast(realloc((void*)ptext->pUnicodeBuffer, + nnewsize * sizeof(sal_Unicode))); + ptext->pCharStyle = static_cast(realloc((void*)ptext->pCharStyle, + nnewsize * sizeof(XIMFeedback))); } // Handle insertion of text in a preedit_draw_callback @@ -152,7 +152,7 @@ Preedit_InsertText(preedit_text_t *pText, XIMText *pInsertText, int where) { wchar_t *pWCString = pInsertText->string.wide_char; size_t nBytes = wcstombs ( NULL, pWCString, 1024 /* dont care */); - pMBString = (char*)alloca( nBytes + 1 ); + pMBString = static_cast(alloca( nBytes + 1 )); nMBLength = wcstombs ( pMBString, pWCString, nBytes + 1); } else @@ -173,7 +173,7 @@ Preedit_InsertText(preedit_text_t *pText, XIMText *pInsertText, int where) sal_Size nBufferSize = nInsertTextLength * 2; - pInsertTextString = (sal_Unicode*)alloca(nBufferSize); + pInsertTextString = static_cast(alloca(nBufferSize)); sal_uInt32 nConversionInfo; sal_Size nConvertedChars; @@ -492,7 +492,7 @@ StatusDrawCallback (XIC, XPointer, XIMStatusDrawCallbackStruct *call_data) { wchar_t* pWString = call_data->data.text->string.wide_char; size_t nBytes = wcstombs( NULL, pWString, 1024 ); - pMBString = (sal_Char*)alloca( nBytes+1 ); + pMBString = static_cast(alloca( nBytes+1 )); nLength = wcstombs( pMBString, pWString, nBytes+1 ); } } diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx index 87e84bbddd21..60cb0f0cdb5d 100644 --- a/vcl/unx/generic/app/i18n_ic.cxx +++ b/vcl/unx/generic/app/i18n_ic.cxx @@ -184,9 +184,9 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : maClientData.eState = ePreeditStatusStartPending; maClientData.pFrame = pFrame; maClientData.aText.pUnicodeBuffer = - (sal_Unicode*)malloc(PREEDIT_BUFSZ * sizeof(sal_Unicode)); + static_cast(malloc(PREEDIT_BUFSZ * sizeof(sal_Unicode))); maClientData.aText.pCharStyle = - (XIMFeedback*)malloc(PREEDIT_BUFSZ * sizeof(XIMFeedback)); + static_cast(malloc(PREEDIT_BUFSZ * sizeof(XIMFeedback))); maClientData.aText.nSize = PREEDIT_BUFSZ; maClientData.aText.nCursorPos = 0; maClientData.aText.nLength = 0; @@ -313,7 +313,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : if ( mpPreeditAttributes != NULL ) #endif mpAttributes = XVaAddToNestedList( mpAttributes, - const_cast(XNPreeditAttributes), (XPointer)mpPreeditAttributes ); + const_cast(XNPreeditAttributes), static_cast(mpPreeditAttributes) ); } if ( mnStatusStyle != XIMStatusNone ) { @@ -321,7 +321,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : if ( mpStatusAttributes != NULL ) #endif mpAttributes = XVaAddToNestedList( mpAttributes, - const_cast(XNStatusAttributes), (XPointer)mpStatusAttributes ); + const_cast(XNStatusAttributes), static_cast(mpStatusAttributes) ); } maContext = XCreateIC( pInputMethod->GetMethod(), XNVaNestedList, mpAttributes, diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx index 838a455b9590..e957671c8ce3 100644 --- a/vcl/unx/generic/app/i18n_status.cxx +++ b/vcl/unx/generic/app/i18n_status.cxx @@ -153,7 +153,7 @@ void XIMStatusWindow::layout() if (m_bAnchoredAtRight && IsVisible()) { - SalFrame* pFrame = (SalFrame*)GetSystemData()->pSalFrame; + SalFrame* pFrame = static_cast(GetSystemData()->pSalFrame); long nDelta = pFrame->maGeometry.nWidth - m_aWindowSize.Width(); pFrame->SetPosSize( pFrame->maGeometry.nX + nDelta, pFrame->maGeometry.nY, @@ -196,7 +196,7 @@ Point XIMStatusWindow::updatePosition() m_pLastParent->CallCallback( SALEVENT_EXTTEXTINPUTPOS, (void*)&aPosEvent ); int x, y; ::Window aChild; - XTranslateCoordinates( (Display*)pParentEnvData->pDisplay, + XTranslateCoordinates( static_cast(pParentEnvData->pDisplay), (::Window)pParentEnvData->aShellWindow, vcl_sal::getSalDisplay(GetGenericData())->GetRootWindow( vcl_sal::getSalDisplay(GetGenericData())->GetDefaultXScreen() ), 0, 0, @@ -246,7 +246,7 @@ void XIMStatusWindow::setPosition( SalFrame* pParent ) if( IsVisible() ) { const SystemEnvData* pEnvData = GetSystemData(); - SalFrame* pStatusFrame = (SalFrame*)pEnvData->pSalFrame; + SalFrame* pStatusFrame = static_cast(pEnvData->pSalFrame); Point aPoint = updatePosition(); pStatusFrame->SetPosSize( aPoint.X(), aPoint.Y(), m_aWindowSize.Width(), m_aWindowSize.Height(), SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y | SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT ); } @@ -257,7 +257,7 @@ IMPL_LINK_NOARG(XIMStatusWindow, DelayedShowHdl) { m_nDelayedEvent = 0; const SystemEnvData* pData = GetSystemData(); - SalFrame* pStatusFrame = (SalFrame*)pData->pSalFrame; + SalFrame* pStatusFrame = static_cast(pData->pSalFrame); if( m_bDelayedShow ) { Size aControlSize( m_aWindowSize.Width()-4, m_aWindowSize.Height()-4 ); @@ -268,7 +268,7 @@ IMPL_LINK_NOARG(XIMStatusWindow, DelayedShowHdl) Show( m_bDelayedShow && m_bOn, SHOW_NOACTIVATE ); if( m_bDelayedShow ) { - XRaiseWindow( (Display*)pData->pDisplay, + XRaiseWindow( static_cast(pData->pDisplay), (::Window)pData->aShellWindow ); } return 0; @@ -350,7 +350,7 @@ IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent, bool bOn ) : int nDistance = rGeom.nTopDecoration; if( nDistance < 20 ) nDistance = 20; - XMoveWindow( (Display*)pEnvData->pDisplay, + XMoveWindow( static_cast(pEnvData->pDisplay), (::Window)pEnvData->aShellWindow, rGeom.nX, rGeom.nY + rGeom.nHeight + nDistance @@ -440,12 +440,12 @@ void IIIMPStatusWindow::GetFocus() { const SystemEnvData* pParentEnvData = m_pResetFocus->GetSystemData(); GetGenericData()->ErrorTrapPush(); - XSetInputFocus( (Display*)pParentEnvData->pDisplay, + XSetInputFocus( static_cast(pParentEnvData->pDisplay), (::Window)pParentEnvData->aShellWindow, RevertToNone, CurrentTime ); - XSync( (Display*)pParentEnvData->pDisplay, False ); + XSync( static_cast(pParentEnvData->pDisplay), False ); GetGenericData()->ErrorTrapPop(); } m_pResetFocus = NULL; @@ -470,12 +470,12 @@ IMPL_LINK( IIIMPStatusWindow, SelectHdl, MenuButton*, pBtn ) { const SystemEnvData* pEnv = pParent->GetSystemData(); GetGenericData()->ErrorTrapPush(); - XSetInputFocus( (Display*)pEnv->pDisplay, + XSetInputFocus( static_cast(pEnv->pDisplay), (::Window)pEnv->aShellWindow, RevertToNone, CurrentTime ); - XSync( (Display*)pEnv->pDisplay, False ); + XSync( static_cast(pEnv->pDisplay), False ); GetGenericData()->ErrorTrapPop(); } } @@ -554,7 +554,7 @@ void I18NStatus::setStatusText( const OUString& rText ) * #93614# convert fullwidth ASCII forms to ascii */ int nChars = rText.getLength(); - sal_Unicode* pBuffer = (sal_Unicode*)alloca( nChars*sizeof( sal_Unicode ) ); + sal_Unicode* pBuffer = static_cast(alloca( nChars*sizeof( sal_Unicode ) )); for( int i = 0; i < nChars; i++ ) { if( rText[i] >=0xff00 && rText[i] <= 0xff5f ) @@ -592,7 +592,7 @@ SalFrame* I18NStatus::getStatusFrame() const if( m_pStatusWindow ) { const SystemEnvData* pData = m_pStatusWindow->GetSystemData(); - pRet = (SalFrame*)pData->pSalFrame; + pRet = static_cast(pData->pSalFrame); } return pRet; } diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 47ecec852431..e984b3e0dd44 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -210,7 +210,7 @@ bool SalDisplay::BestVisual( Display *pDisplay, &aVI, &nVisuals ); // pVInfos should contain at least one visual, otherwise // we're in trouble - int* pWeight = (int*)alloca( sizeof(int)*nVisuals ); + int* pWeight = static_cast(alloca( sizeof(int)*nVisuals )); int i; for( i = 0; i < nVisuals; i++ ) { diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index 782cc9063b3a..750b8b79f867 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -218,14 +218,14 @@ static void BuildSmPropertyList() pSmProps[ 3 ].num_vals = 1; pSmProps[ 3 ].vals = new SmPropValue; pSmProps[ 3 ].vals->value = strdup( aUser.getStr() ); - pSmProps[ 3 ].vals->length = rtl_str_getLength( (char *)pSmProps[ 3 ].vals->value )+1; + pSmProps[ 3 ].vals->length = rtl_str_getLength( static_cast(pSmProps[ 3 ].vals->value) )+1; pSmProps[ 4 ].name = const_cast(SmRestartStyleHint); pSmProps[ 4 ].type = const_cast(SmCARD8); pSmProps[ 4 ].num_vals = 1; pSmProps[ 4 ].vals = new SmPropValue; pSmProps[ 4 ].vals->value = malloc(1); - pSmRestartHint = (unsigned char *)pSmProps[ 4 ].vals->value; + pSmRestartHint = static_cast(pSmProps[ 4 ].vals->value); *pSmRestartHint = SmRestartIfRunning; pSmProps[ 4 ].vals->length = 1; @@ -630,7 +630,7 @@ void ICEConnectionWorker(void * data) osl::MutexGuard g(pThis->m_ICEMutex); nConnectionsBefore = pThis->m_nConnections; int nBytes = sizeof( struct pollfd )*(nConnectionsBefore+1); - pLocalFD = (struct pollfd*)rtl_allocateMemory( nBytes ); + pLocalFD = static_cast(rtl_allocateMemory( nBytes )); memcpy( pLocalFD, pThis->m_pFilehandles, nBytes ); } @@ -683,8 +683,8 @@ void ICEWatchProc( { int fd = IceConnectionNumber( ice_conn ); pThis->m_nConnections++; - pThis->m_pConnections = (IceConn*)rtl_reallocateMemory( pThis->m_pConnections, sizeof( IceConn )*pThis->m_nConnections ); - pThis->m_pFilehandles = (struct pollfd*)rtl_reallocateMemory( pThis->m_pFilehandles, sizeof( struct pollfd )*(pThis->m_nConnections+1) ); + pThis->m_pConnections = static_cast(rtl_reallocateMemory( pThis->m_pConnections, sizeof( IceConn )*pThis->m_nConnections )); + pThis->m_pFilehandles = static_cast(rtl_reallocateMemory( pThis->m_pFilehandles, sizeof( struct pollfd )*(pThis->m_nConnections+1) )); pThis->m_pConnections[ pThis->m_nConnections-1 ] = ice_conn; pThis->m_pFilehandles[ pThis->m_nConnections ].fd = fd; pThis->m_pFilehandles[ pThis->m_nConnections ].events = POLLIN; @@ -734,8 +734,8 @@ void ICEWatchProc( memmove( pThis->m_pFilehandles+i+1, pThis->m_pFilehandles+i+2, sizeof( struct pollfd )*(pThis->m_nConnections-i-1) ); } pThis->m_nConnections--; - pThis->m_pConnections = (IceConn*)rtl_reallocateMemory( pThis->m_pConnections, sizeof( IceConn )*pThis->m_nConnections ); - pThis->m_pFilehandles = (struct pollfd*)rtl_reallocateMemory( pThis->m_pFilehandles, sizeof( struct pollfd )*(pThis->m_nConnections+1) ); + pThis->m_pConnections = static_cast(rtl_reallocateMemory( pThis->m_pConnections, sizeof( IceConn )*pThis->m_nConnections )); + pThis->m_pFilehandles = static_cast(rtl_reallocateMemory( pThis->m_pFilehandles, sizeof( struct pollfd )*(pThis->m_nConnections+1) )); break; } } diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index 58d34fe3928e..e3239fde49df 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -176,7 +176,7 @@ static const WMAdaptorProtocol aAtomTab[] = extern "C" { static int compareProtocol( const void* pLeft, const void* pRight ) { - return strcmp( ((const WMAdaptorProtocol*)pLeft)->pProtocol, ((const WMAdaptorProtocol*)pRight)->pProtocol ); + return strcmp( static_cast(pLeft)->pProtocol, static_cast(pRight)->pProtocol ); } } @@ -385,7 +385,7 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) : ) { Atom* pAtoms = reinterpret_cast(pProperty); - char** pAtomNames = (char**)alloca( sizeof(char*)*nItems ); + char** pAtomNames = static_cast(alloca( sizeof(char*)*nItems )); if( XGetAtomNames( m_pDisplay, pAtoms, nItems, pAtomNames ) ) { #if OSL_DEBUG_LEVEL > 1 @@ -399,12 +399,12 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) : WMAdaptorProtocol aSearch; aSearch.pProtocol = pAtomNames[i]; - WMAdaptorProtocol* pMatch = (WMAdaptorProtocol*) + WMAdaptorProtocol* pMatch = static_cast( bsearch( &aSearch, aProtocolTab, SAL_N_ELEMENTS( aProtocolTab ), sizeof( struct WMAdaptorProtocol ), - compareProtocol ); + compareProtocol )); if( pMatch ) { m_aWMAtoms[ pMatch->nProtocol ] = pAtoms[ i ]; @@ -643,7 +643,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) : ) { Atom* pAtoms = reinterpret_cast(pProperty); - char** pAtomNames = (char**)alloca( sizeof(char*)*nItems ); + char** pAtomNames = static_cast(alloca( sizeof(char*)*nItems )); if( XGetAtomNames( m_pDisplay, pAtoms, nItems, pAtomNames ) ) { #if OSL_DEBUG_LEVEL > 1 @@ -657,12 +657,12 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) : WMAdaptorProtocol aSearch; aSearch.pProtocol = pAtomNames[i]; - WMAdaptorProtocol* pMatch = (WMAdaptorProtocol*) + WMAdaptorProtocol* pMatch = static_cast( bsearch( &aSearch, aProtocolTab, SAL_N_ELEMENTS( aProtocolTab ), sizeof( struct WMAdaptorProtocol ), - compareProtocol ); + compareProtocol )); if( pMatch ) { m_aWMAtoms[ pMatch->nProtocol ] = pAtoms[ i ]; diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index 24480fca9c2e..795930f7dafe 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -1604,7 +1604,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest getNativeTypeList( aFlavors, aConversions, rRequest.selection ); int i, nTypes = aConversions.size(); - Atom* pTypes = (Atom*)alloca( nTypes * sizeof( Atom ) ); + Atom* pTypes = static_cast(alloca( nTypes * sizeof( Atom ) )); std::list< Atom >::const_iterator it; for( i = 0, it = aConversions.begin(); i < nTypes; i++, ++it ) pTypes[i] = *it; @@ -3291,7 +3291,7 @@ void SelectionManager::startDrag( getNativeTypeList( m_aDragFlavors, aConversions, m_nXdndSelection ); int nTypes = aConversions.size(); - Atom* pTypes = (Atom*)alloca( sizeof(Atom)*nTypes ); + Atom* pTypes = static_cast(alloca( sizeof(Atom)*nTypes )); type_it = aConversions.begin(); for( int n = 0; n < nTypes; n++, ++type_it ) pTypes[n] = *type_it; @@ -3375,7 +3375,7 @@ void SelectionManager::startDrag( void SelectionManager::runDragExecute( void* pThis ) { - SelectionManager* This = (SelectionManager*)pThis; + SelectionManager* This = static_cast(pThis); This->dragDoDispatch(); } @@ -3484,7 +3484,7 @@ void SelectionManager::transferablesFlavorsChanged() getNativeTypeList( m_aDragFlavors, aConversions, m_nXdndSelection ); int nTypes = aConversions.size(); - Atom* pTypes = (Atom*)alloca( sizeof(Atom)*aConversions.size() ); + Atom* pTypes = static_cast(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, reinterpret_cast(pTypes), nTypes ); @@ -3654,7 +3654,7 @@ void SelectionManager::run( void* pThis ) osl::Thread::setName("SelectionManager"); // dispatch until the cows come home - SelectionManager* This = (SelectionManager*)pThis; + SelectionManager* This = static_cast(pThis); timeval aLast; gettimeofday( &aLast, 0 ); diff --git a/vcl/unx/generic/dtrans/bmp.cxx b/vcl/unx/generic/dtrans/bmp.cxx index 0c8e1318e735..621243e5a11f 100644 --- a/vcl/unx/generic/dtrans/bmp.cxx +++ b/vcl/unx/generic/dtrans/bmp.cxx @@ -142,7 +142,7 @@ static sal_uInt8* X11_getPaletteBmpFromImage( // allocate buffer to hold header and scanlines, initialize to zero rOutSize = nHeaderSize + nScanlineSize*pImage->height; - pBuffer = (sal_uInt8*)rtl_allocateZeroMemory( rOutSize ); + pBuffer = static_cast(rtl_allocateZeroMemory( rOutSize )); for( int y = 0; y < pImage->height; y++ ) { sal_uInt8* pScanline = pBuffer + nHeaderSize + (pImage->height-1-y)*nScanlineSize; @@ -265,7 +265,7 @@ static sal_uInt8* X11_getTCBmpFromImage( // allocate buffer to hold header and scanlines, initialize to zero rOutSize = nHeaderSize + nScanlineSize*pImage->height; - pBuffer = (sal_uInt8*)rtl_allocateZeroMemory( rOutSize ); + pBuffer = static_cast(rtl_allocateZeroMemory( rOutSize )); for( int y = 0; y < pImage->height; y++ ) { sal_uInt8* pScanline = pBuffer + nHeaderSize + (pImage->height-1-y)*nScanlineSize; @@ -683,7 +683,7 @@ Pixmap PixmapHolder::setBitmapData( const sal_uInt8* pData ) aImage.obdata = NULL; XInitImage( &aImage ); - aImage.data = (char*)rtl_allocateMemory( nHeight*aImage.bytes_per_line ); + aImage.data = static_cast(rtl_allocateMemory( nHeight*aImage.bytes_per_line )); if( readLE32( pData+14 ) == 24 ) { diff --git a/vcl/unx/generic/dtrans/config.cxx b/vcl/unx/generic/dtrans/config.cxx index b99176473757..00829ce61ad7 100644 --- a/vcl/unx/generic/dtrans/config.cxx +++ b/vcl/unx/generic/dtrans/config.cxx @@ -81,7 +81,7 @@ DtransX11ConfigItem::DtransX11ConfigItem() : { if( pValue->getValueTypeClass() == TypeClass_STRING ) { - const OUString* pLine = (const OUString*)pValue->getValue(); + const OUString* pLine = static_cast(pValue->getValue()); if( !pLine->isEmpty() ) { m_nSelectionTimeout = pLine->toInt32(); diff --git a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx index 3f063b37e8c7..bf58b95bf4bb 100644 --- a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx +++ b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx @@ -91,7 +91,7 @@ namespace cairo X11Pixmap::~X11Pixmap() { if( mpDisplay && mhDrawable ) - XFreePixmap( (Display*)mpDisplay, mhDrawable ); + XFreePixmap( static_cast(mpDisplay), mhDrawable ); } /** @@ -148,9 +148,9 @@ namespace cairo maSysData(rSysData), mpPixmap(), mpSurface( - cairo_xlib_surface_create( (Display*)rSysData.pDisplay, + cairo_xlib_surface_create( static_cast(rSysData.pDisplay), rSysData.hDrawable, - (Visual*)rSysData.pVisual, + static_cast(rSysData.pVisual), width + x, height + y ), &cairo_surface_destroy) { @@ -173,9 +173,9 @@ namespace cairo maSysData( rSysData ), mpPixmap(), mpSurface( - cairo_xlib_surface_create( (Display*)rSysData.pDisplay, + cairo_xlib_surface_create( static_cast(rSysData.pDisplay), reinterpret_cast(rData.aPixmap), - (Visual*) rSysData.pVisual, + static_cast(rSysData.pVisual), rData.mnWidth, rData.mnHeight ), &cairo_surface_destroy) { @@ -228,8 +228,8 @@ namespace cairo break; } - pFormat = XRenderFindStandardFormat( (Display*)maSysData.pDisplay, nFormat ); - hPixmap = limitXCreatePixmap( (Display*)maSysData.pDisplay, maSysData.hDrawable, + pFormat = XRenderFindStandardFormat( static_cast(maSysData.pDisplay), nFormat ); + hPixmap = limitXCreatePixmap( static_cast(maSysData.pDisplay), maSysData.hDrawable, width > 0 ? width : 1, height > 0 ? height : 1, pFormat->depth ); @@ -241,9 +241,9 @@ namespace cairo new X11Pixmap(hPixmap, maSysData.pDisplay)), CairoSurfaceSharedPtr( cairo_xlib_surface_create_with_xrender_format( - (Display*)maSysData.pDisplay, + static_cast(maSysData.pDisplay), hPixmap, - ScreenOfDisplay((Display *)maSysData.pDisplay, maSysData.nScreen), + ScreenOfDisplay(static_cast(maSysData.pDisplay), maSysData.nScreen), pFormat, width, height ), &cairo_surface_destroy) )); } @@ -291,7 +291,7 @@ namespace cairo void X11Surface::flush() const { - XSync( (Display*)maSysData.pDisplay, false ); + XSync( static_cast(maSysData.pDisplay), false ); } /** @@ -302,7 +302,7 @@ namespace cairo int X11Surface::getDepth() const { if( maSysData.pRenderFormat ) - return ((XRenderPictFormat*) maSysData.pRenderFormat)->depth; + return static_cast(maSysData.pRenderFormat)->depth; return -1; } diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index ee14de263707..6d9d74871686 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -130,7 +130,7 @@ CairoFontsCache::~CairoFontsCache() { LRUFonts::iterator aEnd = maLRUFonts.end(); for (LRUFonts::iterator aI = maLRUFonts.begin(); aI != aEnd; ++aI) - cairo_font_face_destroy((cairo_font_face_t*)aI->first); + cairo_font_face_destroy(static_cast(aI->first)); } } @@ -139,7 +139,7 @@ void CairoFontsCache::CacheFont(void *pFont, const CairoFontsCache::CacheId &rId maLRUFonts.push_front( std::pair(pFont, rId) ); if (maLRUFonts.size() > 8) { - cairo_font_face_destroy((cairo_font_face_t*)maLRUFonts.back().first); + cairo_font_face_destroy(static_cast(maLRUFonts.back().first)); maLRUFonts.pop_back(); } } @@ -252,7 +252,7 @@ void CairoTextRender::DrawServerFontLayout( const ServerFontLayout& rLayout ) size_t nLen = std::distance(aI, aNext); aId.mbVerticalMetrics = nGlyphRotation != 0.0; - cairo_font_face_t* font_face = (cairo_font_face_t*)CairoFontsCache::FindCachedFont(aId); + cairo_font_face_t* font_face = static_cast(CairoFontsCache::FindCachedFont(aId)); if (!font_face) { const ImplFontOptions *pOptions = rFont.GetFontOptions().get(); diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index c0ece24fb9e1..8a12fbb42562 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -112,7 +112,7 @@ extern "C" { static void getPPDWorker(void* pData) { osl_setThreadName("CUPSManager getPPDWorker"); - GetPPDAttribs* pAttribs = (GetPPDAttribs*)pData; + GetPPDAttribs* pAttribs = static_cast(pData); pAttribs->executeCall(); } } @@ -200,12 +200,12 @@ CUPSManager::~CUPSManager() } if (m_nDests && m_pDests) - cupsFreeDests( m_nDests, (cups_dest_t*)m_pDests ); + cupsFreeDests( m_nDests, static_cast(m_pDests) ); } void CUPSManager::runDestThread( void* pThis ) { - ((CUPSManager*)pThis)->runDests(); + static_cast(pThis)->runDests(); } void CUPSManager::runDests() @@ -267,7 +267,7 @@ void CUPSManager::initialize() // this is needed to check for %%IncludeFeature support // (#i65684#, #i65491#) bool bUsePDF = false; - cups_dest_t* pDest = ((cups_dest_t*)m_pDests); + cups_dest_t* pDest = static_cast(m_pDests); const char* pOpt = cupsGetOption( "printer-info", pDest->num_options, pDest->options ); @@ -295,7 +295,7 @@ void CUPSManager::initialize() // with the same name as a CUPS printer, overwrite it while( nPrinter-- ) { - pDest = ((cups_dest_t*)m_pDests)+nPrinter; + pDest = static_cast(m_pDests)+nPrinter; OUString aPrinterName = OStringToOUString( pDest->name, aEncoding ); if( pDest->instance && *pDest->instance ) { @@ -431,7 +431,7 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter ) m_aCUPSDestMap.find( aPrinter ); if( dest_it != m_aCUPSDestMap.end() ) { - cups_dest_t* pDest = ((cups_dest_t*)m_pDests) + dest_it->second; + cups_dest_t* pDest = static_cast(m_pDests) + dest_it->second; OString aPPDFile = threadedCupsGetPPD( pDest->name ); SAL_INFO("vcl.unx.print", "PPD for " << aPrinter << " is " << aPPDFile); @@ -601,7 +601,7 @@ void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner { OString aKey = OUStringToOString( pKey->getKey(), RTL_TEXTENCODING_ASCII_US ); OString aValue = OUStringToOString( sPayLoad, RTL_TEXTENCODING_ASCII_US ); - rNumOptions = cupsAddOption( aKey.getStr(), aValue.getStr(), rNumOptions, (cups_option_t**)rOptions ); + rNumOptions = cupsAddOption( aKey.getStr(), aValue.getStr(), rNumOptions, reinterpret_cast(rOptions) ); } } } @@ -609,13 +609,13 @@ void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner if( rJob.m_nPDFDevice > 0 && rJob.m_nCopies > 1 ) { OString aVal( OString::number( rJob.m_nCopies ) ); - rNumOptions = cupsAddOption( "copies", aVal.getStr(), rNumOptions, (cups_option_t**)rOptions ); + rNumOptions = cupsAddOption( "copies", aVal.getStr(), rNumOptions, reinterpret_cast(rOptions) ); aVal = OString::boolean(rJob.m_bCollate); - rNumOptions = cupsAddOption( "collate", aVal.getStr(), rNumOptions, (cups_option_t**)rOptions ); + rNumOptions = cupsAddOption( "collate", aVal.getStr(), rNumOptions, reinterpret_cast(rOptions) ); } if( ! bBanner ) { - rNumOptions = cupsAddOption( "job-sheets", "none", rNumOptions, (cups_option_t**)rOptions ); + rNumOptions = cupsAddOption( "job-sheets", "none", rNumOptions, reinterpret_cast(rOptions) ); } } @@ -722,7 +722,7 @@ bool CUPSManager::printJobs( const PendingJob& job, const std::vector< OString > sJobName = OUStringToOString(job.faxNumber, aEnc); } - cups_dest_t* pDest = ((cups_dest_t*)m_pDests) + dest_it->second; + cups_dest_t* pDest = static_cast(m_pDests) + dest_it->second; std::vector< const char* > fnames; for( std::vector< OString >::const_iterator it = files.begin(); @@ -790,7 +790,7 @@ bool CUPSManager::checkPrintersChanged( bool bWait ) // there is no way to query CUPS whether the printer list has changed // so get the dest list anew if( m_nDests && m_pDests ) - cupsFreeDests( m_nDests, (cups_dest_t*)m_pDests ); + cupsFreeDests( m_nDests, static_cast(m_pDests) ); m_nDests = 0; m_pDests = NULL; runDests(); @@ -841,11 +841,11 @@ bool CUPSManager::setDefaultPrinter( const OUString& rName ) m_aCUPSDestMap.find( rName ); if( nit != m_aCUPSDestMap.end() && m_aCUPSMutex.tryToAcquire() ) { - cups_dest_t* pDests = (cups_dest_t*)m_pDests; + cups_dest_t* pDests = static_cast(m_pDests); for( int i = 0; i < m_nDests; i++ ) pDests[i].is_default = 0; pDests[ nit->second ].is_default = 1; - cupsSetDests( m_nDests, (cups_dest_t*)m_pDests ); + cupsSetDests( m_nDests, static_cast(m_pDests) ); m_aDefaultPrinter = rName; m_aCUPSMutex.release(); bSuccess = true; @@ -875,7 +875,7 @@ bool CUPSManager::writePrinterConfig() if( m_aCUPSMutex.tryToAcquire() ) { bDestModified = true; - cups_dest_t* pDest = ((cups_dest_t*)m_pDests) + nit->second; + cups_dest_t* pDest = static_cast(m_pDests) + nit->second; PrinterInfo& rInfo = prt->second.m_aInfo; // create new option list @@ -902,7 +902,7 @@ bool CUPSManager::writePrinterConfig() } if( bDestModified && m_aCUPSMutex.tryToAcquire() ) { - cupsSetDests( m_nDests, (cups_dest_t*)m_pDests ); + cupsSetDests( m_nDests, static_cast(m_pDests) ); m_aCUPSMutex.release(); } diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx index dacf2e2c1d7d..778961faa1bb 100644 --- a/vcl/unx/generic/printer/jobdata.cxx +++ b/vcl/unx/generic/printer/jobdata.cxx @@ -293,7 +293,7 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa { rJobData.m_aContext.setParser( rJobData.m_pParser ); int nBytes = bytes - aStream.Tell(); - char* pRemain = (char*)alloca( bytes - aStream.Tell() ); + char* pRemain = static_cast(alloca( bytes - aStream.Tell() )); aStream.Read( pRemain, nBytes ); rJobData.m_aContext.rebuildFromStreamBuffer( pRemain, nBytes ); bContext = true; diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index e7a5cf85edc4..413d47c02a70 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -3176,7 +3176,7 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) KeySym nKeySym; KeySym nUnmodifiedKeySym; int nLen = 2048; - unsigned char *pPrintable = (unsigned char*)alloca( nLen ); + unsigned char *pPrintable = static_cast(alloca( nLen )); // singlebyte code composed by input method, the new default if (mpInputContext != NULL && mpInputContext->UseContext()) @@ -3190,7 +3190,7 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) if ( nStatus == XBufferOverflow ) { nLen *= 2; - pPrintable = (unsigned char*)alloca( nLen ); + pPrintable = static_cast(alloca( nLen )); nKeySym = pDisplay_->GetKeySym( pEvent, pPrintable, &nLen, &nUnmodifiedKeySym, &nStatus, mpInputContext->GetContext() ); @@ -3355,7 +3355,7 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) sal_Unicode *pString; sal_Size nBufferSize = nLen * 2; sal_Size nSize; - pBuffer = (sal_Unicode*) malloc( nBufferSize + 2 ); + pBuffer = static_cast(malloc( nBufferSize + 2 )); pBuffer[ 0 ] = 0; if (nKeyString != 0) diff --git a/vcl/unx/generic/window/salobj.cxx b/vcl/unx/generic/window/salobj.cxx index 7a7dbf988eb0..e538ae423e99 100644 --- a/vcl/unx/generic/window/salobj.cxx +++ b/vcl/unx/generic/window/salobj.cxx @@ -51,7 +51,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p X11SalObject* pObject = new X11SalObject(); SystemEnvData* pObjData = const_cast(pObject->GetSystemData()); - if ( ! XShapeQueryExtension( (Display*)pObjData->pDisplay, + if ( ! XShapeQueryExtension( static_cast(pObjData->pDisplay), &event_base, &error_base ) ) { delete pObject; @@ -70,7 +70,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p XGetWindowAttributes( pDisp, aObjectParent, &aParentAttr ); SalX11Screen nXScreen( XScreenNumberOfScreen( aParentAttr.screen ) ); Visual* pVisual = (pWindowData && pWindowData->pVisual) ? - (Visual*)pWindowData->pVisual : + static_cast(pWindowData->pVisual) : pSalDisp->GetVisual( nXScreen ).GetVisual(); // get visual info VisualID aVisID = XVisualIDFromVisual( pVisual ); @@ -251,12 +251,12 @@ X11SalObject::~X11SalObject() GetGenericData()->ErrorTrapPush(); if ( maSecondary ) - XDestroyWindow( (Display*)maSystemChildData.pDisplay, maSecondary ); + XDestroyWindow( static_cast(maSystemChildData.pDisplay), maSecondary ); if ( maPrimary ) - XDestroyWindow( (Display*)maSystemChildData.pDisplay, maPrimary ); + XDestroyWindow( static_cast(maSystemChildData.pDisplay), maPrimary ); if ( maColormap ) - XFreeColormap((Display*)maSystemChildData.pDisplay, maColormap); - XSync( (Display*)maSystemChildData.pDisplay, False ); + XFreeColormap(static_cast(maSystemChildData.pDisplay), maColormap); + XSync( static_cast(maSystemChildData.pDisplay), False ); GetGenericData()->ErrorTrapPop(); } @@ -274,7 +274,7 @@ X11SalObject::ResetClipRegion() ::Window aShapeWindow = maPrimary; - XGetWindowAttributes ( (Display*)maSystemChildData.pDisplay, + XGetWindowAttributes ( static_cast(maSystemChildData.pDisplay), aShapeWindow, &win_attrib ); @@ -283,7 +283,7 @@ X11SalObject::ResetClipRegion() win_size.width = win_attrib.width; win_size.height = win_attrib.height; - XShapeCombineRectangles ( (Display*)maSystemChildData.pDisplay, + XShapeCombineRectangles ( static_cast(maSystemChildData.pDisplay), aShapeWindow, dest_kind, 0, 0, // x_off, y_off @@ -332,7 +332,7 @@ X11SalObject::EndSetClipRegion() ::Window aShapeWindow = maPrimary; - XShapeCombineRectangles ( (Display*)maSystemChildData.pDisplay, + XShapeCombineRectangles ( static_cast(maSystemChildData.pDisplay), aShapeWindow, dest_kind, 0, 0, // x_off, y_off @@ -352,10 +352,10 @@ X11SalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight ) { if ( maPrimary && maSecondary && nWidth && nHeight ) { - XMoveResizeWindow( (Display*)maSystemChildData.pDisplay, + XMoveResizeWindow( static_cast(maSystemChildData.pDisplay), maPrimary, nX, nY, nWidth, nHeight ); - XMoveResizeWindow( (Display*)maSystemChildData.pDisplay, + XMoveResizeWindow( static_cast(maSystemChildData.pDisplay), maSecondary, 0, 0, nWidth, nHeight ); } @@ -368,14 +368,14 @@ X11SalObject::Show( bool bVisible ) return; if ( bVisible ) { - XMapWindow( (Display*)maSystemChildData.pDisplay, + XMapWindow( static_cast(maSystemChildData.pDisplay), maSecondary ); - XMapWindow( (Display*)maSystemChildData.pDisplay, + XMapWindow( static_cast(maSystemChildData.pDisplay), maPrimary ); } else { - XUnmapWindow( (Display*)maSystemChildData.pDisplay, + XUnmapWindow( static_cast(maSystemChildData.pDisplay), maPrimary ); - XUnmapWindow( (Display*)maSystemChildData.pDisplay, + XUnmapWindow( static_cast(maSystemChildData.pDisplay), maSecondary ); } mbVisible = bVisible; @@ -384,7 +384,7 @@ X11SalObject::Show( bool bVisible ) void X11SalObject::GrabFocus() { if( mbVisible ) - XSetInputFocus( (Display*)maSystemChildData.pDisplay, + XSetInputFocus( static_cast(maSystemChildData.pDisplay), maSystemChildData.aWindow, RevertToNone, CurrentTime ); diff --git a/vcl/unx/gtk/a11y/atkfactory.cxx b/vcl/unx/gtk/a11y/atkfactory.cxx index f960b4e65632..d3cb30ad94c4 100644 --- a/vcl/unx/gtk/a11y/atkfactory.cxx +++ b/vcl/unx/gtk/a11y/atkfactory.cxx @@ -79,7 +79,7 @@ atk_noop_object_wrapper_new() { AtkObject *accessible; - accessible = (AtkObject *) g_object_new (atk_noop_object_wrapper_get_type(), NULL); + accessible = static_cast(g_object_new (atk_noop_object_wrapper_get_type(), NULL)); g_return_val_if_fail (accessible != NULL, NULL); accessible->role = ATK_ROLE_INVALID; diff --git a/vcl/unx/gtk/a11y/atkhypertext.cxx b/vcl/unx/gtk/a11y/atkhypertext.cxx index 1074dad8ad8a..6b6b4199d8ae 100644 --- a/vcl/unx/gtk/a11y/atkhypertext.cxx +++ b/vcl/unx/gtk/a11y/atkhypertext.cxx @@ -142,7 +142,7 @@ hyper_link_class_init (AtkHyperlinkClass *klass) gobject_class->finalize = hyper_link_finalize; - hyper_parent_class = (GObjectClass *)g_type_class_peek_parent (klass); + hyper_parent_class = static_cast(g_type_class_peek_parent (klass)); klass->get_uri = hyper_link_get_uri; klass->get_object = hyper_link_get_object; @@ -218,7 +218,7 @@ hypertext_get_link( AtkHypertext *hypertext, accessibility::XAccessibleHypertext* pHypertext = getHypertext( hypertext ); if( pHypertext ) { - HyperLink *pLink = (HyperLink *)g_object_new( hyper_link_get_type(), NULL ); + HyperLink *pLink = static_cast(g_object_new( hyper_link_get_type(), NULL )); pLink->xLink = pHypertext->getHyperLink( link_index ); if( !pLink->xLink.is() ) { g_object_unref( G_OBJECT( pLink ) ); diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx index 4bf7d08ffbfb..afa89e0fcf5d 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.cxx +++ b/vcl/unx/gtk/a11y/atktextattributes.cxx @@ -1016,8 +1016,8 @@ DefaultTabStops2String( const uno::Any& rAny ) extern "C" int attr_compare(const void *p1,const void *p2) { - const rtl_uString * pustr = (const rtl_uString *) p1; - const char * pc = *((const char **) p2); + const rtl_uString * pustr = static_cast(p1); + const char * pc = *static_cast(p2); return rtl_ustr_ascii_compare_WithLength(pustr->buffer, pustr->length, pc); } @@ -1028,9 +1028,9 @@ find_exported_attributes( sal_Int32 *pArray, { for( sal_Int32 i = 0; i < rAttributeList.getLength(); i++ ) { - const char ** pAttr = (const char **) bsearch(rAttributeList[i].Name.pData, + const char ** pAttr = static_cast(bsearch(rAttributeList[i].Name.pData, ExportedTextAttributes, TEXT_ATTRIBUTE_LAST, sizeof(const char *), - attr_compare); + attr_compare)); if( pAttr ) { @@ -1049,7 +1049,7 @@ attribute_set_prepend( AtkAttributeSet* attribute_set, { if( value ) { - AtkAttribute *at = (AtkAttribute *) g_malloc( sizeof (AtkAttribute) ); + AtkAttribute *at = static_cast(g_malloc( sizeof (AtkAttribute) )); at->name = g_strdup( atk_text_attribute_get_name( attribute ) ); at->value = value; diff --git a/vcl/unx/gtk/a11y/atkwindow.cxx b/vcl/unx/gtk/a11y/atkwindow.cxx index cd9bf9e49c74..84ef89198fe9 100644 --- a/vcl/unx/gtk/a11y/atkwindow.cxx +++ b/vcl/unx/gtk/a11y/atkwindow.cxx @@ -238,7 +238,7 @@ ooo_window_wrapper_real_initialize(AtkObject *obj, gpointer data) static void ooo_window_wrapper_real_finalize (GObject *obj) { - ooo_wrapper_registry_remove( (XAccessible *) g_object_get_data( obj, "ooo:atk-wrapper-key" )); + ooo_wrapper_registry_remove( static_cast(g_object_get_data( obj, "ooo:atk-wrapper-key" ))); window_real_finalize( obj ); } diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx index 80f347888f68..e2fc450d2918 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.cxx +++ b/vcl/unx/gtk/a11y/atkwrapper.cxx @@ -524,7 +524,7 @@ wrapper_ref_relation_set( AtkObject *atk_obj ) { accessibility::AccessibleRelation aRelation = xRelationSet->getRelation( n ); sal_uInt32 nTargetCount = aRelation.TargetSet.getLength(); - AtkObject **pTargets = (AtkObject **) alloca( nTargetCount * sizeof(AtkObject *) ); + AtkObject **pTargets = static_cast(alloca( nTargetCount * sizeof(AtkObject *) )); for( sal_uInt32 i = 0; i < nTargetCount; i++ ) { @@ -622,7 +622,7 @@ atk_object_wrapper_class_init (AtkObjectWrapperClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS( klass ); AtkObjectClass *atk_class = ATK_OBJECT_CLASS( klass ); - parent_class = (GObjectClass *) g_type_class_peek_parent (klass); + parent_class = static_cast(g_type_class_peek_parent (klass)); // GObject methods gobject_class->finalize = atk_object_wrapper_finalize; diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index cdbfd0a1b7c7..93b2be8b92d3 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -56,7 +56,7 @@ GdkFilterReturn call_filterGdkEvent( GdkXEvent* sys_event, GdkEvent* event, gpointer data ) { - GtkSalDisplay *pDisplay = (GtkSalDisplay *)data; + GtkSalDisplay *pDisplay = static_cast(data); return pDisplay->filterGdkEvent( sys_event, event ); } } @@ -110,13 +110,13 @@ extern "C" { void signalScreenSizeChanged( GdkScreen* pScreen, gpointer data ) { - GtkSalDisplay* pDisp = (GtkSalDisplay*)data; + GtkSalDisplay* pDisp = static_cast(data); pDisp->screenSizeChanged( pScreen ); } void signalMonitorsChanged( GdkScreen* pScreen, gpointer data ) { - GtkSalDisplay* pDisp = (GtkSalDisplay*)data; + GtkSalDisplay* pDisp = static_cast(data); pDisp->monitorsChanged( pScreen ); } @@ -127,7 +127,7 @@ GdkFilterReturn GtkSalDisplay::filterGdkEvent( GdkXEvent* sys_event, { #if !GTK_CHECK_VERSION(3,0,0) GdkFilterReturn aFilterReturn = GDK_FILTER_CONTINUE; - XEvent *pEvent = (XEvent *)sys_event; + XEvent *pEvent = static_cast(sys_event); // dispatch all XEvents to event callback if( GetSalData()->m_pInstance-> @@ -919,7 +919,7 @@ void GtkSalTimer::Stop() gboolean GtkData::userEventFn( gpointer data ) { gboolean bContinue = FALSE; - GtkData *pThis = (GtkData *) data; + GtkData *pThis = static_cast(data); SalGenericData *pData = GetGenericData(); osl::Guard< comphelper::SolarMutex > aGuard( pData->m_pInstance->GetYieldMutex() ); const SalGenericDisplay *pDisplay = pData->GetDisplay(); diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx index fb14bdbd33a9..4392f5d3924d 100644 --- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx @@ -1765,7 +1765,7 @@ static gboolean case_insensitive_filter (const GtkFileFilterInfo *filter_info, gpointer data) { gboolean bRetval = false; - const char *pFilter = (const char *) data; + const char *pFilter = static_cast(data); g_return_val_if_fail( data != NULL, false ); g_return_val_if_fail( filter_info != NULL, false ); diff --git a/vcl/unx/gtk/window/gloactiongroup.cxx b/vcl/unx/gtk/window/gloactiongroup.cxx index 11145e3c44c3..69dea4054880 100644 --- a/vcl/unx/gtk/window/gloactiongroup.cxx +++ b/vcl/unx/gtk/window/gloactiongroup.cxx @@ -132,7 +132,7 @@ g_lo_action_group_list_actions (GActionGroup *group) g_hash_table_iter_init (&iter, loGroup->priv->table); while (g_hash_table_iter_next (&iter, &key, NULL)) - keys[i++] = g_strdup ((gchar*) key); + keys[i++] = g_strdup (static_cast(key)); g_assert_cmpint (i, ==, n); keys[n] = NULL; @@ -428,7 +428,7 @@ g_lo_action_group_clear (GLOActionGroup *group) for (GList* element = g_list_first (keys); element != NULL; element = g_list_next (element)) { - g_lo_action_group_remove (group, (gchar*) element->data); + g_lo_action_group_remove (group, static_cast(element->data)); } g_list_free (keys); diff --git a/vcl/unx/gtk/window/gtkobject.cxx b/vcl/unx/gtk/window/gtkobject.cxx index 0299d6826ec5..2690513ce742 100644 --- a/vcl/unx/gtk/window/gtkobject.cxx +++ b/vcl/unx/gtk/window/gtkobject.cxx @@ -173,7 +173,7 @@ const SystemEnvData* GtkSalObject::GetSystemData() const gboolean GtkSalObject::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer object ) { - GtkSalObject* pThis = (GtkSalObject*)object; + GtkSalObject* pThis = static_cast(object); if( pEvent->type == GDK_BUTTON_PRESS ) { @@ -185,7 +185,7 @@ gboolean GtkSalObject::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointe gboolean GtkSalObject::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer object ) { - GtkSalObject* pThis = (GtkSalObject*)object; + GtkSalObject* pThis = static_cast(object); pThis->CallCallback( pEvent->in ? SALOBJ_EVENT_GETFOCUS : SALOBJ_EVENT_LOSEFOCUS, NULL ); @@ -194,7 +194,7 @@ gboolean GtkSalObject::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer void GtkSalObject::signalDestroy( GtkWidget* pObj, gpointer object ) { - GtkSalObject* pThis = (GtkSalObject*)object; + GtkSalObject* pThis = static_cast(object); if( pObj == pThis->m_pSocket ) { pThis->m_pSocket = NULL; diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index 1b8bdc52da46..f56bbade1247 100644 --- a/vcl/unx/gtk/window/gtksalframe.cxx +++ b/vcl/unx/gtk/window/gtksalframe.cxx @@ -1253,7 +1253,7 @@ static void lcl_set_user_time( GtkWindow* i_pWindow, guint32 i_nTime ) GtkSalFrame *GtkSalFrame::getFromWindow( GtkWindow *pWindow ) { - return (GtkSalFrame *) g_object_get_data( G_OBJECT( pWindow ), "SalFrame" ); + return static_cast(g_object_get_data( G_OBJECT( pWindow ), "SalFrame" )); } void GtkSalFrame::Init( SalFrame* pParent, sal_uLong nStyle ) @@ -1588,7 +1588,7 @@ bitmapToPixbuf( SalBitmap *pSalBitmap, SalBitmap *pSalAlpha ) g_return_val_if_fail( pSalAlpha->GetSize() == aSize, NULL ); int nX, nY; - guchar *pPixbufData = (guchar *)g_malloc (4 * aSize.Width() * aSize.Height() ); + guchar *pPixbufData = static_cast(g_malloc (4 * aSize.Width() * aSize.Height() )); guchar *pDestData = pPixbufData; for( nY = 0; nY < pBitmap->mnHeight; nY++ ) @@ -3217,7 +3217,7 @@ bool GtkSalFrame::Dispatch( const XEvent* pEvent ) gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); SalMouseEvent aEvent; sal_uInt16 nEventType = 0; @@ -3308,7 +3308,7 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer gboolean GtkSalFrame::signalScroll( GtkWidget*, GdkEvent* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); GdkEventScroll* pSEvent = reinterpret_cast(pEvent); #if GTK_CHECK_VERSION(3,0,0) @@ -3349,7 +3349,7 @@ gboolean GtkSalFrame::signalScroll( GtkWidget*, GdkEvent* pEvent, gpointer frame #if GTK_CHECK_VERSION(3,14,0) void GtkSalFrame::gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdouble velocity_y, gpointer frame) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); SalSwipeEvent aEvent; aEvent.mnVelocityX = velocity_x; @@ -3369,7 +3369,7 @@ void GtkSalFrame::gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdo void GtkSalFrame::gestureLongPress(GtkGestureLongPress* gesture, gpointer frame) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); SalLongPressEvent aEvent; @@ -3386,7 +3386,7 @@ void GtkSalFrame::gestureLongPress(GtkGestureLongPress* gesture, gpointer frame) gboolean GtkSalFrame::signalMotion( GtkWidget*, GdkEventMotion* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); SalMouseEvent aEvent; aEvent.mnTime = pEvent->time; @@ -3428,7 +3428,7 @@ gboolean GtkSalFrame::signalMotion( GtkWidget*, GdkEventMotion* pEvent, gpointer gboolean GtkSalFrame::signalCrossing( GtkWidget*, GdkEventCrossing* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); SalMouseEvent aEvent; aEvent.mnTime = pEvent->time; aEvent.mnX = (long)pEvent->x_root - pThis->maGeometry.nX; @@ -3493,7 +3493,7 @@ void GtkSalFrame::damaged (const basegfx::B2IBox& rDamageRect) // blit our backing basebmp buffer to the target cairo context cr gboolean GtkSalFrame::signalDraw( GtkWidget*, cairo_t *cr, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); cairo_save(cr); @@ -3515,7 +3515,7 @@ gboolean GtkSalFrame::signalDraw( GtkWidget*, cairo_t *cr, gpointer frame ) #else gboolean GtkSalFrame::signalExpose( GtkWidget*, GdkEventExpose* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); struct SalPaintEvent aEvent( pEvent->area.x, pEvent->area.y, pEvent->area.width, pEvent->area.height ); @@ -3550,7 +3550,7 @@ void GtkSalFrame::TriggerPaintEvent() gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); X11SalInstance *pSalInstance = static_cast< X11SalInstance* >(GetSalData()->m_pInstance); @@ -3603,7 +3603,7 @@ static OString getDisplayString() gboolean GtkSalFrame::signalMap( GtkWidget *pWidget, GdkEvent*, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); #if !GTK_CHECK_VERSION(3,8,0) //Spawn off a helper program that will attempt to set this fullscreen @@ -3658,7 +3658,7 @@ gboolean GtkSalFrame::signalMap( GtkWidget *pWidget, GdkEvent*, gpointer frame ) gboolean GtkSalFrame::signalUnmap( GtkWidget*, GdkEvent*, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); pThis->CallCallback( SALEVENT_RESIZE, NULL ); @@ -3667,7 +3667,7 @@ gboolean GtkSalFrame::signalUnmap( GtkWidget*, GdkEvent*, gpointer frame ) gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); bool bMoved = false, bSized = false; int x = pEvent->x, y = pEvent->y; @@ -3753,7 +3753,7 @@ gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gp gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); vcl::DeletionListener aDel( pThis ); @@ -3869,7 +3869,7 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame gboolean GtkSalFrame::signalDelete( GtkWidget*, GdkEvent*, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); pThis->CallCallback( SALEVENT_CLOSE, NULL ); @@ -3878,7 +3878,7 @@ gboolean GtkSalFrame::signalDelete( GtkWidget*, GdkEvent*, gpointer frame ) void GtkSalFrame::signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); // every frame gets an initial style set on creation // do not post these as the whole application tends to @@ -3919,7 +3919,7 @@ void GtkSalFrame::signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer fram gboolean GtkSalFrame::signalState( GtkWidget*, GdkEvent* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); if( (pThis->m_nState & GDK_WINDOW_STATE_ICONIFIED) != (pEvent->window_state.new_window_state & GDK_WINDOW_STATE_ICONIFIED ) ) { pThis->getDisplay()->SendInternalEvent( pThis, NULL, SALEVENT_RESIZE ); @@ -3949,14 +3949,14 @@ gboolean GtkSalFrame::signalState( GtkWidget*, GdkEvent* pEvent, gpointer frame gboolean GtkSalFrame::signalVisibility( GtkWidget*, GdkEventVisibility* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); pThis->m_nVisibility = pEvent->state; return true; } void GtkSalFrame::signalDestroy( GtkWidget* pObj, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast(frame); if( pObj == pThis->m_pWindow ) { pThis->m_pFixedContainer = NULL; @@ -4232,7 +4232,7 @@ static bool checkSingleKeyCommitHack( guint keyval, sal_Unicode cCode ) #endif void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* pText, gpointer im_handler ) { - GtkSalFrame::IMHandler* pThis = (GtkSalFrame::IMHandler*)im_handler; + GtkSalFrame::IMHandler* pThis = static_cast(im_handler); SolarMutexGuard aGuard; vcl::DeletionListener aDel( pThis->m_pFrame ); @@ -4302,7 +4302,7 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_handler ) { - GtkSalFrame::IMHandler* pThis = (GtkSalFrame::IMHandler*)im_handler; + GtkSalFrame::IMHandler* pThis = static_cast(im_handler); char* pText = NULL; PangoAttrList* pAttrs = NULL; @@ -4356,7 +4356,7 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_ tmp_list = attr_list = pango_attr_iterator_get_attrs (iter); while (tmp_list) { - PangoAttribute *pango_attr = (PangoAttribute *)(tmp_list->data); + PangoAttribute *pango_attr = static_cast(tmp_list->data); switch (pango_attr->klass->type) { @@ -4414,7 +4414,7 @@ void GtkSalFrame::IMHandler::signalIMPreeditStart( GtkIMContext*, gpointer /*im_ void GtkSalFrame::IMHandler::signalIMPreeditEnd( GtkIMContext*, gpointer im_handler ) { - GtkSalFrame::IMHandler* pThis = (GtkSalFrame::IMHandler*)im_handler; + GtkSalFrame::IMHandler* pThis = static_cast(im_handler); pThis->m_bPreeditJustChanged = true; diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx index afe9e7a4be1b..3a92b6b45cd7 100644 --- a/vcl/unx/gtk/window/gtksalmenu.cxx +++ b/vcl/unx/gtk/window/gtksalmenu.cxx @@ -209,7 +209,7 @@ void RemoveSpareSectionsFromNativeMenu( GLOMenu* pMenu, GList** pOldCommandList, gint CompareStr( gpointer str1, gpointer str2 ) { - return g_strcmp0( (const gchar*) str1, (const gchar*) str2 ); + return g_strcmp0( static_cast(str1), static_cast(str2) ); } void RemoveUnusedCommands( GLOActionGroup* pActionGroup, GList* pOldCommandList, GList* pNewCommandList ) @@ -244,7 +244,7 @@ void RemoveUnusedCommands( GLOActionGroup* pActionGroup, GList* pOldCommandList, GList* pCommand = g_list_first( pOldCommandList ); pOldCommandList = g_list_remove_link( pOldCommandList, pCommand ); - gchar* aCommand = (gchar*) g_list_nth_data( pCommand, 0 ); + gchar* aCommand = static_cast(g_list_nth_data( pCommand, 0 )); g_lo_action_group_remove( pActionGroup, aCommand ); diff --git a/vcl/unx/gtk/window/hudawareness.cxx b/vcl/unx/gtk/window/hudawareness.cxx index 866c1b1f0701..947f404f9d52 100644 --- a/vcl/unx/gtk/window/hudawareness.cxx +++ b/vcl/unx/gtk/window/hudawareness.cxx @@ -33,7 +33,7 @@ hud_awareness_method_call (GDBusConnection * /* connection */, GDBusMethodInvocation *invocation, gpointer user_data) { - HudAwarenessHandle *handle = (HudAwarenessHandle*) user_data; + HudAwarenessHandle *handle = static_cast(user_data); if (g_str_equal (method_name, "HudActiveChanged")) { @@ -82,7 +82,7 @@ hud_awareness_register (GDBusConnection *connection, g_assert (iface != NULL); } - handle = (HudAwarenessHandle*) g_malloc (sizeof (HudAwarenessHandle)); + handle = static_cast(g_malloc (sizeof (HudAwarenessHandle))); object_id = g_dbus_connection_register_object (connection, object_path, iface, &vtable, handle, &g_free, error); @@ -92,7 +92,7 @@ hud_awareness_register (GDBusConnection *connection, return 0; } - handle->connection = (GDBusConnection*) g_object_ref (connection); + handle->connection = static_cast(g_object_ref (connection)); handle->callback = callback; handle->user_data = user_data; handle->notify = notify; diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx index 8af9686d1f39..c97882beba37 100644 --- a/vcl/unx/kde/kdedata.cxx +++ b/vcl/unx/kde/kdedata.cxx @@ -94,7 +94,7 @@ KDEXLib::~KDEXLib() // to the gtk plugin #if ! defined USE_RANDR || ! (defined LINUX && defined X86_64) // properly deinitialize KApplication - delete (VCLKDEApplication*)m_pApplication; + delete static_cast(m_pApplication); #endif // free the faked cmdline arguments no longer needed by KApplication for( int i = 0; i < m_nFakeCmdLineArgs; i++ ) -- cgit