diff options
author | mio <[email protected]> | 2024-08-22 19:34:23 +1000 |
---|---|---|
committer | mio <[email protected]> | 2024-08-22 23:15:20 +1000 |
commit | ed55bf072682ebf73239e74b7e3dd286ed5616a5 (patch) | |
tree | f13875c92a1b0cd5ba8d925ac5f2c6413e9ccc6d | |
parent | 5e965846d17f7053dca99f3366ce5d8f21e8f649 (diff) | |
download | codeine-ed55bf072682ebf73239e74b7e3dd286ed5616a5.tar.gz codeine-ed55bf072682ebf73239e74b7e3dd286ed5616a5.zip |
Use nullptr instead of NULL/0 pointer in C++ files
See: https://mirror.git.trinitydesktop.org/gitea/TDE/tde/issues/73
Signed-off-by: mio <[email protected]>
-rw-r--r-- | src/app/adjustSizeButton.cpp | 2 | ||||
-rw-r--r-- | src/app/captureFrame.cpp | 21 | ||||
-rw-r--r-- | src/app/fht.cpp | 6 | ||||
-rw-r--r-- | src/app/mainWindow.cpp | 17 | ||||
-rw-r--r-- | src/app/playDialog.cpp | 2 | ||||
-rw-r--r-- | src/app/slider.cpp | 6 | ||||
-rw-r--r-- | src/app/videoWindow.cpp | 2 | ||||
-rw-r--r-- | src/app/volumeAction.cpp | 4 | ||||
-rw-r--r-- | src/app/xineConfig.cpp | 22 | ||||
-rw-r--r-- | src/app/xineEngine.cpp | 28 | ||||
-rw-r--r-- | src/debug.h | 4 | ||||
-rw-r--r-- | src/part/videoWindow.cpp | 14 | ||||
-rw-r--r-- | src/part/xineEngine.cpp | 2 |
13 files changed, 68 insertions, 62 deletions
diff --git a/src/app/adjustSizeButton.cpp b/src/app/adjustSizeButton.cpp index fa691d9..1f4b801 100644 --- a/src/app/adjustSizeButton.cpp +++ b/src/app/adjustSizeButton.cpp @@ -48,7 +48,7 @@ namespace Codeine m_thingy->setPaletteForegroundColor( paletteBackgroundColor().dark() ); TQEvent e( TQEvent::Resize ); - eventFilter( 0, &e ); + eventFilter( nullptr, &e ); adjustSize(); show(); diff --git a/src/app/captureFrame.cpp b/src/app/captureFrame.cpp index 41796b9..119e729 100644 --- a/src/app/captureFrame.cpp +++ b/src/app/captureFrame.cpp @@ -255,25 +255,30 @@ VideoWindow::captureFrame() const return TQImage(); int yuv_size = ((w + 8) * (h + 1)) * 2; - uint8_t *yuv = new uint8_t[yuv_size]; - if( yuv == 0 ) { + uint8_t *yuv = new(std::nothrow) uint8_t[yuv_size]; + if (yuv == nullptr) { Debug::error() << "Not enough memory to make screenframe!\n"; - return TQImage(); } + return TQImage(); + } xine_get_current_frame_s(*engine(), &w, &h, &ratio, &format, yuv, &yuv_size); // convert to yv12 if necessary - uint8_t *y = 0, *u = 0, *v = 0; + uint8_t *y = nullptr; + uint8_t *u = nullptr; + uint8_t *v = nullptr; + switch( format ) { case XINE_IMGFMT_YUY2: { uint8_t *yuy2 = yuv; - yuv = new uint8_t[(w * h * 2)]; - if( yuv == 0 ) { + yuv = new(std::nothrow) uint8_t[(w * h * 2)]; + if (yuv == nullptr) { Debug::error() << "Not enough memory to make screenframe!\n"; delete [] yuy2; - return TQImage(); } + return TQImage(); + } y = yuv; u = yuv + w * h; @@ -298,7 +303,7 @@ VideoWindow::captureFrame() const // convert to rgb uchar *rgb = yv12ToRgb( y, u, v, w, h ); - TQImage frame( rgb, w, h, 32, 0, 0, TQImage::IgnoreEndian ); + TQImage frame( rgb, w, h, 32, nullptr, 0, TQImage::IgnoreEndian ); delete [] yuv; return frame; diff --git a/src/app/fht.cpp b/src/app/fht.cpp index 4d03851..f678bee 100644 --- a/src/app/fht.cpp +++ b/src/app/fht.cpp @@ -24,9 +24,9 @@ FHT::FHT(int n) : - m_buf(0), - m_tab(0), - m_log(0) + m_buf(nullptr), + m_tab(nullptr), + m_log(nullptr) { if (n < 3) { m_num = 0; diff --git a/src/app/mainWindow.cpp b/src/app/mainWindow.cpp index 1eb27f5..ee92f7c 100644 --- a/src/app/mainWindow.cpp +++ b/src/app/mainWindow.cpp @@ -116,7 +116,8 @@ MainWindow::MainWindow() } { - TQPopupMenu *menu = 0, *settings = static_cast<TQPopupMenu*>(factory()->container( "settings", this )); + TQPopupMenu *menu = nullptr; + TQPopupMenu *settings = static_cast<TQPopupMenu*>(factory()->container( "settings", this )); int id = SubtitleChannelsMenuItemId, index = 0; #define make_menu( name, text ) \ @@ -263,7 +264,7 @@ MainWindow::setupActions() new TDEAction( i18n("Video Settings..."), "configure", Key_V, this, TQ_SLOT(configure()), ac, "video_settings" ); new TDEAction( i18n("Configure xine..."), "configure", 0, this, TQ_SLOT(configure()), ac, "xine_settings" ); - (new KWidgetAction( m_positionSlider, i18n("Position Slider"), 0, 0, 0, ac, "position_slider" ))->setAutoSized( true ); + (new KWidgetAction( m_positionSlider, i18n("Position Slider"), nullptr, nullptr, nullptr, ac, "position_slider" ))->setAutoSized( true ); m_volumeAction = new VolumeAction( toolBar(), ac ); } @@ -381,7 +382,7 @@ MainWindow::load( const KURL &url ) if (url.protocol() == "media") { #define UDS_LOCAL_PATH (72 | TDEIO::UDS_STRING) TDEIO::UDSEntry e; - if (!TDEIO::NetAccess::stat( url, e, 0 )) + if (!TDEIO::NetAccess::stat( url, e, nullptr )) MessageBox::sorry( "There was an internal error with the media slave..." ); else { TDEIO::UDSEntry::ConstIterator end = e.end(); @@ -571,7 +572,7 @@ MainWindow::fullScreenToggled( bool isFullScreen ) delete s_handler; // prevent videoWindow() moving around when mouse moves - setCentralWidget( isFullScreen ? 0 : videoWindow() ); + setCentralWidget( isFullScreen ? nullptr : videoWindow() ); } void @@ -626,7 +627,7 @@ void MainWindow::aboutToShowMenu() { TQPopupMenu *menu = (TQPopupMenu*)sender(); - TQCString name( sender() ? sender()->name() : 0 ); + TQCString name( sender() ? sender()->name() : nullptr ); // uncheck all items first for( uint x = 0; x < menu->count(); ++x ) @@ -701,9 +702,9 @@ action( const char *name ) { #define QT_FATAL_ASSERT - MainWindow *mainWindow = 0; - TDEActionCollection *actionCollection = 0; - TDEAction *action = 0; + MainWindow *mainWindow = nullptr; + TDEActionCollection *actionCollection = nullptr; + TDEAction *action = nullptr; if( mainWindow = (MainWindow*)kapp->mainWidget() ) if( actionCollection = mainWindow->actionCollection() ) diff --git a/src/app/playDialog.cpp b/src/app/playDialog.cpp index 60ab979..8c40520 100644 --- a/src/app/playDialog.cpp +++ b/src/app/playDialog.cpp @@ -93,7 +93,7 @@ PlayDialog::createRecentFileWidget( TQBoxLayout *layout ) for( KURL::List::ConstIterator it = urls.begin(), end = urls.end(); it != end; ++it ) { const TQString fileName = (*it).fileName(); - new TDEListViewItem( lv, 0, (*it).url(), fileName.isEmpty() ? (*it).prettyURL() : fileName ); + new TDEListViewItem( lv, nullptr, (*it).url(), fileName.isEmpty() ? (*it).prettyURL() : fileName ); } if( lv->childCount() ) { diff --git a/src/app/slider.cpp b/src/app/slider.cpp index 172c15d..997f8db 100644 --- a/src/app/slider.cpp +++ b/src/app/slider.cpp @@ -14,7 +14,7 @@ using Codeine::Slider; -Slider *Slider::s_instance = 0; +Slider *Slider::s_instance = nullptr; Slider::Slider( TQWidget *parent, uint max ) @@ -106,8 +106,8 @@ static inline TQString timeAsString( const int s ) void Slider::setValue( int newValue ) { - static TQLabel *w1 = 0; - static TQLabel *w2 = 0; + static TQLabel *w1 = nullptr; + static TQLabel *w2 = nullptr; if (!w1) { w1 = new TQLabel( this ); diff --git a/src/app/videoWindow.cpp b/src/app/videoWindow.cpp index e9230ce..3a57ee8 100644 --- a/src/app/videoWindow.cpp +++ b/src/app/videoWindow.cpp @@ -259,7 +259,7 @@ VideoWindow::event( TQEvent *e ) xine_event_t xineEvent; xineEvent.type = keyCode; - xineEvent.data = NULL; + xineEvent.data = nullptr; xineEvent.data_length = 0; xine_event_send( m_stream, &xineEvent ); diff --git a/src/app/volumeAction.cpp b/src/app/volumeAction.cpp index e48dc27..ad585ef 100644 --- a/src/app/volumeAction.cpp +++ b/src/app/volumeAction.cpp @@ -48,8 +48,8 @@ public: VolumeAction::VolumeAction( TDEToolBar *bar, TDEActionCollection *ac ) - : TDEToggleAction( i18n("Volume"), "volume", TQt::Key_1, 0, 0, ac, "volume" ) - , m_anchor( 0 ) + : TDEToggleAction( i18n("Volume"), "volume", TQt::Key_1, nullptr, nullptr, ac, "volume" ) + , m_anchor( nullptr ) { m_widget = new VolumeSlider( bar->topLevelWidget() ); diff --git a/src/app/xineConfig.cpp b/src/app/xineConfig.cpp index 7ed26b9..b44c9bc 100644 --- a/src/app/xineConfig.cpp +++ b/src/app/xineConfig.cpp @@ -24,7 +24,7 @@ TQString i18n(const char *text); -KDialogBase *XineConfigDialog::s_instance = 0; +KDialogBase *XineConfigDialog::s_instance = nullptr; namespace Codeine @@ -79,7 +79,7 @@ XineConfigDialog::XineConfigDialog( xine_t *xine, TQWidget *parent ) TQHBox *hbox = new TQHBox( box ); hbox->setSpacing( METRIC_3B2 ); hbox->setMargin( METRIC_3B2 ); - TQPixmap info = kapp->iconLoader()->loadIcon( "messagebox_info", TDEIcon::NoGroup, TDEIcon::SizeMedium, TDEIcon::DefaultState, 0, true ); + TQPixmap info = kapp->iconLoader()->loadIcon( "messagebox_info", TDEIcon::NoGroup, TDEIcon::SizeMedium, TDEIcon::DefaultState, nullptr, true ); TQLabel *label = new TQLabel( hbox ); label->setPixmap( info ); label->setSizePolicy( TQSizePolicy::Maximum, TQSizePolicy::Maximum ); @@ -102,14 +102,14 @@ XineConfigDialog::XineConfigDialog( xine_t *xine, TQWidget *parent ) public: XineConfigEntryIterator( xine_t *xine ) : m_xine( xine ) { m_valid = xine_config_get_first_entry( m_xine, &m_entry ); } inline XineConfigEntryIterator &operator++() { m_valid = xine_config_get_next_entry( m_xine, &m_entry ); return *this; } - inline xine_cfg_entry_t *operator*() { return m_valid ? &m_entry : 0; } + inline xine_cfg_entry_t *operator*() { return m_valid ? &m_entry : nullptr; } }; - TQGridLayout *grid = 0; + TQGridLayout *grid = nullptr; TQString currentPage; - TQScrollView *view = 0; - parent = 0; + TQScrollView *view = nullptr; + parent = nullptr; for( XineConfigEntryIterator it( m_xine ); *it; ++it ) { @@ -171,7 +171,7 @@ XineConfigDialog::slotHelp() void XineConfigDialog::slotUser1() { - for( TQPtrListIterator<XineConfigEntry> it( m_entrys ); *it != 0; ++it ) + for (TQPtrListIterator<XineConfigEntry> it(m_entrys); *it != nullptr; ++it) (*it)->reset(); slotHelp(); @@ -180,8 +180,8 @@ XineConfigDialog::slotUser1() bool XineConfigDialog::isUnsavedSettings() const { - for( TQPtrListIterator<XineConfigEntry> it( m_entrys ); *it != 0; ++it ) - if( (*it)->isChanged() ) + for (TQPtrListIterator<XineConfigEntry> it(m_entrys); *it != nullptr; ++it) + if ((*it)->isChanged()) return true; return false; @@ -202,13 +202,13 @@ XineConfigDialog::saveSettings() ///@class XineConfigEntry XineConfigEntry::XineConfigEntry( TQWidget *parent, TQGridLayout *grid, xine_cfg_entry_t *entry ) - : m_widget( 0 ) + : m_widget( nullptr ) , m_key( entry->key ) , m_string( entry->str_value ) , m_number( entry->num_value ) { TQWidget *&w = m_widget; - const char *signal = 0; + const char *signal = nullptr; const int row = grid->numRows(); TQString description_text = TQString::fromUtf8( entry->description ); diff --git a/src/app/xineEngine.cpp b/src/app/xineEngine.cpp index 04be1cf..3ae7220 100644 --- a/src/app/xineEngine.cpp +++ b/src/app/xineEngine.cpp @@ -25,19 +25,19 @@ namespace Codeine { -VideoWindow *VideoWindow::s_instance = 0; +VideoWindow *VideoWindow::s_instance = nullptr; bool VideoWindow::s_logarithmicVolume = false; VideoWindow::VideoWindow( TQWidget *parent ) : TQWidget( parent, "VideoWindow" ) - , m_osd( 0 ) - , m_stream( 0 ) - , m_eventQueue( 0 ) - , m_videoPort( 0 ) - , m_audioPort( 0 ) - , m_scope( 0 ) - , m_xine( 0 ) + , m_osd( nullptr ) + , m_stream( nullptr ) + , m_eventQueue( nullptr ) + , m_videoPort( nullptr ) + , m_audioPort( nullptr ) + , m_scope( nullptr ) + , m_xine( nullptr ) , m_current_vpts( 0 ) { DEBUG_BLOCK @@ -136,7 +136,7 @@ VideoWindow::init() m_videoPort = xine_open_video_driver( m_xine, "auto", XINE_VISUAL_TYPE_X11, videoWindow()->x11Visual() ); debug() << "xine_open_audio_driver()\n"; - m_audioPort = xine_open_audio_driver( m_xine, "auto", NULL ); + m_audioPort = xine_open_audio_driver( m_xine, "auto", nullptr ); debug() << "xine_stream_new()\n"; m_stream = xine_stream_new( m_xine, m_audioPort, m_videoPort ); @@ -161,7 +161,7 @@ VideoWindow::init() debug() << "scope_plugin_new()\n"; #if XINE_MAJOR_VERSION > 1 || (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION > 2) || \ (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION == 2 && XINE_SUB_VERSION >= 10) - m_scope = xine_post_init( m_xine, "codeine-scope", 1, &m_audioPort, NULL ); + m_scope = xine_post_init( m_xine, "codeine-scope", 1, &m_audioPort, nullptr ); #else m_scope = scope_plugin_new( m_xine, m_audioPort ); @@ -279,7 +279,7 @@ VideoWindow::load( const KURL &url ) // ensure old buffers are deleted // FIXME leaves one erroneous buffer - timerEvent( 0 ); + timerEvent( nullptr ); if( m_scope ) { xine_post_out_t *source = xine_get_audio_source( m_stream ); @@ -613,12 +613,12 @@ VideoWindow::scope() return scope; //prune the buffer list and update the m_current_vpts timestamp - timerEvent( 0 ); + timerEvent( nullptr ); const int64_t pts_per_smpls = 0; //scope_plugin_pts_per_smpls( m_scope ); for( int channels = xine_get_stream_info( m_stream, XINE_STREAM_INFO_AUDIO_CHANNELS ), frame = 0; frame < SCOPE_SIZE; ) { - MyNode *best_node = 0; + MyNode *best_node = nullptr; for( MyNode *node = myList->next; node != myList; node = node->next ) if( node->vpts <= m_current_vpts && (!best_node || node->vpts > best_node->vpts) ) @@ -880,7 +880,7 @@ VideoWindow::toggleDVDMenu() { xine_event_t e; e.type = XINE_EVENT_INPUT_MENU1; - e.data = NULL; + e.data = nullptr; e.data_length = 0; xine_event_send( m_stream, &e ); diff --git a/src/debug.h b/src/debug.h index 9214083..4725486 100644 --- a/src/debug.h +++ b/src/debug.h @@ -164,7 +164,7 @@ namespace Debug Block( const char *label ) : m_label( label ) { - gettimeofday( &m_start, 0 ); + gettimeofday( &m_start, nullptr ); kdDebug() << indent() << "BEGIN: " << label << "\n"; DEBUG_INDENT @@ -173,7 +173,7 @@ namespace Debug ~Block() { timeval end; - gettimeofday( &end, 0 ); + gettimeofday( &end, nullptr ); end.tv_sec -= m_start.tv_sec; if( end.tv_usec < m_start.tv_usec) { diff --git a/src/part/videoWindow.cpp b/src/part/videoWindow.cpp index 2da1c35..6b8c23d 100644 --- a/src/part/videoWindow.cpp +++ b/src/part/videoWindow.cpp @@ -18,7 +18,7 @@ namespace Codeine { -VideoWindow *VideoWindow::s_instance = 0; +VideoWindow *VideoWindow::s_instance = nullptr; namespace X @@ -30,12 +30,12 @@ namespace X VideoWindow::VideoWindow( TQWidget *parent, const char *name ) : TQWidget( parent, name ) - , m_osd( 0 ) - , m_stream( 0 ) - , m_eventQueue( 0 ) - , m_videoPort( 0 ) - , m_audioPort( 0 ) - , m_xine( 0 ) + , m_osd( nullptr ) + , m_stream( nullptr ) + , m_eventQueue( nullptr ) + , m_videoPort( nullptr ) + , m_audioPort( nullptr ) + , m_xine( nullptr ) , m_displayRatio( 1 ) { s_instance = this; diff --git a/src/part/xineEngine.cpp b/src/part/xineEngine.cpp index 96108a7..f6bbf87 100644 --- a/src/part/xineEngine.cpp +++ b/src/part/xineEngine.cpp @@ -37,7 +37,7 @@ VideoWindow::init() m_videoPort = xine_open_video_driver( m_xine, "auto", XINE_VISUAL_TYPE_X11, x11Visual() ); debug() << "xine_open_audio_driver()\n"; - m_audioPort = xine_open_audio_driver( m_xine, "auto", NULL ); + m_audioPort = xine_open_audio_driver( m_xine, "auto", nullptr ); debug() << "xine_stream_new()\n"; m_stream = xine_stream_new( m_xine, m_audioPort, m_videoPort ); |