mirror of https://github.com/KLayout/klayout.git
Fixed some issues found by Coverity scan.
This commit is contained in:
parent
cabd8bbdf1
commit
415d52f35d
|
|
@ -449,6 +449,9 @@ CIFReader::read_cell (db::Layout &layout, db::Cell &cell, double sf, int level)
|
||||||
if (! test_semi ()) {
|
if (! test_semi ()) {
|
||||||
denom = read_integer ();
|
denom = read_integer ();
|
||||||
divider = read_integer ();
|
divider = read_integer ();
|
||||||
|
if (divider == 0) {
|
||||||
|
error ("'DS' command: divider cannot be zero");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
expect_semi ();
|
expect_semi ();
|
||||||
|
|
@ -476,7 +479,7 @@ CIFReader::read_cell (db::Layout &layout, db::Cell &cell, double sf, int level)
|
||||||
// DF command:
|
// DF command:
|
||||||
// "D" blank* "F"
|
// "D" blank* "F"
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
error ("'DS' command must be inside a cell specification");
|
error ("'DF' command must be inside a cell specification");
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip the rest of the command
|
// skip the rest of the command
|
||||||
|
|
@ -490,7 +493,7 @@ CIFReader::read_cell (db::Layout &layout, db::Cell &cell, double sf, int level)
|
||||||
// "D" blank* "D" integer
|
// "D" blank* "D" integer
|
||||||
|
|
||||||
read_integer ();
|
read_integer ();
|
||||||
warn ("DD command ignored");
|
warn ("'DD' command ignored");
|
||||||
skip_to_end ();
|
skip_to_end ();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -665,6 +665,9 @@ OASISWriter::OASISWriter ()
|
||||||
mp_cell (0),
|
mp_cell (0),
|
||||||
m_layer (0), m_datatype (0),
|
m_layer (0), m_datatype (0),
|
||||||
m_in_cblock (false),
|
m_in_cblock (false),
|
||||||
|
m_propname_id (0),
|
||||||
|
m_propstring_id (0),
|
||||||
|
m_proptables_written (false),
|
||||||
m_progress (tl::to_string (QObject::tr ("Writing OASIS file")), 10000)
|
m_progress (tl::to_string (QObject::tr ("Writing OASIS file")), 10000)
|
||||||
{
|
{
|
||||||
m_progress.set_format (tl::to_string (QObject::tr ("%.0f MB")));
|
m_progress.set_format (tl::to_string (QObject::tr ("%.0f MB")));
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,8 @@ RecursiveShapeIterator::RecursiveShapeIterator ()
|
||||||
mp_shape_prop_sel = 0;
|
mp_shape_prop_sel = 0;
|
||||||
m_shape_inv_prop_sel = false;
|
m_shape_inv_prop_sel = false;
|
||||||
m_needs_reinit = false;
|
m_needs_reinit = false;
|
||||||
|
m_inst_quad_id = 0;
|
||||||
|
m_shape_quad_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RecursiveShapeIterator::RecursiveShapeIterator (const shapes_type &shapes)
|
RecursiveShapeIterator::RecursiveShapeIterator (const shapes_type &shapes)
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,8 @@ class LayoutDiff
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LayoutDiff ()
|
LayoutDiff ()
|
||||||
: mp_layout_a (0), mp_layout_b (0)
|
: mp_layout_a (0), mp_cell_a (0), m_layer_index_a (0),
|
||||||
|
mp_layout_b (0), mp_cell_b (0), m_layer_index_b (0)
|
||||||
{
|
{
|
||||||
// .. nothing yet ..
|
// .. nothing yet ..
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,13 +49,13 @@ struct A : public db::Object
|
||||||
x += d;
|
x += d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void undo (db::Op *op) throw ()
|
void undo (db::Op *op)
|
||||||
{
|
{
|
||||||
AO *aop = dynamic_cast<AO *> (op);
|
AO *aop = dynamic_cast<AO *> (op);
|
||||||
x -= aop->d;
|
x -= aop->d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void redo (db::Op *op) throw ()
|
void redo (db::Op *op)
|
||||||
{
|
{
|
||||||
AO *aop = dynamic_cast<AO *> (op);
|
AO *aop = dynamic_cast<AO *> (op);
|
||||||
tl_assert (aop != 0);
|
tl_assert (aop != 0);
|
||||||
|
|
@ -154,13 +154,13 @@ struct B : public db::Object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void undo (db::Op *op) throw ()
|
void undo (db::Op *op)
|
||||||
{
|
{
|
||||||
BO *bop = dynamic_cast<BO *> (op);
|
BO *bop = dynamic_cast<BO *> (op);
|
||||||
x -= bop->d;
|
x -= bop->d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void redo (db::Op *op) throw ()
|
void redo (db::Op *op)
|
||||||
{
|
{
|
||||||
BO *bop = dynamic_cast<BO *> (op);
|
BO *bop = dynamic_cast<BO *> (op);
|
||||||
tl_assert (bop != 0);
|
tl_assert (bop != 0);
|
||||||
|
|
|
||||||
|
|
@ -703,7 +703,8 @@ SearchReplaceDialog::SearchReplaceDialog (lay::PluginRoot *root, lay::LayoutView
|
||||||
m_current_mode (0),
|
m_current_mode (0),
|
||||||
m_window (FitMarker),
|
m_window (FitMarker),
|
||||||
m_window_dim (0.0),
|
m_window_dim (0.0),
|
||||||
m_max_item_count (0)
|
m_max_item_count (0),
|
||||||
|
m_last_query_cv_index (0)
|
||||||
{
|
{
|
||||||
setObjectName (QString::fromUtf8 ("search_replace_dialog"));
|
setObjectName (QString::fromUtf8 ("search_replace_dialog"));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1143,7 +1143,7 @@ static bool
|
||||||
skip_quad (const db::Box &qb, const lay::Bitmap *vertex_bitmap, const db::CplxTrans &trans)
|
skip_quad (const db::Box &qb, const lay::Bitmap *vertex_bitmap, const db::CplxTrans &trans)
|
||||||
{
|
{
|
||||||
double threshold = 32 / trans.mag (); // don't check cells below 32x32 pixels
|
double threshold = 32 / trans.mag (); // don't check cells below 32x32 pixels
|
||||||
if (qb.empty () || qb.width () > threshold || qb.height () > threshold) {
|
if (qb.empty () || qb.width () > threshold || qb.height () > threshold || !vertex_bitmap) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,7 @@ SaveLayoutOptionsDialog::get_options_internal ()
|
||||||
// SaveLayoutAsOptionsDialog implementation
|
// SaveLayoutAsOptionsDialog implementation
|
||||||
|
|
||||||
SaveLayoutAsOptionsDialog::SaveLayoutAsOptionsDialog (QWidget *parent, const std::string &title)
|
SaveLayoutAsOptionsDialog::SaveLayoutAsOptionsDialog (QWidget *parent, const std::string &title)
|
||||||
: QDialog (parent), Ui::SaveLayoutAsOptionsDialog ()
|
: QDialog (parent), Ui::SaveLayoutAsOptionsDialog (), mp_tech (0)
|
||||||
{
|
{
|
||||||
setObjectName (QString::fromUtf8 ("save_layout_options_dialog"));
|
setObjectName (QString::fromUtf8 ("save_layout_options_dialog"));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -401,7 +401,7 @@ public:
|
||||||
bool cat_matches (const QModelIndex &index, const QString &filter) const
|
bool cat_matches (const QModelIndex &index, const QString &filter) const
|
||||||
{
|
{
|
||||||
MarkerBrowserTreeViewModelCacheEntry *node = (MarkerBrowserTreeViewModelCacheEntry *)(index.internalPointer ());
|
MarkerBrowserTreeViewModelCacheEntry *node = (MarkerBrowserTreeViewModelCacheEntry *)(index.internalPointer ());
|
||||||
if (node) {
|
if (node && mp_database) {
|
||||||
|
|
||||||
rdb::id_type id = node->id ();
|
rdb::id_type id = node->id ();
|
||||||
const rdb::Category *category = mp_database->category_by_id (id);
|
const rdb::Category *category = mp_database->category_by_id (id);
|
||||||
|
|
@ -418,7 +418,7 @@ public:
|
||||||
bool cell_matches (const QModelIndex &index, const QString &filter) const
|
bool cell_matches (const QModelIndex &index, const QString &filter) const
|
||||||
{
|
{
|
||||||
MarkerBrowserTreeViewModelCacheEntry *node = (MarkerBrowserTreeViewModelCacheEntry *)(index.internalPointer ());
|
MarkerBrowserTreeViewModelCacheEntry *node = (MarkerBrowserTreeViewModelCacheEntry *)(index.internalPointer ());
|
||||||
if (node) {
|
if (node && mp_database) {
|
||||||
|
|
||||||
rdb::id_type id = node->id ();
|
rdb::id_type id = node->id ();
|
||||||
const rdb::Cell *cell = mp_database->cell_by_id (id);
|
const rdb::Cell *cell = mp_database->cell_by_id (id);
|
||||||
|
|
@ -435,7 +435,7 @@ public:
|
||||||
bool no_errors (const QModelIndex &index) const
|
bool no_errors (const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
MarkerBrowserTreeViewModelCacheEntry *node = (MarkerBrowserTreeViewModelCacheEntry *)(index.internalPointer ());
|
MarkerBrowserTreeViewModelCacheEntry *node = (MarkerBrowserTreeViewModelCacheEntry *)(index.internalPointer ());
|
||||||
if (node) {
|
if (node && mp_database) {
|
||||||
|
|
||||||
rdb::id_type id = node->id ();
|
rdb::id_type id = node->id ();
|
||||||
bool none = false;
|
bool none = false;
|
||||||
|
|
@ -638,6 +638,10 @@ public:
|
||||||
|
|
||||||
QModelIndex next_index (QModelIndex current_index, bool up)
|
QModelIndex next_index (QModelIndex current_index, bool up)
|
||||||
{
|
{
|
||||||
|
if (!mp_database) {
|
||||||
|
return QModelIndex ();
|
||||||
|
}
|
||||||
|
|
||||||
MarkerBrowserTreeViewModelCacheEntry *node = (MarkerBrowserTreeViewModelCacheEntry *) current_index.internalPointer ();
|
MarkerBrowserTreeViewModelCacheEntry *node = (MarkerBrowserTreeViewModelCacheEntry *) current_index.internalPointer ();
|
||||||
|
|
||||||
rdb::id_type id = node->id ();
|
rdb::id_type id = node->id ();
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ inline void usleep(long us)
|
||||||
class Sum
|
class Sum
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Sum () : m_sum(0) { }
|
Sum () : m_sum(0), m_flag (false) { }
|
||||||
|
|
||||||
void reset () { lock.lock (); m_sum = 0; lock.unlock (); m_flag = false; }
|
void reset () { lock.lock (); m_sum = 0; lock.unlock (); m_flag = false; }
|
||||||
void add(int n) { lock.lock (); m_sum += n; lock.unlock (); m_flag = true; }
|
void add(int n) { lock.lock (); m_sum += n; lock.unlock (); m_flag = true; }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue