From af50c0f0c308f103cecdab5d84607e6a1b696d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20K=C3=B6fferlein?= Date: Wed, 29 Aug 2018 01:46:18 +0200 Subject: [PATCH] Many warnings fixed for MSVC --- src/ant/ant/antConfigPage.cc | 4 +-- src/db/db/dbFillTool.cc | 8 ++--- src/db/db/dbHash.h | 2 +- src/db/db/dbPath.h | 12 +++---- src/db/db/dbRegion.cc | 12 +++---- src/db/db/dbTilingProcessor.cc | 2 +- src/db/db/gsiDeclDbLayoutQuery.cc | 2 +- src/db/db/gsiDeclDbRegion.cc | 2 +- src/db/unit_tests/dbCell.cc | 4 +-- src/db/unit_tests/dbLayoutQuery.cc | 8 ++--- src/gsi/gsi/gsiExpression.cc | 4 +-- src/gsi/gsi/gsiSerialisation.h | 6 ++-- src/gsi/gsi/gsiTypes.h | 2 +- src/gsi/gsi_test/gsiTest.h | 6 ++-- src/img/img/gsiDeclImg.cc | 2 +- src/img/img/imgObject.cc | 4 +-- src/img/img/imgService.cc | 16 +++++----- src/klayout.pri | 6 ++++ src/lay/lay/layGSIHelpProvider.cc | 4 +-- src/lay/lay/layHelpSource.cc | 4 +-- src/lay/lay/layMacroEditorDialog.cc | 2 +- src/lay/lay/layMacroEditorPage.cc | 12 +++---- src/lay/lay/layMacroVariableView.cc | 8 ++--- src/lay/lay/laySaltGrain.cc | 2 +- src/lay/lay/laySearchReplaceDialog.cc | 4 +-- src/lay/lay/laySettingsForm.cc | 2 +- src/lay/lay/laySettingsForm.h | 2 +- src/laybasic/laybasic/gsiDeclLayLayoutView.cc | 2 +- src/laybasic/laybasic/gtf.h | 2 +- src/laybasic/laybasic/layBitmapsToImage.cc | 8 ++--- .../laybasic/layConfigurationDialog.cc | 2 +- .../laybasic/layConfigurationDialog.h | 2 +- src/laybasic/laybasic/layDitherPattern.cc | 6 ++-- src/laybasic/laybasic/layFinder.cc | 2 +- src/laybasic/laybasic/layLayerTreeModel.cc | 2 +- src/laybasic/laybasic/layLayoutView.cc | 28 ++++++++-------- src/laybasic/laybasic/layLineStyles.cc | 6 ++-- src/laybasic/laybasic/layRedrawThread.cc | 4 +-- .../laybasic/layRedrawThreadWorker.cc | 4 +-- src/laybasic/laybasic/laySnap.cc | 2 +- src/laybasic/laybasic/layStipplePalette.cc | 4 +-- src/laybasic/laybasic/layViewObject.cc | 4 +-- src/laybasic/laybasic/rdbMarkerBrowserPage.cc | 4 +-- .../db_plugin/contrib/dbGDS2TextReader.cc | 28 ++++++++-------- .../gds2/db_plugin/contrib/dbGDS2TextReader.h | 26 +++++++-------- .../lefdef/db_plugin/dbLEFDEFImporter.cc | 4 +-- .../lefdef/db_plugin/dbLEFDEFPlugin.cc | 6 ++-- .../oasis/db_plugin/dbOASISReader.cc | 32 +++++++++---------- .../oasis/unit_tests/dbOASISReader.cc | 20 ++++++------ .../pcb/db_plugin/dbGerberImporter.cc | 4 +-- .../pcb/db_plugin/dbRS274XApertures.cc | 2 +- .../pcb/lay_plugin/layGerberImportDialog.cc | 4 +-- .../lay_plugin/layNetTracerDialog.cc | 4 +-- .../net_tracer/lay_plugin/layNetTracerIO.cc | 8 ++--- .../tools/xor/lay_plugin/layXORToolDialog.cc | 12 +++---- src/pya/pya/pyaModule.cc | 18 +++++------ src/pya/pya/pyaObject.cc | 22 +++++++------ src/pya/pya/pyaObject.h | 4 +-- src/pymod/bridge_sample/bridge_sample.pro | 6 ++++ src/pymod/tl/tl.pro | 6 +++- src/rdb/rdb/rdb.cc | 2 +- src/tl/tl/tlDeflate.cc | 4 +-- src/tl/tl/tlKDTree.h | 4 +-- src/tl/tl/tlLog.cc | 12 ++++--- src/tl/tl/tlObject.cc | 4 +-- src/tl/tl/tlStream.cc | 12 +++---- src/tl/tl/tlString.cc | 2 +- 67 files changed, 247 insertions(+), 223 deletions(-) diff --git a/src/ant/ant/antConfigPage.cc b/src/ant/ant/antConfigPage.cc index 1cd81d52c..498c066b3 100644 --- a/src/ant/ant/antConfigPage.cc +++ b/src/ant/ant/antConfigPage.cc @@ -227,7 +227,7 @@ ConfigPage4::setup (lay::PluginRoot *root) m_current_template = 0; } if (m_current_template >= int (m_ruler_templates.size ())) { - m_current_template = m_ruler_templates.size (); + m_current_template = int (m_ruler_templates.size ()); m_ruler_templates.push_back (ant::Template ()); } @@ -251,7 +251,7 @@ ConfigPage4::add_clicked () commit (); ant::Template new_one; if (m_current_template < 0 || m_current_template >= int (m_ruler_templates.size ())) { - m_current_template = m_ruler_templates.size (); + m_current_template = int (m_ruler_templates.size ()); } else { new_one = m_ruler_templates [m_current_template]; } diff --git a/src/db/db/dbFillTool.cc b/src/db/db/dbFillTool.cc index efd6b6411..7cdfc20b3 100644 --- a/src/db/db/dbFillTool.cc +++ b/src/db/db/dbFillTool.cc @@ -330,8 +330,8 @@ rasterize_extended (const db::Polygon &fp, const db::Box &fc_bbox, db::AreaMap & if (tl::verbosity () >= 50) { - db::Coord nx = am.nx (); - db::Coord ny = am.ny (); + db::Coord nx = db::Coord (am.nx ()); + db::Coord ny = db::Coord (am.ny ()); db::AreaMap::area_type amax = am.pixel_area (); double n = 0; for (size_t i = 0; i < size_t (nx); ++i) { @@ -361,8 +361,8 @@ rasterize_extended (const db::Polygon &fp, const db::Box &fc_bbox, db::AreaMap & if (tl::verbosity () >= 50) { - db::Coord nx = am.nx (); - db::Coord ny = am.ny (); + db::Coord nx = db::Coord (am.nx ()); + db::Coord ny = db::Coord (am.ny ()); db::AreaMap::area_type amax = am.pixel_area (); double n = 0; for (size_t i = 0; i < size_t (nx); ++i) { diff --git a/src/db/db/dbHash.h b/src/db/db/dbHash.h index c7ffff096..5729af952 100644 --- a/src/db/db/dbHash.h +++ b/src/db/db/dbHash.h @@ -247,7 +247,7 @@ namespace std { size_t h = hfunc (o.hull ()); for (size_t i = 0; i < o.holes (); ++i) { - h = hfunc (o.hole (i), h); + h = hfunc (o.hole (int (i)), h); } return h; } diff --git a/src/db/db/dbPath.h b/src/db/db/dbPath.h index b5dce53c8..4bde626f5 100644 --- a/src/db/db/dbPath.h +++ b/src/db/db/dbPath.h @@ -554,17 +554,17 @@ public: { m_bbox = box_type (); if (m_width < 0) { - m_width = -t.ctrans (-m_width); + m_width = -coord_type (t.ctrans (-m_width)); } else { m_width = t.ctrans (m_width); } if (m_bgn_ext < 0) { - m_bgn_ext = -t.ctrans (-m_bgn_ext); + m_bgn_ext = -coord_type (t.ctrans (-m_bgn_ext)); } else { m_bgn_ext = t.ctrans (m_bgn_ext); } if (m_end_ext < 0) { - m_end_ext = -t.ctrans (-m_end_ext); + m_end_ext = -coord_type (t.ctrans (-m_end_ext)); } else { m_end_ext = t.ctrans (m_end_ext); } @@ -592,17 +592,17 @@ public: path res; if (m_width < 0) { - res.m_width = -t.ctrans (-m_width); + res.m_width = -target_coord_type (t.ctrans (-m_width)); } else { res.m_width = t.ctrans (m_width); } if (m_bgn_ext < 0) { - res.m_bgn_ext = -t.ctrans (-m_bgn_ext); + res.m_bgn_ext = -target_coord_type (t.ctrans (-m_bgn_ext)); } else { res.m_bgn_ext = t.ctrans (m_bgn_ext); } if (m_end_ext < 0) { - res.m_end_ext = -t.ctrans (-m_end_ext); + res.m_end_ext = -target_coord_type (t.ctrans (-m_end_ext)); } else { res.m_end_ext = t.ctrans (m_end_ext); } diff --git a/src/db/db/dbRegion.cc b/src/db/db/dbRegion.cc index efde4a740..65554fab4 100644 --- a/src/db/db/dbRegion.cc +++ b/src/db/db/dbRegion.cc @@ -243,7 +243,7 @@ Region::holes () const for (const_iterator p = begin_merged (); ! p.at_end (); ++p) { for (size_t i = 0; i < p->holes (); ++i) { db::Polygon h; - h.assign_hull (p->begin_hole (i), p->end_hole (i)); + h.assign_hull (p->begin_hole ((unsigned int) i), p->end_hole ((unsigned int) i)); region.insert (h); } } @@ -1151,8 +1151,8 @@ Region::grid_check (db::Coord gx, db::Coord gy) const b = p->begin_hull (); e = p->end_hull (); } else { - b = p->begin_hole (i - 1); - e = p->end_hole (i - 1); + b = p->begin_hole ((unsigned int) (i - 1)); + e = p->end_hole ((unsigned int) (i - 1)); } for (db::Polygon::polygon_contour_iterator pt = b; pt != e; ++pt) { @@ -1199,7 +1199,7 @@ Region::angle_check (double min, double max, bool inverse) const if (i == 0) { h = &p->hull (); } else { - h = &p->hole (i - 1); + h = &p->hole ((unsigned int) (i - 1)); } size_t np = h->size (); @@ -1262,8 +1262,8 @@ Region::snap (db::Coord gx, db::Coord gy) b = p->begin_hull (); e = p->end_hull (); } else { - b = p->begin_hole (i - 1); - e = p->end_hole (i - 1); + b = p->begin_hole ((unsigned int) (i - 1)); + e = p->end_hole ((unsigned int) (i - 1)); } for (db::Polygon::polygon_contour_iterator pt = b; pt != e; ++pt) { diff --git a/src/db/db/dbTilingProcessor.cc b/src/db/db/dbTilingProcessor.cc index eea0f3718..f061f769a 100644 --- a/src/db/db/dbTilingProcessor.cc +++ b/src/db/db/dbTilingProcessor.cc @@ -814,7 +814,7 @@ TilingProcessor::execute (const std::string &desc) // is just a single tile. bool has_tiles = (ntiles_w > 1 || ntiles_h > 1 || ! m_frame.empty ()); - TilingProcessorJob job (this, m_threads, has_tiles); + TilingProcessorJob job (this, int (m_threads), has_tiles); double l = 0.0, b = 0.0; diff --git a/src/db/db/gsiDeclDbLayoutQuery.cc b/src/db/db/gsiDeclDbLayoutQuery.cc index 19f21da6b..c5a0e6315 100644 --- a/src/db/db/gsiDeclDbLayoutQuery.cc +++ b/src/db/db/gsiDeclDbLayoutQuery.cc @@ -61,7 +61,7 @@ static std::vector query_prop_names (const db::LayoutQuery *q) std::vector pn; pn.reserve (pcount); for (size_t i = 0; i < pcount; ++i) { - pn.push_back (q->property_name (i)); + pn.push_back (q->property_name (int (i))); } return pn; } diff --git a/src/db/db/gsiDeclDbRegion.cc b/src/db/db/gsiDeclDbRegion.cc index ec18a94f5..6bb770ebb 100644 --- a/src/db/db/gsiDeclDbRegion.cc +++ b/src/db/db/gsiDeclDbRegion.cc @@ -161,7 +161,7 @@ static typename Delivery::container_type *corners (const db::Region *r, double a size_t n = p->holes () + 1; for (size_t i = 0; i < n; ++i) { - const db::Polygon::contour_type &ctr = p->contour (i); + const db::Polygon::contour_type &ctr = p->contour (int (i)); size_t nn = ctr.size (); if (nn > 2) { diff --git a/src/db/unit_tests/dbCell.cc b/src/db/unit_tests/dbCell.cc index 7929c9777..1e2ef168e 100644 --- a/src/db/unit_tests/dbCell.cc +++ b/src/db/unit_tests/dbCell.cc @@ -254,9 +254,9 @@ static unsigned int pi = 0; void insert_ci (db::Cell &c, size_t ci, const db::Trans &t) { if (pi == 0) { - c.insert (db::CellInstArray (db::CellInst (ci), t)); + c.insert (db::CellInstArray (db::CellInst (db::cell_index_type (ci)), t)); } else { - c.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (ci), t), pi)); + c.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (db::cell_index_type (ci)), t), pi)); } pi = (pi + 1) % 3; } diff --git a/src/db/unit_tests/dbLayoutQuery.cc b/src/db/unit_tests/dbLayoutQuery.cc index 8197a5337..965faf4ac 100644 --- a/src/db/unit_tests/dbLayoutQuery.cc +++ b/src/db/unit_tests/dbLayoutQuery.cc @@ -1358,13 +1358,13 @@ TEST(62) db::Layout g; init_layout (g); - size_t c3index = g.get_lib_proxy (basic_lib, v1t1); - size_t c4index = g.get_lib_proxy (basic_lib, v1t2); + size_t c3index = g.get_lib_proxy (basic_lib, db::cell_index_type (v1t1)); + size_t c4index = g.get_lib_proxy (basic_lib, db::cell_index_type (v1t2)); db::Cell &c1 (g.cell (g.add_cell ("c1"))); db::Cell &c2 (g.cell (g.add_cell ("c2"))); - db::Cell &c3 (g.cell (c3index)); - db::Cell &c4 (g.cell (c4index)); + db::Cell &c3 (g.cell (db::cell_index_type (c3index))); + db::Cell &c4 (g.cell (db::cell_index_type (c4index))); db::FTrans f (1, true); db::Vector p (-10, 20); diff --git a/src/gsi/gsi/gsiExpression.cc b/src/gsi/gsi/gsiExpression.cc index b86b91bc6..53c55f372 100644 --- a/src/gsi/gsi/gsiExpression.cc +++ b/src/gsi/gsi/gsiExpression.cc @@ -1389,7 +1389,7 @@ VariantUserClassImpl::execute_gsi (const tl::ExpressionParserContext & /*context throw tl::Exception (tl::sprintf (tl::to_string (tr ("Signals are not supported inside expressions (event %s)")), method.c_str ())); } else if ((*m)->is_callback()) { // ignore callbacks - } else if ((*m)->compatible_with_num_args (args.size ())) { + } else if ((*m)->compatible_with_num_args ((unsigned int) args.size ())) { ++candidates; meth = *m; } @@ -1427,7 +1427,7 @@ VariantUserClassImpl::execute_gsi (const tl::ExpressionParserContext & /*context if (! (*m)->is_callback () && ! (*m)->is_signal ()) { // check arguments (count and type) - bool is_valid = (*m)->compatible_with_num_args (args.size ()); + bool is_valid = (*m)->compatible_with_num_args ((unsigned int) args.size ()); int sc = 0; int i = 0; for (gsi::MethodBase::argument_iterator a = (*m)->begin_arguments (); is_valid && i < int (args.size ()) && a != (*m)->end_arguments (); ++a, ++i) { diff --git a/src/gsi/gsi/gsiSerialisation.h b/src/gsi/gsi/gsiSerialisation.h index 606e8781a..675c9b0a3 100644 --- a/src/gsi/gsi/gsiSerialisation.h +++ b/src/gsi/gsi/gsiSerialisation.h @@ -708,7 +708,7 @@ public: virtual void set (const char *c_str, size_t s, tl::Heap &) { if (! m_is_const) { - *mp_s = QByteArray (c_str, s); + *mp_s = QByteArray (c_str, int (s)); } } @@ -779,7 +779,7 @@ public: virtual void set (const char *c_str, size_t s, tl::Heap &) { if (! m_is_const) { - *mp_s = QString::fromUtf8 (c_str, s); + *mp_s = QString::fromUtf8 (c_str, int (s)); } } @@ -851,7 +851,7 @@ public: virtual void set (const char *c_str, size_t s, tl::Heap &heap) { if (! m_is_const) { - QString *qstr = new QString (QString::fromUtf8 (c_str, s)); + QString *qstr = new QString (QString::fromUtf8 (c_str, int (s))); heap.push (qstr); *mp_s = QStringRef (qstr); } diff --git a/src/gsi/gsi/gsiTypes.h b/src/gsi/gsi/gsiTypes.h index 89d40bd0d..578e82f46 100644 --- a/src/gsi/gsi/gsiTypes.h +++ b/src/gsi/gsi/gsiTypes.h @@ -1467,7 +1467,7 @@ public: m_is_ptr = type_traits::is_ptr (); m_is_cref = type_traits::is_cref (); m_is_cptr = type_traits::is_cptr (); - m_size = type_traits::serial_size (); + m_size = (unsigned int) type_traits::serial_size (); if (mp_inner) { delete mp_inner; diff --git a/src/gsi/gsi_test/gsiTest.h b/src/gsi/gsi_test/gsiTest.h index 439a50bdb..ad3c367aa 100644 --- a/src/gsi/gsi_test/gsiTest.h +++ b/src/gsi/gsi_test/gsiTest.h @@ -113,7 +113,7 @@ struct A } void a2 () const { } int a3 (const std::string &x) { - return x.size (); + return int (x.size ()); } #if defined(HAVE_QT) int a3_qstr (const QString &x) { @@ -626,12 +626,12 @@ struct B m_var = vars.back (); } m_vars = vars; - return vars.size (); + return long (vars.size ()); } long set_vars (const std::vector &vars) { m_vars = vars; - return vars.size (); + return long (vars.size ()); } tl::Variant b22b () const { return tl::Variant (); } diff --git a/src/img/img/gsiDeclImg.cc b/src/img/img/gsiDeclImg.cc index 0fa337d5e..00a07b69c 100644 --- a/src/img/img/gsiDeclImg.cc +++ b/src/img/img/gsiDeclImg.cc @@ -1029,7 +1029,7 @@ static void insert_image (lay::LayoutView *view, ImageRef &obj) img::Service *img_service = view->get_plugin (); if (img_service) { img::Object *inew = img_service->insert_image (obj); - obj.id (inew->id ()); + obj.id (int (inew->id ())); obj.set_view (view); } } diff --git a/src/img/img/imgObject.cc b/src/img/img/imgObject.cc index 5af774576..5e66c25cc 100644 --- a/src/img/img/imgObject.cc +++ b/src/img/img/imgObject.cc @@ -1479,7 +1479,7 @@ Object::read_file () for (size_t y = 0; y < h; ++y) { for (size_t x = 0; x < w; ++x) { - QRgb rgb = qimage.pixel (QPoint (x, h - y - 1)); + QRgb rgb = qimage.pixel (QPoint (int (x), int (h - y - 1))); red[i] = qRed (rgb); green[i] = qGreen (rgb); blue[i] = qBlue (rgb); @@ -1497,7 +1497,7 @@ Object::read_file () for (size_t y = 0; y < h; ++y) { for (size_t x = 0; x < w; ++x) { - QRgb rgb = qimage.pixel (QPoint (x, h - y - 1)); + QRgb rgb = qimage.pixel (QPoint (int (x), int (h - y - 1))); *d++ = qGreen (rgb); if (msk) { msk[i] = qAlpha (rgb) > 128; diff --git a/src/img/img/imgService.cc b/src/img/img/imgService.cc index f0b7a0628..8f34901e0 100644 --- a/src/img/img/imgService.cc +++ b/src/img/img/imgService.cc @@ -750,7 +750,7 @@ Service::move (const db::DPoint &p, lay::angle_constraint_type ac) // realize transformation db::Matrix3d m (1.0); - db::adjust_matrix (m, li, lm, adjust, m_moved_landmark); + db::adjust_matrix (m, li, lm, adjust, int (m_moved_landmark)); m_current.set_matrix (m * m_initial.matrix ()); m_selected_image_views [0]->redraw (); @@ -874,7 +874,7 @@ Service::end_move (const db::DPoint &, lay::angle_constraint_type) inew->transform (m_trans); mp_view->annotation_shapes ().replace (s->first, db::DUserObject (inew)); - image_changed_event (inew->id ()); + image_changed_event (int (inew->id ())); } @@ -886,7 +886,7 @@ Service::end_move (const db::DPoint &, lay::angle_constraint_type) // replace the image that was moved img::Object *inew = new img::Object (m_current); mp_view->annotation_shapes ().replace (m_selected.begin ()->first, db::DUserObject (inew)); - image_changed_event (inew->id ()); + image_changed_event (int (inew->id ())); // clear the selection (that was artifically created before) if (! m_keep_selection_for_landmark) { @@ -900,7 +900,7 @@ Service::end_move (const db::DPoint &, lay::angle_constraint_type) // replace the image that was moved img::Object *inew = new img::Object (m_current); mp_view->annotation_shapes ().replace (m_selected.begin ()->first, db::DUserObject (inew)); - image_changed_event (inew->id ()); + image_changed_event (int (inew->id ())); // clear the selection (that was artifically created before) clear_selection (); @@ -926,7 +926,7 @@ Service::selection_to_view (img::View::Mode mode) m_selected_image_views.reserve (m_selected.size ()); for (std::map::iterator r = m_selected.begin (); r != m_selected.end (); ++r) { - r->second = m_selected_image_views.size (); + r->second = (unsigned int) m_selected_image_views.size (); m_selected_image_views.push_back (new img::View (this, r->first, mode)); } } @@ -956,7 +956,7 @@ Service::transform (const db::DCplxTrans &trans) img::Object *inew = new img::Object (*iobj); inew->transform (trans); mp_view->annotation_shapes ().replace (s->first, db::DUserObject (inew)); - image_changed_event (inew->id ()); + image_changed_event (int (inew->id ())); } @@ -994,7 +994,7 @@ Service::copy_selected () { // extract all selected images and paste in "micron" space for (std::map::iterator r = m_selected.begin (); r != m_selected.end (); ++r) { - r->second = m_selected_image_views.size (); + r->second = (unsigned int) m_selected_image_views.size (); const img::Object *iobj = dynamic_cast (r->first->ptr ()); db::Clipboard::instance () += new db::ClipboardValue (*iobj); } @@ -1342,7 +1342,7 @@ Service::change_image (obj_iterator pos, const img::Object &to) // replace the object img::Object *inew = new img::Object (to); mp_view->annotation_shapes ().replace (pos, db::DUserObject (inew)); - image_changed_event (inew->id ()); + image_changed_event (int (inew->id ())); // and make selection "visible" selection_to_view (); diff --git a/src/klayout.pri b/src/klayout.pri index 05b59e514..b554c458e 100644 --- a/src/klayout.pri +++ b/src/klayout.pri @@ -85,6 +85,12 @@ msvc { -Wno-deprecated-declarations \ -Wno-reserved-user-defined-literal \ +} else { + + # disable some warnings + QMAKE_CXXFLAGS += \ + /wd4251 \ # DLL interface required + } equals(HAVE_QT, "0") { diff --git a/src/lay/lay/layGSIHelpProvider.cc b/src/lay/lay/layGSIHelpProvider.cc index aeb4d0e18..e77efe6b5 100644 --- a/src/lay/lay/layGSIHelpProvider.cc +++ b/src/lay/lay/layGSIHelpProvider.cc @@ -481,7 +481,7 @@ GSIHelpProvider::get (const std::string &path) const QString errorMsg; int errorLine = 0; - if (! doc.setContent (QByteArray (text.c_str (), text.size ()), true, &errorMsg, &errorLine)) { + if (! doc.setContent (QByteArray (text.c_str (), int (text.size ())), true, &errorMsg, &errorLine)) { // fallback: provide the original text plus the error message std::string fallback_text = std::string ("\n") + @@ -492,7 +492,7 @@ GSIHelpProvider::get (const std::string &path) const escape_xml (text) + "\n" + ""; - doc.setContent (QByteArray (fallback_text.c_str (), fallback_text.size ()), true, &errorMsg, &errorLine); + doc.setContent (QByteArray (fallback_text.c_str (), int (fallback_text.size ())), true, &errorMsg, &errorLine); } diff --git a/src/lay/lay/layHelpSource.cc b/src/lay/lay/layHelpSource.cc index be419c4aa..ff8a53e3f 100644 --- a/src/lay/lay/layHelpSource.cc +++ b/src/lay/lay/layHelpSource.cc @@ -606,7 +606,7 @@ HelpSource::produce_main_index () QDomDocument doc; QString errorMsg; int errorLine = 0 ; - if (! doc.setContent (QByteArray (text.c_str (), text.size ()), true, &errorMsg, &errorLine)) { + if (! doc.setContent (QByteArray (text.c_str (), int (text.size ())), true, &errorMsg, &errorLine)) { throw tl::Exception (tl::to_string (errorMsg) + ", in line " + tl::to_string (errorLine) + " of main index"); } @@ -714,7 +714,7 @@ HelpSource::produce_search (const std::string &string) QDomDocument doc; QString errorMsg; int errorLine = 0 ; - if (! doc.setContent (QByteArray (text.c_str (), text.size ()), true, &errorMsg, &errorLine)) { + if (! doc.setContent (QByteArray (text.c_str (), int (text.size ())), true, &errorMsg, &errorLine)) { throw tl::Exception (tl::to_string (errorMsg) + ", in line " + tl::to_string (errorLine) + " of main index"); } diff --git a/src/lay/lay/layMacroEditorDialog.cc b/src/lay/lay/layMacroEditorDialog.cc index 688990ee1..eed7c5496 100644 --- a/src/lay/lay/layMacroEditorDialog.cc +++ b/src/lay/lay/layMacroEditorDialog.cc @@ -1256,7 +1256,7 @@ MacroEditorDialog::execute (const QString &cmd) write_str (ex.msg ().c_str (), OS_stderr); write_str ("\n", OS_stderr); - } catch (tl::CancelException &ex) { + } catch (tl::CancelException & /*ex*/) { // ignore CancelException diff --git a/src/lay/lay/layMacroEditorPage.cc b/src/lay/lay/layMacroEditorPage.cc index f82350c44..08894123a 100644 --- a/src/lay/lay/layMacroEditorPage.cc +++ b/src/lay/lay/layMacroEditorPage.cc @@ -635,11 +635,11 @@ void MacroEditorPage::cursor_position_changed () bool forward = false, backward = false; if (e != user_data->elements ().end () && valid_element (*e)) { - QString t = b.text ().mid (pos, 1); + QString t = b.text ().mid (int (pos), 1); forward = (t == open_rbracket || t == open_sqbracket || t == open_cbracket); } if (e != user_data->elements ().begin () && e[-1].start_offset + e[-1].length >= pos && valid_element (*e)) { - QString t = b.text ().mid (pos - 1, 1); + QString t = b.text ().mid (int (pos) - 1, 1); backward = (t == close_rbracket || t == close_sqbracket || t == close_cbracket); } @@ -656,7 +656,7 @@ void MacroEditorPage::cursor_position_changed () int found = -1; while (true) { - QString t = b.text ().mid (e->start_offset, e->length).trimmed (); + QString t = b.text ().mid (int (e->start_offset), int (e->length)).trimmed (); if (valid_element (*e)) { @@ -674,7 +674,7 @@ void MacroEditorPage::cursor_position_changed () } else if (c == bs.back ()) { bs.pop_back (); if (bs.empty ()) { - found = p + e->start_offset; + found = p + int (e->start_offset); } } } @@ -684,7 +684,7 @@ void MacroEditorPage::cursor_position_changed () for (int p = t.size (); p > 0 && found < 0; ) { --p; - if (p + e->start_offset < pos) { + if (p + int (e->start_offset) < pos) { QString c = t.mid (p, 1); if (c == close_rbracket) { bs.push_back (open_rbracket); @@ -695,7 +695,7 @@ void MacroEditorPage::cursor_position_changed () } else if (c == bs.back ()) { bs.pop_back (); if (bs.empty ()) { - found = p + e->start_offset; + found = p + int (e->start_offset); } } } diff --git a/src/lay/lay/layMacroVariableView.cc b/src/lay/lay/layMacroVariableView.cc index bbc127c29..d80eae8ac 100644 --- a/src/lay/lay/layMacroVariableView.cc +++ b/src/lay/lay/layMacroVariableView.cc @@ -212,7 +212,7 @@ void MacroVariableView::sync_item (QTreeWidgetItem *parent, gsi::Inspector *insp item->addChild (new PlaceholderItem (ci)); update_value (item, inspector_description (ci), fresh); } else { - update_value (item, inspector_value (inspector, index), fresh); + update_value (item, inspector_value (inspector, int (index)), fresh); } } else if (parent->child (pos)->text (0) != key) { @@ -229,7 +229,7 @@ void MacroVariableView::sync_item (QTreeWidgetItem *parent, gsi::Inspector *insp item->addChild (new PlaceholderItem (ci)); update_value (item, inspector_description (ci), fresh); } else { - update_value (item, inspector_value (inspector, index), fresh); + update_value (item, inspector_value (inspector, int (index)), fresh); } } else { @@ -248,7 +248,7 @@ void MacroVariableView::sync_item (QTreeWidgetItem *parent, gsi::Inspector *insp } else { - update_value (item, inspector_value (inspector, index), false); + update_value (item, inspector_value (inspector, int (index)), false); while (item->childCount () > 0) { delete item->takeChild (0); } @@ -297,7 +297,7 @@ void MacroVariableView::sync (QTreeWidgetItem *parent, gsi::Inspector *inspector // delete all items which are no longer present while (size_t (parent->childCount ()) > n) { - delete parent->takeChild (n); + delete parent->takeChild (int (n)); } // insert or update new items diff --git a/src/lay/lay/laySaltGrain.cc b/src/lay/lay/laySaltGrain.cc index eb5ccb565..3ab886ebb 100644 --- a/src/lay/lay/laySaltGrain.cc +++ b/src/lay/lay/laySaltGrain.cc @@ -368,7 +368,7 @@ struct ImageConverter if (image.empty ()) { res = QImage (); } else { - res = QImage::fromData (QByteArray::fromBase64 (QByteArray (image.c_str (), image.size ()))); + res = QImage::fromData (QByteArray::fromBase64 (QByteArray (image.c_str (), int (image.size ())))); } } }; diff --git a/src/lay/lay/laySearchReplaceDialog.cc b/src/lay/lay/laySearchReplaceDialog.cc index 3a4924b96..499c8c212 100644 --- a/src/lay/lay/laySearchReplaceDialog.cc +++ b/src/lay/lay/laySearchReplaceDialog.cc @@ -469,7 +469,7 @@ SearchReplaceResults::export_csv (const std::string &file) if (c) { output << ","; } - output << escape_csv (tl::to_string (headerData (c, Qt::Horizontal, Qt::DisplayRole).toString ())); + output << escape_csv (tl::to_string (headerData (int (c), Qt::Horizontal, Qt::DisplayRole).toString ())); } output << std::endl; @@ -480,7 +480,7 @@ SearchReplaceResults::export_csv (const std::string &file) output << ","; } // TODO: optimize - output << escape_csv (tl::to_string (data (index (r, c, parent), Qt::DisplayRole).toString ())); + output << escape_csv (tl::to_string (data (index (int (r), int (c), parent), Qt::DisplayRole).toString ())); } output << std::endl; diff --git a/src/lay/lay/laySettingsForm.cc b/src/lay/lay/laySettingsForm.cc index 637f0af1e..8d595f807 100644 --- a/src/lay/lay/laySettingsForm.cc +++ b/src/lay/lay/laySettingsForm.cc @@ -242,7 +242,7 @@ SettingsForm::setup () } void -SettingsForm::commit () throw (tl::Exception) +SettingsForm::commit () { // commit the custom config pages for (std::vector ::iterator cp = m_config_pages.begin (); cp != m_config_pages.end (); ++cp) { diff --git a/src/lay/lay/laySettingsForm.h b/src/lay/lay/laySettingsForm.h index 63ef13d3d..92ab4497d 100644 --- a/src/lay/lay/laySettingsForm.h +++ b/src/lay/lay/laySettingsForm.h @@ -49,7 +49,7 @@ public: SettingsForm (QWidget *parent, lay::MainWindow *lv, const char *name); void setup (); - void commit () throw (tl::Exception); + void commit (); public slots: virtual void ok_clicked (); diff --git a/src/laybasic/laybasic/gsiDeclLayLayoutView.cc b/src/laybasic/laybasic/gsiDeclLayLayoutView.cc index 4973fa550..eb77cd48f 100644 --- a/src/laybasic/laybasic/gsiDeclLayLayoutView.cc +++ b/src/laybasic/laybasic/gsiDeclLayLayoutView.cc @@ -66,7 +66,7 @@ static unsigned int add_stipple1 (lay::LayoutView *view, const std::string &name lay::DitherPatternInfo p; p.set_name (name); if (bits > 0 && ! data.empty ()) { - p.set_pattern (&(*data.begin ()), std::min (32u, bits), std::min (size_t (32), data.size ())); + p.set_pattern (&(*data.begin ()), std::min (32u, bits), std::min (32u, (unsigned int) data.size ())); } unsigned int index = pattern.add_pattern (p); diff --git a/src/laybasic/laybasic/gtf.h b/src/laybasic/laybasic/gtf.h index f94e7a143..b3af7b328 100644 --- a/src/laybasic/laybasic/gtf.h +++ b/src/laybasic/laybasic/gtf.h @@ -235,7 +235,7 @@ public: */ unsigned int size () const { - return m_events.size (); + return int (m_events.size ()); } /** diff --git a/src/laybasic/laybasic/layBitmapsToImage.cc b/src/laybasic/laybasic/layBitmapsToImage.cc index 2d8d7e3eb..57e547e4b 100644 --- a/src/laybasic/laybasic/layBitmapsToImage.cc +++ b/src/laybasic/laybasic/layBitmapsToImage.cc @@ -427,7 +427,7 @@ bitmaps_to_image_rgb (const std::vector &view_ops_in, bool transparent, QMutex *mutex) { - unsigned int n_in = view_ops_in.size (); + unsigned int n_in = (unsigned int) view_ops_in.size (); std::vector bm_map; std::vector vo_map; @@ -607,7 +607,7 @@ bitmaps_to_image_rgb (const std::vector &view_ops_in, }; dptr = dptr_end - nwords + i; - for (int j = masks.size () - 1; j >= 0; --j) { + for (int j = int (masks.size () - 1); j >= 0; --j) { uint32_t d = *dptr; if (d != 0) { @@ -660,7 +660,7 @@ bitmaps_to_image_mono (const std::vector &view_ops_in, bool use_bitmap_index, QMutex *mutex) { - unsigned int n_in = view_ops_in.size (); + unsigned int n_in = (unsigned int) view_ops_in.size (); std::vector bm_map; std::vector vo_map; @@ -820,7 +820,7 @@ bitmaps_to_image_mono (const std::vector &view_ops_in, uint32_t z = lay::wordones; dptr = dptr_end - nwords + i; - for (int j = masks.size () - 1; j >= 0; --j) { + for (int j = int (masks.size () - 1); j >= 0; --j) { uint32_t d = *dptr; if (d != 0) { uint32_t m = 1; diff --git a/src/laybasic/laybasic/layConfigurationDialog.cc b/src/laybasic/laybasic/layConfigurationDialog.cc index af9f4cf71..ca05932b9 100644 --- a/src/laybasic/laybasic/layConfigurationDialog.cc +++ b/src/laybasic/laybasic/layConfigurationDialog.cc @@ -119,7 +119,7 @@ ConfigurationDialog::init (const lay::PluginDeclaration *decl) } void -ConfigurationDialog::commit () throw (tl::Exception) +ConfigurationDialog::commit () { for (std::vector ::iterator p = m_config_pages.begin (); p != m_config_pages.end (); ++p) { (*p)->commit (mp_root); diff --git a/src/laybasic/laybasic/layConfigurationDialog.h b/src/laybasic/laybasic/layConfigurationDialog.h index e3454da8f..3607f33a8 100644 --- a/src/laybasic/laybasic/layConfigurationDialog.h +++ b/src/laybasic/laybasic/layConfigurationDialog.h @@ -52,7 +52,7 @@ public: ConfigurationDialog (QWidget *parent, lay::PluginRoot *root, const std::string &plugin_name, const char *name = ""); ~ConfigurationDialog (); - void commit () throw (tl::Exception); + void commit (); public slots: virtual void ok_clicked (); diff --git a/src/laybasic/laybasic/layDitherPattern.cc b/src/laybasic/laybasic/layDitherPattern.cc index b4faa1e93..8ee1823e1 100644 --- a/src/laybasic/laybasic/layDitherPattern.cc +++ b/src/laybasic/laybasic/layDitherPattern.cc @@ -951,13 +951,13 @@ DitherPattern::merge (const DitherPattern &other, std::map patterns; for (iterator c = begin_custom (); c != end (); ++c) { - patterns.insert (std::make_pair (*c, std::distance (begin (), c))); + patterns.insert (std::make_pair (*c, (unsigned int) std::distance (begin (), c))); } // map the pattern of other into *this, possibly creating new ones @@ -970,7 +970,7 @@ DitherPattern::merge (const DitherPattern &other, std::mapsecond; } - index_map.insert (std::make_pair (std::distance (other.begin (), c), new_index)); + index_map.insert (std::make_pair ((unsigned int) std::distance (other.begin (), c), new_index)); } } diff --git a/src/laybasic/laybasic/layFinder.cc b/src/laybasic/laybasic/layFinder.cc index 24c2951f5..d21535a9f 100644 --- a/src/laybasic/laybasic/layFinder.cc +++ b/src/laybasic/laybasic/layFinder.cc @@ -107,7 +107,7 @@ Finder::start (lay::LayoutView *view, const lay::CellView &cv, unsigned int cv_i m_path.erase (m_path.begin (), m_path.end ()); for (std::vector::const_iterator t = trans.begin (); t != trans.end (); ++t) { - do_find (*cv.cell (), cv.specific_path ().size (), *t * cv.context_trans ()); + do_find (*cv.cell (), int (cv.specific_path ().size ()), *t * cv.context_trans ()); } } diff --git a/src/laybasic/laybasic/layLayerTreeModel.cc b/src/laybasic/laybasic/layLayerTreeModel.cc index 43b35e971..d53b1ccf0 100644 --- a/src/laybasic/laybasic/layLayerTreeModel.cc +++ b/src/laybasic/laybasic/layLayerTreeModel.cc @@ -448,7 +448,7 @@ LayerTreeModel::parent (const QModelIndex &index) const } else { // It is important that the column index of the parent is 0. // Otherwise the tree view will not behave as expected. - return createIndex (iter.child_index (), 0, (void *) (iter.uint () + m_id_start)); + return createIndex (int (iter.child_index ()), 0, (void *) (iter.uint () + m_id_start)); } } } else { diff --git a/src/laybasic/laybasic/layLayoutView.cc b/src/laybasic/laybasic/layLayoutView.cc index abd68dba5..543553d41 100644 --- a/src/laybasic/laybasic/layLayoutView.cc +++ b/src/laybasic/laybasic/layLayoutView.cc @@ -296,7 +296,7 @@ LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool edit } else { *m_layer_properties_lists [i] = *source->m_layer_properties_lists [i]; } - m_layer_properties_lists [i]->attach_view (this, i); + m_layer_properties_lists [i]->attach_view (this, (unsigned int) i); } if (! m_layer_properties_lists.empty ()) { @@ -434,7 +434,7 @@ LayoutView::init (db::Manager *mgr, lay::PluginRoot *root, QWidget * /*parent*/) m_copy_layerr = -1; m_layer_properties_lists.push_back (new LayerPropertiesList ()); - m_layer_properties_lists.back ()->attach_view (this, m_layer_properties_lists.size () - 1); + m_layer_properties_lists.back ()->attach_view (this, (unsigned int) (m_layer_properties_lists.size () - 1)); m_current_layer_list = 0; QVBoxLayout *vbl = new QVBoxLayout (this); @@ -1764,7 +1764,7 @@ LayoutView::set_properties (unsigned int index, const LayerPropertiesList &props return; } else { m_layer_properties_lists.push_back (new LayerPropertiesList ()); - m_layer_properties_lists.back ()->attach_view (this, m_layer_properties_lists.size () - 1); + m_layer_properties_lists.back ()->attach_view (this, (unsigned int) (m_layer_properties_lists.size () - 1)); } } @@ -1833,7 +1833,7 @@ LayoutView::replace_layer_node (unsigned int index, const LayerPropertiesConstIt if (*iter != node) { if (transacting ()) { - manager ()->queue (this, new OpSetLayerPropsNode (index, iter.uint (), *iter, node)); + manager ()->queue (this, new OpSetLayerPropsNode (index, (unsigned int) iter.uint (), *iter, node)); } else if (manager () && ! replaying ()) { manager ()->clear (); } @@ -1867,7 +1867,7 @@ LayoutView::set_properties (unsigned int index, const LayerPropertiesConstIterat if (l != props) { if (transacting ()) { - manager ()->queue (this, new OpSetLayerProps (index, iter.uint (), l, props)); + manager ()->queue (this, new OpSetLayerProps (index, (unsigned int) iter.uint (), l, props)); } else if (manager () && ! replaying ()) { manager ()->clear (); } @@ -1902,7 +1902,7 @@ const LayerPropertiesNode & LayoutView::insert_layer (unsigned int index, const LayerPropertiesConstIterator &before, const LayerPropertiesNode &node) { if (transacting ()) { - manager ()->queue (this, new OpInsertLayerProps (index, before.uint (), node)); + manager ()->queue (this, new OpInsertLayerProps (index, (unsigned int) before.uint (), node)); } else if (manager () && ! replaying ()) { manager ()->clear (); } @@ -1935,7 +1935,7 @@ LayoutView::delete_layer (unsigned int index, LayerPropertiesConstIterator &iter m_layer_properties_lists [index]->erase (LayerPropertiesIterator (*m_layer_properties_lists [index], iter.uint ())); if (transacting ()) { - manager ()->queue (this, new OpDeleteLayerProps (index, iter.uint (), orig)); + manager ()->queue (this, new OpDeleteLayerProps (index, (unsigned int) iter.uint (), orig)); } else if (manager () && ! replaying ()) { manager ()->clear (); } @@ -3313,12 +3313,12 @@ LayoutView::merge_layer_props (const std::vector &prop std::vector::const_iterator p = props.begin (); if (n < layer_lists ()) { - lay::LayerPropertiesList new_props (get_properties (n)); + lay::LayerPropertiesList new_props (get_properties ((unsigned int) n)); new_props.append (*p); if (! p->name ().empty ()) { new_props.set_name (p->name ()); } - set_properties (n, new_props); + set_properties ((unsigned int) n, new_props); } else { lay::LayerPropertiesList new_props = p0; @@ -3326,7 +3326,7 @@ LayoutView::merge_layer_props (const std::vector &prop if (! p->name ().empty ()) { new_props.set_name (p->name ()); } - insert_layer_list (n, new_props); + insert_layer_list ((unsigned int) n, new_props); } } @@ -3337,19 +3337,19 @@ LayoutView::merge_layer_props (const std::vector &prop for (std::vector::const_iterator p = props.begin (); p != props.end (); ++p, ++n) { if (n < layer_lists ()) { - lay::LayerPropertiesList new_props (get_properties (n)); + lay::LayerPropertiesList new_props (get_properties ((unsigned int) n)); new_props.append (*p); if (! p->name ().empty ()) { new_props.set_name (p->name ()); } - set_properties (n, new_props); + set_properties ((unsigned int) n, new_props); } else { lay::LayerPropertiesList new_props = p0; new_props.append (*p); if (! p->name ().empty ()) { new_props.set_name (p->name ()); } - insert_layer_list (n, new_props); + insert_layer_list ((unsigned int) n, new_props); } } @@ -3385,7 +3385,7 @@ LayoutView::store_state () DisplayState state (box (), get_min_hier_levels (), get_max_hier_levels (), m_cellviews); m_display_states.push_back (state); - m_display_state_ptr = m_display_states.size () - 1; + m_display_state_ptr = (unsigned int) (m_display_states.size () - 1); } db::DBox diff --git a/src/laybasic/laybasic/layLineStyles.cc b/src/laybasic/laybasic/layLineStyles.cc index c37d0739e..f43287876 100644 --- a/src/laybasic/laybasic/layLineStyles.cc +++ b/src/laybasic/laybasic/layLineStyles.cc @@ -520,13 +520,13 @@ LineStyles::merge (const LineStyles &other, std::map { // insert the standard pattern into the map (for completeness) for (iterator c = begin (); c != begin_custom (); ++c) { - index_map.insert (std::make_pair (std::distance (begin (), c), std::distance (begin (), c))); + index_map.insert (std::make_pair ((unsigned int) std::distance (begin (), c), (unsigned int) std::distance (begin (), c))); } // build an index of present pattern std::map styles; for (iterator c = begin_custom (); c != end (); ++c) { - styles.insert (std::make_pair (*c, std::distance (begin (), c))); + styles.insert (std::make_pair (*c, (unsigned int) std::distance (begin (), c))); } // map the pattern of other into *this, possibly creating new ones @@ -539,7 +539,7 @@ LineStyles::merge (const LineStyles &other, std::map } else { new_index = p->second; } - index_map.insert (std::make_pair (std::distance (other.begin (), c), new_index)); + index_map.insert (std::make_pair ((unsigned int) std::distance (other.begin (), c), new_index)); } } diff --git a/src/laybasic/laybasic/layRedrawThread.cc b/src/laybasic/laybasic/layRedrawThread.cc index ec2233de7..f71f15e00 100644 --- a/src/laybasic/laybasic/layRedrawThread.cc +++ b/src/laybasic/laybasic/layRedrawThread.cc @@ -117,7 +117,7 @@ RedrawThread::commit (const std::vector &layers, const la m_resolution = resolution; m_layers = layers; - m_nlayers = m_layers.size (); + m_nlayers = int (m_layers.size ()); for (size_t i = 0; i < m_layers.size (); ++i) { if (m_layers [i].visible) { m_layers [i].enabled = false; @@ -258,7 +258,7 @@ RedrawThread::do_start (bool clear, const db::Vector *shift_vector, const std::v m_layers = *layers; } - m_nlayers = m_layers.size (); + m_nlayers = int (m_layers.size ()); if (mp_view->cellviews () > 0) { diff --git a/src/laybasic/laybasic/layRedrawThreadWorker.cc b/src/laybasic/laybasic/layRedrawThreadWorker.cc index 7d67986e4..5f485e208 100644 --- a/src/laybasic/laybasic/layRedrawThreadWorker.cc +++ b/src/laybasic/laybasic/layRedrawThreadWorker.cc @@ -2002,8 +2002,8 @@ RedrawThreadWorker::iterate_variants (const std::vector &redraw_region // traversals along the context path bottom up. size_t ctx_path_length = m_cellviews [m_cv_index].specific_path ().size (); if (ctx_path_length > 0) { - m_from_level -= ctx_path_length; - m_to_level -= ctx_path_length; + m_from_level -= int (ctx_path_length); + m_to_level -= int (ctx_path_length); trans = trans * m_cellviews [m_cv_index].context_trans (); } diff --git a/src/laybasic/laybasic/laySnap.cc b/src/laybasic/laybasic/laySnap.cc index 57943af9b..193a1cb67 100644 --- a/src/laybasic/laybasic/laySnap.cc +++ b/src/laybasic/laybasic/laySnap.cc @@ -310,7 +310,7 @@ public: db::DBox dregion = dworld & db::DBox (px - dd, py - dd, px + dd, py + dd); if (! dregion.empty ()) { - int ctx_levels = cv.specific_path ().size (); + int ctx_levels = int (cv.specific_path ().size ()); int min_hier_level = view->get_min_hier_levels () - ctx_levels; int max_hier_level = view->get_max_hier_levels () - ctx_levels; diff --git a/src/laybasic/laybasic/layStipplePalette.cc b/src/laybasic/laybasic/layStipplePalette.cc index 3cfb85c54..af0fb5c7e 100644 --- a/src/laybasic/laybasic/layStipplePalette.cc +++ b/src/laybasic/laybasic/layStipplePalette.cc @@ -93,7 +93,7 @@ StipplePalette::stipple_by_index (unsigned int n) const unsigned int StipplePalette::stipples () const { - return m_stipples.size (); + return (unsigned int) m_stipples.size (); } unsigned int @@ -110,7 +110,7 @@ StipplePalette::standard_stipple_index_by_index (unsigned int n) const unsigned int StipplePalette::standard_stipples () const { - return m_standard.size (); + return (unsigned int) m_standard.size (); } void diff --git a/src/laybasic/laybasic/layViewObject.cc b/src/laybasic/laybasic/layViewObject.cc index 600b10cc5..3b93eeb51 100644 --- a/src/laybasic/laybasic/layViewObject.cc +++ b/src/laybasic/laybasic/layViewObject.cc @@ -1006,7 +1006,7 @@ BitmapViewObjectCanvas::plane (const lay::ViewOp &style) if (b == m_fg_bitmap_table.end ()) { // we need to create a new plane - m_fg_bitmap_table.insert (std::make_pair (style, mp_alloc_bitmaps.size ())); + m_fg_bitmap_table.insert (std::make_pair (style, (unsigned int) mp_alloc_bitmaps.size ())); lay::Bitmap *bm = new lay::Bitmap (m_width, m_height, m_resolution); mp_fg_bitmaps.push_back (bm); mp_alloc_bitmaps.push_back (bm); @@ -1026,7 +1026,7 @@ BitmapViewObjectCanvas::plane (const std::vector &style) if (b == m_fgv_bitmap_table.end ()) { // we need to create a new bitmap - m_fgv_bitmap_table.insert (std::make_pair (style, mp_alloc_bitmaps.size ())); + m_fgv_bitmap_table.insert (std::make_pair (style, (unsigned int) mp_alloc_bitmaps.size ())); lay::Bitmap *bm = new lay::Bitmap (m_width, m_height, m_resolution); mp_alloc_bitmaps.push_back (bm); for (std::vector::const_iterator s = style.begin (); s != style.end (); ++s) { diff --git a/src/laybasic/laybasic/rdbMarkerBrowserPage.cc b/src/laybasic/laybasic/rdbMarkerBrowserPage.cc index c43b5d060..db54294e0 100644 --- a/src/laybasic/laybasic/rdbMarkerBrowserPage.cc +++ b/src/laybasic/laybasic/rdbMarkerBrowserPage.cc @@ -630,7 +630,7 @@ public: if (node) { update_cache (node); - return node->children (); + return int (node->children ()); } else { return 0; } @@ -1401,7 +1401,7 @@ public: int rowCount (const QModelIndex &index) const { if (mp_database && ! index.isValid ()) { - return m_item_list.size (); + return int (m_item_list.size ()); } else { return 0; } diff --git a/src/plugins/streamers/gds2/db_plugin/contrib/dbGDS2TextReader.cc b/src/plugins/streamers/gds2/db_plugin/contrib/dbGDS2TextReader.cc index db1e582dd..e5b8cd51a 100644 --- a/src/plugins/streamers/gds2/db_plugin/contrib/dbGDS2TextReader.cc +++ b/src/plugins/streamers/gds2/db_plugin/contrib/dbGDS2TextReader.cc @@ -52,7 +52,7 @@ GDS2ReaderText::~GDS2ReaderText() } const LayerMap & -GDS2ReaderText::read (db::Layout &layout, const db::LoadLayoutOptions &options) throw (tl::Exception) +GDS2ReaderText::read (db::Layout &layout, const db::LoadLayoutOptions &options) { storedRecId = 0; @@ -65,19 +65,19 @@ GDS2ReaderText::read (db::Layout &layout, const db::LoadLayoutOptions &options) } const LayerMap & -GDS2ReaderText::read (db::Layout &layout) throw (tl::Exception) +GDS2ReaderText::read (db::Layout &layout) { return read (layout, db::LoadLayoutOptions ()); } void -GDS2ReaderText::unget_record (short rec_id) throw (tl::Exception) +GDS2ReaderText::unget_record (short rec_id) { storedRecId = rec_id; } short -GDS2ReaderText::get_record () throw (tl::Exception) +GDS2ReaderText::get_record () { short siValueToReturn = 0; @@ -243,13 +243,13 @@ GDS2ReaderText::siExtractData(std::string &_sInput, std::string &_sToken, std::s } const char * -GDS2ReaderText::get_string () throw (tl::Exception) +GDS2ReaderText::get_string () { return reader.skip (); } double -GDS2ReaderText::get_double () throw (tl::Exception) +GDS2ReaderText::get_double () { double x = 0; if (! reader.try_read (x)) { @@ -259,14 +259,14 @@ GDS2ReaderText::get_double () throw (tl::Exception) } void -GDS2ReaderText::get_string (tl::string &s) const throw (tl::Exception) +GDS2ReaderText::get_string (tl::string &s) const { // TODO: get rid of this const_cast hack s = (const_cast (this))->reader.skip (); } int -GDS2ReaderText::get_int () throw (tl::Exception) +GDS2ReaderText::get_int () { int x = 0; if (! reader.try_read (x)) { @@ -276,7 +276,7 @@ GDS2ReaderText::get_int () throw (tl::Exception) } short -GDS2ReaderText::get_short () throw (tl::Exception) +GDS2ReaderText::get_short () { int x = 0; if (! reader.try_read (x)) { @@ -289,7 +289,7 @@ GDS2ReaderText::get_short () throw (tl::Exception) } unsigned short -GDS2ReaderText::get_ushort () throw (tl::Exception) +GDS2ReaderText::get_ushort () { unsigned int x = 0; if (! reader.try_read (x)) { @@ -302,7 +302,7 @@ GDS2ReaderText::get_ushort () throw (tl::Exception) } void -GDS2ReaderText::error (const std::string &msg) throw (tl::Exception) +GDS2ReaderText::error (const std::string &msg) { throw GDS2ReaderTextException (msg, int(sStream.line_number()), cellname().c_str ()); } @@ -318,7 +318,7 @@ GDS2ReaderText::warn (const std::string &msg) } void -GDS2ReaderText::get_time (unsigned int *mod_time, unsigned int *access_time) throw (tl::Exception) +GDS2ReaderText::get_time (unsigned int *mod_time, unsigned int *access_time) { if (! reader.try_read (mod_time [1])) { return; @@ -370,9 +370,9 @@ GDS2ReaderText::get_time (unsigned int *mod_time, unsigned int *access_time) thr } GDS2XY * -GDS2ReaderText::get_xy_data (unsigned int &xy_length) throw (tl::Exception) +GDS2ReaderText::get_xy_data (unsigned int &xy_length) { - xy_length = xyData.size (); + xy_length = (unsigned int) xyData.size (); return xyData.empty () ? 0 : &xyData.front (); } diff --git a/src/plugins/streamers/gds2/db_plugin/contrib/dbGDS2TextReader.h b/src/plugins/streamers/gds2/db_plugin/contrib/dbGDS2TextReader.h index d35d9f14f..8cf00045c 100644 --- a/src/plugins/streamers/gds2/db_plugin/contrib/dbGDS2TextReader.h +++ b/src/plugins/streamers/gds2/db_plugin/contrib/dbGDS2TextReader.h @@ -79,7 +79,7 @@ public: * @param options The generic reader options * @return The LayerMap object that tells where which layer was loaded */ - virtual const LayerMap &read (db::Layout &layout, const LoadLayoutOptions &options) throw (tl::Exception); + virtual const LayerMap &read (db::Layout &layout, const LoadLayoutOptions &options); /** * @brief The basic read method (without mapping) @@ -94,7 +94,7 @@ public: * @param layout The layout object to write to * @return The LayerMap object */ - virtual const LayerMap &read (db::Layout &layout) throw (tl::Exception); + virtual const LayerMap &read (db::Layout &layout); /** * @brief Format @@ -110,16 +110,16 @@ private: tl::Extractor reader; std::vector xyData; - const char *get_string () throw (tl::Exception); - void get_string (tl::string &s) const throw (tl::Exception); - int get_int () throw (tl::Exception); - short get_short () throw (tl::Exception); - unsigned short get_ushort () throw (tl::Exception); - double get_double()throw (tl::Exception); - short get_record() throw (tl::Exception); - void unget_record (short rec_id) throw (tl::Exception); - void get_time (unsigned int *mod_time, unsigned int *access_time) throw (tl::Exception); - GDS2XY *get_xy_data (unsigned int &xy_length) throw (tl::Exception); + const char *get_string (); + void get_string (tl::string &s) const; + int get_int (); + short get_short (); + unsigned short get_ushort (); + double get_double(); + short get_record(); + void unget_record (short rec_id); + void get_time (unsigned int *mod_time, unsigned int *access_time); + GDS2XY *get_xy_data (unsigned int &xy_length); void progress_checkpoint (); short siExtractData(std::string &sInput, std::string &sToken, std::string &sArguments); @@ -128,7 +128,7 @@ private: */ void vConvertToXY(const std::string &_sArg); - void error (const std::string &txt) throw (tl::Exception); + void error (const std::string &txt); void warn (const std::string &txt); }; diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc index aced0dc0d..0e817f56f 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc @@ -416,7 +416,7 @@ LEFDEFImporter::read (tl::InputStream &stream, db::Layout &layout, LEFDEFLayerDe void LEFDEFImporter::error (const std::string &msg) { - throw LEFDEFReaderException (msg, mp_stream->line_number (), m_cellname, m_fn); + throw LEFDEFReaderException (msg, int (mp_stream->line_number ()), m_cellname, m_fn); } void @@ -549,7 +549,7 @@ LEFDEFImporter::get () const std::string & LEFDEFImporter::next () { - unsigned int last_line = mp_stream->line_number (); + unsigned int last_line = (unsigned int) mp_stream->line_number (); m_last_token.clear (); diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc index 52265cb61..fa756fc31 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc @@ -88,12 +88,12 @@ public: // .. nothing yet .. } - virtual const db::LayerMap &read (db::Layout &layout, const db::LoadLayoutOptions &options) throw (tl::Exception) + virtual const db::LayerMap &read (db::Layout &layout, const db::LoadLayoutOptions &options) { return read_lefdef (layout, options, is_lef_format (m_stream.filename ())); } - virtual const db::LayerMap &read (db::Layout &layout) throw (tl::Exception) + virtual const db::LayerMap &read (db::Layout &layout) { return read_lefdef (layout, db::LoadLayoutOptions (), is_lef_format (m_stream.filename ())); } @@ -115,7 +115,7 @@ private: } } - const db::LayerMap &read_lefdef (db::Layout &layout, const db::LoadLayoutOptions &options, bool import_lef) throw (tl::Exception) + const db::LayerMap &read_lefdef (db::Layout &layout, const db::LoadLayoutOptions &options, bool import_lef) { const db::LEFDEFReaderOptions *lefdef_options = dynamic_cast (options.get_options (format ())); static db::LEFDEFReaderOptions default_options; diff --git a/src/plugins/streamers/oasis/db_plugin/dbOASISReader.cc b/src/plugins/streamers/oasis/db_plugin/dbOASISReader.cc index ab8167988..a97d1e913 100644 --- a/src/plugins/streamers/oasis/db_plugin/dbOASISReader.cc +++ b/src/plugins/streamers/oasis/db_plugin/dbOASISReader.cc @@ -2030,10 +2030,10 @@ OASISReader::do_read_placement (unsigned char r, if (mag_set || angle < 0) { inst = db::CellInstArray (db::CellInst (mm_placement_cell.get ()), - db::ICplxTrans (mag, angle_deg, mirror, pos), layout.array_repository (), a, b, na, nb); + db::ICplxTrans (mag, angle_deg, mirror, pos), layout.array_repository (), a, b, (unsigned long) na, (unsigned long) nb); } else { inst = db::CellInstArray (db::CellInst (mm_placement_cell.get ()), - db::Trans (angle, mirror, pos), layout.array_repository (), a, b, na, nb); + db::Trans (angle, mirror, pos), layout.array_repository (), a, b, (unsigned long) na, (unsigned long) nb); } if (pp.first) { @@ -2198,9 +2198,9 @@ OASISReader::do_read_text (bool xy_absolute, db::TextPtr text_ptr (text, layout.shape_repository ()); if (pp.first) { - cell.shapes (ll.second).insert (db::object_with_properties (db::Shape::text_ptr_array_type (text_ptr, db::Disp (pos), layout.array_repository (), a, b, na, nb), pp.second)); + cell.shapes (ll.second).insert (db::object_with_properties (db::Shape::text_ptr_array_type (text_ptr, db::Disp (pos), layout.array_repository (), a, b, (unsigned long) na, (unsigned long) nb), pp.second)); } else { - cell.shapes (ll.second).insert (db::Shape::text_ptr_array_type (text_ptr, db::Disp (pos), layout.array_repository (), a, b, na, nb)); + cell.shapes (ll.second).insert (db::Shape::text_ptr_array_type (text_ptr, db::Disp (pos), layout.array_repository (), a, b, (unsigned long) na, (unsigned long) nb)); } } else if (! layout.is_editable () && (points = mm_repetition.get ().is_iterated ()) != 0) { @@ -2330,9 +2330,9 @@ OASISReader::do_read_rectangle (bool xy_absolute, // Create a box array if (pp.first) { - cell.shapes (ll.second).insert (db::object_with_properties (db::Shape::box_array_type (box, db::UnitTrans (), layout.array_repository (), a, b, na, nb), pp.second)); + cell.shapes (ll.second).insert (db::object_with_properties (db::Shape::box_array_type (box, db::UnitTrans (), layout.array_repository (), a, b, (unsigned long) na, (unsigned long) nb), pp.second)); } else { - cell.shapes (ll.second).insert (db::Shape::box_array_type (box, db::UnitTrans (), layout.array_repository (), a, b, na, nb)); + cell.shapes (ll.second).insert (db::Shape::box_array_type (box, db::UnitTrans (), layout.array_repository (), a, b, (unsigned long) na, (unsigned long) nb)); } } else if (! layout.is_editable () && (points = mm_repetition.get ().is_iterated ()) != 0) { @@ -2456,9 +2456,9 @@ OASISReader::do_read_polygon (bool xy_absolute, db::cell_index_type cell_index, db::SimplePolygonPtr poly_ptr (poly, layout.shape_repository ()); if (pp.first) { - cell.shapes (ll.second).insert (db::object_with_properties > (db::array (poly_ptr, db::Disp (d + pos), layout.array_repository (), a, b, na, nb), pp.second)); + cell.shapes (ll.second).insert (db::object_with_properties > (db::array (poly_ptr, db::Disp (d + pos), layout.array_repository (), a, b, (unsigned long) na, (unsigned long) nb), pp.second)); } else { - cell.shapes (ll.second).insert (db::array (poly_ptr, db::Disp (d + pos), layout.array_repository (), a, b, na, nb)); + cell.shapes (ll.second).insert (db::array (poly_ptr, db::Disp (d + pos), layout.array_repository (), a, b, (unsigned long) na, (unsigned long) nb)); } } else if (! layout.is_editable () && (points = mm_repetition.get ().is_iterated ()) != 0) { @@ -2625,9 +2625,9 @@ OASISReader::do_read_path (bool xy_absolute, db::cell_index_type cell_index, db: db::PathPtr path_ptr (path, layout.shape_repository ()); if (pp.first) { - cell.shapes (ll.second).insert (db::object_with_properties > (db::array (path_ptr, db::Disp (d + pos), layout.array_repository (), a, b, na, nb), pp.second)); + cell.shapes (ll.second).insert (db::object_with_properties > (db::array (path_ptr, db::Disp (d + pos), layout.array_repository (), a, b, (unsigned long) na, (unsigned long) nb), pp.second)); } else { - cell.shapes (ll.second).insert (db::array (path_ptr, db::Disp (d + pos), layout.array_repository (), a, b, na, nb)); + cell.shapes (ll.second).insert (db::array (path_ptr, db::Disp (d + pos), layout.array_repository (), a, b, (unsigned long) na, (unsigned long) nb)); } } else if (! layout.is_editable () && (points = mm_repetition.get ().is_iterated ()) != 0) { @@ -2794,9 +2794,9 @@ OASISReader::do_read_trapezoid (unsigned char r, bool xy_absolute,db::cell_index db::SimplePolygonPtr poly_ptr (poly, layout.shape_repository ()); if (pp.first) { - cell.shapes (ll.second).insert (db::object_with_properties > (db::array (poly_ptr, db::Disp (d + pos), layout.array_repository (), a, b, na, nb), pp.second)); + cell.shapes (ll.second).insert (db::object_with_properties > (db::array (poly_ptr, db::Disp (d + pos), layout.array_repository (), a, b, (unsigned long) na, (unsigned long) nb), pp.second)); } else { - cell.shapes (ll.second).insert (db::array (poly_ptr, db::Disp (d + pos), layout.array_repository (), a, b, na, nb)); + cell.shapes (ll.second).insert (db::array (poly_ptr, db::Disp (d + pos), layout.array_repository (), a, b, (unsigned long) na, (unsigned long) nb)); } } else if (! layout.is_editable () && (points = mm_repetition.get ().is_iterated ()) != 0) { @@ -3153,9 +3153,9 @@ OASISReader::do_read_ctrapezoid (bool xy_absolute,db::cell_index_type cell_index db::SimplePolygonPtr poly_ptr (poly, layout.shape_repository ()); if (pp.first) { - cell.shapes (ll.second).insert (db::object_with_properties > (db::array (poly_ptr, db::Disp (d + pos), layout.array_repository (), a, b, na, nb), pp.second)); + cell.shapes (ll.second).insert (db::object_with_properties > (db::array (poly_ptr, db::Disp (d + pos), layout.array_repository (), a, b, (unsigned long) na, (unsigned long) nb), pp.second)); } else { - cell.shapes (ll.second).insert (db::array (poly_ptr, db::Disp (d + pos), layout.array_repository (), a, b, na, nb)); + cell.shapes (ll.second).insert (db::array (poly_ptr, db::Disp (d + pos), layout.array_repository (), a, b, (unsigned long) na, (unsigned long) nb)); } } else if (! layout.is_editable () && (points = mm_repetition.get ().is_iterated ()) != 0) { @@ -3291,9 +3291,9 @@ OASISReader::do_read_circle (bool xy_absolute, db::cell_index_type cell_index, d db::PathPtr path_ptr (path, layout.shape_repository ()); if (pp.first) { - cell.shapes (ll.second).insert (db::object_with_properties > (db::array (path_ptr, db::Disp (pos), layout.array_repository (), a, b, na, nb), pp.second)); + cell.shapes (ll.second).insert (db::object_with_properties > (db::array (path_ptr, db::Disp (pos), layout.array_repository (), a, b, (unsigned long) na, (unsigned long) nb), pp.second)); } else { - cell.shapes (ll.second).insert (db::array (path_ptr, db::Disp (pos), layout.array_repository (), a, b, na, nb)); + cell.shapes (ll.second).insert (db::array (path_ptr, db::Disp (pos), layout.array_repository (), a, b, (unsigned long) na, (unsigned long) nb)); } } else if (! layout.is_editable () && (points = mm_repetition.get ().is_iterated ()) != 0) { diff --git a/src/plugins/streamers/oasis/unit_tests/dbOASISReader.cc b/src/plugins/streamers/oasis/unit_tests/dbOASISReader.cc index f900f2e53..3837f952c 100644 --- a/src/plugins/streamers/oasis/unit_tests/dbOASISReader.cc +++ b/src/plugins/streamers/oasis/unit_tests/dbOASISReader.cc @@ -1094,7 +1094,7 @@ TEST(11_8) bool error = false; try { db::LayerMap map = reader.read (layout); - } catch (tl::Exception &ex) { + } catch (tl::Exception & /*ex*/) { /* *** ERROR: Modal variable accessed before being defined: last-value-list (position=96, cell=) */ @@ -1116,7 +1116,7 @@ TEST(11_9) bool error = false; try { db::LayerMap map = reader.read (layout); - } catch (tl::Exception &ex) { + } catch (tl::Exception & /*ex*/) { /* *** ERROR: Modal variable accessed before being defined: last-value-list (position=118, cell=) */ @@ -1531,7 +1531,7 @@ TEST(2_3) bool error = false; try { db::LayerMap map = reader.read (layout); - } catch (tl::Exception &ex) { + } catch (tl::Exception & /*ex*/) { /* *** ERROR: Explicit and implicit CELLNAME modes cannot be mixed (position=45, cell=) */ @@ -1588,7 +1588,7 @@ TEST(2_5) bool error = false; try { db::LayerMap map = reader.read (layout); - } catch (tl::Exception &ex) { + } catch (tl::Exception & /*ex*/) { /* *** ERROR: No cellname declared for cell id 2 (position=305, cell=#2) */ @@ -1930,7 +1930,7 @@ TEST(3_11) bool error = false; try { db::LayerMap map = reader.read (layout); - } catch (tl::Exception &ex) { + } catch (tl::Exception & /*ex*/) { /* *** ERROR: Modal variable accessed before being defined: text-string (position=50, cell=ABC) */ @@ -2454,7 +2454,7 @@ TEST(3_3) bool error = false; try { db::LayerMap map = reader.read (layout); - } catch (tl::Exception &ex) { + } catch (tl::Exception & /*ex*/) { /* *** ERROR: Explicit and implicit TEXTSTRING modes cannot be mixed (position=41, cell=) */ @@ -2476,7 +2476,7 @@ TEST(3_4) bool error = false; try { db::LayerMap map = reader.read (layout); - } catch (tl::Exception &ex) { + } catch (tl::Exception & /*ex*/) { /* *** ERROR: No text string defined for id 2 (must be declared before text is used) (position=48, cell=ABC) */ @@ -2749,7 +2749,7 @@ TEST(3_6) bool error = false; try { db::LayerMap map = reader.read (layout); - } catch (tl::Exception &ex) { + } catch (tl::Exception & /*ex*/) { /* *** ERROR: Modal variable accessed before being defined: repetition (position=52, cell=ABC) */ @@ -2771,7 +2771,7 @@ TEST(3_7) bool error = false; try { db::LayerMap map = reader.read (layout); - } catch (tl::Exception &ex) { + } catch (tl::Exception & /*ex*/) { /* *** ERROR: Modal variable accessed before being defined: textlayer (position=50, cell=ABC) */ @@ -2793,7 +2793,7 @@ TEST(3_8) bool error = false; try { db::LayerMap map = reader.read (layout); - } catch (tl::Exception &ex) { + } catch (tl::Exception & /*ex*/) { /* *** ERROR: Modal variable accessed before being defined: texttype (position=50, cell=ABC) */ diff --git a/src/plugins/streamers/pcb/db_plugin/dbGerberImporter.cc b/src/plugins/streamers/pcb/db_plugin/dbGerberImporter.cc index 18a20dd17..e801f73b5 100644 --- a/src/plugins/streamers/pcb/db_plugin/dbGerberImporter.cc +++ b/src/plugins/streamers/pcb/db_plugin/dbGerberImporter.cc @@ -1094,13 +1094,13 @@ public: // .. nothing yet .. } - virtual const db::LayerMap &read (db::Layout &layout, const db::LoadLayoutOptions & /*options*/) throw (tl::Exception) + virtual const db::LayerMap &read (db::Layout &layout, const db::LoadLayoutOptions & /*options*/) { // TODO: too simple, should provide at least a layer filtering. return read (layout); } - virtual const db::LayerMap &read (db::Layout &layout) throw (tl::Exception) + virtual const db::LayerMap &read (db::Layout &layout) { db::GerberImportData data; diff --git a/src/plugins/streamers/pcb/db_plugin/dbRS274XApertures.cc b/src/plugins/streamers/pcb/db_plugin/dbRS274XApertures.cc index 88bef7c62..aafd43df1 100644 --- a/src/plugins/streamers/pcb/db_plugin/dbRS274XApertures.cc +++ b/src/plugins/streamers/pcb/db_plugin/dbRS274XApertures.cc @@ -563,7 +563,7 @@ void RS274XRegionAperture::do_produce_flash () for (size_t h = 0; h < poly.holes (); ++h) { clear_points (); - for (db::Polygon::polygon_contour_iterator pt = poly.begin_hole (h); pt != poly.end_hole (h); ++pt) { + for (db::Polygon::polygon_contour_iterator pt = poly.begin_hole (int (h)); pt != poly.end_hole (int (h)); ++pt) { add_point (*pt); } produce_polygon (true); diff --git a/src/plugins/streamers/pcb/lay_plugin/layGerberImportDialog.cc b/src/plugins/streamers/pcb/lay_plugin/layGerberImportDialog.cc index 8c638bb6a..ff6eae34d 100644 --- a/src/plugins/streamers/pcb/lay_plugin/layGerberImportDialog.cc +++ b/src/plugins/streamers/pcb/lay_plugin/layGerberImportDialog.cc @@ -538,7 +538,7 @@ GerberImportDialog::add_target_layer () if (lp_dialog.exec_dialog (props)) { mp_data->layout_layers.push_back (props); update (); - tree->setCurrentItem (tree->topLevelItem (mp_data->layout_layers.size () - 1)); + tree->setCurrentItem (tree->topLevelItem (int (mp_data->layout_layers.size () - 1))); } } @@ -678,7 +678,7 @@ GerberImportDialog::add_free_file () } update (); - tree->setCurrentItem (tree->topLevelItem (mp_data->free_files.size () - 1)); + tree->setCurrentItem (tree->topLevelItem (int (mp_data->free_files.size () - 1))); } } diff --git a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.cc b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.cc index 886cfdbd6..bcdd8038e 100644 --- a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.cc +++ b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.cc @@ -207,7 +207,7 @@ NetTracerDialog::mouse_click_event (const db::DPoint &p, unsigned int buttons, b update_list (); item_selection_changed (); - net_list->setCurrentItem (net_list->item (mp_nets.size () - 1)); + net_list->setCurrentItem (net_list->item (int (mp_nets.size () - 1))); } @@ -1053,7 +1053,7 @@ NetTracerDialog::update_list () QListWidgetItem *item = 0; if (net_list->count () > int (i)) { - item = net_list->item (i); + item = net_list->item (int (i)); } else { item = new QListWidgetItem (net_list); net_list->addItem (item); diff --git a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerIO.cc b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerIO.cc index 2ac906725..a2e7c9799 100644 --- a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerIO.cc +++ b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerIO.cc @@ -431,7 +431,7 @@ NetTracerTechComponentEditor::move_down_clicked () connectivity_table->setCurrentIndex (QModelIndex ()); - int n = m_data.size (); + int n = int (m_data.size ()); for (db::NetTracerTechnologyComponent::iterator l = m_data.end (); l != m_data.begin (); ) { --l; --n; @@ -557,7 +557,7 @@ NetTracerTechComponentEditor::symbol_move_down_clicked () symbol_table->setCurrentIndex (QModelIndex ()); - int n = m_data.symbols (); + int n = int (m_data.symbols ()); for (db::NetTracerTechnologyComponent::symbol_iterator l = m_data.end_symbols (); l != m_data.begin_symbols (); ) { --l; --n; @@ -590,7 +590,7 @@ NetTracerTechComponentEditor::update () int n; connectivity_table->clear (); - connectivity_table->setRowCount (m_data.size ()); + connectivity_table->setRowCount (int (m_data.size ())); connectivity_table->setColumnCount (3); labels.clear (); @@ -643,7 +643,7 @@ NetTracerTechComponentEditor::update () connectivity_table->clearSelection (); symbol_table->clear (); - symbol_table->setRowCount (m_data.symbols ()); + symbol_table->setRowCount (int (m_data.symbols ())); symbol_table->setColumnCount (2); labels.clear (); diff --git a/src/plugins/tools/xor/lay_plugin/layXORToolDialog.cc b/src/plugins/tools/xor/lay_plugin/layXORToolDialog.cc index 243e27753..0c917b054 100644 --- a/src/plugins/tools/xor/lay_plugin/layXORToolDialog.cc +++ b/src/plugins/tools/xor/lay_plugin/layXORToolDialog.cc @@ -489,7 +489,7 @@ public: { QMutexLocker locker (&m_mutex); p = m_progress; - progress.configure (m_dbu, m_nx, m_ny, m_tolerances); + progress.configure (m_dbu, int (m_nx), int (m_ny), m_tolerances); progress.merge_results (m_results); } @@ -553,7 +553,7 @@ public: // merge the polygons to heal and re-issue (this time without healing) for (std::map, db::Region>::iterator p = m_polygons_to_heal.begin (); p != m_polygons_to_heal.end (); ++p) { for (db::Region::const_iterator mp = p->second.begin_merged (); !mp.at_end (); ++mp) { - issue_polygon (p->first.first, p->first.second, *mp, false); + issue_polygon ((unsigned int) p->first.first, (unsigned int) p->first.second, *mp, false); } } } @@ -1327,13 +1327,13 @@ XORToolDialog::run_xor () db::Coord tile_enlargement_b = db::coord_traits::rounded_up (tile_enlargement * dbu / cvb->layout ().dbu ()); if (ntiles_w > 1 || ntiles_h > 1 || region_mode != RMAll /*enforces clip*/) { - job.set_tiles (true, ntiles_w, ntiles_h, tile_heal); + job.set_tiles (true, int (ntiles_w), int (ntiles_h), tile_heal); } // create the XOR tasks - for (size_t nw = 0; nw < ntiles_w; ++nw) { + for (db::Coord nw = 0; nw < db::Coord (ntiles_w); ++nw) { - for (size_t nh = 0; nh < ntiles_h; ++nh) { + for (db::Coord nh = 0; nh < db::Coord (ntiles_h); ++nh) { db::Box clip_box (box_out.left () + nw * box_width_out, box_out.bottom () + nh * box_height_out, @@ -1392,7 +1392,7 @@ XORToolDialog::run_xor () job.wait (100); } - } catch (tl::BreakException &ex) { + } catch (tl::BreakException & /*ex*/) { job.terminate (); was_cancelled = true; } catch (tl::Exception &ex) { diff --git a/src/pya/pya/pyaModule.cc b/src/pya/pya/pyaModule.cc index 793f4f2ad..219e49721 100644 --- a/src/pya/pya/pyaModule.cc +++ b/src/pya/pya/pyaModule.cc @@ -2614,7 +2614,7 @@ PythonModule::make_classes (const char *mod_name) tl::warn << tl::to_string (tr ("Class ")) << c->name () << ": " << tl::to_string (tr ("no Python mapping for method ")) << mt->name (mid); } - add_python_doc (*c, mt, mid, tl::to_string (tr ("This method is not available for Python"))); + add_python_doc (*c, mt, int (mid), tl::to_string (tr ("This method is not available for Python"))); } else { @@ -2649,7 +2649,7 @@ PythonModule::make_classes (const char *mod_name) } if (name != raw_name) { - add_python_doc (*c, mt, mid, tl::sprintf (tl::to_string (tr ("This method is available as method '%s' in Python")), name)); + add_python_doc (*c, mt, int (mid), tl::sprintf (tl::to_string (tr ("This method is available as method '%s' in Python")), name)); } // create documentation @@ -2673,29 +2673,29 @@ PythonModule::make_classes (const char *mod_name) // The str method is also routed via the tp_str implementation alt_names.push_back ("__str__"); if (! has_inspect) { - add_python_doc (*c, mt, mid, tl::to_string (tr ("This method is also available as 'str(object)' and 'repr(object)'"))); + add_python_doc (*c, mt, int (mid), tl::to_string (tr ("This method is also available as 'str(object)' and 'repr(object)'"))); alt_names.push_back ("__repr__"); } else { - add_python_doc (*c, mt, mid, tl::to_string (tr ("This method is also available as 'str(object)'"))); + add_python_doc (*c, mt, int (mid), tl::to_string (tr ("This method is also available as 'str(object)'"))); } } else if (name == "inspect" && m_first->compatible_with_num_args (0)) { // The str method is also routed via the tp_str implementation - add_python_doc (*c, mt, mid, tl::to_string (tr ("This method is also available as 'repr(object)'"))); + add_python_doc (*c, mt, int (mid), tl::to_string (tr ("This method is also available as 'repr(object)'"))); alt_names.push_back ("__repr__"); } else if (name == "size" && m_first->compatible_with_num_args (0)) { // The size method is also routed via the sequence methods protocol if there // is a [] function - add_python_doc (*c, mt, mid, tl::to_string (tr ("This method is also available as 'len(object)'"))); + add_python_doc (*c, mt, int (mid), tl::to_string (tr ("This method is also available as 'len(object)'"))); alt_names.push_back ("__len__"); } else if (name == "each" && m_first->compatible_with_num_args (0) && m_first->ret_type ().is_iter ()) { // each makes the object iterable - add_python_doc (*c, mt, mid, tl::to_string (tr ("This method enables iteration of the object"))); + add_python_doc (*c, mt, int (mid), tl::to_string (tr ("This method enables iteration of the object"))); alt_names.push_back ("__iter__"); } @@ -2738,7 +2738,7 @@ PythonModule::make_classes (const char *mod_name) } else if (tl::verbosity () >= 20) { tl::warn << "Upper case method name encountered which cannot be used as a Python constant (more than one overload or at least one argument): " << c->name () << "." << name; - add_python_doc (*c, mt, mid, tl::to_string (tr ("This method is not available for Python"))); + add_python_doc (*c, mt, int (mid), tl::to_string (tr ("This method is not available for Python"))); } } else { @@ -2746,7 +2746,7 @@ PythonModule::make_classes (const char *mod_name) if (m_first->ret_type ().type () == gsi::T_object && m_first->ret_type ().pass_obj () && name == "new") { // The constructor is also routed via the pya_object_init implementation - add_python_doc (*c, mt, mid, tl::to_string (tr ("This method is the default initializer of the object"))); + add_python_doc (*c, mt, int (mid), tl::to_string (tr ("This method is the default initializer of the object"))); PyMethodDef *method = make_method_def (); method->ml_name = "__init__"; diff --git a/src/pya/pya/pyaObject.cc b/src/pya/pya/pyaObject.cc index ae9fd624d..9ddd7172e 100644 --- a/src/pya/pya/pyaObject.cc +++ b/src/pya/pya/pyaObject.cc @@ -171,8 +171,8 @@ Callee::call (int id, gsi::SerialArgs &args, gsi::SerialArgs &ret) const PYAObjectBase::PYAObjectBase(const gsi::ClassBase *_cls_decl, PyObject *py_object) : mp_py_object (py_object), - m_listener (new pya::StatusChangedListener (this)), - m_callee (new pya::Callee (this)), + mp_listener (new pya::StatusChangedListener (this)), + mp_callee (new pya::Callee (this)), m_cls_decl (_cls_decl), m_obj (0), m_owned (false), @@ -206,6 +206,10 @@ PYAObjectBase::~PYAObjectBase () tl::warn << "Caught unspecified exception in object destructor"; } + delete mp_listener; + mp_listener = 0; + delete mp_callee; + mp_callee = 0; m_destroyed = true; } @@ -287,7 +291,7 @@ PYAObjectBase::detach () if (! m_destroyed && cls && cls->is_managed ()) { gsi::ObjectBase *gsi_object = cls->gsi_object (m_obj, false); if (gsi_object) { - gsi_object->status_changed_event ().remove (m_listener.get (), &StatusChangedListener::object_status_changed); + gsi_object->status_changed_event ().remove (mp_listener, &StatusChangedListener::object_status_changed); } } @@ -326,7 +330,7 @@ PYAObjectBase::set (void *obj, bool owned, bool const_ref, bool can_destroy) if (gsi_object->already_kept ()) { keep_internal (); } - gsi_object->status_changed_event ().add (m_listener.get (), &StatusChangedListener::object_status_changed); + gsi_object->status_changed_event ().add (mp_listener, &StatusChangedListener::object_status_changed); } if (!m_owned) { @@ -427,8 +431,8 @@ PYAObjectBase::initialize_callbacks () const char *nstr = (*m)->primary_name ().c_str (); py_attr = PyObject_GetAttrString ((PyObject *) Py_TYPE (py_object ()), nstr); - int id = m_callee->add_callback (CallbackFunction (py_attr, *m)); - (*m)->set_callback (m_obj, gsi::Callback (id, m_callee.get (), (*m)->argsize (), (*m)->retsize ())); + int id = mp_callee->add_callback (CallbackFunction (py_attr, *m)); + (*m)->set_callback (m_obj, gsi::Callback (id, mp_callee, (*m)->argsize (), (*m)->retsize ())); } @@ -475,8 +479,8 @@ PYAObjectBase::initialize_callbacks () PyObject *py_attr = PyObject_GetAttrString ((PyObject *) Py_TYPE (py_object ()), nstr); tl_assert (py_attr != NULL); - int id = m_callee.add_callback (CallbackFunction (py_attr, *m)); - (*m)->set_callback (m_obj, gsi::Callback (id, &m_callee, (*m)->argsize (), (*m)->retsize ())); + int id = mp_callee->add_callback (CallbackFunction (py_attr, *m)); + (*m)->set_callback (m_obj, gsi::Callback (id, mp_callee, (*m)->argsize (), (*m)->retsize ())); } @@ -512,7 +516,7 @@ PYAObjectBase::detach_callbacks () } } - m_callee->clear_callbacks (); + mp_callee->clear_callbacks (); } void diff --git a/src/pya/pya/pyaObject.h b/src/pya/pya/pyaObject.h index a675ed325..c1b4a0aaf 100644 --- a/src/pya/pya/pyaObject.h +++ b/src/pya/pya/pyaObject.h @@ -220,8 +220,8 @@ private: void keep_internal (); PyObject *mp_py_object; - std::auto_ptr m_listener; - std::auto_ptr m_callee; + StatusChangedListener *mp_listener; + Callee *mp_callee; const gsi::ClassBase *m_cls_decl; void *m_obj; bool m_owned : 1; diff --git a/src/pymod/bridge_sample/bridge_sample.pro b/src/pymod/bridge_sample/bridge_sample.pro index 98ef0c6dd..d9365d455 100644 --- a/src/pymod/bridge_sample/bridge_sample.pro +++ b/src/pymod/bridge_sample/bridge_sample.pro @@ -88,6 +88,12 @@ LIBS += -L$$LIBDIR -lklayout_db # of strucs to 0: QMAKE_CXXFLAGS_WARN_ON += \ -Wno-missing-field-initializers +} else { + + # disable some warnings + QMAKE_CXXFLAGS += \ + /wd4251 \ # DLL interface required + } win32 { diff --git a/src/pymod/tl/tl.pro b/src/pymod/tl/tl.pro index 30b549504..6f7fe6d37 100644 --- a/src/pymod/tl/tl.pro +++ b/src/pymod/tl/tl.pro @@ -24,7 +24,11 @@ equals(HAVE_QTBINDINGS, "1") { } } -QMAKE_POST_LINK += && $(COPY) $$INIT_PY $$DESTDIR_PYMOD/__init__.py +msvc { + QMAKE_POST_LINK += && $(COPY) $$shell_path($$INIT_PY) $$shell_path($$DESTDIR_PYMOD/__init__.py) +} else { + QMAKE_POST_LINK += && $(COPY) $$INIT_PY $$DESTDIR_PYMOD/__init__.py +} # INSTALLS needs to be inside a lib or app templates. init_target.path = $$PREFIX/pymod/klayout diff --git a/src/rdb/rdb/rdb.cc b/src/rdb/rdb/rdb.cc index 34a897418..a8a8808da 100644 --- a/src/rdb/rdb/rdb.cc +++ b/src/rdb/rdb/rdb.cc @@ -974,7 +974,7 @@ Item::set_image_str (const std::string &s) set_image (0); } else { - QByteArray img_data (QByteArray::fromBase64 (QByteArray::fromRawData (s.c_str (), s.size ()))); + QByteArray img_data (QByteArray::fromBase64 (QByteArray::fromRawData (s.c_str (), int (s.size ())))); QImage *image = new QImage (); if (image->loadFromData (img_data)) { diff --git a/src/tl/tl/tlDeflate.cc b/src/tl/tl/tlDeflate.cc index a10f819d2..9a7d5f167 100644 --- a/src/tl/tl/tlDeflate.cc +++ b/src/tl/tl/tlDeflate.cc @@ -271,7 +271,7 @@ void InflateFilter::unget (size_t n) { tl_assert (m_b_read >= n); - m_b_read -= n; + m_b_read -= (unsigned int) n; } bool @@ -513,7 +513,7 @@ DeflateFilter::put (const char *b, size_t n) m_uc += n; mp_stream->next_in = (Byte *)b; - mp_stream->avail_in = n; + mp_stream->avail_in = (unsigned int) n; while (mp_stream->avail_in > 0) { diff --git a/src/tl/tl/tlKDTree.h b/src/tl/tl/tlKDTree.h index 61e20baef..618ea184d 100644 --- a/src/tl/tl/tlKDTree.h +++ b/src/tl/tl/tlKDTree.h @@ -134,7 +134,7 @@ private: // one level up. Returns true if from right bool up () { - size_type m = 1 << m_l; + size_type m = size_type (1) << m_l; size_type mm = m / 2; --m_l; bool right = ((m_j & mm) != 0); @@ -159,7 +159,7 @@ private: // one level down (left). Returns false if not possible bool down_left () { - size_type m = 1 << m_l; + size_type m = size_type (1) << m_l; m_j += m; if (m_j > m_n) { m_j -= m; diff --git a/src/tl/tl/tlLog.cc b/src/tl/tl/tlLog.cc index 4c954df15..402aacad6 100644 --- a/src/tl/tl/tlLog.cc +++ b/src/tl/tl/tlLog.cc @@ -249,15 +249,19 @@ ChannelProxy::ChannelProxy (const ChannelProxy &d) // ------------------------------------------------ // Some utilities for colorized terminal output +#if defined(_MSC_VER) +static bool +can_colorize (FILE * /*stream*/) +{ + return false; +} +#else static bool can_colorize (FILE *stream) { -#if defined(_MSC_VER) - return false; -#else return isatty (fileno (stream)); -#endif } +#endif #define ANSI_RED "\033[31;1m" #define ANSI_BLUE "\033[34m" diff --git a/src/tl/tl/tlObject.cc b/src/tl/tl/tlObject.cc index 05e8b528a..42f476b85 100644 --- a/src/tl/tl/tlObject.cc +++ b/src/tl/tl/tlObject.cc @@ -75,7 +75,7 @@ void Object::register_ptr (WeakOrSharedPtr *p) ptrs->mp_prev = p; } - mp_ptrs = (WeakOrSharedPtr *)(size_t (p) | kept); + mp_ptrs = (WeakOrSharedPtr *)(size_t (p) | (kept ? 1 : 0)); } void Object::unregister_ptr (WeakOrSharedPtr *p) @@ -84,7 +84,7 @@ void Object::unregister_ptr (WeakOrSharedPtr *p) bool kept = (size_t (mp_ptrs) & size_t(1)); if (p == ptrs) { - mp_ptrs = (WeakOrSharedPtr *)(size_t (p->mp_next) | kept); + mp_ptrs = (WeakOrSharedPtr *)(size_t (p->mp_next) | (kept ? 1 : 0)); } if (p->mp_prev) { p->mp_prev->mp_next = p->mp_next; diff --git a/src/tl/tl/tlStream.cc b/src/tl/tl/tlStream.cc index 98bc293a1..e8d31b04e 100644 --- a/src/tl/tl/tlStream.cc +++ b/src/tl/tl/tlStream.cc @@ -492,9 +492,9 @@ InputFile::read (char *b, size_t n) { tl_assert (m_fd >= 0); #if defined(_WIN32) - ptrdiff_t ret = _read (m_fd, b, n); + ptrdiff_t ret = _read (m_fd, b, (unsigned int) n); #else - ptrdiff_t ret = ::read (m_fd, b, n); + ptrdiff_t ret = ::read (m_fd, b, (unsigned int) n); #endif if (ret < 0) { throw FileReadErrorException (m_source, errno); @@ -567,7 +567,7 @@ size_t InputZLibFile::read (char *b, size_t n) { tl_assert (m_zs != NULL); - int ret = gzread (m_zs, b, n); + int ret = gzread (m_zs, b, (unsigned int) n); if (ret < 0) { int gz_err = 0; const char *em = gzerror (m_zs, &gz_err); @@ -791,9 +791,9 @@ OutputFile::write (const char *b, size_t n) { tl_assert (m_fd >= 0); #if defined(_WIN32) - ptrdiff_t ret = _write (m_fd, b, n); + ptrdiff_t ret = _write (m_fd, b, (unsigned int) n); #else - ptrdiff_t ret = ::write (m_fd, b, n); + ptrdiff_t ret = ::write (m_fd, b, (unsigned int) n); #endif if (ret < 0) { throw FileWriteErrorException (m_source, errno); @@ -833,7 +833,7 @@ void OutputZLibFile::write (const char *b, size_t n) { tl_assert (m_zs != NULL); - int ret = gzwrite (m_zs, (char *) b, n); + int ret = gzwrite (m_zs, (char *) b, (unsigned int) n); if (ret < 0) { int gz_err = 0; const char *em = gzerror (m_zs, &gz_err); diff --git a/src/tl/tl/tlString.cc b/src/tl/tl/tlString.cc index 245e8f94a..c7220c191 100644 --- a/src/tl/tl/tlString.cc +++ b/src/tl/tl/tlString.cc @@ -213,7 +213,7 @@ std::string to_string_from_local (const char *cp) while (max > 0) { wchar_t wc; // NOTE: mbrtowc uses the current LOCALE, hence "local" - int length = mbrtowc (&wc, cp, max, &state); + int length = int (mbrtowc (&wc, cp, max, &state)); if (length < 1) { break; }