Fix some Coverity uninitialized field warnings.
Fixes Coverity CIDs: - 175824 - 169337 - 163191 - 175827 - 175440 - 175438 - 157136
This commit is contained in:
parent
5dbfa6a9c1
commit
7343e78347
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2018 CERN
|
||||
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* Author: Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
|
@ -27,6 +29,8 @@ DIALOG_FILE_DIR_PICKER::DIALOG_FILE_DIR_PICKER( wxWindow* parent, const wxString
|
|||
: DIALOG_SHIM( parent, wxID_ANY, title, wxDefaultPosition,
|
||||
wxSize( 500, 600 ), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
|
||||
{
|
||||
m_showHidden = nullptr;
|
||||
|
||||
wxString path = defaultPath.IsEmpty() ? wxGetCwd() : defaultPath;
|
||||
m_filesOnly = style & FD_RETURN_FILESONLY;
|
||||
|
||||
|
|
|
@ -105,11 +105,12 @@ int CMP_TREE_NODE::Compare( CMP_TREE_NODE const& aNode1, CMP_TREE_NODE const& aN
|
|||
|
||||
CMP_TREE_NODE::CMP_TREE_NODE()
|
||||
: Parent( nullptr ),
|
||||
Type( INVALID ),
|
||||
IntrinsicRank( 0 ),
|
||||
Score( kLowestDefaultScore ),
|
||||
Unit( 0 ),
|
||||
IsRoot( false )
|
||||
Type( INVALID ),
|
||||
IntrinsicRank( 0 ),
|
||||
Score( kLowestDefaultScore ),
|
||||
SearchTextNormalized( false ),
|
||||
Unit( 0 ),
|
||||
IsRoot( false )
|
||||
{}
|
||||
|
||||
|
||||
|
|
|
@ -115,7 +115,8 @@ protected:
|
|||
public:
|
||||
FIELDS_EDITOR_GRID_DATA_MODEL( SCH_EDIT_FRAME* aFrame, SCH_REFERENCE_LIST& aComponentList ) :
|
||||
m_frame( aFrame ),
|
||||
m_componentRefs( aComponentList )
|
||||
m_componentRefs( aComponentList ),
|
||||
m_sortAscending( false )
|
||||
{
|
||||
m_componentRefs.SplitReferences();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016-2018 CERN
|
||||
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
|
@ -37,7 +39,8 @@ using namespace std;
|
|||
|
||||
static const wxChar* const traceNgspice = wxT( "KICAD_NGSPICE" );
|
||||
|
||||
NGSPICE::NGSPICE()
|
||||
NGSPICE::NGSPICE() :
|
||||
m_error( false )
|
||||
{
|
||||
init_dll();
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@ public:
|
|||
aMainText, aMainText,
|
||||
aMainPos, aMainPos );
|
||||
m_hasSecondItem = false;
|
||||
m_parent = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017 CERN
|
||||
* @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
|
||||
*
|
||||
|
@ -214,6 +214,7 @@ public:
|
|||
*/
|
||||
OPTIONAL_XML_ATTRIBUTE( const wxString& aData )
|
||||
{
|
||||
m_data = T();
|
||||
m_isAvailable = !aData.IsEmpty();
|
||||
|
||||
if( m_isAvailable )
|
||||
|
|
|
@ -80,12 +80,13 @@ namespace numEval
|
|||
|
||||
struct TokenType
|
||||
{
|
||||
union {
|
||||
double dValue;
|
||||
int iValue;
|
||||
};
|
||||
bool valid;
|
||||
char text[32];
|
||||
union {
|
||||
double dValue;
|
||||
int iValue;
|
||||
};
|
||||
|
||||
bool valid;
|
||||
char text[32];
|
||||
};
|
||||
|
||||
} // namespace numEval
|
||||
|
@ -94,101 +95,101 @@ class NumericEvaluator {
|
|||
enum class Unit { Invalid, Metric, Inch, Mil };
|
||||
|
||||
public:
|
||||
NumericEvaluator();
|
||||
~NumericEvaluator();
|
||||
NumericEvaluator();
|
||||
~NumericEvaluator();
|
||||
|
||||
/* Initialization and destruction. init() is invoked be the constructor and should not be needed
|
||||
* by the user.
|
||||
* clear() should be invoked by the user if a new input string is to be processed. It will reset
|
||||
* the parser and clear the original expression value for a requested object (if pObj != null).
|
||||
*/
|
||||
void init();
|
||||
void clear(const void* pObj = nullptr);
|
||||
/* Initialization and destruction. init() is invoked be the constructor and should not be needed
|
||||
* by the user.
|
||||
* clear() should be invoked by the user if a new input string is to be processed. It will reset
|
||||
* the parser and clear the original expression value for a requested object (if pObj != null).
|
||||
*/
|
||||
void init();
|
||||
void clear(const void* pObj = nullptr);
|
||||
|
||||
/* Set the decimal separator for the input string. Defaults to '.' */
|
||||
void setDecimalSeparator(char sep);
|
||||
/* Set the decimal separator for the input string. Defaults to '.' */
|
||||
void setDecimalSeparator(char sep);
|
||||
|
||||
/* Enable or disable support for input string storage.
|
||||
* If enabled the input string is saved if process(const char*, const void*) is used.
|
||||
*/
|
||||
void enableTextInputStorage(bool w) { bClTextInputStorage = w; }
|
||||
/* Enable or disable support for input string storage.
|
||||
* If enabled the input string is saved if process(const char*, const void*) is used.
|
||||
*/
|
||||
void enableTextInputStorage(bool w) { bClTextInputStorage = w; }
|
||||
|
||||
/* Used by the lemon parser */
|
||||
void parseError(const char* s);
|
||||
void parseOk();
|
||||
void parseSetResult(double);
|
||||
/* Used by the lemon parser */
|
||||
void parseError(const char* s);
|
||||
void parseOk();
|
||||
void parseSetResult(double);
|
||||
|
||||
/* Check if previous invokation of process() was successful */
|
||||
inline bool isValid() const { return !bClError; }
|
||||
/* Check if previous invokation of process() was successful */
|
||||
inline bool isValid() const { return !bClError; }
|
||||
|
||||
/* Result of string processing. Undefined if !isValid() */
|
||||
inline const char* result() const { return clToken.token; }
|
||||
/* Result of string processing. Undefined if !isValid() */
|
||||
inline const char* result() const { return clToken.token; }
|
||||
|
||||
/* Evaluate input string.
|
||||
* Result can be retrieved by result().
|
||||
* Returns true if input string could be evaluated, otherwise false.
|
||||
*/
|
||||
bool process(const char* s);
|
||||
/* Evaluate input string.
|
||||
* Result can be retrieved by result().
|
||||
* Returns true if input string could be evaluated, otherwise false.
|
||||
*/
|
||||
bool process(const char* s);
|
||||
|
||||
/* Like process(const char*) but also stores input string in a std:map with key pObj. */
|
||||
bool process(const char* s, const void* pObj);
|
||||
/* Like process(const char*) but also stores input string in a std:map with key pObj. */
|
||||
bool process(const char* s, const void* pObj);
|
||||
|
||||
/* Retrieve old input string with key pObj. */
|
||||
const char* textInput(const void* pObj) const;
|
||||
/* Retrieve old input string with key pObj. */
|
||||
const char* textInput(const void* pObj) const;
|
||||
|
||||
/* Add/set variable with value */
|
||||
void setVar(const std::string&, double value);
|
||||
/* Add/set variable with value */
|
||||
void setVar(const std::string&, double value);
|
||||
|
||||
/* Get value of variable. Returns 0.0 if not defined. */
|
||||
double getVar(const std::string&);
|
||||
/* Get value of variable. Returns 0.0 if not defined. */
|
||||
double getVar(const std::string&);
|
||||
|
||||
/* Remove single variable */
|
||||
void removeVar(const std::string& s) { clVarMap.erase(s); }
|
||||
/* Remove single variable */
|
||||
void removeVar(const std::string& s) { clVarMap.erase(s); }
|
||||
|
||||
/* Remove all variables */
|
||||
void clearVar() { clVarMap.clear(); }
|
||||
/* Remove all variables */
|
||||
void clearVar() { clVarMap.clear(); }
|
||||
|
||||
protected:
|
||||
/* Token type used by the tokenizer */
|
||||
struct Token {
|
||||
int token;
|
||||
numEval::TokenType value;
|
||||
};
|
||||
struct Token {
|
||||
int token;
|
||||
numEval::TokenType value;
|
||||
};
|
||||
|
||||
/* Begin processing of a new input string */
|
||||
void newString(const char* s);
|
||||
/* Begin processing of a new input string */
|
||||
void newString(const char* s);
|
||||
|
||||
/* Tokenizer: Next token/value taken from input string. */
|
||||
Token getToken();
|
||||
/* Tokenizer: Next token/value taken from input string. */
|
||||
Token getToken();
|
||||
|
||||
/* Used by processing loop */
|
||||
void parse(int token, numEval::TokenType value);
|
||||
/* Used by processing loop */
|
||||
void parse(int token, numEval::TokenType value);
|
||||
|
||||
private:
|
||||
void* pClParser; // the current lemon parser state machine
|
||||
void* pClParser; // the current lemon parser state machine
|
||||
|
||||
/* Token state for input string. */
|
||||
struct TokenStat {
|
||||
enum { OutLen=32 };
|
||||
TokenStat() : input(0), token(0), inputLen(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)
|
||||
size_t pos; // current index
|
||||
} clToken;
|
||||
/* Token state for input string. */
|
||||
struct TokenStat {
|
||||
enum { OutLen=32 };
|
||||
TokenStat() : input(0), token(0), 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)
|
||||
size_t pos; // current index
|
||||
} clToken;
|
||||
|
||||
char cClDecSep; // decimal separator ('.')
|
||||
char cClDecSep; // decimal separator ('.')
|
||||
|
||||
/* Parse progress. Set by parser actions. */
|
||||
bool bClError;
|
||||
bool bClParseFinished;
|
||||
/* Parse progress. Set by parser actions. */
|
||||
bool bClError;
|
||||
bool bClParseFinished;
|
||||
|
||||
bool bClTextInputStorage; // Enable input string storage used by process(const char*, const void*)
|
||||
bool bClTextInputStorage; // Enable input string storage used by process(const char*, const void*)
|
||||
|
||||
Unit eClUnitDefault; // Default unit for values
|
||||
Unit eClUnitDefault; // Default unit for values
|
||||
|
||||
std::map<const void*, std::string> clObjMap; // Map pointer to text entry -> (original) input string
|
||||
std::map<std::string, double> clVarMap;
|
||||
std::map<const void*, std::string> clObjMap; // Map pointer to text entry -> (original) input string
|
||||
std::map<std::string, double> clVarMap;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue