Commit 10d67ffb authored by jean-pierre charras's avatar jean-pierre charras

Fix some coverity warnings (not initialized members). Add comments. Better...

Fix some coverity warnings (not initialized members). Add comments. Better (more informative) title in dialog to download .pretty libs.
parent dbdadbf5
......@@ -80,6 +80,18 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) :
{
m_init = false;
m_shadow_init = false;
// set an invalide value to not yet initialized indexes managing
// textures created to enhance 3D rendering
// (they are dummy values but we do not want uninitialized values)
m_text_pcb = m_text_silk = -1;
m_text_fake_shadow_front = -1;
m_text_fake_shadow_back = -1;
m_text_fake_shadow_board = -1;
// position of the front and back layers
// (will be initialized to a better value later)
m_ZBottom = 0.0;
m_ZTop = 0.0;
// Clear all gl list identifiers:
for( int ii = GL_ID_BEGIN; ii < GL_ID_END; ii++ )
......
......@@ -83,9 +83,10 @@ private:
double m_ZBottom; // position of the back layer
double m_ZTop; // position of the front layer
GLuint m_text_pcb;
GLuint m_text_silk;
GLuint m_text_pcb; // an index to the texture generated for pcb texts
GLuint m_text_silk; // an index to the texture generated for silk layers
// Index to the textures generated for shadows
bool m_shadow_init;
GLuint m_text_fake_shadow_front;
GLuint m_text_fake_shadow_back;
......
......@@ -66,6 +66,7 @@ INFO3D_VISU::INFO3D_VISU()
m_epoxyThickness = 0;
m_nonCopperLayerThickness = 0;
m_BiuTo3Dunits = 1.0;
zpos_offset = 0.0;
// Set copper color, in realistic mode
#define LUMINANCE 0.7/255.0
......
......@@ -58,6 +58,7 @@ BITMAP_BASE::BITMAP_BASE( const wxPoint& pos )
BITMAP_BASE::BITMAP_BASE( const BITMAP_BASE& aSchBitmap )
{
m_Scale = aSchBitmap.m_Scale;
m_ppi = aSchBitmap.m_ppi;
m_pixelScaleFactor = aSchBitmap.m_pixelScaleFactor;
m_image = new wxImage( *aSchBitmap.m_image );
m_bitmap = new wxBitmap( *m_image );
......
......@@ -2,6 +2,28 @@
* @file common_plotDXF_functions.cpp
* @brief KiCad: Common plot DXF Routines.
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <gr_basic.h>
......
......@@ -221,6 +221,8 @@ void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
paperSize.y *= 10.0 * aIusPerDecimil;
SetDefaultLineWidth( 0 ); // HPGL has pen sizes instead
m_plotMirror = aMirror;
penOverlap = 0;
penDiameter = 0;
}
......
......@@ -102,7 +102,7 @@ private:
* @param aOldsheetpath the stored old sheet path for the current sheet before the plot started
* @param aMsg the message which is print to the message box
*/
void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH aOldsheetpath,
void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH& aOldsheetpath,
const wxString& aMsg );
// DXF
......
......@@ -139,7 +139,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
void DIALOG_PLOT_SCHEMATIC::restoreEnvironment( PDF_PLOTTER* aPlotter,
SCH_SHEET_PATH aOldsheetpath, const wxString& aMsg )
SCH_SHEET_PATH& aOldsheetpath, const wxString& aMsg )
{
aPlotter->EndPlot();
delete aPlotter;
......
......@@ -200,11 +200,16 @@ void GERBER_IMAGE::ResetDefaultValues()
m_PreviousPos.x = m_PreviousPos.y = 0; // last specified coord
m_IJPos.x = m_IJPos.y = 0; // current centre coord for
// plot arcs & circles
m_Current_File = NULL; // Gerger file to read
m_Current_File = NULL; // Gerber file to read
m_FilesPtr = 0;
m_PolygonFillMode = false;
m_PolygonFillModeState = 0;
m_Selected_Tool = FIRST_DCODE;
m_Last_Pen_Command = 0;
m_Exposure = false;
for( unsigned ii = 0; ii < DIM( m_FilesList ); ii++ )
m_FilesList[ii] = NULL;
}
/* Function HasNegativeItems
......@@ -455,7 +460,7 @@ const wxString GERBER_IMAGE_LIST::GetDisplayName( int aIdx )
if( aIdx >= 0 && aIdx < (int)m_GERBER_List.size() )
gerber = m_GERBER_List[aIdx];
if( IsUsed(aIdx ) )
if( gerber && IsUsed(aIdx ) )
{
if( gerber->m_FileFunction )
name.Printf( _( "Layer %d (%s, %s)" ), aIdx + 1,
......
......@@ -225,10 +225,9 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
m_FineAdjustYscaleOpt->SetValue( msg );
bool enable = (s_Parameters.m_PrintScale == 1.0);
if( m_FineAdjustXscaleOpt )
m_FineAdjustXscaleOpt->Enable(enable);
if( m_FineAdjustYscaleOpt )
m_FineAdjustYscaleOpt->Enable(enable);
m_FineAdjustXscaleOpt->Enable(enable);
m_FineAdjustYscaleOpt->Enable(enable);
}
int DIALOG_PRINT_USING_PRINTER::SetLayerSetFromListSelection()
......
......@@ -71,6 +71,7 @@ public:
m_DisplayPolarCood = false;
m_DisplayDCodes = true;
m_IsPrinting = false;
m_DisplayNegativeObjects = false;
}
};
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.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
......@@ -671,6 +671,8 @@ class PDF_PLOTTER : public PSLIKE_PLOTTER
public:
PDF_PLOTTER() : pageStreamHandle( 0 ), workFile( NULL )
{
// Avoid non initialized variables:
pageStreamHandle = streamLengthHandle = fontResDictHandle = 0;
}
virtual PlotFormat GetPlotterType() const
......@@ -986,6 +988,8 @@ class DXF_PLOTTER : public PLOTTER
public:
DXF_PLOTTER() : textAsLines( false )
{
textAsLines = true;
m_currentColor = BLACK;
}
virtual PlotFormat GetPlotterType() const
......
......@@ -163,6 +163,7 @@ public:
DRW_Variant()
{
type = INVALID;
code = 0;
}
DRW_Variant( const DRW_Variant& d )
......
......@@ -46,6 +46,8 @@ dxfRW::dxfRW( const char* name )
applyExt = false;
elParts = 128; // parts munber when convert ellipse to polyline
version = DRW::UNKNOWNV;
binary = false;
iface = NULL;
entCount = 0;
......
......@@ -119,6 +119,7 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
case ID_NO_TOOL_SELECTED:
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
break;
case ID_SELECT_PAGE_NUMBER:
m_canvas->Refresh();
......
......@@ -709,6 +709,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
// because the locate requirements are very basic.
std::vector <WS_DRAW_ITEM_BASE*> list;
drawList.Locate( list, aPosition );
if( list.size() == 0 )
return NULL;
......
......@@ -891,7 +891,7 @@ bool WIZARD_FPLIB_TABLE::downloadGithubLibsFromList( wxArrayString& aUrlList,
wxString default_path;
wxGetEnv( FP_LIB_TABLE::GlobalPathEnvVariableName(), &default_path );
masterFolder = wxDirSelector( _("Output Folder" ),
masterFolder = wxDirSelector( _("Choose Folder to Copy Downloaded '.pretty' Libraries" ),
default_path, 0, wxDefaultPosition, this );
if( masterFolder.IsEmpty() ) // Aborted by user
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment