From ecd9bf696eef9eb325797b52efb11c7d088e4e80 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Thu, 22 Apr 2021 22:20:34 +0100 Subject: [PATCH] Be consistent about using nullptr instead of 0 0 can be too easily overloaded into an int, so ensure we use nullptr when we mean pointers. --- 3d-viewer/3d_model_viewer/3d_model_viewer.h | 2 +- .../shapes2D/object_2d.cpp | 2 +- 3d-viewer/3d_rendering/legacy/3d_model.cpp | 2 +- .../3d_rendering/legacy/layer_triangles.cpp | 10 ++--- .../3d_rendering/legacy/render_3d_legacy.cpp | 4 +- common/dialog_shim.cpp | 6 +-- common/dsnlexer.cpp | 38 +++++++++---------- common/filter_reader.cpp | 8 ++-- common/gal/opengl/gpu_manager.cpp | 2 +- common/kiway.cpp | 2 +- common/kiway_player.cpp | 14 +++---- common/lib_id.cpp | 2 +- common/lib_table_base.cpp | 6 +-- common/pgm_base.cpp | 8 ++-- common/plotters/GERBER_plotter.cpp | 10 ++--- common/plotters/PDF_plotter.cpp | 4 +- common/plotters/plotter.cpp | 2 +- common/widgets/net_selector.cpp | 20 +++++----- eeschema/lib_pin.cpp | 2 +- .../sch_plugins/kicad/sch_sexpr_plugin.cpp | 2 +- .../sch_plugins/legacy/sch_legacy_plugin.cpp | 2 +- gerbview/excellon_read_drill_file.cpp | 14 +++---- gerbview/gerber_file_image.cpp | 20 +++++----- gerbview/readgerb.cpp | 6 +-- gerbview/rs274x.cpp | 20 +++++----- include/collector.h | 2 +- include/footprint_info.h | 2 +- include/libeval/numeric_evaluator.h | 2 +- include/tool/coroutine.h | 2 +- pcbnew/board.cpp | 28 +++++++------- pcbnew/exporters/export_gencad.cpp | 2 +- pcbnew/files.cpp | 2 +- pcbnew/footprint.cpp | 10 ++--- pcbnew/load_select_footprint.cpp | 28 +++++++------- pcbnew/plugins/geda/gpcb_plugin.cpp | 18 ++++----- pcbnew/plugins/kicad/kicad_plugin.cpp | 6 +-- pcbnew/plugins/kicad/pcb_parser.h | 6 +-- pcbnew/plugins/legacy/legacy_plugin.cpp | 4 +- pcbnew/router/pns_component_dragger.cpp | 2 +- pcbnew/zones_functions_for_undo_redo.cpp | 14 +++---- plugins/3d/vrml/vrml.cpp | 2 +- 41 files changed, 169 insertions(+), 169 deletions(-) diff --git a/3d-viewer/3d_model_viewer/3d_model_viewer.h b/3d-viewer/3d_model_viewer/3d_model_viewer.h index 53e48b912b..749165df9b 100644 --- a/3d-viewer/3d_model_viewer/3d_model_viewer.h +++ b/3d-viewer/3d_model_viewer/3d_model_viewer.h @@ -51,7 +51,7 @@ public: * @param aParent the parent creator of this canvas. * @param aAttribList a list of openGL options created by #OGL_ATT_LIST::GetAttributesList. */ - C3D_MODEL_VIEWER( wxWindow* aParent, const int* aAttribList = 0, + C3D_MODEL_VIEWER( wxWindow* aParent, const int* aAttribList = nullptr, S3D_CACHE* aCacheManager = nullptr ); ~C3D_MODEL_VIEWER(); diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/object_2d.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/object_2d.cpp index 88ab79c1bd..245eba3fda 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/object_2d.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/object_2d.cpp @@ -30,7 +30,7 @@ #include #include -OBJECT_2D_STATS *OBJECT_2D_STATS::s_instance = 0; +OBJECT_2D_STATS *OBJECT_2D_STATS::s_instance = nullptr; OBJECT_2D::OBJECT_2D( OBJECT_2D_TYPE aObjType, const BOARD_ITEM& aBoardItem ) diff --git a/3d-viewer/3d_rendering/legacy/3d_model.cpp b/3d-viewer/3d_rendering/legacy/3d_model.cpp index bbaa77b6fd..a7aa17fe3b 100644 --- a/3d-viewer/3d_rendering/legacy/3d_model.cpp +++ b/3d-viewer/3d_rendering/legacy/3d_model.cpp @@ -486,7 +486,7 @@ void MODEL_3D::DrawBbox() const reinterpret_cast( offsetof( VERTEX, m_color ) ) ); glDrawElements( GL_LINES, bbox_idx_count, m_bbox_index_buffer_type, - reinterpret_cast( 0 ) ); + reinterpret_cast( NULL ) ); } diff --git a/3d-viewer/3d_rendering/legacy/layer_triangles.cpp b/3d-viewer/3d_rendering/legacy/layer_triangles.cpp index 3ea7909b49..2c0751ed2d 100644 --- a/3d-viewer/3d_rendering/legacy/layer_triangles.cpp +++ b/3d-viewer/3d_rendering/legacy/layer_triangles.cpp @@ -112,19 +112,19 @@ TRIANGLE_DISPLAY_LIST::TRIANGLE_DISPLAY_LIST( unsigned int aNrReservedTriangles TRIANGLE_DISPLAY_LIST::~TRIANGLE_DISPLAY_LIST() { delete m_layer_top_segment_ends; - m_layer_top_segment_ends = 0; + m_layer_top_segment_ends = nullptr; delete m_layer_top_triangles; - m_layer_top_triangles = 0; + m_layer_top_triangles = nullptr; delete m_layer_middle_contourns_quads; - m_layer_middle_contourns_quads = 0; + m_layer_middle_contourns_quads = nullptr; delete m_layer_bot_triangles; - m_layer_bot_triangles = 0; + m_layer_bot_triangles = nullptr; delete m_layer_bot_segment_ends; - m_layer_bot_segment_ends = 0; + m_layer_bot_segment_ends = nullptr; } diff --git a/3d-viewer/3d_rendering/legacy/render_3d_legacy.cpp b/3d-viewer/3d_rendering/legacy/render_3d_legacy.cpp index 1df068ed08..235e2b4635 100644 --- a/3d-viewer/3d_rendering/legacy/render_3d_legacy.cpp +++ b/3d-viewer/3d_rendering/legacy/render_3d_legacy.cpp @@ -996,10 +996,10 @@ bool RENDER_3D_LEGACY::initializeOpenGL() m_circleTexture = OglLoadTexture( *circleImageBlured ); delete circleImageBlured; - circleImageBlured = 0; + circleImageBlured = nullptr; delete circleImage; - circleImage = 0; + circleImage = nullptr; init_lights(); diff --git a/common/dialog_shim.cpp b/common/dialog_shim.cpp index 2f3d76f2cc..f69589f13e 100644 --- a/common/dialog_shim.cpp +++ b/common/dialog_shim.cpp @@ -401,7 +401,7 @@ int DIALOG_SHIM::ShowQuasiModal() { void*& m_what; NULLER( void*& aPtr ) : m_what( aPtr ) {} - ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction + ~NULLER() { m_what = nullptr; } // indeed, set it to NULL on destruction } clear_this( (void*&) m_qmodal_loop ); // release the mouse if it's currently captured as the window having it @@ -465,11 +465,11 @@ void DIALOG_SHIM::EndQuasiModal( int retCode ) else m_qmodal_loop->ScheduleExit( 0 ); - m_qmodal_loop = NULL; + m_qmodal_loop = nullptr; } delete m_qmodal_parent_disabler; - m_qmodal_parent_disabler = 0; + m_qmodal_parent_disabler = nullptr; Show( false ); } diff --git a/common/dsnlexer.cpp b/common/dsnlexer.cpp index fd87f31f7f..b2e1bd16e1 100644 --- a/common/dsnlexer.cpp +++ b/common/dsnlexer.cpp @@ -71,10 +71,10 @@ void DSNLEXER::init() DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount, FILE* aFile, const wxString& aFilename ) : iOwnReaders( true ), - start( NULL ), - next( NULL ), - limit( NULL ), - reader( NULL ), + start( nullptr ), + next( nullptr ), + limit( nullptr ), + reader( nullptr ), keywords( aKeywordTable ), keywordCount( aKeywordCount ) { @@ -87,10 +87,10 @@ DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount, DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount, const std::string& aClipboardTxt, const wxString& aSource ) : iOwnReaders( true ), - start( NULL ), - next( NULL ), - limit( NULL ), - reader( NULL ), + start( nullptr ), + next( nullptr ), + limit( nullptr ), + reader( nullptr ), keywords( aKeywordTable ), keywordCount( aKeywordCount ) { @@ -104,10 +104,10 @@ DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount, DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount, LINE_READER* aLineReader ) : iOwnReaders( false ), - start( NULL ), - next( NULL ), - limit( NULL ), - reader( NULL ), + start( nullptr ), + next( nullptr ), + limit( nullptr ), + reader( nullptr ), keywords( aKeywordTable ), keywordCount( aKeywordCount ) { @@ -121,10 +121,10 @@ static const KEYWORD empty_keywords[1] = {}; DSNLEXER::DSNLEXER( const std::string& aSExpression, const wxString& aSource ) : iOwnReaders( true ), - start( NULL ), - next( NULL ), - limit( NULL ), - reader( NULL ), + start( nullptr ), + next( nullptr ), + limit( nullptr ), + reader( nullptr ), keywords( empty_keywords ), keywordCount( 0 ) { @@ -198,7 +198,7 @@ void DSNLEXER::PushReader( LINE_READER* aLineReader ) LINE_READER* DSNLEXER::PopReader() { - LINE_READER* ret = 0; + LINE_READER* ret = nullptr; if( readerStack.size() ) { @@ -216,7 +216,7 @@ LINE_READER* DSNLEXER::PopReader() } else { - reader = 0; + reader = nullptr; start = dummy; limit = dummy; } @@ -778,7 +778,7 @@ exit: // single point of exit, no returns elsewhere please. wxArrayString* DSNLEXER::ReadCommentLines() { - wxArrayString* ret = 0; + wxArrayString* ret = nullptr; bool cmt_setting = SetCommentsAreTokens( true ); int tok = NextTok(); diff --git a/common/filter_reader.cpp b/common/filter_reader.cpp index 5d143044e2..215558445b 100644 --- a/common/filter_reader.cpp +++ b/common/filter_reader.cpp @@ -37,7 +37,7 @@ FILTER_READER::FILTER_READER( LINE_READER& aReader ) : // is not owned here. delete [] m_line; - m_line = 0; + m_line = nullptr; } @@ -45,7 +45,7 @@ FILTER_READER::~FILTER_READER() { // Our 'm_line' points to aReader's, and he will delete that buffer. // Prevent subsequent call to ~LINE_READER() from deleting a buffer we do not own. - m_line = 0; + m_line = nullptr; } @@ -62,7 +62,7 @@ char* FILTER_READER::ReadLine() m_line = reader.Line(); m_length = reader.Length(); - return m_length ? m_line : NULL; + return m_length ? m_line : nullptr; } @@ -103,5 +103,5 @@ char* WHITESPACE_FILTER_READER::ReadLine() m_line = s; m_length = reader.Length(); - return m_length ? m_line : NULL; + return m_length ? m_line : nullptr; } diff --git a/common/gal/opengl/gpu_manager.cpp b/common/gal/opengl/gpu_manager.cpp index 907ff9065b..ea07881c84 100644 --- a/common/gal/opengl/gpu_manager.cpp +++ b/common/gal/opengl/gpu_manager.cpp @@ -196,7 +196,7 @@ void GPU_CACHED_MANAGER::EndDrawing() glBufferData( GL_ELEMENT_ARRAY_BUFFER, m_indicesSize * sizeof( int ), (GLvoid*) m_indices.get(), GL_DYNAMIC_DRAW ); - glDrawElements( GL_TRIANGLES, m_indicesSize, GL_UNSIGNED_INT, 0 ); + glDrawElements( GL_TRIANGLES, m_indicesSize, GL_UNSIGNED_INT, NULL ); #ifdef __WXDEBUG__ wxLogTrace( traceGalProfile, wxT( "Cached manager size: %d" ), m_indicesSize ); diff --git a/common/kiway.cpp b/common/kiway.cpp index 0b2cf3b041..8f2d6037e9 100644 --- a/common/kiway.cpp +++ b/common/kiway.cpp @@ -47,7 +47,7 @@ int KIWAY::m_kiface_version[KIWAY_FACE_COUNT]; KIWAY::KIWAY( PGM_BASE* aProgram, int aCtlBits, wxFrame* aTop ): - m_program( aProgram ), m_ctl( aCtlBits ), m_top( 0 ) + m_program( aProgram ), m_ctl( aCtlBits ), m_top( nullptr ) { SetTop( aTop ); // hook player_destroy_handler() into aTop. diff --git a/common/kiway_player.cpp b/common/kiway_player.cpp index 0b5cda02ea..fc1720b916 100644 --- a/common/kiway_player.cpp +++ b/common/kiway_player.cpp @@ -45,10 +45,10 @@ KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType long aStyle, const wxString& aWdoName ) : EDA_BASE_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aWdoName, aKiway ), m_modal( false ), - m_modal_loop( 0 ), - m_modal_resultant_parent( 0 ) + m_modal_loop( nullptr ), + m_modal_resultant_parent( nullptr ), + m_modal_ret_val( false ) { - m_modal_ret_val = 0; } @@ -57,8 +57,8 @@ KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& a const wxString& aWdoName ) : EDA_BASE_FRAME( aParent, (FRAME_T) aId, aTitle, aPos, aSize, aStyle, aWdoName, nullptr ), m_modal( false ), - m_modal_loop( 0 ), - m_modal_resultant_parent( 0 ), + m_modal_loop( nullptr ), + m_modal_resultant_parent( nullptr ), m_modal_ret_val( false ) { } @@ -92,7 +92,7 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow { void*& m_what; NULLER( void*& aPtr ) : m_what( aPtr ) {} - ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction + ~NULLER() { m_what = nullptr; } // indeed, set it to NULL on destruction } clear_this( (void*&) m_modal_loop ); @@ -166,7 +166,7 @@ void KIWAY_PLAYER::DismissModal( bool aRetVal, const wxString& aResult ) if( m_modal_loop ) { m_modal_loop->Exit(); - m_modal_loop = 0; // this marks it as dismissed. + m_modal_loop = nullptr; // this marks it as dismissed. } Show( false ); diff --git a/common/lib_id.cpp b/common/lib_id.cpp index c032073e0f..14c2227408 100644 --- a/common/lib_id.cpp +++ b/common/lib_id.cpp @@ -59,7 +59,7 @@ const char* EndsWithRev( const char* start, const char* tail, char separator ) } } - return 0; + return nullptr; } diff --git a/common/lib_table_base.cpp b/common/lib_table_base.cpp index 8b72713027..477df51545 100644 --- a/common/lib_table_base.cpp +++ b/common/lib_table_base.cpp @@ -219,7 +219,7 @@ LIB_TABLE_ROW* LIB_TABLE::findRow( const wxString& aNickName, bool aCheckIfEnabl } // not found, search fall back table(s), if any - } while( ( cur = cur->fallBack ) != 0 ); + } while( ( cur = cur->fallBack ) != nullptr ); return nullptr; // not found } @@ -255,7 +255,7 @@ const LIB_TABLE_ROW* LIB_TABLE::FindRowByURI( const wxString& aURI ) } // not found, search fall back table(s), if any - } while( ( cur = cur->fallBack ) != 0 ); + } while( ( cur = cur->fallBack ) != nullptr ); return nullptr; // not found } @@ -281,7 +281,7 @@ std::vector LIB_TABLE::GetLogicalLibs() } } - } while( ( cur = cur->fallBack ) != 0 ); + } while( ( cur = cur->fallBack ) != nullptr ); ret.reserve( unique.size() ); diff --git a/common/pgm_base.cpp b/common/pgm_base.cpp index 6e036779d8..049c38abc6 100644 --- a/common/pgm_base.cpp +++ b/common/pgm_base.cpp @@ -108,8 +108,8 @@ LANGUAGE_DESCR LanguagesList[] = PGM_BASE::PGM_BASE() { - m_pgm_checker = NULL; - m_locale = NULL; + m_pgm_checker = nullptr; + m_locale = nullptr; m_Printing = false; m_ModalDialogCount = 0; @@ -131,10 +131,10 @@ void PGM_BASE::Destroy() { // unlike a normal destructor, this is designed to be called more than once safely: delete m_pgm_checker; - m_pgm_checker = 0; + m_pgm_checker = nullptr; delete m_locale; - m_locale = 0; + m_locale = nullptr; } diff --git a/common/plotters/GERBER_plotter.cpp b/common/plotters/GERBER_plotter.cpp index dbea78cd7d..ba37034220 100644 --- a/common/plotters/GERBER_plotter.cpp +++ b/common/plotters/GERBER_plotter.cpp @@ -91,8 +91,8 @@ static bool polyCompare( const std::vector& aPolygon, GERBER_PLOTTER::GERBER_PLOTTER() { - workFile = NULL; - finalFile = NULL; + workFile = nullptr; + finalFile = nullptr; m_currentApertureIdx = -1; m_apertureAttribute = 0; @@ -205,7 +205,7 @@ void GERBER_PLOTTER::formatNetAttribute( GBR_NETLIST_METADATA* aData ) // print a Gerber net attribute record. // it is added to the object attributes dictionary // On file, only modified or new attributes are printed. - if( aData == NULL ) + if( aData == nullptr ) return; if( !m_useNetAttributes ) @@ -253,7 +253,7 @@ bool GERBER_PLOTTER::StartPlot() m_outputFile = workFile; wxASSERT( m_outputFile ); - if( m_outputFile == NULL ) + if( m_outputFile == nullptr ) return false; for( unsigned ii = 0; ii < m_headerExtraLines.GetCount(); ii++ ) @@ -386,7 +386,7 @@ bool GERBER_PLOTTER::EndPlot() fclose( workFile ); fclose( finalFile ); ::wxRemoveFile( m_workFilename ); - m_outputFile = 0; + m_outputFile = nullptr; return true; } diff --git a/common/plotters/PDF_plotter.cpp b/common/plotters/PDF_plotter.cpp index 252c8766a0..f36167ccbb 100644 --- a/common/plotters/PDF_plotter.cpp +++ b/common/plotters/PDF_plotter.cpp @@ -115,7 +115,7 @@ bool PDF_PLOTTER::OpenFile( const wxString& aFullFilename ) // Open the PDF file in binary mode m_outputFile = wxFopen( m_filename, wxT( "wb" ) ); - if( m_outputFile == NULL ) + if( m_outputFile == nullptr ) return false ; return true; @@ -543,7 +543,7 @@ void PDF_PLOTTER::closePdfStream() // We are done with the temporary file, junk it fclose( workFile ); - workFile = 0; + workFile = nullptr; ::wxRemoveFile( workFilename ); unsigned out_count; diff --git a/common/plotters/plotter.cpp b/common/plotters/plotter.cpp index e8d74bd9c7..c5611e0081 100644 --- a/common/plotters/plotter.cpp +++ b/common/plotters/plotter.cpp @@ -55,7 +55,7 @@ PLOTTER::PLOTTER( ) m_plotMirror = false; // Plot mirror option flag m_mirrorIsHorizontal = true; m_yaxisReversed = false; - m_outputFile = 0; + m_outputFile = nullptr; m_colorMode = false; // Starts as a BW plot m_negativeMode = false; // Temporary init to avoid not initialized vars, will be set later diff --git a/common/widgets/net_selector.cpp b/common/widgets/net_selector.cpp index ecbb17668d..aa61946b85 100644 --- a/common/widgets/net_selector.cpp +++ b/common/widgets/net_selector.cpp @@ -83,22 +83,22 @@ public: m_filterCtrl->SetValidator( *m_filterValidator ); mainSizer->Add( m_filterCtrl, 0, wxEXPAND, 0 ); - m_listBox = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, 0, + m_listBox = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_SINGLE|wxLB_NEEDED_SB ); mainSizer->Add( m_listBox, 0, wxEXPAND|wxTOP, 2 ); SetSizer( mainSizer ); Layout(); - Connect( wxEVT_IDLE, wxIdleEventHandler( NET_SELECTOR_COMBOPOPUP::onIdle ), NULL, this ); - Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( NET_SELECTOR_COMBOPOPUP::onKeyDown ), NULL, this ); - Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( NET_SELECTOR_COMBOPOPUP::onMouseClick ), NULL, this ); - m_listBox->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( NET_SELECTOR_COMBOPOPUP::onMouseClick ), NULL, this ); - m_filterCtrl->Connect( wxEVT_TEXT, wxCommandEventHandler( NET_SELECTOR_COMBOPOPUP::onFilterEdit ), NULL, this ); - m_filterCtrl->Connect( wxEVT_TEXT_ENTER, wxCommandEventHandler( NET_SELECTOR_COMBOPOPUP::onEnter ), NULL, this ); + Connect( wxEVT_IDLE, wxIdleEventHandler( NET_SELECTOR_COMBOPOPUP::onIdle ), nullptr, this ); + Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( NET_SELECTOR_COMBOPOPUP::onKeyDown ), nullptr, this ); + Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( NET_SELECTOR_COMBOPOPUP::onMouseClick ), nullptr, this ); + m_listBox->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( NET_SELECTOR_COMBOPOPUP::onMouseClick ), nullptr, this ); + m_filterCtrl->Connect( wxEVT_TEXT, wxCommandEventHandler( NET_SELECTOR_COMBOPOPUP::onFilterEdit ), nullptr, this ); + m_filterCtrl->Connect( wxEVT_TEXT_ENTER, wxCommandEventHandler( NET_SELECTOR_COMBOPOPUP::onEnter ), nullptr, this ); // in a ListBox comes in as a double-click on GTK - m_listBox->Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( NET_SELECTOR_COMBOPOPUP::onEnter ), NULL, this ); + m_listBox->Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( NET_SELECTOR_COMBOPOPUP::onEnter ), nullptr, this ); return true; } @@ -548,13 +548,13 @@ NET_SELECTOR::NET_SELECTOR( wxWindow *parent, wxWindowID id, const wxPoint &pos, m_netSelectorPopup = new NET_SELECTOR_COMBOPOPUP(); SetPopupControl( m_netSelectorPopup ); - Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( NET_SELECTOR::onKeyDown ), NULL, this ); + Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( NET_SELECTOR::onKeyDown ), nullptr, this ); } NET_SELECTOR::~NET_SELECTOR() { - Disconnect( wxEVT_CHAR_HOOK, wxKeyEventHandler( NET_SELECTOR::onKeyDown ), NULL, this ); + Disconnect( wxEVT_CHAR_HOOK, wxKeyEventHandler( NET_SELECTOR::onKeyDown ), nullptr, this ); } diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index e062f51903..83cce37e25 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -506,7 +506,7 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, wxPo } GRText( DC, txtpos, color, typeName, orient, wxSize( textSize, textSize ), hjustify, - GR_TEXT_VJUSTIFY_CENTER, pensize, false, false, 0 ); + GR_TEXT_VJUSTIFY_CENTER, pensize, false, false, nullptr ); } diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp index f71fc517df..6249fcc8a4 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp @@ -2243,7 +2243,7 @@ bool SCH_SEXPR_PLUGIN::DeleteSymbolLib( const wxString& aLibraryPath, if( m_cache && m_cache->IsFile( aLibraryPath ) ) { delete m_cache; - m_cache = 0; + m_cache = nullptr; } return true; diff --git a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp index 6e61e9d580..2253408de8 100644 --- a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp +++ b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp @@ -4388,7 +4388,7 @@ bool SCH_LEGACY_PLUGIN::DeleteSymbolLib( const wxString& aLibraryPath, if( m_cache && m_cache->IsFile( aLibraryPath ) ) { delete m_cache; - m_cache = 0; + m_cache = nullptr; } return true; diff --git a/gerbview/excellon_read_drill_file.cpp b/gerbview/excellon_read_drill_file.cpp index 9db724eec9..9bf58b2e21 100644 --- a/gerbview/excellon_read_drill_file.cpp +++ b/gerbview/excellon_read_drill_file.cpp @@ -312,7 +312,7 @@ bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName ) m_Current_File = wxFopen( aFullFileName, "rt" ); - if( m_Current_File == NULL ) + if( m_Current_File == nullptr ) return false; wxString msg; @@ -325,7 +325,7 @@ bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName ) while( true ) { - if( excellonReader.ReadLine() == 0 ) + if( excellonReader.ReadLine() == nullptr ) break; char* line = excellonReader.Line(); @@ -383,7 +383,7 @@ bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName ) X2_ATTRIBUTE dummy; char* text = (char*)file_attribute; int dummyline = 0; - dummy.ParseAttribCmd( NULL, NULL, 0, text, dummyline ); + dummy.ParseAttribCmd( nullptr, nullptr, 0, text, dummyline ); delete m_FileFunction; m_FileFunction = new X2_ATTRIBUTE_FILEFUNCTION( dummy ); @@ -395,7 +395,7 @@ bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName ) bool EXCELLON_IMAGE::Execute_HEADER_And_M_Command( char*& text ) { - EXCELLON_CMD* cmd = NULL; + EXCELLON_CMD* cmd = nullptr; wxString msg; // Search command in list @@ -590,7 +590,7 @@ bool EXCELLON_IMAGE::readToolInformation( char*& aText ) // Remember: dcodes are >= FIRST_DCODE D_CODE* dcode = GetDCODEOrCreate( iprm + FIRST_DCODE ); - if( dcode == NULL ) + if( dcode == nullptr ) return false; // conv_scale = scaling factor from inch to Internal Unit @@ -717,7 +717,7 @@ bool EXCELLON_IMAGE::Select_Tool( char*& text ) m_Current_Tool = dcode_id; D_CODE* currDcode = GetDCODEOrCreate( dcode_id, true ); - if( currDcode == NULL && tool_id > 0 ) // if the definition is embedded, enter it + if( currDcode == nullptr && tool_id > 0 ) // if the definition is embedded, enter it { text = startline; // text starts at the beginning of the command readToolInformation( text ); @@ -737,7 +737,7 @@ bool EXCELLON_IMAGE::Select_Tool( char*& text ) bool EXCELLON_IMAGE::Execute_EXCELLON_G_Command( char*& text ) { - EXCELLON_CMD* cmd = NULL; + EXCELLON_CMD* cmd = nullptr; bool success = false; int id = DRILL_G_UNKNOWN; diff --git a/gerbview/gerber_file_image.cpp b/gerbview/gerber_file_image.cpp index 276a964400..bdca9e5d1a 100644 --- a/gerbview/gerber_file_image.cpp +++ b/gerbview/gerber_file_image.cpp @@ -86,19 +86,19 @@ void GERBER_LAYER::ResetDefaultValues() GERBER_FILE_IMAGE::GERBER_FILE_IMAGE( int aLayer ) : - EDA_ITEM( (EDA_ITEM*)NULL, GERBER_IMAGE_T ) + EDA_ITEM( nullptr, GERBER_IMAGE_T ) { m_GraphicLayer = aLayer; // Graphic layer Number m_IsVisible = true; // must be drawn m_PositiveDrawColor = WHITE; // The color used to draw positive items for this image m_Selected_Tool = 0; - m_FileFunction = NULL; // file function parameters + m_FileFunction = nullptr; // file function parameters ResetDefaultValues(); for( unsigned ii = 0; ii < arrayDim( m_Aperture_List ); ii++ ) - m_Aperture_List[ii] = 0; + m_Aperture_List[ii] = nullptr; } @@ -128,14 +128,14 @@ D_CODE* GERBER_FILE_IMAGE::GetDCODEOrCreate( int aDCODE, bool aCreateIfNoExist ) // lazily create the D_CODE if it does not exist. if( aCreateIfNoExist ) { - if( m_Aperture_List[ndx] == NULL ) + if( m_Aperture_List[ndx] == nullptr ) m_Aperture_List[ndx] = new D_CODE( ndx + FIRST_DCODE ); } return m_Aperture_List[ndx]; } - return NULL; + return nullptr; } @@ -148,7 +148,7 @@ D_CODE* GERBER_FILE_IMAGE::GetDCODE( int aDCODE ) const return m_Aperture_List[ndx]; } - return NULL; + return nullptr; } @@ -162,7 +162,7 @@ APERTURE_MACRO* GERBER_FILE_IMAGE::FindApertureMacro( const APERTURE_MACRO& aLoo return pam; } - return NULL; // not found + return nullptr; // not found } @@ -175,7 +175,7 @@ void GERBER_FILE_IMAGE::ResetDefaultValues() m_ImageNegative = false; // true = Negative image m_IsX2_file = false; // true only if a %TF, %TA or %TD command delete m_FileFunction; // file function parameters - m_FileFunction = NULL; + m_FileFunction = nullptr; m_MD5_value.Empty(); // MD5 value found in a %TF.MD5 command m_PartString.Empty(); // string found in a %TF.Part command m_hasNegativeItems = -1; // set to uninitialized @@ -218,7 +218,7 @@ void GERBER_FILE_IMAGE::ResetDefaultValues() m_LastArcDataType = ARC_INFO_TYPE_NONE; // Extra coordinate info type for arcs // (radius or IJ center coord) m_LineNum = 0; // line number in file being read - m_Current_File = NULL; // Gerber file to read + m_Current_File = nullptr; // Gerber file to read m_PolygonFillMode = false; m_PolygonFillModeState = 0; m_Selected_Tool = 0; @@ -274,7 +274,7 @@ void GERBER_FILE_IMAGE::InitToolTable() { for( int count = 0; count < TOOLS_MAX_COUNT; count++ ) { - if( m_Aperture_List[count] == NULL ) + if( m_Aperture_List[count] == nullptr ) continue; m_Aperture_List[count]->m_Num_Dcode = count + FIRST_DCODE; diff --git a/gerbview/readgerb.cpp b/gerbview/readgerb.cpp index 08abacbf9d..680c49edcb 100644 --- a/gerbview/readgerb.cpp +++ b/gerbview/readgerb.cpp @@ -45,7 +45,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName ) GERBER_FILE_IMAGE_LIST* images = GetImagesList(); GERBER_FILE_IMAGE* gerber = GetGbrImage( layer ); - if( gerber != NULL ) + if( gerber != nullptr ) { Erase_Current_DrawLayer( false ); } @@ -126,7 +126,7 @@ bool GERBER_FILE_IMAGE::LoadGerberFile( const wxString& aFullFileName ) // Read the gerber file */ m_Current_File = wxFopen( aFullFileName, wxT( "rt" ) ); - if( m_Current_File == 0 ) + if( m_Current_File == nullptr ) return false; m_FileName = aFullFileName; @@ -137,7 +137,7 @@ bool GERBER_FILE_IMAGE::LoadGerberFile( const wxString& aFullFileName ) while( true ) { - if( fgets( lineBuffer, GERBER_BUFZ, m_Current_File ) == NULL ) + if( fgets( lineBuffer, GERBER_BUFZ, m_Current_File ) == nullptr ) break; m_LineNum++; diff --git a/gerbview/rs274x.cpp b/gerbview/rs274x.cpp index 1aeb3ec807..21a72b2556 100644 --- a/gerbview/rs274x.cpp +++ b/gerbview/rs274x.cpp @@ -179,7 +179,7 @@ bool GERBER_FILE_IMAGE::ReadRS274XCommand( char *aBuff, unsigned int aBuffSize, } // end of current line, read another one. - if( fgets( aBuff, aBuffSize, m_Current_File ) == NULL ) + if( fgets( aBuff, aBuffSize, m_Current_File ) == nullptr ) { // end of file ok = false; @@ -712,7 +712,7 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff, D_CODE* dcode; dcode = GetDCODEOrCreate( code ); - if( dcode == NULL ) + if( dcode == nullptr ) break; dcode->m_AperFunction = m_AperFunction; @@ -920,7 +920,7 @@ bool GERBER_FILE_IMAGE::GetEndOfBlock( char* aBuff, unsigned int aBuffSize, char aText++; } - if( fgets( aBuff, aBuffSize, gerber_file ) == NULL ) + if( fgets( aBuff, aBuffSize, gerber_file ) == nullptr ) break; m_LineNum++; @@ -944,8 +944,8 @@ char* GERBER_FILE_IMAGE::GetNextLine( char *aBuff, unsigned int aBuffSize, char* break; case 0: // End of text found in aBuff: Read a new string - if( fgets( aBuff, aBuffSize, aFile ) == NULL ) - return NULL; + if( fgets( aBuff, aBuffSize, aFile ) == nullptr ) + return nullptr; m_LineNum++; aText = aBuff; @@ -986,7 +986,7 @@ bool GERBER_FILE_IMAGE::ReadApertureMacro( char *aBuff, unsigned int aBuffSize, aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file ); - if( aText == NULL ) // End of File + if( aText == nullptr ) // End of File return false; // aText points the beginning of a new line. @@ -1011,7 +1011,7 @@ bool GERBER_FILE_IMAGE::ReadApertureMacro( char *aBuff, unsigned int aBuffSize, am.m_localparamStack.push_back( AM_PARAM() ); AM_PARAM& param = am.m_localparamStack.back(); aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file ); - if( aText == NULL) // End of File + if( aText == nullptr) // End of File return false; param.ReadParam( aText ); continue; @@ -1097,7 +1097,7 @@ bool GERBER_FILE_IMAGE::ReadApertureMacro( char *aBuff, unsigned int aBuffSize, aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file ); - if( aText == NULL) // End of File + if( aText == nullptr) // End of File return false; param.ReadParam( aText ); @@ -1121,7 +1121,7 @@ bool GERBER_FILE_IMAGE::ReadApertureMacro( char *aBuff, unsigned int aBuffSize, // in advance, i.e. be immediate. wxASSERT( prim.params[1].IsImmediate() ); - paramCount = (int) prim.params[1].GetValue( 0 ) * 2 + 1; + paramCount = (int) prim.params[1].GetValue( nullptr ) * 2 + 1; for( int jj = 0; jj < paramCount && *aText != '*'; ++jj ) { @@ -1131,7 +1131,7 @@ bool GERBER_FILE_IMAGE::ReadApertureMacro( char *aBuff, unsigned int aBuffSize, aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file ); - if( aText == NULL ) // End of File + if( aText == nullptr ) // End of File return false; param.ReadParam( aText ); diff --git a/include/collector.h b/include/collector.h index decdf81390..752e5cfb54 100644 --- a/include/collector.h +++ b/include/collector.h @@ -56,7 +56,7 @@ public: COLLECTOR() : m_Threshold( 0 ), m_MenuCancelled( false ), - m_scanTypes( 0 ), + m_scanTypes( nullptr ), // Inspect() is virtual so calling it from a class common inspector preserves // polymorphism. m_inspector( [=]( EDA_ITEM* aItem, void* aTestData ) diff --git a/include/footprint_info.h b/include/footprint_info.h index 65ef341571..0bd6203acc 100644 --- a/include/footprint_info.h +++ b/include/footprint_info.h @@ -169,7 +169,7 @@ public: typedef std::vector> FPILIST; typedef SYNC_QUEUE> ERRLIST; - FOOTPRINT_LIST() : m_lib_table( 0 ) + FOOTPRINT_LIST() : m_lib_table( nullptr ) { } diff --git a/include/libeval/numeric_evaluator.h b/include/libeval/numeric_evaluator.h index 3dd94c2878..87e498a74e 100644 --- a/include/libeval/numeric_evaluator.h +++ b/include/libeval/numeric_evaluator.h @@ -160,7 +160,7 @@ private: struct TokenStat { enum { OutLen = 32 }; - TokenStat() : input( 0 ), token( 0 ), inputLen( 0 ), pos( 0 ) { /* empty */ } + TokenStat() : input( nullptr ), token( nullptr ), inputLen( 0 ), pos( 0 ) { /* empty */ } const char* input; // current input string ("var=4") char* token; // output token ("var", type:VAR; "4", type:VALUE) size_t inputLen; // strlen(input) diff --git a/include/tool/coroutine.h b/include/tool/coroutine.h index 142a63799f..4cc047a7ec 100644 --- a/include/tool/coroutine.h +++ b/include/tool/coroutine.h @@ -190,7 +190,7 @@ public: COROUTINE( std::function aEntry ) : m_func( std::move( aEntry ) ), m_running( false ), - m_args( 0 ), + m_args( nullptr ), m_caller(), m_callContext( nullptr ), m_callee(), diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index 3be9b575d5..caa9e27b6a 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -57,7 +57,7 @@ wxPoint BOARD_ITEM::ZeroOffset( 0, 0 ); BOARD::BOARD() : - BOARD_ITEM_CONTAINER( (BOARD_ITEM*) NULL, PCB_T ), + BOARD_ITEM_CONTAINER( (BOARD_ITEM*) nullptr, PCB_T ), m_boardUse( BOARD_USE::NORMAL ), m_timeStamp( 1 ), m_paper( PAGE_INFO::A4 ), @@ -279,7 +279,7 @@ void BOARD::Move( const wxPoint& aMoveVector ) // overload return SEARCH_RESULT::CONTINUE; }; - Visit( inspector, NULL, top_level_board_stuff ); + Visit( inspector, nullptr, top_level_board_stuff ); } @@ -299,7 +299,7 @@ TRACKS BOARD::TracksInNet( int aNetCode ) // visit this BOARD's TRACKs and VIAs with above TRACK INSPECTOR which // appends all in aNetCode to ret. - Visit( inspector, NULL, GENERAL_COLLECTOR::Tracks ); + Visit( inspector, nullptr, GENERAL_COLLECTOR::Tracks ); return ret; } @@ -562,9 +562,9 @@ bool BOARD::IsFootprintLayerVisible( PCB_LAYER_ID aLayer ) const void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode ) { - if( aBoardItem == NULL ) + if( aBoardItem == nullptr ) { - wxFAIL_MSG( wxT( "BOARD::Add() param error: aBoardItem NULL" ) ); + wxFAIL_MSG( wxT( "BOARD::Add() param error: aBoardItem nullptr" ) ); return; } @@ -664,7 +664,7 @@ void BOARD::FinalizeBulkRemove( std::vector& aRemovedItems ) void BOARD::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aRemoveMode ) { - // find these calls and fix them! Don't send me no stinking' NULL. + // find these calls and fix them! Don't send me no stinking' nullptr. wxASSERT( aBoardItem ); switch( aBoardItem->Type() ) @@ -1290,7 +1290,7 @@ NETINFO_ITEM* BOARD::FindNet( int aNetcode ) const { // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1. // zero is reserved for "no connection" and is not actually a net. - // NULL is returned for non valid netcodes + // nullptr is returned for non valid netcodes wxASSERT( m_NetInfo.GetNetCount() > 0 ); @@ -1505,7 +1505,7 @@ PAD* BOARD::GetPad( const wxPoint& aPosition, LSET aLayerSet ) const for( FOOTPRINT* footprint : m_footprints ) { - PAD* pad = NULL; + PAD* pad = nullptr; if( footprint->HitTest( aPosition ) ) pad = footprint->GetPad( aPosition, aLayerSet ); @@ -1514,7 +1514,7 @@ PAD* BOARD::GetPad( const wxPoint& aPosition, LSET aLayerSet ) const return pad; } - return NULL; + return nullptr; } @@ -1601,7 +1601,7 @@ PAD* BOARD::GetPad( std::vector& aPadList, const wxPoint& aPosition, LSET } // Not found: - return 0; + return nullptr; } if( pad->GetPosition().x == aPosition.x ) // Must search considering Y coordinate @@ -1637,7 +1637,7 @@ PAD* BOARD::GetPad( std::vector& aPadList, const wxPoint& aPosition, LSET } } - return NULL; + return nullptr; } @@ -1765,8 +1765,8 @@ std::tuple BOARD::GetTrackLength( const TRACK& aTrack ) con FOOTPRINT* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer, bool aVisibleOnly, bool aIgnoreLocked ) const { - FOOTPRINT* footprint = NULL; - FOOTPRINT* alt_footprint = NULL; + FOOTPRINT* footprint = nullptr; + FOOTPRINT* alt_footprint = nullptr; int min_dim = 0x7FFFFFFF; int alt_min_dim = 0x7FFFFFFF; bool current_layer_back = IsBackLayer( aActiveLayer ); @@ -1822,7 +1822,7 @@ FOOTPRINT* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLa if( alt_footprint) return alt_footprint; - return NULL; + return nullptr; } diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp index f08e05e69f..213c45257c 100644 --- a/pcbnew/exporters/export_gencad.cpp +++ b/pcbnew/exporters/export_gencad.cpp @@ -406,7 +406,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) } // Emit component pads - PAD* old_pad = 0; + PAD* old_pad = nullptr; int pad_name_number = 0; for( unsigned i = 0; i& aFileSet, in } else { - BOARD* loadedBoard = 0; // it will be set to non-NULL if loaded OK + BOARD* loadedBoard = nullptr; // it will be set to non-NULL if loaded OK PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) ); diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 059d4f6bc5..5a5f949bea 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -50,7 +50,7 @@ FOOTPRINT::FOOTPRINT( BOARD* parent ) : m_visibleBBoxCacheTimeStamp( 0 ), m_textExcludedBBoxCacheTimeStamp( 0 ), m_hullCacheTimeStamp( 0 ), - m_initial_comments( 0 ) + m_initial_comments( nullptr ) { m_attributes = 0; m_layer = F_Cu; @@ -962,7 +962,7 @@ PAD* FOOTPRINT::FindPadByName( const wxString& aPadName ) const return pad; } - return NULL; + return nullptr; } @@ -978,7 +978,7 @@ PAD* FOOTPRINT::GetPad( const wxPoint& aPosition, LSET aLayerMask ) return pad; } - return NULL; + return nullptr; } @@ -1614,8 +1614,8 @@ BOARD_ITEM* FOOTPRINT::Duplicate() const BOARD_ITEM* FOOTPRINT::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootprint ) { - BOARD_ITEM* new_item = NULL; - FP_ZONE* new_zone = NULL; + BOARD_ITEM* new_item = nullptr; + FP_ZONE* new_zone = nullptr; switch( aItem->Type() ) { diff --git a/pcbnew/load_select_footprint.cpp b/pcbnew/load_select_footprint.cpp index 3f56f61c53..b5f4ad4368 100644 --- a/pcbnew/load_select_footprint.cpp +++ b/pcbnew/load_select_footprint.cpp @@ -83,10 +83,10 @@ bool FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard( FOOTPRINT* aFootprint ) FOOTPRINT* newFootprint = nullptr; PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false ); - if( frame == NULL ) // happens if no board editor opened + if( frame == nullptr ) // happens if no board editor opened return false; - if( aFootprint == NULL ) + if( aFootprint == nullptr ) { if( !frame->GetBoard() || !frame->GetBoard()->GetFirstFootprint() ) return false; @@ -94,7 +94,7 @@ bool FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard( FOOTPRINT* aFootprint ) aFootprint = SelectFootprintFromBoard( frame->GetBoard() ); } - if( aFootprint == NULL ) + if( aFootprint == nullptr ) return false; // Ensure we do not have the pad editor open (that is apseudo modal dlg). @@ -268,7 +268,7 @@ FOOTPRINT* PCB_BASE_FRAME::SelectFootprintFromLibTree( LIB_ID aPreselect ) DIALOG_CHOOSE_FOOTPRINT dialog( this, title, ptr ); if( dialog.ShowQuasiModal() == wxID_CANCEL ) - return NULL; + return nullptr; if( dialog.IsExternalBrowserSelected() ) { @@ -277,7 +277,7 @@ FOOTPRINT* PCB_BASE_FRAME::SelectFootprintFromLibTree( LIB_ID aPreselect ) footprintName = SelectFootprintFromLibBrowser(); if( footprintName.IsEmpty() ) // Cancel command - return NULL; + return nullptr; else fpid.Parse( footprintName ); } @@ -286,7 +286,7 @@ FOOTPRINT* PCB_BASE_FRAME::SelectFootprintFromLibTree( LIB_ID aPreselect ) fpid = dialog.GetSelectedLibId(); if( !fpid.IsValid() ) - return NULL; + return nullptr; else footprintName = fpid.Format(); } @@ -311,7 +311,7 @@ FOOTPRINT* PCB_BASE_FRAME::SelectFootprintFromLibTree( LIB_ID aPreselect ) FOOTPRINT* PCB_BASE_FRAME::LoadFootprint( const LIB_ID& aFootprintId ) { - FOOTPRINT* footprint = NULL; + FOOTPRINT* footprint = nullptr; try { @@ -329,7 +329,7 @@ FOOTPRINT* PCB_BASE_FRAME::loadFootprint( const LIB_ID& aFootprintId ) { FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs(); - wxCHECK_MSG( fptbl, NULL, wxT( "Cannot look up LIB_ID in NULL FP_LIB_TABLE." ) ); + wxCHECK_MSG( fptbl, nullptr, wxT( "Cannot look up LIB_ID in NULL FP_LIB_TABLE." ) ); FOOTPRINT *footprint = nullptr; @@ -387,7 +387,7 @@ FOOTPRINT* FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard( BOARD* aPcb ) if( dlg.ShowModal() == wxID_OK ) fpname = dlg.GetTextSelection(); else - return NULL; + return nullptr; oldName = fpname; @@ -450,7 +450,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveLibraryAs( const wxString& aLibraryPath ) } -static FOOTPRINT* s_FootprintInitialCopy = NULL; // Copy of footprint for abort/undo command +static FOOTPRINT* s_FootprintInitialCopy = nullptr; // Copy of footprint for abort/undo command static PICKED_ITEMS_LIST s_PickedList; // A pick-list to save initial footprint // and dragged tracks @@ -470,7 +470,7 @@ FOOTPRINT* PCB_BASE_FRAME::GetFootprintFromBoardByReference() DIALOG_GET_FOOTPRINT_BY_NAME dlg( this, fplist ); if( dlg.ShowModal() != wxID_OK ) //Aborted by user - return NULL; + return nullptr; footprintName = dlg.GetValue(); footprintName.Trim( true ); @@ -491,7 +491,7 @@ FOOTPRINT* PCB_BASE_FRAME::GetFootprintFromBoardByReference() void PCB_BASE_FRAME::PlaceFootprint( FOOTPRINT* aFootprint, bool aRecreateRatsnest ) { - if( aFootprint == 0 ) + if( aFootprint == nullptr ) return; OnModify(); @@ -505,7 +505,7 @@ void PCB_BASE_FRAME::PlaceFootprint( FOOTPRINT* aFootprint, bool aRecreateRatsne ITEM_PICKER picker( nullptr, aFootprint, UNDO_REDO::CHANGED ); picker.SetLink( s_FootprintInitialCopy ); s_PickedList.PushItem( picker ); - s_FootprintInitialCopy = NULL; // the picker is now owner of s_ModuleInitialCopy. + s_FootprintInitialCopy = nullptr; // the picker is now owner of s_ModuleInitialCopy. } if( s_PickedList.GetCount() ) @@ -521,7 +521,7 @@ void PCB_BASE_FRAME::PlaceFootprint( FOOTPRINT* aFootprint, bool aRecreateRatsne aFootprint->ClearFlags(); delete s_FootprintInitialCopy; - s_FootprintInitialCopy = NULL; + s_FootprintInitialCopy = nullptr; if( aRecreateRatsnest ) m_pcb->GetConnectivity()->Update( aFootprint ); diff --git a/pcbnew/plugins/geda/gpcb_plugin.cpp b/pcbnew/plugins/geda/gpcb_plugin.cpp index 4b4c4d9fa0..144569228c 100644 --- a/pcbnew/plugins/geda/gpcb_plugin.cpp +++ b/pcbnew/plugins/geda/gpcb_plugin.cpp @@ -818,20 +818,20 @@ bool GPCB_FPL_CACHE::testFlags( const wxString& aFlag, long aMask, const wxChar* GPCB_PLUGIN::GPCB_PLUGIN() : - m_cache( 0 ), + m_cache( nullptr ), m_ctl( 0 ) { - m_reader = NULL; - init( 0 ); + m_reader = nullptr; + init( nullptr ); } GPCB_PLUGIN::GPCB_PLUGIN( int aControlFlags ) : - m_cache( 0 ), + m_cache( nullptr ), m_ctl( aControlFlags ) { - m_reader = NULL; - init( 0 ); + m_reader = nullptr; + init( nullptr ); } @@ -915,7 +915,7 @@ const FOOTPRINT* GPCB_PLUGIN::getFootprint( const wxString& aLibraryPath, FOOTPRINT_MAP::const_iterator it = mods.find( TO_UTF8( aFootprintName ) ); if( it == mods.end() ) - return NULL; + return nullptr; return it->second->GetFootprint(); } @@ -1036,7 +1036,7 @@ bool GPCB_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, const PROPER if( m_cache && m_cache->GetPath() == aLibraryPath ) { delete m_cache; - m_cache = NULL; + m_cache = nullptr; } return true; @@ -1053,7 +1053,7 @@ bool GPCB_PLUGIN::IsFootprintLibWritable( const wxString& aLibraryPath ) { LOCALE_IO toggle; - init( NULL ); + init( nullptr ); validateCache( aLibraryPath ); diff --git a/pcbnew/plugins/kicad/kicad_plugin.cpp b/pcbnew/plugins/kicad/kicad_plugin.cpp index d09797b6cb..645d809665 100644 --- a/pcbnew/plugins/kicad/kicad_plugin.cpp +++ b/pcbnew/plugins/kicad/kicad_plugin.cpp @@ -1760,7 +1760,7 @@ void PCB_IO::format( const TRACK* aTrack, int aNestLevel ) const const VIA* via = static_cast( aTrack ); BOARD* board = (BOARD*) via->GetParent(); - wxCHECK_RET( board != 0, wxT( "Via " ) + + wxCHECK_RET( board != nullptr, wxT( "Via " ) + via->GetSelectMenuText( EDA_UNITS::MILLIMETRES ) + wxT( " has no parent." ) ); m_out->Print( aNestLevel, "(via" ); @@ -2161,12 +2161,12 @@ void PCB_IO::format( const ZONE* aZone, int aNestLevel ) const PCB_IO::PCB_IO( int aControlFlags ) : - m_cache( 0 ), + m_cache( nullptr ), m_ctl( aControlFlags ), m_parser( new PCB_PARSER() ), m_mapping( new NETINFO_MAPPING() ) { - init( 0 ); + init( nullptr ); m_out = &m_sf; } diff --git a/pcbnew/plugins/kicad/pcb_parser.h b/pcbnew/plugins/kicad/pcb_parser.h index 6c2af11e64..812931b2cf 100644 --- a/pcbnew/plugins/kicad/pcb_parser.h +++ b/pcbnew/plugins/kicad/pcb_parser.h @@ -68,7 +68,7 @@ struct LAYER; class PCB_PARSER : public PCB_LEXER { public: - PCB_PARSER( LINE_READER* aReader = NULL ) : + PCB_PARSER( LINE_READER* aReader = nullptr ) : PCB_LEXER( aReader ), m_board( nullptr ), m_resetKIIDs( false ) @@ -108,7 +108,7 @@ public: * wxArrayString to this function and care must be taken to * delete it even on exception. */ - FOOTPRINT* parseFOOTPRINT( wxArrayString* aInitialComments = 0 ); + FOOTPRINT* parseFOOTPRINT( wxArrayString* aInitialComments = nullptr ); /** * Return whether a version number, if any was parsed, was too recent @@ -189,7 +189,7 @@ private: DIMENSION_BASE* parseDIMENSION(); // Parse a footprint, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically. - FOOTPRINT* parseFOOTPRINT_unchecked( wxArrayString* aInitialComments = 0 ); + FOOTPRINT* parseFOOTPRINT_unchecked( wxArrayString* aInitialComments = nullptr ); FP_TEXT* parseFP_TEXT(); FP_SHAPE* parseFP_SHAPE(); diff --git a/pcbnew/plugins/legacy/legacy_plugin.cpp b/pcbnew/plugins/legacy/legacy_plugin.cpp index 50da43ec65..113b03e7f4 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.cpp +++ b/pcbnew/plugins/legacy/legacy_plugin.cpp @@ -188,7 +188,7 @@ typedef unsigned LAYER_MSK; static const char delims[] = " \t\r\n"; -static bool inline isSpace( int c ) { return strchr( delims, c ) != 0; } +static bool inline isSpace( int c ) { return strchr( delims, c ) != nullptr; } #define MASK(x) (1<<(x)) @@ -3344,7 +3344,7 @@ bool LEGACY_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, if( m_cache && m_cache->m_lib_path == aLibraryPath ) { delete m_cache; - m_cache = 0; + m_cache = nullptr; } return true; diff --git a/pcbnew/router/pns_component_dragger.cpp b/pcbnew/router/pns_component_dragger.cpp index 5fcbba63ec..d2a3bc1e2f 100644 --- a/pcbnew/router/pns_component_dragger.cpp +++ b/pcbnew/router/pns_component_dragger.cpp @@ -99,7 +99,7 @@ bool COMPONENT_DRAGGER::Start( const VECTOR2I& aP, ITEM_SET& aPrimitives ) { LINKED_ITEM* li = static_cast( extraJoint->LinkList()[0].item ); - if( li->Collide( solid, 0, m_world ) ) + if( li->Collide( solid, nullptr, m_world ) ) addLinked( solid, li, extraJoint->Pos() - solid->Pos() ); } } diff --git a/pcbnew/zones_functions_for_undo_redo.cpp b/pcbnew/zones_functions_for_undo_redo.cpp index b16b1b5c14..49b9491944 100644 --- a/pcbnew/zones_functions_for_undo_redo.cpp +++ b/pcbnew/zones_functions_for_undo_redo.cpp @@ -151,7 +151,7 @@ int SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb, int aNetCode, LA { ZONE* zone = aPcb->GetArea( ii ); - if( zone == NULL ) // End of list + if( zone == nullptr ) // End of list break; if( aNetCode >= 0 && aNetCode != zone->GetNetCode() ) @@ -221,7 +221,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, { ZONE* zone = aPcb->GetArea( ii ); - if( zone == NULL ) + if( zone == nullptr ) { /* End of list: the stored item is not found: * it must be in aDeletedList: @@ -232,7 +232,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, if( status == UNDO_REDO::NEWITEM ) { delete ref; - ref = NULL; + ref = nullptr; aPickList.RemovePicker( kk ); kk--; } @@ -241,13 +241,13 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, ZONE* zcopy = (ZONE*) aPickList.GetPickedItemLink( kk ); aPickList.SetPickedItemStatus( UNDO_REDO::DELETED, kk ); - wxASSERT_MSG( zcopy != NULL, + wxASSERT_MSG( zcopy != nullptr, wxT( "UpdateCopyOfZonesList() error: link = NULL" ) ); *ref = *zcopy; // the copy was deleted; the link does not exists now. - aPickList.SetPickedItemLink( NULL, kk ); + aPickList.SetPickedItemLink( nullptr, kk ); delete zcopy; } @@ -256,7 +256,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, for( unsigned nn = 0; nn < aAuxiliaryList.GetCount(); nn++ ) { - if( ref != NULL && aAuxiliaryList.GetPickedItem( nn ) == ref ) + if( ref != nullptr && aAuxiliaryList.GetPickedItem( nn ) == ref ) { aAuxiliaryList.RemovePicker( nn ); notfound = false; @@ -270,7 +270,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, #if defined(DEBUG) printf( "UpdateCopyOfZonesList(): item not found in aAuxiliaryList," "combined with another zone\n" ); - fflush(0); + fflush(nullptr); #endif } break; diff --git a/plugins/3d/vrml/vrml.cpp b/plugins/3d/vrml/vrml.cpp index 36a8ce026b..d633e2e9ef 100644 --- a/plugins/3d/vrml/vrml.cpp +++ b/plugins/3d/vrml/vrml.cpp @@ -147,7 +147,7 @@ class LOCALESWITCH public: LOCALESWITCH() { - m_locale = setlocale( LC_NUMERIC, 0 ); + m_locale = setlocale( LC_NUMERIC, NULL ); setlocale( LC_NUMERIC, "C" ); }