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 <stigma@disroot.org>
pull/17/head
mio 3 months ago
parent 5e965846d1
commit ed55bf0726

@ -48,7 +48,7 @@ namespace Codeine
m_thingy->setPaletteForegroundColor( paletteBackgroundColor().dark() ); m_thingy->setPaletteForegroundColor( paletteBackgroundColor().dark() );
TQEvent e( TQEvent::Resize ); TQEvent e( TQEvent::Resize );
eventFilter( 0, &e ); eventFilter( nullptr, &e );
adjustSize(); adjustSize();
show(); show();

@ -255,25 +255,30 @@ VideoWindow::captureFrame() const
return TQImage(); return TQImage();
int yuv_size = ((w + 8) * (h + 1)) * 2; int yuv_size = ((w + 8) * (h + 1)) * 2;
uint8_t *yuv = new uint8_t[yuv_size]; uint8_t *yuv = new(std::nothrow) uint8_t[yuv_size];
if( yuv == 0 ) { if (yuv == nullptr) {
Debug::error() << "Not enough memory to make screenframe!\n"; 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); xine_get_current_frame_s(*engine(), &w, &h, &ratio, &format, yuv, &yuv_size);
// convert to yv12 if necessary // 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 ) switch( format )
{ {
case XINE_IMGFMT_YUY2: { case XINE_IMGFMT_YUY2: {
uint8_t *yuy2 = yuv; uint8_t *yuy2 = yuv;
yuv = new uint8_t[(w * h * 2)]; yuv = new(std::nothrow) uint8_t[(w * h * 2)];
if( yuv == 0 ) { if (yuv == nullptr) {
Debug::error() << "Not enough memory to make screenframe!\n"; Debug::error() << "Not enough memory to make screenframe!\n";
delete [] yuy2; delete [] yuy2;
return TQImage(); } return TQImage();
}
y = yuv; y = yuv;
u = yuv + w * h; u = yuv + w * h;
@ -298,7 +303,7 @@ VideoWindow::captureFrame() const
// convert to rgb // convert to rgb
uchar *rgb = yv12ToRgb( y, u, v, w, h ); 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; delete [] yuv;
return frame; return frame;

@ -24,9 +24,9 @@
FHT::FHT(int n) : FHT::FHT(int n) :
m_buf(0), m_buf(nullptr),
m_tab(0), m_tab(nullptr),
m_log(0) m_log(nullptr)
{ {
if (n < 3) { if (n < 3) {
m_num = 0; m_num = 0;

@ -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; int id = SubtitleChannelsMenuItemId, index = 0;
#define make_menu( name, text ) \ #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("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 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 ); m_volumeAction = new VolumeAction( toolBar(), ac );
} }
@ -381,7 +382,7 @@ MainWindow::load( const KURL &url )
if (url.protocol() == "media") { if (url.protocol() == "media") {
#define UDS_LOCAL_PATH (72 | TDEIO::UDS_STRING) #define UDS_LOCAL_PATH (72 | TDEIO::UDS_STRING)
TDEIO::UDSEntry e; 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..." ); MessageBox::sorry( "There was an internal error with the media slave..." );
else { else {
TDEIO::UDSEntry::ConstIterator end = e.end(); TDEIO::UDSEntry::ConstIterator end = e.end();
@ -571,7 +572,7 @@ MainWindow::fullScreenToggled( bool isFullScreen )
delete s_handler; delete s_handler;
// prevent videoWindow() moving around when mouse moves // prevent videoWindow() moving around when mouse moves
setCentralWidget( isFullScreen ? 0 : videoWindow() ); setCentralWidget( isFullScreen ? nullptr : videoWindow() );
} }
void void
@ -626,7 +627,7 @@ void
MainWindow::aboutToShowMenu() MainWindow::aboutToShowMenu()
{ {
TQPopupMenu *menu = (TQPopupMenu*)sender(); TQPopupMenu *menu = (TQPopupMenu*)sender();
TQCString name( sender() ? sender()->name() : 0 ); TQCString name( sender() ? sender()->name() : nullptr );
// uncheck all items first // uncheck all items first
for( uint x = 0; x < menu->count(); ++x ) for( uint x = 0; x < menu->count(); ++x )
@ -701,9 +702,9 @@ action( const char *name )
{ {
#define QT_FATAL_ASSERT #define QT_FATAL_ASSERT
MainWindow *mainWindow = 0; MainWindow *mainWindow = nullptr;
TDEActionCollection *actionCollection = 0; TDEActionCollection *actionCollection = nullptr;
TDEAction *action = 0; TDEAction *action = nullptr;
if( mainWindow = (MainWindow*)kapp->mainWidget() ) if( mainWindow = (MainWindow*)kapp->mainWidget() )
if( actionCollection = mainWindow->actionCollection() ) if( actionCollection = mainWindow->actionCollection() )

@ -93,7 +93,7 @@ PlayDialog::createRecentFileWidget( TQBoxLayout *layout )
for( KURL::List::ConstIterator it = urls.begin(), end = urls.end(); it != end; ++it ) { for( KURL::List::ConstIterator it = urls.begin(), end = urls.end(); it != end; ++it ) {
const TQString fileName = (*it).fileName(); 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() ) { if( lv->childCount() ) {

@ -14,7 +14,7 @@
using Codeine::Slider; using Codeine::Slider;
Slider *Slider::s_instance = 0; Slider *Slider::s_instance = nullptr;
Slider::Slider( TQWidget *parent, uint max ) Slider::Slider( TQWidget *parent, uint max )
@ -106,8 +106,8 @@ static inline TQString timeAsString( const int s )
void void
Slider::setValue( int newValue ) Slider::setValue( int newValue )
{ {
static TQLabel *w1 = 0; static TQLabel *w1 = nullptr;
static TQLabel *w2 = 0; static TQLabel *w2 = nullptr;
if (!w1) { if (!w1) {
w1 = new TQLabel( this ); w1 = new TQLabel( this );

@ -259,7 +259,7 @@ VideoWindow::event( TQEvent *e )
xine_event_t xineEvent; xine_event_t xineEvent;
xineEvent.type = keyCode; xineEvent.type = keyCode;
xineEvent.data = NULL; xineEvent.data = nullptr;
xineEvent.data_length = 0; xineEvent.data_length = 0;
xine_event_send( m_stream, &xineEvent ); xine_event_send( m_stream, &xineEvent );

@ -48,8 +48,8 @@ public:
VolumeAction::VolumeAction( TDEToolBar *bar, TDEActionCollection *ac ) VolumeAction::VolumeAction( TDEToolBar *bar, TDEActionCollection *ac )
: TDEToggleAction( i18n("Volume"), "volume", TQt::Key_1, 0, 0, ac, "volume" ) : TDEToggleAction( i18n("Volume"), "volume", TQt::Key_1, nullptr, nullptr, ac, "volume" )
, m_anchor( 0 ) , m_anchor( nullptr )
{ {
m_widget = new VolumeSlider( bar->topLevelWidget() ); m_widget = new VolumeSlider( bar->topLevelWidget() );

@ -24,7 +24,7 @@
TQString i18n(const char *text); TQString i18n(const char *text);
KDialogBase *XineConfigDialog::s_instance = 0; KDialogBase *XineConfigDialog::s_instance = nullptr;
namespace Codeine namespace Codeine
@ -79,7 +79,7 @@ XineConfigDialog::XineConfigDialog( xine_t *xine, TQWidget *parent )
TQHBox *hbox = new TQHBox( box ); TQHBox *hbox = new TQHBox( box );
hbox->setSpacing( METRIC_3B2 ); hbox->setSpacing( METRIC_3B2 );
hbox->setMargin( 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 ); TQLabel *label = new TQLabel( hbox );
label->setPixmap( info ); label->setPixmap( info );
label->setSizePolicy( TQSizePolicy::Maximum, TQSizePolicy::Maximum ); label->setSizePolicy( TQSizePolicy::Maximum, TQSizePolicy::Maximum );
@ -102,14 +102,14 @@ XineConfigDialog::XineConfigDialog( xine_t *xine, TQWidget *parent )
public: public:
XineConfigEntryIterator( xine_t *xine ) : m_xine( xine ) { m_valid = xine_config_get_first_entry( m_xine, &m_entry ); } 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 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; TQString currentPage;
TQScrollView *view = 0; TQScrollView *view = nullptr;
parent = 0; parent = nullptr;
for( XineConfigEntryIterator it( m_xine ); *it; ++it ) for( XineConfigEntryIterator it( m_xine ); *it; ++it )
{ {
@ -171,7 +171,7 @@ XineConfigDialog::slotHelp()
void void
XineConfigDialog::slotUser1() XineConfigDialog::slotUser1()
{ {
for( TQPtrListIterator<XineConfigEntry> it( m_entrys ); *it != 0; ++it ) for (TQPtrListIterator<XineConfigEntry> it(m_entrys); *it != nullptr; ++it)
(*it)->reset(); (*it)->reset();
slotHelp(); slotHelp();
@ -180,7 +180,7 @@ XineConfigDialog::slotUser1()
bool bool
XineConfigDialog::isUnsavedSettings() const XineConfigDialog::isUnsavedSettings() const
{ {
for( TQPtrListIterator<XineConfigEntry> it( m_entrys ); *it != 0; ++it ) for (TQPtrListIterator<XineConfigEntry> it(m_entrys); *it != nullptr; ++it)
if ((*it)->isChanged()) if ((*it)->isChanged())
return true; return true;
@ -202,13 +202,13 @@ XineConfigDialog::saveSettings()
///@class XineConfigEntry ///@class XineConfigEntry
XineConfigEntry::XineConfigEntry( TQWidget *parent, TQGridLayout *grid, xine_cfg_entry_t *entry ) XineConfigEntry::XineConfigEntry( TQWidget *parent, TQGridLayout *grid, xine_cfg_entry_t *entry )
: m_widget( 0 ) : m_widget( nullptr )
, m_key( entry->key ) , m_key( entry->key )
, m_string( entry->str_value ) , m_string( entry->str_value )
, m_number( entry->num_value ) , m_number( entry->num_value )
{ {
TQWidget *&w = m_widget; TQWidget *&w = m_widget;
const char *signal = 0; const char *signal = nullptr;
const int row = grid->numRows(); const int row = grid->numRows();
TQString description_text = TQString::fromUtf8( entry->description ); TQString description_text = TQString::fromUtf8( entry->description );

@ -25,19 +25,19 @@
namespace Codeine { namespace Codeine {
VideoWindow *VideoWindow::s_instance = 0; VideoWindow *VideoWindow::s_instance = nullptr;
bool VideoWindow::s_logarithmicVolume = false; bool VideoWindow::s_logarithmicVolume = false;
VideoWindow::VideoWindow( TQWidget *parent ) VideoWindow::VideoWindow( TQWidget *parent )
: TQWidget( parent, "VideoWindow" ) : TQWidget( parent, "VideoWindow" )
, m_osd( 0 ) , m_osd( nullptr )
, m_stream( 0 ) , m_stream( nullptr )
, m_eventQueue( 0 ) , m_eventQueue( nullptr )
, m_videoPort( 0 ) , m_videoPort( nullptr )
, m_audioPort( 0 ) , m_audioPort( nullptr )
, m_scope( 0 ) , m_scope( nullptr )
, m_xine( 0 ) , m_xine( nullptr )
, m_current_vpts( 0 ) , m_current_vpts( 0 )
{ {
DEBUG_BLOCK DEBUG_BLOCK
@ -136,7 +136,7 @@ VideoWindow::init()
m_videoPort = xine_open_video_driver( m_xine, "auto", XINE_VISUAL_TYPE_X11, videoWindow()->x11Visual() ); m_videoPort = xine_open_video_driver( m_xine, "auto", XINE_VISUAL_TYPE_X11, videoWindow()->x11Visual() );
debug() << "xine_open_audio_driver()\n"; 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"; debug() << "xine_stream_new()\n";
m_stream = xine_stream_new( m_xine, m_audioPort, m_videoPort ); m_stream = xine_stream_new( m_xine, m_audioPort, m_videoPort );
@ -161,7 +161,7 @@ VideoWindow::init()
debug() << "scope_plugin_new()\n"; debug() << "scope_plugin_new()\n";
#if XINE_MAJOR_VERSION > 1 || (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION > 2) || \ #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) (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 #else
m_scope = scope_plugin_new( m_xine, m_audioPort ); m_scope = scope_plugin_new( m_xine, m_audioPort );
@ -279,7 +279,7 @@ VideoWindow::load( const KURL &url )
// ensure old buffers are deleted // ensure old buffers are deleted
// FIXME leaves one erroneous buffer // FIXME leaves one erroneous buffer
timerEvent( 0 ); timerEvent( nullptr );
if( m_scope ) { if( m_scope ) {
xine_post_out_t *source = xine_get_audio_source( m_stream ); xine_post_out_t *source = xine_get_audio_source( m_stream );
@ -613,12 +613,12 @@ VideoWindow::scope()
return scope; return scope;
//prune the buffer list and update the m_current_vpts timestamp //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 ); 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; ) 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 ) for( MyNode *node = myList->next; node != myList; node = node->next )
if( node->vpts <= m_current_vpts && (!best_node || node->vpts > best_node->vpts) ) if( node->vpts <= m_current_vpts && (!best_node || node->vpts > best_node->vpts) )
@ -880,7 +880,7 @@ VideoWindow::toggleDVDMenu()
{ {
xine_event_t e; xine_event_t e;
e.type = XINE_EVENT_INPUT_MENU1; e.type = XINE_EVENT_INPUT_MENU1;
e.data = NULL; e.data = nullptr;
e.data_length = 0; e.data_length = 0;
xine_event_send( m_stream, &e ); xine_event_send( m_stream, &e );

@ -164,7 +164,7 @@ namespace Debug
Block( const char *label ) Block( const char *label )
: m_label( label ) : m_label( label )
{ {
gettimeofday( &m_start, 0 ); gettimeofday( &m_start, nullptr );
kdDebug() << indent() << "BEGIN: " << label << "\n"; kdDebug() << indent() << "BEGIN: " << label << "\n";
DEBUG_INDENT DEBUG_INDENT
@ -173,7 +173,7 @@ namespace Debug
~Block() ~Block()
{ {
timeval end; timeval end;
gettimeofday( &end, 0 ); gettimeofday( &end, nullptr );
end.tv_sec -= m_start.tv_sec; end.tv_sec -= m_start.tv_sec;
if( end.tv_usec < m_start.tv_usec) { if( end.tv_usec < m_start.tv_usec) {

@ -18,7 +18,7 @@
namespace Codeine { namespace Codeine {
VideoWindow *VideoWindow::s_instance = 0; VideoWindow *VideoWindow::s_instance = nullptr;
namespace X namespace X
@ -30,12 +30,12 @@ namespace X
VideoWindow::VideoWindow( TQWidget *parent, const char *name ) VideoWindow::VideoWindow( TQWidget *parent, const char *name )
: TQWidget( parent, name ) : TQWidget( parent, name )
, m_osd( 0 ) , m_osd( nullptr )
, m_stream( 0 ) , m_stream( nullptr )
, m_eventQueue( 0 ) , m_eventQueue( nullptr )
, m_videoPort( 0 ) , m_videoPort( nullptr )
, m_audioPort( 0 ) , m_audioPort( nullptr )
, m_xine( 0 ) , m_xine( nullptr )
, m_displayRatio( 1 ) , m_displayRatio( 1 )
{ {
s_instance = this; s_instance = this;

@ -37,7 +37,7 @@ VideoWindow::init()
m_videoPort = xine_open_video_driver( m_xine, "auto", XINE_VISUAL_TYPE_X11, x11Visual() ); m_videoPort = xine_open_video_driver( m_xine, "auto", XINE_VISUAL_TYPE_X11, x11Visual() );
debug() << "xine_open_audio_driver()\n"; 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"; debug() << "xine_stream_new()\n";
m_stream = xine_stream_new( m_xine, m_audioPort, m_videoPort ); m_stream = xine_stream_new( m_xine, m_audioPort, m_videoPort );

Loading…
Cancel
Save