More NULL expunging.

This commit is contained in:
Wayne Stambaugh
2021-07-16 16:13:41 -04:00
parent d1c9572bcc
commit cb72da294a
119 changed files with 1305 additions and 1307 deletions
+14 -10
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2010 jean-pierre.charras
* Copyright (C) 1992-2021 Kicad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -439,7 +439,7 @@ bool BM2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
m_NB_Image = m_Greyscale_Image;
Binarize( (double) m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
Binarize( (double) m_sliderThreshold->GetValue() / m_sliderThreshold->GetMax() );
m_buttonExportFile->Enable( true );
m_buttonExportClipboard->Enable( true );
@@ -526,7 +526,7 @@ void BM2CMP_FRAME::OnSizeChangeX( wxCommandEvent& event )
if( getUnitFromSelection() == EDA_UNITS::UNSCALED )
{
// for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked.
// just rescale the other dpi
// just re-scale the other dpi
double ratio = new_size / m_outputSizeX.GetOutputSize();
calculatedY = m_outputSizeY.GetOutputSize() * ratio;
}
@@ -555,7 +555,7 @@ void BM2CMP_FRAME::OnSizeChangeY( wxCommandEvent& event )
if( getUnitFromSelection() == EDA_UNITS::UNSCALED )
{
// for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked.
// just rescale the other dpi
// just re-scale the other dpi
double ratio = new_size / m_outputSizeX.GetOutputSize();
calculatedX = m_outputSizeX.GetOutputSize() * ratio;
}
@@ -671,6 +671,7 @@ void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event )
void BM2CMP_FRAME::OnExportToFile( wxCommandEvent& event )
{
m_exportToClipboard = false;
// choices of m_rbOutputFormat are expected to be in same order as
// OUTPUT_FMT_ID. See bitmap2component.h
OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_rbOutputFormat->GetSelection();
@@ -681,6 +682,7 @@ void BM2CMP_FRAME::OnExportToFile( wxCommandEvent& event )
void BM2CMP_FRAME::OnExportToClipboard( wxCommandEvent& event )
{
m_exportToClipboard = true;
// choices of m_rbOutputFormat are expected to be in same order as
// OUTPUT_FMT_ID. See bitmap2component.h
OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_rbOutputFormat->GetSelection();
@@ -691,7 +693,7 @@ void BM2CMP_FRAME::OnExportToClipboard( wxCommandEvent& event )
wxLogNull doNotLog; // disable logging of failed clipboard actions
// Write buffer to the clipboard
if (wxTheClipboard->Open())
if( wxTheClipboard->Open() )
{
// This data objects are held by the clipboard,
// so do not delete them in the app.
@@ -700,7 +702,9 @@ void BM2CMP_FRAME::OnExportToClipboard( wxCommandEvent& event )
wxTheClipboard->Close();
}
else
{
wxMessageBox( _( "Unable to export to the Clipboard") );
}
}
@@ -749,7 +753,7 @@ void BM2CMP_FRAME::OnExportLogo()
FILE* outfile;
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
if( outfile == NULL )
if( outfile == nullptr )
{
wxString msg;
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
@@ -789,7 +793,7 @@ void BM2CMP_FRAME::exportPostScriptFormat()
FILE* outfile;
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
if( outfile == NULL )
if( outfile == nullptr )
{
wxString msg;
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
@@ -828,7 +832,7 @@ void BM2CMP_FRAME::exportEeschemaFormat()
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
if( outfile == NULL )
if( outfile == nullptr )
{
wxString msg;
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
@@ -867,7 +871,7 @@ void BM2CMP_FRAME::exportPcbnewFormat()
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
if( outfile == NULL )
if( outfile == nullptr )
{
wxString msg;
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
@@ -917,7 +921,7 @@ void BM2CMP_FRAME::ExportToBuffer( std::string& aOutput, OUTPUT_FMT_ID aFormat )
BITMAPCONV_INFO converter( aOutput );
converter.ConvertBitmap( potrace_bitmap, aFormat, m_outputSizeX.GetOutputDPI(),
m_outputSizeY.GetOutputDPI(), modLayer );
m_outputSizeY.GetOutputDPI(), modLayer );
if( !converter.GetErrorMessages().empty() )
wxMessageBox( converter.GetErrorMessages().c_str(), _( "Errors" ) );