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.
This commit is contained in:
Ian McInerney 2021-04-22 22:20:34 +01:00
parent fcca4bc3e6
commit ecd9bf696e
41 changed files with 169 additions and 169 deletions

View File

@ -51,7 +51,7 @@ public:
* @param aParent the parent creator of this canvas. * @param aParent the parent creator of this canvas.
* @param aAttribList a list of openGL options created by #OGL_ATT_LIST::GetAttributesList. * @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 ); S3D_CACHE* aCacheManager = nullptr );
~C3D_MODEL_VIEWER(); ~C3D_MODEL_VIEWER();

View File

@ -30,7 +30,7 @@
#include <wx/log.h> #include <wx/log.h>
#include <map> #include <map>
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 ) OBJECT_2D::OBJECT_2D( OBJECT_2D_TYPE aObjType, const BOARD_ITEM& aBoardItem )

View File

@ -486,7 +486,7 @@ void MODEL_3D::DrawBbox() const
reinterpret_cast<const void*>( offsetof( VERTEX, m_color ) ) ); reinterpret_cast<const void*>( offsetof( VERTEX, m_color ) ) );
glDrawElements( GL_LINES, bbox_idx_count, m_bbox_index_buffer_type, glDrawElements( GL_LINES, bbox_idx_count, m_bbox_index_buffer_type,
reinterpret_cast<const void*>( 0 ) ); reinterpret_cast<const void*>( NULL ) );
} }

View File

@ -112,19 +112,19 @@ TRIANGLE_DISPLAY_LIST::TRIANGLE_DISPLAY_LIST( unsigned int aNrReservedTriangles
TRIANGLE_DISPLAY_LIST::~TRIANGLE_DISPLAY_LIST() TRIANGLE_DISPLAY_LIST::~TRIANGLE_DISPLAY_LIST()
{ {
delete m_layer_top_segment_ends; delete m_layer_top_segment_ends;
m_layer_top_segment_ends = 0; m_layer_top_segment_ends = nullptr;
delete m_layer_top_triangles; delete m_layer_top_triangles;
m_layer_top_triangles = 0; m_layer_top_triangles = nullptr;
delete m_layer_middle_contourns_quads; delete m_layer_middle_contourns_quads;
m_layer_middle_contourns_quads = 0; m_layer_middle_contourns_quads = nullptr;
delete m_layer_bot_triangles; delete m_layer_bot_triangles;
m_layer_bot_triangles = 0; m_layer_bot_triangles = nullptr;
delete m_layer_bot_segment_ends; delete m_layer_bot_segment_ends;
m_layer_bot_segment_ends = 0; m_layer_bot_segment_ends = nullptr;
} }

View File

@ -996,10 +996,10 @@ bool RENDER_3D_LEGACY::initializeOpenGL()
m_circleTexture = OglLoadTexture( *circleImageBlured ); m_circleTexture = OglLoadTexture( *circleImageBlured );
delete circleImageBlured; delete circleImageBlured;
circleImageBlured = 0; circleImageBlured = nullptr;
delete circleImage; delete circleImage;
circleImage = 0; circleImage = nullptr;
init_lights(); init_lights();

View File

@ -401,7 +401,7 @@ int DIALOG_SHIM::ShowQuasiModal()
{ {
void*& m_what; void*& m_what;
NULLER( void*& aPtr ) : m_what( aPtr ) {} 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 ); } clear_this( (void*&) m_qmodal_loop );
// release the mouse if it's currently captured as the window having it // release the mouse if it's currently captured as the window having it
@ -465,11 +465,11 @@ void DIALOG_SHIM::EndQuasiModal( int retCode )
else else
m_qmodal_loop->ScheduleExit( 0 ); m_qmodal_loop->ScheduleExit( 0 );
m_qmodal_loop = NULL; m_qmodal_loop = nullptr;
} }
delete m_qmodal_parent_disabler; delete m_qmodal_parent_disabler;
m_qmodal_parent_disabler = 0; m_qmodal_parent_disabler = nullptr;
Show( false ); Show( false );
} }

View File

@ -71,10 +71,10 @@ void DSNLEXER::init()
DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount, DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
FILE* aFile, const wxString& aFilename ) : FILE* aFile, const wxString& aFilename ) :
iOwnReaders( true ), iOwnReaders( true ),
start( NULL ), start( nullptr ),
next( NULL ), next( nullptr ),
limit( NULL ), limit( nullptr ),
reader( NULL ), reader( nullptr ),
keywords( aKeywordTable ), keywords( aKeywordTable ),
keywordCount( aKeywordCount ) keywordCount( aKeywordCount )
{ {
@ -87,10 +87,10 @@ DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount, DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
const std::string& aClipboardTxt, const wxString& aSource ) : const std::string& aClipboardTxt, const wxString& aSource ) :
iOwnReaders( true ), iOwnReaders( true ),
start( NULL ), start( nullptr ),
next( NULL ), next( nullptr ),
limit( NULL ), limit( nullptr ),
reader( NULL ), reader( nullptr ),
keywords( aKeywordTable ), keywords( aKeywordTable ),
keywordCount( aKeywordCount ) keywordCount( aKeywordCount )
{ {
@ -104,10 +104,10 @@ DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount, DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
LINE_READER* aLineReader ) : LINE_READER* aLineReader ) :
iOwnReaders( false ), iOwnReaders( false ),
start( NULL ), start( nullptr ),
next( NULL ), next( nullptr ),
limit( NULL ), limit( nullptr ),
reader( NULL ), reader( nullptr ),
keywords( aKeywordTable ), keywords( aKeywordTable ),
keywordCount( aKeywordCount ) keywordCount( aKeywordCount )
{ {
@ -121,10 +121,10 @@ static const KEYWORD empty_keywords[1] = {};
DSNLEXER::DSNLEXER( const std::string& aSExpression, const wxString& aSource ) : DSNLEXER::DSNLEXER( const std::string& aSExpression, const wxString& aSource ) :
iOwnReaders( true ), iOwnReaders( true ),
start( NULL ), start( nullptr ),
next( NULL ), next( nullptr ),
limit( NULL ), limit( nullptr ),
reader( NULL ), reader( nullptr ),
keywords( empty_keywords ), keywords( empty_keywords ),
keywordCount( 0 ) keywordCount( 0 )
{ {
@ -198,7 +198,7 @@ void DSNLEXER::PushReader( LINE_READER* aLineReader )
LINE_READER* DSNLEXER::PopReader() LINE_READER* DSNLEXER::PopReader()
{ {
LINE_READER* ret = 0; LINE_READER* ret = nullptr;
if( readerStack.size() ) if( readerStack.size() )
{ {
@ -216,7 +216,7 @@ LINE_READER* DSNLEXER::PopReader()
} }
else else
{ {
reader = 0; reader = nullptr;
start = dummy; start = dummy;
limit = dummy; limit = dummy;
} }
@ -778,7 +778,7 @@ exit: // single point of exit, no returns elsewhere please.
wxArrayString* DSNLEXER::ReadCommentLines() wxArrayString* DSNLEXER::ReadCommentLines()
{ {
wxArrayString* ret = 0; wxArrayString* ret = nullptr;
bool cmt_setting = SetCommentsAreTokens( true ); bool cmt_setting = SetCommentsAreTokens( true );
int tok = NextTok(); int tok = NextTok();

View File

@ -37,7 +37,7 @@ FILTER_READER::FILTER_READER( LINE_READER& aReader ) :
// is not owned here. // is not owned here.
delete [] m_line; 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. // 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. // 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_line = reader.Line();
m_length = reader.Length(); 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_line = s;
m_length = reader.Length(); m_length = reader.Length();
return m_length ? m_line : NULL; return m_length ? m_line : nullptr;
} }

View File

@ -196,7 +196,7 @@ void GPU_CACHED_MANAGER::EndDrawing()
glBufferData( GL_ELEMENT_ARRAY_BUFFER, m_indicesSize * sizeof( int ), (GLvoid*) m_indices.get(), glBufferData( GL_ELEMENT_ARRAY_BUFFER, m_indicesSize * sizeof( int ), (GLvoid*) m_indices.get(),
GL_DYNAMIC_DRAW ); GL_DYNAMIC_DRAW );
glDrawElements( GL_TRIANGLES, m_indicesSize, GL_UNSIGNED_INT, 0 ); glDrawElements( GL_TRIANGLES, m_indicesSize, GL_UNSIGNED_INT, NULL );
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
wxLogTrace( traceGalProfile, wxT( "Cached manager size: %d" ), m_indicesSize ); wxLogTrace( traceGalProfile, wxT( "Cached manager size: %d" ), m_indicesSize );

View File

@ -47,7 +47,7 @@ int KIWAY::m_kiface_version[KIWAY_FACE_COUNT];
KIWAY::KIWAY( PGM_BASE* aProgram, int aCtlBits, wxFrame* aTop ): 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. SetTop( aTop ); // hook player_destroy_handler() into aTop.

View File

@ -45,10 +45,10 @@ KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType
long aStyle, const wxString& aWdoName ) : long aStyle, const wxString& aWdoName ) :
EDA_BASE_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aWdoName, aKiway ), EDA_BASE_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aWdoName, aKiway ),
m_modal( false ), m_modal( false ),
m_modal_loop( 0 ), m_modal_loop( nullptr ),
m_modal_resultant_parent( 0 ) 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 ) : const wxString& aWdoName ) :
EDA_BASE_FRAME( aParent, (FRAME_T) aId, aTitle, aPos, aSize, aStyle, aWdoName, nullptr ), EDA_BASE_FRAME( aParent, (FRAME_T) aId, aTitle, aPos, aSize, aStyle, aWdoName, nullptr ),
m_modal( false ), m_modal( false ),
m_modal_loop( 0 ), m_modal_loop( nullptr ),
m_modal_resultant_parent( 0 ), m_modal_resultant_parent( nullptr ),
m_modal_ret_val( false ) m_modal_ret_val( false )
{ {
} }
@ -92,7 +92,7 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow
{ {
void*& m_what; void*& m_what;
NULLER( void*& aPtr ) : m_what( aPtr ) {} 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 ); } clear_this( (void*&) m_modal_loop );
@ -166,7 +166,7 @@ void KIWAY_PLAYER::DismissModal( bool aRetVal, const wxString& aResult )
if( m_modal_loop ) if( m_modal_loop )
{ {
m_modal_loop->Exit(); m_modal_loop->Exit();
m_modal_loop = 0; // this marks it as dismissed. m_modal_loop = nullptr; // this marks it as dismissed.
} }
Show( false ); Show( false );

View File

@ -59,7 +59,7 @@ const char* EndsWithRev( const char* start, const char* tail, char separator )
} }
} }
return 0; return nullptr;
} }

View File

@ -219,7 +219,7 @@ LIB_TABLE_ROW* LIB_TABLE::findRow( const wxString& aNickName, bool aCheckIfEnabl
} }
// not found, search fall back table(s), if any // not found, search fall back table(s), if any
} while( ( cur = cur->fallBack ) != 0 ); } while( ( cur = cur->fallBack ) != nullptr );
return nullptr; // not found 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 // not found, search fall back table(s), if any
} while( ( cur = cur->fallBack ) != 0 ); } while( ( cur = cur->fallBack ) != nullptr );
return nullptr; // not found return nullptr; // not found
} }
@ -281,7 +281,7 @@ std::vector<wxString> LIB_TABLE::GetLogicalLibs()
} }
} }
} while( ( cur = cur->fallBack ) != 0 ); } while( ( cur = cur->fallBack ) != nullptr );
ret.reserve( unique.size() ); ret.reserve( unique.size() );

View File

@ -108,8 +108,8 @@ LANGUAGE_DESCR LanguagesList[] =
PGM_BASE::PGM_BASE() PGM_BASE::PGM_BASE()
{ {
m_pgm_checker = NULL; m_pgm_checker = nullptr;
m_locale = NULL; m_locale = nullptr;
m_Printing = false; m_Printing = false;
m_ModalDialogCount = 0; 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: // unlike a normal destructor, this is designed to be called more than once safely:
delete m_pgm_checker; delete m_pgm_checker;
m_pgm_checker = 0; m_pgm_checker = nullptr;
delete m_locale; delete m_locale;
m_locale = 0; m_locale = nullptr;
} }

View File

@ -91,8 +91,8 @@ static bool polyCompare( const std::vector<wxPoint>& aPolygon,
GERBER_PLOTTER::GERBER_PLOTTER() GERBER_PLOTTER::GERBER_PLOTTER()
{ {
workFile = NULL; workFile = nullptr;
finalFile = NULL; finalFile = nullptr;
m_currentApertureIdx = -1; m_currentApertureIdx = -1;
m_apertureAttribute = 0; m_apertureAttribute = 0;
@ -205,7 +205,7 @@ void GERBER_PLOTTER::formatNetAttribute( GBR_NETLIST_METADATA* aData )
// print a Gerber net attribute record. // print a Gerber net attribute record.
// it is added to the object attributes dictionary // it is added to the object attributes dictionary
// On file, only modified or new attributes are printed. // On file, only modified or new attributes are printed.
if( aData == NULL ) if( aData == nullptr )
return; return;
if( !m_useNetAttributes ) if( !m_useNetAttributes )
@ -253,7 +253,7 @@ bool GERBER_PLOTTER::StartPlot()
m_outputFile = workFile; m_outputFile = workFile;
wxASSERT( m_outputFile ); wxASSERT( m_outputFile );
if( m_outputFile == NULL ) if( m_outputFile == nullptr )
return false; return false;
for( unsigned ii = 0; ii < m_headerExtraLines.GetCount(); ii++ ) for( unsigned ii = 0; ii < m_headerExtraLines.GetCount(); ii++ )
@ -386,7 +386,7 @@ bool GERBER_PLOTTER::EndPlot()
fclose( workFile ); fclose( workFile );
fclose( finalFile ); fclose( finalFile );
::wxRemoveFile( m_workFilename ); ::wxRemoveFile( m_workFilename );
m_outputFile = 0; m_outputFile = nullptr;
return true; return true;
} }

View File

@ -115,7 +115,7 @@ bool PDF_PLOTTER::OpenFile( const wxString& aFullFilename )
// Open the PDF file in binary mode // Open the PDF file in binary mode
m_outputFile = wxFopen( m_filename, wxT( "wb" ) ); m_outputFile = wxFopen( m_filename, wxT( "wb" ) );
if( m_outputFile == NULL ) if( m_outputFile == nullptr )
return false ; return false ;
return true; return true;
@ -543,7 +543,7 @@ void PDF_PLOTTER::closePdfStream()
// We are done with the temporary file, junk it // We are done with the temporary file, junk it
fclose( workFile ); fclose( workFile );
workFile = 0; workFile = nullptr;
::wxRemoveFile( workFilename ); ::wxRemoveFile( workFilename );
unsigned out_count; unsigned out_count;

View File

@ -55,7 +55,7 @@ PLOTTER::PLOTTER( )
m_plotMirror = false; // Plot mirror option flag m_plotMirror = false; // Plot mirror option flag
m_mirrorIsHorizontal = true; m_mirrorIsHorizontal = true;
m_yaxisReversed = false; m_yaxisReversed = false;
m_outputFile = 0; m_outputFile = nullptr;
m_colorMode = false; // Starts as a BW plot m_colorMode = false; // Starts as a BW plot
m_negativeMode = false; m_negativeMode = false;
// Temporary init to avoid not initialized vars, will be set later // Temporary init to avoid not initialized vars, will be set later

View File

@ -83,22 +83,22 @@ public:
m_filterCtrl->SetValidator( *m_filterValidator ); m_filterCtrl->SetValidator( *m_filterValidator );
mainSizer->Add( m_filterCtrl, 0, wxEXPAND, 0 ); 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 ); wxLB_SINGLE|wxLB_NEEDED_SB );
mainSizer->Add( m_listBox, 0, wxEXPAND|wxTOP, 2 ); mainSizer->Add( m_listBox, 0, wxEXPAND|wxTOP, 2 );
SetSizer( mainSizer ); SetSizer( mainSizer );
Layout(); Layout();
Connect( wxEVT_IDLE, wxIdleEventHandler( NET_SELECTOR_COMBOPOPUP::onIdle ), NULL, this ); Connect( wxEVT_IDLE, wxIdleEventHandler( NET_SELECTOR_COMBOPOPUP::onIdle ), nullptr, this );
Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( NET_SELECTOR_COMBOPOPUP::onKeyDown ), NULL, this ); Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( NET_SELECTOR_COMBOPOPUP::onKeyDown ), nullptr, this );
Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( NET_SELECTOR_COMBOPOPUP::onMouseClick ), NULL, this ); Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( NET_SELECTOR_COMBOPOPUP::onMouseClick ), nullptr, this );
m_listBox->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( NET_SELECTOR_COMBOPOPUP::onMouseClick ), NULL, this ); m_listBox->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( NET_SELECTOR_COMBOPOPUP::onMouseClick ), nullptr, this );
m_filterCtrl->Connect( wxEVT_TEXT, wxCommandEventHandler( NET_SELECTOR_COMBOPOPUP::onFilterEdit ), NULL, this ); m_filterCtrl->Connect( wxEVT_TEXT, wxCommandEventHandler( NET_SELECTOR_COMBOPOPUP::onFilterEdit ), nullptr, this );
m_filterCtrl->Connect( wxEVT_TEXT_ENTER, wxCommandEventHandler( NET_SELECTOR_COMBOPOPUP::onEnter ), NULL, this ); m_filterCtrl->Connect( wxEVT_TEXT_ENTER, wxCommandEventHandler( NET_SELECTOR_COMBOPOPUP::onEnter ), nullptr, this );
// <enter> in a ListBox comes in as a double-click on GTK // <enter> 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; return true;
} }
@ -548,13 +548,13 @@ NET_SELECTOR::NET_SELECTOR( wxWindow *parent, wxWindowID id, const wxPoint &pos,
m_netSelectorPopup = new NET_SELECTOR_COMBOPOPUP(); m_netSelectorPopup = new NET_SELECTOR_COMBOPOPUP();
SetPopupControl( m_netSelectorPopup ); 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() NET_SELECTOR::~NET_SELECTOR()
{ {
Disconnect( wxEVT_CHAR_HOOK, wxKeyEventHandler( NET_SELECTOR::onKeyDown ), NULL, this ); Disconnect( wxEVT_CHAR_HOOK, wxKeyEventHandler( NET_SELECTOR::onKeyDown ), nullptr, this );
} }

View File

@ -506,7 +506,7 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, wxPo
} }
GRText( DC, txtpos, color, typeName, orient, wxSize( textSize, textSize ), hjustify, 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 );
} }

View File

@ -2243,7 +2243,7 @@ bool SCH_SEXPR_PLUGIN::DeleteSymbolLib( const wxString& aLibraryPath,
if( m_cache && m_cache->IsFile( aLibraryPath ) ) if( m_cache && m_cache->IsFile( aLibraryPath ) )
{ {
delete m_cache; delete m_cache;
m_cache = 0; m_cache = nullptr;
} }
return true; return true;

View File

@ -4388,7 +4388,7 @@ bool SCH_LEGACY_PLUGIN::DeleteSymbolLib( const wxString& aLibraryPath,
if( m_cache && m_cache->IsFile( aLibraryPath ) ) if( m_cache && m_cache->IsFile( aLibraryPath ) )
{ {
delete m_cache; delete m_cache;
m_cache = 0; m_cache = nullptr;
} }
return true; return true;

View File

@ -312,7 +312,7 @@ bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName )
m_Current_File = wxFopen( aFullFileName, "rt" ); m_Current_File = wxFopen( aFullFileName, "rt" );
if( m_Current_File == NULL ) if( m_Current_File == nullptr )
return false; return false;
wxString msg; wxString msg;
@ -325,7 +325,7 @@ bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName )
while( true ) while( true )
{ {
if( excellonReader.ReadLine() == 0 ) if( excellonReader.ReadLine() == nullptr )
break; break;
char* line = excellonReader.Line(); char* line = excellonReader.Line();
@ -383,7 +383,7 @@ bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName )
X2_ATTRIBUTE dummy; X2_ATTRIBUTE dummy;
char* text = (char*)file_attribute; char* text = (char*)file_attribute;
int dummyline = 0; int dummyline = 0;
dummy.ParseAttribCmd( NULL, NULL, 0, text, dummyline ); dummy.ParseAttribCmd( nullptr, nullptr, 0, text, dummyline );
delete m_FileFunction; delete m_FileFunction;
m_FileFunction = new X2_ATTRIBUTE_FILEFUNCTION( dummy ); 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 ) bool EXCELLON_IMAGE::Execute_HEADER_And_M_Command( char*& text )
{ {
EXCELLON_CMD* cmd = NULL; EXCELLON_CMD* cmd = nullptr;
wxString msg; wxString msg;
// Search command in list // Search command in list
@ -590,7 +590,7 @@ bool EXCELLON_IMAGE::readToolInformation( char*& aText )
// Remember: dcodes are >= FIRST_DCODE // Remember: dcodes are >= FIRST_DCODE
D_CODE* dcode = GetDCODEOrCreate( iprm + FIRST_DCODE ); D_CODE* dcode = GetDCODEOrCreate( iprm + FIRST_DCODE );
if( dcode == NULL ) if( dcode == nullptr )
return false; return false;
// conv_scale = scaling factor from inch to Internal Unit // 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; m_Current_Tool = dcode_id;
D_CODE* currDcode = GetDCODEOrCreate( dcode_id, true ); 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 text = startline; // text starts at the beginning of the command
readToolInformation( text ); readToolInformation( text );
@ -737,7 +737,7 @@ bool EXCELLON_IMAGE::Select_Tool( char*& text )
bool EXCELLON_IMAGE::Execute_EXCELLON_G_Command( char*& text ) bool EXCELLON_IMAGE::Execute_EXCELLON_G_Command( char*& text )
{ {
EXCELLON_CMD* cmd = NULL; EXCELLON_CMD* cmd = nullptr;
bool success = false; bool success = false;
int id = DRILL_G_UNKNOWN; int id = DRILL_G_UNKNOWN;

View File

@ -86,19 +86,19 @@ void GERBER_LAYER::ResetDefaultValues()
GERBER_FILE_IMAGE::GERBER_FILE_IMAGE( int aLayer ) : 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_GraphicLayer = aLayer; // Graphic layer Number
m_IsVisible = true; // must be drawn m_IsVisible = true; // must be drawn
m_PositiveDrawColor = WHITE; // The color used to draw positive items for this image m_PositiveDrawColor = WHITE; // The color used to draw positive items for this image
m_Selected_Tool = 0; m_Selected_Tool = 0;
m_FileFunction = NULL; // file function parameters m_FileFunction = nullptr; // file function parameters
ResetDefaultValues(); ResetDefaultValues();
for( unsigned ii = 0; ii < arrayDim( m_Aperture_List ); ii++ ) 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. // lazily create the D_CODE if it does not exist.
if( aCreateIfNoExist ) if( aCreateIfNoExist )
{ {
if( m_Aperture_List[ndx] == NULL ) if( m_Aperture_List[ndx] == nullptr )
m_Aperture_List[ndx] = new D_CODE( ndx + FIRST_DCODE ); m_Aperture_List[ndx] = new D_CODE( ndx + FIRST_DCODE );
} }
return m_Aperture_List[ndx]; 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 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 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_ImageNegative = false; // true = Negative image
m_IsX2_file = false; // true only if a %TF, %TA or %TD command m_IsX2_file = false; // true only if a %TF, %TA or %TD command
delete m_FileFunction; // file function parameters 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_MD5_value.Empty(); // MD5 value found in a %TF.MD5 command
m_PartString.Empty(); // string found in a %TF.Part command m_PartString.Empty(); // string found in a %TF.Part command
m_hasNegativeItems = -1; // set to uninitialized 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 m_LastArcDataType = ARC_INFO_TYPE_NONE; // Extra coordinate info type for arcs
// (radius or IJ center coord) // (radius or IJ center coord)
m_LineNum = 0; // line number in file being read 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_PolygonFillMode = false;
m_PolygonFillModeState = 0; m_PolygonFillModeState = 0;
m_Selected_Tool = 0; m_Selected_Tool = 0;
@ -274,7 +274,7 @@ void GERBER_FILE_IMAGE::InitToolTable()
{ {
for( int count = 0; count < TOOLS_MAX_COUNT; count++ ) for( int count = 0; count < TOOLS_MAX_COUNT; count++ )
{ {
if( m_Aperture_List[count] == NULL ) if( m_Aperture_List[count] == nullptr )
continue; continue;
m_Aperture_List[count]->m_Num_Dcode = count + FIRST_DCODE; m_Aperture_List[count]->m_Num_Dcode = count + FIRST_DCODE;

View File

@ -45,7 +45,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName )
GERBER_FILE_IMAGE_LIST* images = GetImagesList(); GERBER_FILE_IMAGE_LIST* images = GetImagesList();
GERBER_FILE_IMAGE* gerber = GetGbrImage( layer ); GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
if( gerber != NULL ) if( gerber != nullptr )
{ {
Erase_Current_DrawLayer( false ); Erase_Current_DrawLayer( false );
} }
@ -126,7 +126,7 @@ bool GERBER_FILE_IMAGE::LoadGerberFile( const wxString& aFullFileName )
// Read the gerber file */ // Read the gerber file */
m_Current_File = wxFopen( aFullFileName, wxT( "rt" ) ); m_Current_File = wxFopen( aFullFileName, wxT( "rt" ) );
if( m_Current_File == 0 ) if( m_Current_File == nullptr )
return false; return false;
m_FileName = aFullFileName; m_FileName = aFullFileName;
@ -137,7 +137,7 @@ bool GERBER_FILE_IMAGE::LoadGerberFile( const wxString& aFullFileName )
while( true ) while( true )
{ {
if( fgets( lineBuffer, GERBER_BUFZ, m_Current_File ) == NULL ) if( fgets( lineBuffer, GERBER_BUFZ, m_Current_File ) == nullptr )
break; break;
m_LineNum++; m_LineNum++;

View File

@ -179,7 +179,7 @@ bool GERBER_FILE_IMAGE::ReadRS274XCommand( char *aBuff, unsigned int aBuffSize,
} }
// end of current line, read another one. // 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 // end of file
ok = false; ok = false;
@ -712,7 +712,7 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff,
D_CODE* dcode; D_CODE* dcode;
dcode = GetDCODEOrCreate( code ); dcode = GetDCODEOrCreate( code );
if( dcode == NULL ) if( dcode == nullptr )
break; break;
dcode->m_AperFunction = m_AperFunction; dcode->m_AperFunction = m_AperFunction;
@ -920,7 +920,7 @@ bool GERBER_FILE_IMAGE::GetEndOfBlock( char* aBuff, unsigned int aBuffSize, char
aText++; aText++;
} }
if( fgets( aBuff, aBuffSize, gerber_file ) == NULL ) if( fgets( aBuff, aBuffSize, gerber_file ) == nullptr )
break; break;
m_LineNum++; m_LineNum++;
@ -944,8 +944,8 @@ char* GERBER_FILE_IMAGE::GetNextLine( char *aBuff, unsigned int aBuffSize, char*
break; break;
case 0: // End of text found in aBuff: Read a new string case 0: // End of text found in aBuff: Read a new string
if( fgets( aBuff, aBuffSize, aFile ) == NULL ) if( fgets( aBuff, aBuffSize, aFile ) == nullptr )
return NULL; return nullptr;
m_LineNum++; m_LineNum++;
aText = aBuff; aText = aBuff;
@ -986,7 +986,7 @@ bool GERBER_FILE_IMAGE::ReadApertureMacro( char *aBuff, unsigned int aBuffSize,
aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file ); aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file );
if( aText == NULL ) // End of File if( aText == nullptr ) // End of File
return false; return false;
// aText points the beginning of a new line. // 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.m_localparamStack.push_back( AM_PARAM() );
AM_PARAM& param = am.m_localparamStack.back(); AM_PARAM& param = am.m_localparamStack.back();
aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file ); aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file );
if( aText == NULL) // End of File if( aText == nullptr) // End of File
return false; return false;
param.ReadParam( aText ); param.ReadParam( aText );
continue; continue;
@ -1097,7 +1097,7 @@ bool GERBER_FILE_IMAGE::ReadApertureMacro( char *aBuff, unsigned int aBuffSize,
aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file ); aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file );
if( aText == NULL) // End of File if( aText == nullptr) // End of File
return false; return false;
param.ReadParam( aText ); param.ReadParam( aText );
@ -1121,7 +1121,7 @@ bool GERBER_FILE_IMAGE::ReadApertureMacro( char *aBuff, unsigned int aBuffSize,
// in advance, i.e. be immediate. // in advance, i.e. be immediate.
wxASSERT( prim.params[1].IsImmediate() ); 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 ) 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 ); aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file );
if( aText == NULL ) // End of File if( aText == nullptr ) // End of File
return false; return false;
param.ReadParam( aText ); param.ReadParam( aText );

View File

@ -56,7 +56,7 @@ public:
COLLECTOR() : COLLECTOR() :
m_Threshold( 0 ), m_Threshold( 0 ),
m_MenuCancelled( false ), m_MenuCancelled( false ),
m_scanTypes( 0 ), m_scanTypes( nullptr ),
// Inspect() is virtual so calling it from a class common inspector preserves // Inspect() is virtual so calling it from a class common inspector preserves
// polymorphism. // polymorphism.
m_inspector( [=]( EDA_ITEM* aItem, void* aTestData ) m_inspector( [=]( EDA_ITEM* aItem, void* aTestData )

View File

@ -169,7 +169,7 @@ public:
typedef std::vector<std::unique_ptr<FOOTPRINT_INFO>> FPILIST; typedef std::vector<std::unique_ptr<FOOTPRINT_INFO>> FPILIST;
typedef SYNC_QUEUE<std::unique_ptr<IO_ERROR>> ERRLIST; typedef SYNC_QUEUE<std::unique_ptr<IO_ERROR>> ERRLIST;
FOOTPRINT_LIST() : m_lib_table( 0 ) FOOTPRINT_LIST() : m_lib_table( nullptr )
{ {
} }

View File

@ -160,7 +160,7 @@ private:
struct TokenStat struct TokenStat
{ {
enum { OutLen = 32 }; 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") const char* input; // current input string ("var=4")
char* token; // output token ("var", type:VAR; "4", type:VALUE) char* token; // output token ("var", type:VAR; "4", type:VALUE)
size_t inputLen; // strlen(input) size_t inputLen; // strlen(input)

View File

@ -190,7 +190,7 @@ public:
COROUTINE( std::function<ReturnType(ArgType)> aEntry ) : COROUTINE( std::function<ReturnType(ArgType)> aEntry ) :
m_func( std::move( aEntry ) ), m_func( std::move( aEntry ) ),
m_running( false ), m_running( false ),
m_args( 0 ), m_args( nullptr ),
m_caller(), m_caller(),
m_callContext( nullptr ), m_callContext( nullptr ),
m_callee(), m_callee(),

View File

@ -57,7 +57,7 @@ wxPoint BOARD_ITEM::ZeroOffset( 0, 0 );
BOARD::BOARD() : BOARD::BOARD() :
BOARD_ITEM_CONTAINER( (BOARD_ITEM*) NULL, PCB_T ), BOARD_ITEM_CONTAINER( (BOARD_ITEM*) nullptr, PCB_T ),
m_boardUse( BOARD_USE::NORMAL ), m_boardUse( BOARD_USE::NORMAL ),
m_timeStamp( 1 ), m_timeStamp( 1 ),
m_paper( PAGE_INFO::A4 ), m_paper( PAGE_INFO::A4 ),
@ -279,7 +279,7 @@ void BOARD::Move( const wxPoint& aMoveVector ) // overload
return SEARCH_RESULT::CONTINUE; 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 // visit this BOARD's TRACKs and VIAs with above TRACK INSPECTOR which
// appends all in aNetCode to ret. // appends all in aNetCode to ret.
Visit( inspector, NULL, GENERAL_COLLECTOR::Tracks ); Visit( inspector, nullptr, GENERAL_COLLECTOR::Tracks );
return ret; return ret;
} }
@ -562,9 +562,9 @@ bool BOARD::IsFootprintLayerVisible( PCB_LAYER_ID aLayer ) const
void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode ) 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; return;
} }
@ -664,7 +664,7 @@ void BOARD::FinalizeBulkRemove( std::vector<BOARD_ITEM*>& aRemovedItems )
void BOARD::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aRemoveMode ) 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 ); wxASSERT( aBoardItem );
switch( aBoardItem->Type() ) 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. // 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. // 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 ); wxASSERT( m_NetInfo.GetNetCount() > 0 );
@ -1505,7 +1505,7 @@ PAD* BOARD::GetPad( const wxPoint& aPosition, LSET aLayerSet ) const
for( FOOTPRINT* footprint : m_footprints ) for( FOOTPRINT* footprint : m_footprints )
{ {
PAD* pad = NULL; PAD* pad = nullptr;
if( footprint->HitTest( aPosition ) ) if( footprint->HitTest( aPosition ) )
pad = footprint->GetPad( aPosition, aLayerSet ); pad = footprint->GetPad( aPosition, aLayerSet );
@ -1514,7 +1514,7 @@ PAD* BOARD::GetPad( const wxPoint& aPosition, LSET aLayerSet ) const
return pad; return pad;
} }
return NULL; return nullptr;
} }
@ -1601,7 +1601,7 @@ PAD* BOARD::GetPad( std::vector<PAD*>& aPadList, const wxPoint& aPosition, LSET
} }
// Not found: // Not found:
return 0; return nullptr;
} }
if( pad->GetPosition().x == aPosition.x ) // Must search considering Y coordinate if( pad->GetPosition().x == aPosition.x ) // Must search considering Y coordinate
@ -1637,7 +1637,7 @@ PAD* BOARD::GetPad( std::vector<PAD*>& aPadList, const wxPoint& aPosition, LSET
} }
} }
return NULL; return nullptr;
} }
@ -1765,8 +1765,8 @@ std::tuple<int, double, double> BOARD::GetTrackLength( const TRACK& aTrack ) con
FOOTPRINT* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer, FOOTPRINT* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked ) const bool aVisibleOnly, bool aIgnoreLocked ) const
{ {
FOOTPRINT* footprint = NULL; FOOTPRINT* footprint = nullptr;
FOOTPRINT* alt_footprint = NULL; FOOTPRINT* alt_footprint = nullptr;
int min_dim = 0x7FFFFFFF; int min_dim = 0x7FFFFFFF;
int alt_min_dim = 0x7FFFFFFF; int alt_min_dim = 0x7FFFFFFF;
bool current_layer_back = IsBackLayer( aActiveLayer ); bool current_layer_back = IsBackLayer( aActiveLayer );
@ -1822,7 +1822,7 @@ FOOTPRINT* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLa
if( alt_footprint) if( alt_footprint)
return alt_footprint; return alt_footprint;
return NULL; return nullptr;
} }

View File

@ -406,7 +406,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
} }
// Emit component pads // Emit component pads
PAD* old_pad = 0; PAD* old_pad = nullptr;
int pad_name_number = 0; int pad_name_number = 0;
for( unsigned i = 0; i<pads.size(); ++i ) for( unsigned i = 0; i<pads.size(); ++i )

View File

@ -653,7 +653,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
} }
else 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 ) ); PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );

View File

@ -50,7 +50,7 @@ FOOTPRINT::FOOTPRINT( BOARD* parent ) :
m_visibleBBoxCacheTimeStamp( 0 ), m_visibleBBoxCacheTimeStamp( 0 ),
m_textExcludedBBoxCacheTimeStamp( 0 ), m_textExcludedBBoxCacheTimeStamp( 0 ),
m_hullCacheTimeStamp( 0 ), m_hullCacheTimeStamp( 0 ),
m_initial_comments( 0 ) m_initial_comments( nullptr )
{ {
m_attributes = 0; m_attributes = 0;
m_layer = F_Cu; m_layer = F_Cu;
@ -962,7 +962,7 @@ PAD* FOOTPRINT::FindPadByName( const wxString& aPadName ) const
return pad; return pad;
} }
return NULL; return nullptr;
} }
@ -978,7 +978,7 @@ PAD* FOOTPRINT::GetPad( const wxPoint& aPosition, LSET aLayerMask )
return pad; 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* FOOTPRINT::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootprint )
{ {
BOARD_ITEM* new_item = NULL; BOARD_ITEM* new_item = nullptr;
FP_ZONE* new_zone = NULL; FP_ZONE* new_zone = nullptr;
switch( aItem->Type() ) switch( aItem->Type() )
{ {

View File

@ -83,10 +83,10 @@ bool FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard( FOOTPRINT* aFootprint )
FOOTPRINT* newFootprint = nullptr; FOOTPRINT* newFootprint = nullptr;
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false ); 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; return false;
if( aFootprint == NULL ) if( aFootprint == nullptr )
{ {
if( !frame->GetBoard() || !frame->GetBoard()->GetFirstFootprint() ) if( !frame->GetBoard() || !frame->GetBoard()->GetFirstFootprint() )
return false; return false;
@ -94,7 +94,7 @@ bool FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard( FOOTPRINT* aFootprint )
aFootprint = SelectFootprintFromBoard( frame->GetBoard() ); aFootprint = SelectFootprintFromBoard( frame->GetBoard() );
} }
if( aFootprint == NULL ) if( aFootprint == nullptr )
return false; return false;
// Ensure we do not have the pad editor open (that is apseudo modal dlg). // 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 ); DIALOG_CHOOSE_FOOTPRINT dialog( this, title, ptr );
if( dialog.ShowQuasiModal() == wxID_CANCEL ) if( dialog.ShowQuasiModal() == wxID_CANCEL )
return NULL; return nullptr;
if( dialog.IsExternalBrowserSelected() ) if( dialog.IsExternalBrowserSelected() )
{ {
@ -277,7 +277,7 @@ FOOTPRINT* PCB_BASE_FRAME::SelectFootprintFromLibTree( LIB_ID aPreselect )
footprintName = SelectFootprintFromLibBrowser(); footprintName = SelectFootprintFromLibBrowser();
if( footprintName.IsEmpty() ) // Cancel command if( footprintName.IsEmpty() ) // Cancel command
return NULL; return nullptr;
else else
fpid.Parse( footprintName ); fpid.Parse( footprintName );
} }
@ -286,7 +286,7 @@ FOOTPRINT* PCB_BASE_FRAME::SelectFootprintFromLibTree( LIB_ID aPreselect )
fpid = dialog.GetSelectedLibId(); fpid = dialog.GetSelectedLibId();
if( !fpid.IsValid() ) if( !fpid.IsValid() )
return NULL; return nullptr;
else else
footprintName = fpid.Format(); 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* PCB_BASE_FRAME::LoadFootprint( const LIB_ID& aFootprintId )
{ {
FOOTPRINT* footprint = NULL; FOOTPRINT* footprint = nullptr;
try try
{ {
@ -329,7 +329,7 @@ FOOTPRINT* PCB_BASE_FRAME::loadFootprint( const LIB_ID& aFootprintId )
{ {
FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs(); 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; FOOTPRINT *footprint = nullptr;
@ -387,7 +387,7 @@ FOOTPRINT* FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard( BOARD* aPcb )
if( dlg.ShowModal() == wxID_OK ) if( dlg.ShowModal() == wxID_OK )
fpname = dlg.GetTextSelection(); fpname = dlg.GetTextSelection();
else else
return NULL; return nullptr;
oldName = fpname; 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 static PICKED_ITEMS_LIST s_PickedList; // A pick-list to save initial footprint
// and dragged tracks // and dragged tracks
@ -470,7 +470,7 @@ FOOTPRINT* PCB_BASE_FRAME::GetFootprintFromBoardByReference()
DIALOG_GET_FOOTPRINT_BY_NAME dlg( this, fplist ); DIALOG_GET_FOOTPRINT_BY_NAME dlg( this, fplist );
if( dlg.ShowModal() != wxID_OK ) //Aborted by user if( dlg.ShowModal() != wxID_OK ) //Aborted by user
return NULL; return nullptr;
footprintName = dlg.GetValue(); footprintName = dlg.GetValue();
footprintName.Trim( true ); footprintName.Trim( true );
@ -491,7 +491,7 @@ FOOTPRINT* PCB_BASE_FRAME::GetFootprintFromBoardByReference()
void PCB_BASE_FRAME::PlaceFootprint( FOOTPRINT* aFootprint, bool aRecreateRatsnest ) void PCB_BASE_FRAME::PlaceFootprint( FOOTPRINT* aFootprint, bool aRecreateRatsnest )
{ {
if( aFootprint == 0 ) if( aFootprint == nullptr )
return; return;
OnModify(); OnModify();
@ -505,7 +505,7 @@ void PCB_BASE_FRAME::PlaceFootprint( FOOTPRINT* aFootprint, bool aRecreateRatsne
ITEM_PICKER picker( nullptr, aFootprint, UNDO_REDO::CHANGED ); ITEM_PICKER picker( nullptr, aFootprint, UNDO_REDO::CHANGED );
picker.SetLink( s_FootprintInitialCopy ); picker.SetLink( s_FootprintInitialCopy );
s_PickedList.PushItem( picker ); 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() ) if( s_PickedList.GetCount() )
@ -521,7 +521,7 @@ void PCB_BASE_FRAME::PlaceFootprint( FOOTPRINT* aFootprint, bool aRecreateRatsne
aFootprint->ClearFlags(); aFootprint->ClearFlags();
delete s_FootprintInitialCopy; delete s_FootprintInitialCopy;
s_FootprintInitialCopy = NULL; s_FootprintInitialCopy = nullptr;
if( aRecreateRatsnest ) if( aRecreateRatsnest )
m_pcb->GetConnectivity()->Update( aFootprint ); m_pcb->GetConnectivity()->Update( aFootprint );

View File

@ -818,20 +818,20 @@ bool GPCB_FPL_CACHE::testFlags( const wxString& aFlag, long aMask, const wxChar*
GPCB_PLUGIN::GPCB_PLUGIN() : GPCB_PLUGIN::GPCB_PLUGIN() :
m_cache( 0 ), m_cache( nullptr ),
m_ctl( 0 ) m_ctl( 0 )
{ {
m_reader = NULL; m_reader = nullptr;
init( 0 ); init( nullptr );
} }
GPCB_PLUGIN::GPCB_PLUGIN( int aControlFlags ) : GPCB_PLUGIN::GPCB_PLUGIN( int aControlFlags ) :
m_cache( 0 ), m_cache( nullptr ),
m_ctl( aControlFlags ) m_ctl( aControlFlags )
{ {
m_reader = NULL; m_reader = nullptr;
init( 0 ); init( nullptr );
} }
@ -915,7 +915,7 @@ const FOOTPRINT* GPCB_PLUGIN::getFootprint( const wxString& aLibraryPath,
FOOTPRINT_MAP::const_iterator it = mods.find( TO_UTF8( aFootprintName ) ); FOOTPRINT_MAP::const_iterator it = mods.find( TO_UTF8( aFootprintName ) );
if( it == mods.end() ) if( it == mods.end() )
return NULL; return nullptr;
return it->second->GetFootprint(); return it->second->GetFootprint();
} }
@ -1036,7 +1036,7 @@ bool GPCB_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, const PROPER
if( m_cache && m_cache->GetPath() == aLibraryPath ) if( m_cache && m_cache->GetPath() == aLibraryPath )
{ {
delete m_cache; delete m_cache;
m_cache = NULL; m_cache = nullptr;
} }
return true; return true;
@ -1053,7 +1053,7 @@ bool GPCB_PLUGIN::IsFootprintLibWritable( const wxString& aLibraryPath )
{ {
LOCALE_IO toggle; LOCALE_IO toggle;
init( NULL ); init( nullptr );
validateCache( aLibraryPath ); validateCache( aLibraryPath );

View File

@ -1760,7 +1760,7 @@ void PCB_IO::format( const TRACK* aTrack, int aNestLevel ) const
const VIA* via = static_cast<const VIA*>( aTrack ); const VIA* via = static_cast<const VIA*>( aTrack );
BOARD* board = (BOARD*) via->GetParent(); 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." ) ); via->GetSelectMenuText( EDA_UNITS::MILLIMETRES ) + wxT( " has no parent." ) );
m_out->Print( aNestLevel, "(via" ); 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 ) : PCB_IO::PCB_IO( int aControlFlags ) :
m_cache( 0 ), m_cache( nullptr ),
m_ctl( aControlFlags ), m_ctl( aControlFlags ),
m_parser( new PCB_PARSER() ), m_parser( new PCB_PARSER() ),
m_mapping( new NETINFO_MAPPING() ) m_mapping( new NETINFO_MAPPING() )
{ {
init( 0 ); init( nullptr );
m_out = &m_sf; m_out = &m_sf;
} }

View File

@ -68,7 +68,7 @@ struct LAYER;
class PCB_PARSER : public PCB_LEXER class PCB_PARSER : public PCB_LEXER
{ {
public: public:
PCB_PARSER( LINE_READER* aReader = NULL ) : PCB_PARSER( LINE_READER* aReader = nullptr ) :
PCB_LEXER( aReader ), PCB_LEXER( aReader ),
m_board( nullptr ), m_board( nullptr ),
m_resetKIIDs( false ) m_resetKIIDs( false )
@ -108,7 +108,7 @@ public:
* wxArrayString to this function and care must be taken to * wxArrayString to this function and care must be taken to
* delete it even on exception. * 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 * Return whether a version number, if any was parsed, was too recent
@ -189,7 +189,7 @@ private:
DIMENSION_BASE* parseDIMENSION(); DIMENSION_BASE* parseDIMENSION();
// Parse a footprint, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically. // 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_TEXT* parseFP_TEXT();
FP_SHAPE* parseFP_SHAPE(); FP_SHAPE* parseFP_SHAPE();

View File

@ -188,7 +188,7 @@ typedef unsigned LAYER_MSK;
static const char delims[] = " \t\r\n"; 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)) #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 ) if( m_cache && m_cache->m_lib_path == aLibraryPath )
{ {
delete m_cache; delete m_cache;
m_cache = 0; m_cache = nullptr;
} }
return true; return true;

View File

@ -99,7 +99,7 @@ bool COMPONENT_DRAGGER::Start( const VECTOR2I& aP, ITEM_SET& aPrimitives )
{ {
LINKED_ITEM* li = static_cast<LINKED_ITEM*>( extraJoint->LinkList()[0].item ); LINKED_ITEM* li = static_cast<LINKED_ITEM*>( 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() ); addLinked( solid, li, extraJoint->Pos() - solid->Pos() );
} }
} }

View File

@ -151,7 +151,7 @@ int SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb, int aNetCode, LA
{ {
ZONE* zone = aPcb->GetArea( ii ); ZONE* zone = aPcb->GetArea( ii );
if( zone == NULL ) // End of list if( zone == nullptr ) // End of list
break; break;
if( aNetCode >= 0 && aNetCode != zone->GetNetCode() ) if( aNetCode >= 0 && aNetCode != zone->GetNetCode() )
@ -221,7 +221,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
{ {
ZONE* zone = aPcb->GetArea( ii ); ZONE* zone = aPcb->GetArea( ii );
if( zone == NULL ) if( zone == nullptr )
{ {
/* End of list: the stored item is not found: /* End of list: the stored item is not found:
* it must be in aDeletedList: * it must be in aDeletedList:
@ -232,7 +232,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
if( status == UNDO_REDO::NEWITEM ) if( status == UNDO_REDO::NEWITEM )
{ {
delete ref; delete ref;
ref = NULL; ref = nullptr;
aPickList.RemovePicker( kk ); aPickList.RemovePicker( kk );
kk--; kk--;
} }
@ -241,13 +241,13 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
ZONE* zcopy = (ZONE*) aPickList.GetPickedItemLink( kk ); ZONE* zcopy = (ZONE*) aPickList.GetPickedItemLink( kk );
aPickList.SetPickedItemStatus( UNDO_REDO::DELETED, kk ); aPickList.SetPickedItemStatus( UNDO_REDO::DELETED, kk );
wxASSERT_MSG( zcopy != NULL, wxASSERT_MSG( zcopy != nullptr,
wxT( "UpdateCopyOfZonesList() error: link = NULL" ) ); wxT( "UpdateCopyOfZonesList() error: link = NULL" ) );
*ref = *zcopy; *ref = *zcopy;
// the copy was deleted; the link does not exists now. // the copy was deleted; the link does not exists now.
aPickList.SetPickedItemLink( NULL, kk ); aPickList.SetPickedItemLink( nullptr, kk );
delete zcopy; delete zcopy;
} }
@ -256,7 +256,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
for( unsigned nn = 0; nn < aAuxiliaryList.GetCount(); nn++ ) 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 ); aAuxiliaryList.RemovePicker( nn );
notfound = false; notfound = false;
@ -270,7 +270,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
#if defined(DEBUG) #if defined(DEBUG)
printf( "UpdateCopyOfZonesList(): item not found in aAuxiliaryList," printf( "UpdateCopyOfZonesList(): item not found in aAuxiliaryList,"
"combined with another zone\n" ); "combined with another zone\n" );
fflush(0); fflush(nullptr);
#endif #endif
} }
break; break;

View File

@ -147,7 +147,7 @@ class LOCALESWITCH
public: public:
LOCALESWITCH() LOCALESWITCH()
{ {
m_locale = setlocale( LC_NUMERIC, 0 ); m_locale = setlocale( LC_NUMERIC, NULL );
setlocale( LC_NUMERIC, "C" ); setlocale( LC_NUMERIC, "C" );
} }