From abaa9076d96670f66a413ef35d527c190e6e42ba Mon Sep 17 00:00:00 2001
From: Sebastião Guerra <sebastiao.luiz.guerra@gmail.com>
Date: Sat, 3 Oct 2026 17:47:40 -0300
Subject: Replace NULL pointer constants with nullptr
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Sebastião Guerra <sebastiao.luiz.guerra@gmail.com>
---
 src/cassembler.cpp     | 22 +++++++++++-----------
 src/cpicoblaze.cpp     | 20 ++++++++++----------
 src/jtagprogrammer.cpp |  2 +-
 src/kpicosim.cpp       | 18 +++++++++---------
 4 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/src/cassembler.cpp b/src/cassembler.cpp
index fe7965f..212a405 100644
--- a/src/cassembler.cpp
+++ b/src/cassembler.cpp
@@ -503,7 +503,7 @@ bool CAssembler::exportVHDL( string templateFile, string outputDir, string entit
 	for ( addr = i = j = k = l = 0, n = 0 ; addr < 1024 ; addr++ ) {			
 		instr = m_code->getInstruction( addr ) ;
 		
-		if ( instr == NULL ) d = 0 ;
+		if ( !instr ) d = 0 ;
 		else d = instr->getHexCode() ;
 		
 						
@@ -529,14 +529,14 @@ bool CAssembler::exportVHDL( string templateFile, string outputDir, string entit
 	}
 	
 	FILE * infile = fopen( templateFile.c_str(), "r" ) ;
-	if ( infile == NULL ) {
+	if ( !infile ) {
 		error( NO_LINE_NR, string( "Unable to open VHDL template file '" + templateFile + "'" ).c_str() ) ;
 		return false ;
 	}
 	
 	string exportFile = outputDir + "/" + entityName + ".vhd" ;
 	FILE * outfile = fopen( exportFile.c_str(), "w" ) ;		
-	if ( outfile == NULL ) {
+	if ( !outfile ) {
 		error( NO_LINE_NR , string( "Unable to open VHDL template file '%s'" + exportFile + ".vhd").c_str() ) ;
 		return false ;
 	}
@@ -591,7 +591,7 @@ bool CAssembler::exportVHDL( string templateFile, string outputDir, string entit
 bool CAssembler::exportHEX( string filename, bool mem )
 {
 	FILE * file = fopen( filename.c_str(), "w" ) ;		
-	if ( file == NULL ) {
+	if ( !file ) {
 		error( NO_LINE_NR , string( "Unable to write to file '" + filename + "'").c_str() ) ;
 		return false ;
 	}
@@ -607,7 +607,7 @@ bool CAssembler::exportHEX( string filename, bool mem )
 	for ( addr = 0 ; addr < 1024 ; addr++ ) {			
 		instr = m_code->getInstruction( addr ) ;
 		
-		if ( instr == NULL ) d = 0 ;
+		if ( !instr ) d = 0 ;
 		else d = instr->getHexCode() ;
 
 		fprintf( file, "%05X\r\n", d ) ;
@@ -676,7 +676,7 @@ char * CAssembler::getWord( char *s, char *word ) {
 	start = s ;
 	
 	if ( *start == '\0' || *start == '\r' || *start == '\n' || *start == ';' )	// end of line
-		return NULL ;
+		return nullptr ;
 		
 	while ( *s != ' ' && *s != '\t' && *s != '\0' && *s != '\r' && *s != '\n' && 
 	        *s != ';'  && *s != ',' && *s != ':' && *s != '(' && *s != ')' )
@@ -694,7 +694,7 @@ char * CAssembler::getWord( char *s, char *word ) {
 		*word = '\0' ;
 		return end + 1 ;
 	} else
-		return NULL ;
+		return nullptr ;
 }
 
 CSourceLine * CAssembler::formatLine( int lineNr, char *s )
@@ -705,7 +705,7 @@ CSourceLine * CAssembler::formatLine( int lineNr, char *s )
 	next = getWord( s, word ) ; 
 	if ( word[ 0 ] == '\0' ) {			// empty line
 		delete sourceLine ;
-		return NULL ;
+		return nullptr ;
 	}
 	
 	do {
@@ -713,7 +713,7 @@ CSourceLine * CAssembler::formatLine( int lineNr, char *s )
 		next = getWord( next, word ) ;	
 		if ( word[ 0 ] == '\0' )
 			break ;
-	} while ( next != NULL ) ;
+	} while ( next ) ;
 	
 	return sourceLine ;
 }
@@ -724,7 +724,7 @@ bool CAssembler::loadFile()
 
 	f = fopen( m_filename.c_str(), "r" ) ;
 
-	if ( f == NULL ) {
+	if ( !f ) {
 		string str =  "Unable to load file '" + m_filename + "'";
 		error( NO_LINE_NR, str.c_str() ) ;							// No linenumber information
 		return false ;
@@ -733,7 +733,7 @@ bool CAssembler::loadFile()
 	int linenr = 0 ;
 	while( fgets( buf, sizeof( buf ), f ) ) {
 		CSourceLine *sourceLine = formatLine( linenr++, buf ) ;
-		if ( sourceLine != NULL )
+		if ( sourceLine )
 			m_source.push_back( sourceLine ) ;
 	}
 
diff --git a/src/cpicoblaze.cpp b/src/cpicoblaze.cpp
index 6dff08e..9246af2 100644
--- a/src/cpicoblaze.cpp
+++ b/src/cpicoblaze.cpp
@@ -136,7 +136,7 @@ CCode::CCode( CPicoBlaze *cpu )
 	
 	int i ;
 	for ( i = 0 ; i < MAX_ADDRESS ; i++ )
-		CodeMap[ i ] = NULL ;
+		CodeMap[ i ] = nullptr ;
 }
 
 CCode::~CCode()
@@ -147,9 +147,9 @@ CCode::~CCode()
 void CCode::ClearCode() {	
 	int i ;
 	for ( i = 0 ; i < MAX_ADDRESS ; i++ )
-		if ( CodeMap[ i ] != NULL ) {
+		if ( CodeMap[ i ] ) {
 			delete CodeMap[ i ] ;
-			CodeMap[ i ] = NULL ;
+			CodeMap[ i ] = nullptr ;
 		}
 }
 
@@ -290,13 +290,13 @@ CInstruction * CCode::Disassemble( uint32_t code )
 */
 	cout << "Invalid code (" << code << ")\r\n" ;
 	
-	return NULL ;
+	return nullptr ;
 }
 
 bool CCode::setInstruction( uint16_t address, uint32_t code, unsigned int sourceLine )
 {
 	CInstruction *instr = Disassemble( code ) ;
-	if ( instr == NULL ) {
+	if ( !instr ) {
 		cout << ">>>>Unknown code at address " << address << "<<<<\r\n" ;
 		return false ;
 	}
@@ -308,7 +308,7 @@ bool CCode::setInstruction( uint16_t address, uint32_t code, unsigned int source
 	}
 	
 	
-	if ( CodeMap[ address ] != NULL ) {
+	if ( CodeMap[ address ] ) {
 		cout << ">>>>Code is placed at same address (" << address << ")<<<<\r\n" ;
 		delete instr ;
 		return false ;
@@ -323,7 +323,7 @@ bool CCode::setInstruction( uint16_t address, uint32_t code, unsigned int source
 CInstruction * CCode::getInstruction( uint16_t address )
 {
 	if ( address >= MAX_ADDRESS )
-		return NULL ;
+		return nullptr ;
 	else
 		return CodeMap[ address ] ;
 }
@@ -334,7 +334,7 @@ void CCode::Print()
 	
 	cout << "----listing----\r\n" ;
 	for ( i = 0 ; i < MAX_ADDRESS ;  i++ ) {
-		if ( CodeMap[ i ] != NULL ) {
+		if ( CodeMap[ i ] ) {
 			cout << i << "  : " ;
 			CodeMap[ i ]->Print() ;
 			cout << "\r\n" ;
@@ -402,7 +402,7 @@ void CPicoBlaze::Print()
 unsigned int CPicoBlaze::GetNextSourceLine()
 {
 	CInstruction *instr = code->getInstruction( pc->Get() ) ;
-	if ( instr == NULL ) {
+	if ( !instr ) {
 		cout << ">>>>Error in simulation (No code found at " << pc->Get() << ")<<<<\r\n" ;
 		return false ;
 	}
@@ -413,7 +413,7 @@ unsigned int CPicoBlaze::GetNextSourceLine()
 bool CPicoBlaze::Next()
 {
 	CInstruction *instr = code->getInstruction( pc->Get() ) ;
-	if ( instr == NULL ) {
+	if ( !instr ) {
 		cout << ">>>>Error in simulation (No code found at " << pc->Get() << ")<<<<\r\n" ;
 		return false ;
 	}
diff --git a/src/jtagprogrammer.cpp b/src/jtagprogrammer.cpp
index 7060ee0..5a68f87 100644
--- a/src/jtagprogrammer.cpp
+++ b/src/jtagprogrammer.cpp
@@ -169,7 +169,7 @@ void JTAGProgrammer::program()
 /* ....Send bit file.....*/
 	FILE *bit_file ;
 	bit_file = fopen( m_bitFilename.c_str(), "r" ) ;
-	if ( bit_file == NULL ) {
+	if ( !bit_file ) {
 		emit message( "Could not read bit file\n" ) ;
 		goto exit ;
 	}
diff --git a/src/kpicosim.cpp b/src/kpicosim.cpp
index dbb70d4..f613ef4 100644
--- a/src/kpicosim.cpp
+++ b/src/kpicosim.cpp
@@ -154,8 +154,8 @@ KPicoSim::KPicoSim() : TDEMainWindow( 0, "KPicoSim" )
 	m_simulator->setMessageList( m_messages ) ;
 
 	m_simulationMode = false ;
-	m_scratchpadView = NULL ;
-	m_serialView = NULL ;
+	m_scratchpadView = nullptr ;
+	m_serialView = nullptr ;
 
 	statusBar()->insertItem( TQString( "Mode: Edit" ), 0 ) ;
 	statusBar()->insertItem( TQString( "Status: Stopped" ), 1 ) ;
@@ -372,20 +372,20 @@ void KPicoSim::newIOPort()
 
 void KPicoSim::showSerialPort()
 {
-	if ( m_serialView == NULL ) {
+	if ( !m_serialView ) {
 		m_serialView = new KSerialView( m_simulator->getCpu(), m_tabWidget ) ;
 		m_tabWidget->addTab( m_serialView, "Serial" ) ;
 		m_peripheralMenu->setItemChecked( VIEW_SERIAL_ID, true ) ;
 	} else {
 		m_peripheralMenu->setItemChecked( VIEW_SERIAL_ID, false ) ;
 		delete m_serialView ;
-		m_serialView = NULL ;
+		m_serialView = nullptr ;
 	}
 }
 
 void KPicoSim::showScratchpad()
 {
-	if ( m_scratchpadView == NULL ) {
+	if ( !m_scratchpadView ) {
 		m_scratchpadView = new KScratchpadView( this ) ;
 		updateScratchpadView() ;
 		addDockWindow( m_scratchpadView, DockRight ) ;
@@ -393,7 +393,7 @@ void KPicoSim::showScratchpad()
 	} else {
 		m_peripheralMenu->setItemChecked( VIEW_SCRATCHPAD_ID, false ) ;
 		delete m_scratchpadView ; 
-		m_scratchpadView = NULL ;
+		m_scratchpadView = nullptr ;
 	}
 }
 
@@ -479,7 +479,7 @@ void KPicoSim::updateViews()
 
 void KPicoSim::updateScratchpadView()
 {
-	if ( m_scratchpadView != NULL ) {
+	if ( m_scratchpadView ) {
 		unsigned char sp_ram[ 64 ] ;
 		m_simulator->getScratchpad( sp_ram ) ;
 		m_scratchpadView->setContent( sp_ram, sizeof( sp_ram ) ) ;
@@ -585,8 +585,8 @@ void KPicoSim::closeGUI()
 
 	config.setGroup( "Peripherals" ) ;
 	
-	config.writeEntry( "serial", m_serialView != NULL ) ;
-	config.writeEntry( "scratchpad", m_scratchpadView != NULL ) ; 
+	config.writeEntry( "serial", m_serialView != nullptr ) ;
+	config.writeEntry( "scratchpad", m_scratchpadView != nullptr ) ; 
 	config.writeEntry( "filename", m_editor->getFilename() ) ;
 	config.writeEntry( "bitfile", m_bitfile ) ;
 
-- 
cgit v1.2.3

