Many warnings fixed for MSVC

This commit is contained in:
Matthias Köfferlein 2018-08-29 01:46:18 +02:00
parent 860014e3ae
commit af50c0f0c3
67 changed files with 247 additions and 223 deletions

View File

@ -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];
}

View File

@ -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) {

View File

@ -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;
}

View File

@ -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<target_coord_type> 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);
}

View File

@ -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) {

View File

@ -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;

View File

@ -61,7 +61,7 @@ static std::vector<std::string> query_prop_names (const db::LayoutQuery *q)
std::vector<std::string> 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;
}

View File

@ -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) {

View File

@ -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;
}

View File

@ -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);

View File

@ -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) {

View File

@ -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);
}

View File

@ -1467,7 +1467,7 @@ public:
m_is_ptr = type_traits<X>::is_ptr ();
m_is_cref = type_traits<X>::is_cref ();
m_is_cptr = type_traits<X>::is_cptr ();
m_size = type_traits<X>::serial_size ();
m_size = (unsigned int) type_traits<X>::serial_size ();
if (mp_inner) {
delete mp_inner;

View File

@ -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<tl::Variant> &vars) {
m_vars = vars;
return vars.size ();
return long (vars.size ());
}
tl::Variant b22b () const { return tl::Variant (); }

View File

@ -1029,7 +1029,7 @@ static void insert_image (lay::LayoutView *view, ImageRef &obj)
img::Service *img_service = view->get_plugin <img::Service> ();
if (img_service) {
img::Object *inew = img_service->insert_image (obj);
obj.id (inew->id ());
obj.id (int (inew->id ()));
obj.set_view (view);
}
}

View File

@ -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;

View File

@ -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<obj_iterator, unsigned int>::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<obj_iterator, unsigned int>::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<const img::Object *> (r->first->ptr ());
db::Clipboard::instance () += new db::ClipboardValue<img::Object> (*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 ();

View File

@ -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") {

View File

@ -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 ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") +
@ -492,7 +492,7 @@ GSIHelpProvider::get (const std::string &path) const
escape_xml (text) + "\n" +
"</pre></doc>";
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);
}

View File

@ -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");
}

View File

@ -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

View File

@ -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);
}
}
}

View File

@ -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

View File

@ -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 ()))));
}
}
};

View File

@ -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;

View File

@ -242,7 +242,7 @@ SettingsForm::setup ()
}
void
SettingsForm::commit () throw (tl::Exception)
SettingsForm::commit ()
{
// commit the custom config pages
for (std::vector <lay::ConfigPage *>::iterator cp = m_config_pages.begin (); cp != m_config_pages.end (); ++cp) {

View File

@ -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 ();

View File

@ -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);

View File

@ -235,7 +235,7 @@ public:
*/
unsigned int size () const
{
return m_events.size ();
return int (m_events.size ());
}
/**

View File

@ -427,7 +427,7 @@ bitmaps_to_image_rgb (const std::vector<lay::ViewOp> &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<unsigned int> bm_map;
std::vector<unsigned int> vo_map;
@ -607,7 +607,7 @@ bitmaps_to_image_rgb (const std::vector<lay::ViewOp> &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<lay::ViewOp> &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<unsigned int> bm_map;
std::vector<unsigned int> vo_map;
@ -820,7 +820,7 @@ bitmaps_to_image_mono (const std::vector<lay::ViewOp> &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;

View File

@ -119,7 +119,7 @@ ConfigurationDialog::init (const lay::PluginDeclaration *decl)
}
void
ConfigurationDialog::commit () throw (tl::Exception)
ConfigurationDialog::commit ()
{
for (std::vector <lay::ConfigPage *>::iterator p = m_config_pages.begin (); p != m_config_pages.end (); ++p) {
(*p)->commit (mp_root);

View File

@ -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 ();

View File

@ -951,13 +951,13 @@ DitherPattern::merge (const DitherPattern &other, std::map<unsigned int, unsigne
{
// 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 <DitherPatternInfo, unsigned int, pattern_less_f> 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::map<unsigned int, unsigne
} 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));
}
}

View File

@ -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<db::ICplxTrans>::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 ());
}
}

View File

@ -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 {

View File

@ -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<lay::LayerPropertiesList> &prop
std::vector<lay::LayerPropertiesList>::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<lay::LayerPropertiesList> &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<lay::LayerPropertiesList> &prop
for (std::vector<lay::LayerPropertiesList>::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

View File

@ -520,13 +520,13 @@ LineStyles::merge (const LineStyles &other, std::map<unsigned int, unsigned int>
{
// 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 <LineStyleInfo, unsigned int, style_less_f> 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<unsigned int, unsigned int>
} 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));
}
}

View File

@ -117,7 +117,7 @@ RedrawThread::commit (const std::vector <lay::RedrawLayerInfo> &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) {

View File

@ -2002,8 +2002,8 @@ RedrawThreadWorker::iterate_variants (const std::vector <db::Box> &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 ();
}

View File

@ -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;

View File

@ -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

View File

@ -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<lay::ViewOp> &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<lay::ViewOp>::const_iterator s = style.begin (); s != style.end (); ++s) {

View File

@ -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;
}

View File

@ -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<GDS2ReaderText *> (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 ();
}

View File

@ -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<GDS2XY> 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);
};

View File

@ -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 ();

View File

@ -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<const db::LEFDEFReaderOptions *> (options.get_options (format ()));
static db::LEFDEFReaderOptions default_options;

View File

@ -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> (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> (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> (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> (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<db::SimplePolygonPtr, db::Disp> > (db::array<db::SimplePolygonPtr, db::Disp> (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<db::SimplePolygonPtr, db::Disp> > (db::array<db::SimplePolygonPtr, db::Disp> (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<db::SimplePolygonPtr, db::Disp> (poly_ptr, db::Disp (d + pos), layout.array_repository (), a, b, na, nb));
cell.shapes (ll.second).insert (db::array<db::SimplePolygonPtr, db::Disp> (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<db::PathPtr, db::Disp> > (db::array<db::PathPtr, db::Disp> (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<db::PathPtr, db::Disp> > (db::array<db::PathPtr, db::Disp> (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<db::PathPtr, db::Disp> (path_ptr, db::Disp (d + pos), layout.array_repository (), a, b, na, nb));
cell.shapes (ll.second).insert (db::array<db::PathPtr, db::Disp> (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<db::SimplePolygonPtr, db::Disp> > (db::array<db::SimplePolygonPtr, db::Disp> (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<db::SimplePolygonPtr, db::Disp> > (db::array<db::SimplePolygonPtr, db::Disp> (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<db::SimplePolygonPtr, db::Disp> (poly_ptr, db::Disp (d + pos), layout.array_repository (), a, b, na, nb));
cell.shapes (ll.second).insert (db::array<db::SimplePolygonPtr, db::Disp> (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<db::SimplePolygonPtr, db::Disp> > (db::array<db::SimplePolygonPtr, db::Disp> (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<db::SimplePolygonPtr, db::Disp> > (db::array<db::SimplePolygonPtr, db::Disp> (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<db::SimplePolygonPtr, db::Disp> (poly_ptr, db::Disp (d + pos), layout.array_repository (), a, b, na, nb));
cell.shapes (ll.second).insert (db::array<db::SimplePolygonPtr, db::Disp> (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<db::PathPtr, db::Disp> > (db::array<db::PathPtr, db::Disp> (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<db::PathPtr, db::Disp> > (db::array<db::PathPtr, db::Disp> (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<db::PathPtr, db::Disp> (path_ptr, db::Disp (pos), layout.array_repository (), a, b, na, nb));
cell.shapes (ll.second).insert (db::array<db::PathPtr, db::Disp> (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) {

View File

@ -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)
*/

View File

@ -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;

View File

@ -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);

View File

@ -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)));
}
}

View File

@ -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);

View File

@ -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 ();

View File

@ -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<std::pair<size_t, size_t>, 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<db::Coord>::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) {

View File

@ -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__";

View File

@ -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

View File

@ -220,8 +220,8 @@ private:
void keep_internal ();
PyObject *mp_py_object;
std::auto_ptr<StatusChangedListener> m_listener;
std::auto_ptr<Callee> m_callee;
StatusChangedListener *mp_listener;
Callee *mp_callee;
const gsi::ClassBase *m_cls_decl;
void *m_obj;
bool m_owned : 1;

View File

@ -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 {

View File

@ -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

View File

@ -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)) {

View File

@ -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) {

View File

@ -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;

View File

@ -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"

View File

@ -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;

View File

@ -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);

View File

@ -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;
}