diff --git a/src/ant/ant/gsiDeclAnt.cc b/src/ant/ant/gsiDeclAnt.cc index 61e407f06..65298eceb 100644 --- a/src/ant/ant/gsiDeclAnt.cc +++ b/src/ant/ant/gsiDeclAnt.cc @@ -1035,7 +1035,7 @@ public: value_type operator* () const { - return value_type (*(dynamic_cast (m_iter->first->ptr ())), m_services[m_service]->view ()); + return value_type (*(static_cast (m_iter->first->ptr ())), m_services[m_service]->view ()); } private: diff --git a/src/db/db/dbOASISReader.cc b/src/db/db/dbOASISReader.cc index 1edcec995..844a0024b 100644 --- a/src/db/db/dbOASISReader.cc +++ b/src/db/db/dbOASISReader.cc @@ -110,6 +110,18 @@ OASISReader::OASISReader (tl::InputStream &s) { m_progress.set_format (tl::to_string (QObject::tr ("%.0f MB"))); m_progress.set_unit (1024 * 1024); + m_first_cellname = 0; + m_first_propname = 0; + m_first_propstring = 0; + m_first_textstring = 0; + m_first_layername = 0; + m_in_table = NotInTable; + m_table_cellname = 0; + m_table_propname = 0; + m_table_propstring = 0; + m_table_textstring = 0; + m_table_layername = 0; + m_table_start = 0; } OASISReader::~OASISReader () @@ -197,6 +209,16 @@ OASISReader::get_long () } } +inline unsigned long +OASISReader::get_ulong_for_divider () +{ + unsigned long l = get_ulong (); + if (l == 0) { + error (tl::to_string (QObject::tr ("Divider must not be zero"))); + } + return l; +} + inline unsigned long OASISReader::get_ulong () { @@ -295,21 +317,21 @@ OASISReader::get_real () } else if (t == 2) { - return 1.0 / double (get_ulong ()); + return 1.0 / double (get_ulong_for_divider ()); } else if (t == 3) { - return -1.0 / double (get_ulong ()); + return -1.0 / double (get_ulong_for_divider ()); } else if (t == 4) { double d = double (get_ulong ()); - return d / double (get_ulong ()); + return d / double (get_ulong_for_divider ()); } else if (t == 5) { double d = double (get_ulong ()); - return -d / double (get_ulong ()); + return -d / double (get_ulong_for_divider ()); } else if (t == 6) { diff --git a/src/db/db/dbOASISReader.h b/src/db/db/dbOASISReader.h index 60f04aeda..26487ef68 100644 --- a/src/db/db/dbOASISReader.h +++ b/src/db/db/dbOASISReader.h @@ -318,6 +318,7 @@ private: unsigned long long get_ulong_long (); long get_long (); unsigned long get_ulong (); + unsigned long get_ulong_for_divider (); int get_int (); unsigned int get_uint (); diff --git a/src/db/db/dbRecursiveShapeIterator.cc b/src/db/db/dbRecursiveShapeIterator.cc index bd6718522..7281b9861 100644 --- a/src/db/db/dbRecursiveShapeIterator.cc +++ b/src/db/db/dbRecursiveShapeIterator.cc @@ -276,6 +276,8 @@ RecursiveShapeIterator::init () m_shape_inv_prop_sel = false; m_inst_quad_id = 0; m_shape_quad_id = 0; + mp_cell = 0; + m_current_layer = 0; } void diff --git a/src/db/unit_tests/dbObject.cc b/src/db/unit_tests/dbObject.cc index 0ecf9195b..a8d03d968 100644 --- a/src/db/unit_tests/dbObject.cc +++ b/src/db/unit_tests/dbObject.cc @@ -58,6 +58,7 @@ struct A : public db::Object void redo (db::Op *op) throw () { AO *aop = dynamic_cast (op); + tl_assert (aop != 0); x += aop->d; } @@ -162,6 +163,7 @@ struct B : public db::Object void redo (db::Op *op) throw () { BO *bop = dynamic_cast (op); + tl_assert (bop != 0); x += bop->d; } diff --git a/src/ext/ext/extNetTracerIO.cc b/src/ext/ext/extNetTracerIO.cc index 761271dd2..22d9ef3fb 100644 --- a/src/ext/ext/extNetTracerIO.cc +++ b/src/ext/ext/extNetTracerIO.cc @@ -1092,7 +1092,7 @@ Net::Net () } Net::Net (const NetTracer &tracer, const db::ICplxTrans &trans, const db::Layout &layout, db::cell_index_type cell_index, const std::string &layout_filename, const std::string &layout_name, const NetTracerData &data) - : m_name (tracer.name ()), m_incomplete (tracer.incomplete ()) + : m_name (tracer.name ()), m_incomplete (tracer.incomplete ()), m_trace_path (false) { m_dbu = layout.dbu (); m_top_cell_name = layout.cell_name (cell_index); diff --git a/src/ext/ext/extRS274XApertures.cc b/src/ext/ext/extRS274XApertures.cc index 0a42d40ea..d232293c9 100644 --- a/src/ext/ext/extRS274XApertures.cc +++ b/src/ext/ext/extRS274XApertures.cc @@ -607,11 +607,30 @@ RS274XMacroAperture::do_produce_flash () } } +void +RS274XMacroAperture::read_exposure (tl::Extractor &ex, bool &clear, bool &clear_set) +{ + int pol = int (floor (read_expr (ex) + 0.5)); + + if (pol == 0) { + clear = true; + } else if (pol == 1) { + clear = false; + } else if (pol == 2) { + clear = !clear_set || !clear; + } else { + throw tl::Exception (tl::to_string (QObject::tr ("Invalid exposure code '%d'")), pol); + } + + clear_set = true; +} + void RS274XMacroAperture::do_produce_flash_internal () { tl::Extractor ex (m_def.c_str ()); bool clear = false; + bool clear_set = false; while (! ex.at_end ()) { @@ -640,18 +659,7 @@ RS274XMacroAperture::do_produce_flash_internal () if (code == 1) { ex.expect (","); - int pol = (read_expr (ex) > 0.5); - - if (pol == 0) { - clear = true; - } else if (pol == 1) { - clear = false; - } else if (pol == 2) { - clear = !clear; - } else { - throw tl::Exception (tl::to_string (QObject::tr ("Invalid exposure code '%d'")), pol); - } - + read_exposure (ex, clear, clear_set); ex.expect (","); double d = read_expr (ex, true); ex.expect (","); @@ -670,18 +678,7 @@ RS274XMacroAperture::do_produce_flash_internal () } else if (code == 2 || code == 20) { ex.expect (","); - int pol = (read_expr (ex) > 0.5); - - if (pol == 0) { - clear = true; - } else if (pol == 1) { - clear = false; - } else if (pol == 2) { - clear = !clear; - } else { - throw tl::Exception (tl::to_string (QObject::tr ("Invalid exposure code '%d'")), pol); - } - + read_exposure (ex, clear, clear_set); ex.expect (","); double w = read_expr (ex, true); ex.expect (","); @@ -723,18 +720,7 @@ RS274XMacroAperture::do_produce_flash_internal () } else if (code == 21 || code == 22) { ex.expect (","); - int pol = (read_expr (ex) > 0.5); - - if (pol == 0) { - clear = true; - } else if (pol == 1) { - clear = false; - } else if (pol == 2) { - clear = !clear; - } else { - throw tl::Exception (tl::to_string (QObject::tr ("Invalid exposure code '%d'")), pol); - } - + read_exposure (ex, clear, clear_set); ex.expect (","); double w = read_expr (ex, true); ex.expect (","); @@ -766,18 +752,7 @@ RS274XMacroAperture::do_produce_flash_internal () } else if (code == 4) { ex.expect (","); - int pol = (read_expr (ex) > 0.5); - - if (pol == 0) { - clear = true; - } else if (pol == 1) { - clear = false; - } else if (pol == 2) { - clear = !clear; - } else { - throw tl::Exception (tl::to_string (QObject::tr ("Invalid exposure code '%d'")), pol); - } - + read_exposure (ex, clear, clear_set); ex.expect (","); int n = int (read_expr (ex) + 0.5); if (n < 1) { @@ -854,18 +829,7 @@ RS274XMacroAperture::do_produce_flash_internal () } else if (code == 5) { ex.expect (","); - int pol = (read_expr (ex) > 0.5); - - if (pol == 0) { - clear = true; - } else if (pol == 1) { - clear = false; - } else if (pol == 2) { - clear = !clear; - } else { - throw tl::Exception (tl::to_string (QObject::tr ("Invalid exposure code '%d'")), pol); - } - + read_exposure (ex, clear, clear_set); ex.expect (","); int n = int (read_expr (ex) + 0.5); if (n < 3) { diff --git a/src/ext/ext/extRS274XApertures.h b/src/ext/ext/extRS274XApertures.h index 969a1d710..78fa02ac6 100644 --- a/src/ext/ext/extRS274XApertures.h +++ b/src/ext/ext/extRS274XApertures.h @@ -168,6 +168,7 @@ private: double read_atom (tl::Extractor &ex); double read_dot_expr (tl::Extractor &ex); double read_expr (tl::Extractor &ex, bool length = false); + void read_exposure (tl::Extractor &ex, bool &clear, bool &clear_set); void do_produce_flash_internal (); }; diff --git a/src/gsi/gsi/gsiMethods.h b/src/gsi/gsi/gsiMethods.h index c0deceef9..d4bb408bd 100644 --- a/src/gsi/gsi/gsiMethods.h +++ b/src/gsi/gsi/gsiMethods.h @@ -524,7 +524,6 @@ private: ArgType m_ret_type; bool m_const : 1; bool m_static : 1; - bool m_is_predicate : 1; bool m_protected : 1; unsigned int m_argsize; std::vector m_method_synonyms; diff --git a/src/img/img/imgObject.cc b/src/img/img/imgObject.cc index c4c1e9b2f..eb45a1668 100644 --- a/src/img/img/imgObject.cc +++ b/src/img/img/imgObject.cc @@ -697,12 +697,14 @@ static size_t make_id () Object::Object () : m_trans (1.0), mp_data (0), m_id (make_id ()), m_min_value (0.0), m_max_value (1.0), m_min_value_set (false), m_max_value_set (false), m_visible (true), m_z_position (0) { + m_updates_enabled = false; mp_pixel_data = 0; } Object::Object (size_t w, size_t h, const db::DCplxTrans &trans, bool color) : m_trans (trans), m_id (make_id ()), m_min_value (0.0), m_max_value (1.0), m_min_value_set (false), m_max_value_set (false), m_visible (true), m_z_position (0) { + m_updates_enabled = false; mp_pixel_data = 0; mp_data = new DataHeader (w, h, color, false); diff --git a/src/lay/lay/layProgress.cc b/src/lay/lay/layProgress.cc index 219473fa5..daefbaff1 100644 --- a/src/lay/lay/layProgress.cc +++ b/src/lay/lay/layProgress.cc @@ -211,10 +211,12 @@ ProgressReporter::set_visible (bool vis) // actual operation tl::DeferredMethodScheduler::enable (!vis); - if (!vis) { - mp_pb->progress_remove_widget (); - } else if (mp_pb->progress_wants_widget () && mp_objects.front ()) { - mp_pb->progress_add_widget (mp_objects.front ()->progress_widget ()); + if (mp_pb) { + if (!vis) { + mp_pb->progress_remove_widget (); + } else if (mp_pb->progress_wants_widget () && mp_objects.front ()) { + mp_pb->progress_add_widget (mp_objects.front ()->progress_widget ()); + } } m_pw_visible = vis; diff --git a/src/lay/lay/laySaltGrainPropertiesDialog.cc b/src/lay/lay/laySaltGrainPropertiesDialog.cc index 809d953e4..336f041c4 100644 --- a/src/lay/lay/laySaltGrainPropertiesDialog.cc +++ b/src/lay/lay/laySaltGrainPropertiesDialog.cc @@ -259,7 +259,7 @@ SaltGrainPropertiesDialog::dependency_changed (QTreeWidgetItem *item, int column m_update_enabled = false; std::string name = tl::to_string (item->data (0, Qt::UserRole).toString ().simplified ()); - SaltGrain *g = mp_salt->grain_by_name (name); + SaltGrain *g = mp_salt ? mp_salt->grain_by_name (name) : 0; if (column == 0 && mp_salt) { diff --git a/src/laybasic/laybasic/gsiDeclLayTechnologies.cc b/src/laybasic/laybasic/gsiDeclLayTechnologies.cc index acd9b6964..9ed316979 100644 --- a/src/laybasic/laybasic/gsiDeclLayTechnologies.cc +++ b/src/laybasic/laybasic/gsiDeclLayTechnologies.cc @@ -45,7 +45,7 @@ static lay::Technology *create_technology (const std::string &name) { lay::Technology *tech = new lay::Technology (); tech->set_name (name); - lay::Technologies::instance ()->add (tech); + lay::Technologies::instance ()->add_new (tech); return tech; } diff --git a/src/laybasic/laybasic/layQtTools.cc b/src/laybasic/laybasic/layQtTools.cc index d9d0751a9..f7642e8d7 100644 --- a/src/laybasic/laybasic/layQtTools.cc +++ b/src/laybasic/laybasic/layQtTools.cc @@ -88,11 +88,13 @@ save_dialog_state (QWidget *w) } - for (QList::const_iterator c = w->children ().begin (); c != w->children ().end (); ++c) { - if (dynamic_cast (*c)) { - std::string cs = save_dialog_state (dynamic_cast (*c)); - if (! cs.empty ()) { - s += cs; + if (w) { + for (QList::const_iterator c = w->children ().begin (); c != w->children ().end (); ++c) { + if (dynamic_cast (*c)) { + std::string cs = save_dialog_state (dynamic_cast (*c)); + if (! cs.empty ()) { + s += cs; + } } } } diff --git a/src/laybasic/laybasic/layTechnology.cc b/src/laybasic/laybasic/layTechnology.cc index 0ff8b044d..8934cb547 100644 --- a/src/laybasic/laybasic/layTechnology.cc +++ b/src/laybasic/laybasic/layTechnology.cc @@ -45,6 +45,8 @@ Technologies::Technologies () Technologies::Technologies (const Technologies &other) : tl::Object () { + m_changed = false; + m_in_update = false; operator= (other); } @@ -115,19 +117,30 @@ Technologies::load_from_xml (const std::string &s) } void -Technologies::add (Technology *technology) +Technologies::add_tech (Technology *tech, bool replace_same) { - for (tl::stable_vector::iterator t = m_technologies.begin (); technology && t != m_technologies.end (); ++t) { - if (t->name () == technology->name ()) { - *t = *technology; - delete technology; - technology = 0; + if (! tech) { + return; + } + + std::auto_ptr tech_ptr (tech); + + Technology *t = 0; + for (tl::stable_vector::iterator i = m_technologies.begin (); !t && i != m_technologies.end (); ++i) { + if (i->name () == tech->name ()) { + t = i.operator-> (); } } - if (technology) { - m_technologies.push_back (technology); - technology->technology_changed_with_sender_event.add (this, &Technologies::technology_changed); + if (t) { + if (replace_same) { + *t = *tech; + } else { + throw tl::Exception (tl::to_string (QObject::tr ("A technology with this name already exists: %1").arg (tl::to_qstring (tech->name ())))); + } + } else { + m_technologies.push_back (tech_ptr.release ()); + tech->technology_changed_with_sender_event.add (this, &Technologies::technology_changed); } technologies_changed (); @@ -218,6 +231,7 @@ Technologies::technology_by_name (const std::string &name) } } + tl_assert (! m_technologies.empty ()); return &*m_technologies.begin (); } diff --git a/src/laybasic/laybasic/layTechnology.h b/src/laybasic/laybasic/layTechnology.h index 03f2ddc55..a7d130c7d 100644 --- a/src/laybasic/laybasic/layTechnology.h +++ b/src/laybasic/laybasic/layTechnology.h @@ -126,7 +126,22 @@ public: * The container becomes owner of the technology object. * Replaces a technology with the name of the given technology. */ - void add (Technology *technology); + void add (Technology *technology) + { + add_tech (technology, true /*replace*/); + } + + /** + * @brief Adds a technology with a new name + * + * Like \add, but throws an exception if a technology with this name + * already exists. Takes over ownership over the technology object. + * The technology object is discarded if an exception is thrown. + */ + void add_new (Technology *technology) + { + add_tech (technology, false /*throws exception on same name*/); + } /** * @brief Remove a technology with the given name from the setup @@ -233,6 +248,8 @@ private: tl::stable_vector m_technologies; bool m_changed; bool m_in_update; + + void add_tech (Technology *technology, bool replace_same); }; /** diff --git a/src/lym/lym/lymMacro.cc b/src/lym/lym/lymMacro.cc index 4f76d32e2..e6c64c658 100644 --- a/src/lym/lym/lymMacro.cc +++ b/src/lym/lym/lymMacro.cc @@ -915,26 +915,28 @@ void Macro::install_doc () const if (cls == 0) { tl::error << tl::to_string (QObject::tr ("Reading class doc from ")) << path () << ": " << tl::to_string (QObject::tr ("@method without preceeding @class")); - } + } else { - std::string n; - ex.read_word_or_quoted (n); + std::string n; + ex.read_word_or_quoted (n); - std::string doc; - while (++i < lines.size ()) { - std::string l = tl::trim (lines [i]); - if (l.find ("@method") == 0 || l.find ("@static_method") == 0) { - break; + std::string doc; + while (++i < lines.size ()) { + std::string l = tl::trim (lines [i]); + if (l.find ("@method") == 0 || l.find ("@static_method") == 0) { + break; + } + if (! doc.empty ()) { + doc += "\n"; + } + doc += lines [i]; } - if (! doc.empty ()) { - doc += "\n"; - } - doc += lines [i]; - } - --i; + --i; - ExternalMethod *meth = new ExternalMethod (n, doc, false, st); - cls->add_method (meth); + ExternalMethod *meth = new ExternalMethod (n, doc, false, st); + cls->add_method (meth); + + } } diff --git a/src/pya/pya/pya.cc b/src/pya/pya/pya.cc index c2d3ebac4..4bcce316e 100644 --- a/src/pya/pya/pya.cc +++ b/src/pya/pya/pya.cc @@ -1945,7 +1945,11 @@ property_setter_impl (int mid, PyObject *self, PyObject *value) if (meth->is_signal ()) { - if (PyObject_IsInstance (value, (PyObject *) PYASignal::cls)) { + if (!p) { + + // TODO: Static signals? + + } else if (PyObject_IsInstance (value, (PyObject *) PYASignal::cls)) { // assigning a signal to a signal works if it applies to the same handler - // this simplifies the implementation of += and -=. diff --git a/src/rdb/rdb/rdb.h b/src/rdb/rdb/rdb.h index 44029f3f0..ae401399f 100644 --- a/src/rdb/rdb/rdb.h +++ b/src/rdb/rdb/rdb.h @@ -495,7 +495,7 @@ public: bool compare (const ValueBase *other) const { - return m_value < dynamic_cast *> (other)->m_value; + return m_value < static_cast *> (other)->m_value; } std::string to_string () const; diff --git a/src/tl/tl/tlIntervalMap.h b/src/tl/tl/tlIntervalMap.h index ed477748a..194d0e5ce 100644 --- a/src/tl/tl/tlIntervalMap.h +++ b/src/tl/tl/tlIntervalMap.h @@ -213,7 +213,7 @@ public: ++lb0; } --lb; - if (lb != m_index_map.end () && i2 < lb->first.second) { + if (i2 < lb->first.second) { // the last one is overlapping above i2: cut it lb->first.first = i2; } else { diff --git a/src/tl/tl/tlThreadedWorkers.cc b/src/tl/tl/tlThreadedWorkers.cc index 648afcfb6..16a3e7c5a 100644 --- a/src/tl/tl/tlThreadedWorkers.cc +++ b/src/tl/tl/tlThreadedWorkers.cc @@ -424,17 +424,20 @@ JobBase::schedule (Task *task) { m_lock.lock (); - // Don't allow tasks to be scheduled while stopping or exiting (waiting for m_queue_empty_condition) if (m_stopping) { - m_lock.unlock (); - throw TaskTerminatedException (); - } - // Add the task to the task queue - m_task_list.put (task); + // Don't allow tasks to be scheduled while stopping or exiting (waiting for m_queue_empty_condition) + delete task; + + } else { + + // Add the task to the task queue + m_task_list.put (task); + + if (m_running) { + m_task_available_condition.wakeAll (); + } - if (m_running) { - m_task_available_condition.wakeAll (); } m_lock.unlock (); diff --git a/src/tl/tl/tlVariant.cc b/src/tl/tl/tlVariant.cc index b1b73dff0..d223ab537 100644 --- a/src/tl/tl/tlVariant.cc +++ b/src/tl/tl/tlVariant.cc @@ -1298,7 +1298,7 @@ Variant::can_convert_to_long () const case t_double: return m_var.m_double <= std::numeric_limits::max () && m_var.m_double >= std::numeric_limits::min (); case t_float: - return m_var.m_float <= std::numeric_limits::max () && m_var.m_float >= std::numeric_limits::min (); + return m_var.m_float <= float (std::numeric_limits::max ()) && m_var.m_float >= float (std::numeric_limits::min ()); #if defined(HAVE_64BIT_COORD) case t_int128: return m_var.m_int128 <= __int128 (std::numeric_limits::max ()) && m_var.m_int128 >= __int128 (std::numeric_limits::min ());