mirror of https://github.com/KLayout/klayout.git
Fit a few compiler warnings in the ruby part
This commit is contained in:
parent
4e12b9fae7
commit
ce918bbc4e
|
|
@ -1448,7 +1448,7 @@ rba_add_path (const std::string &path)
|
|||
{
|
||||
VALUE pv = rb_gv_get ("$:");
|
||||
if (pv != Qnil && TYPE (pv) == T_ARRAY) {
|
||||
rb_ary_push (pv, rb_str_new (path.c_str (), path.size ()));
|
||||
rb_ary_push (pv, rb_str_new (path.c_str (), long (path.size ())));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1953,7 +1953,7 @@ RubyInterpreter::load_file (const std::string &filename_utf8)
|
|||
{
|
||||
std::string fl (rb_cstring_from_utf8 (filename_utf8));
|
||||
|
||||
rb_set_progname (rb_str_new (fl.c_str (), fl.size ()));
|
||||
rb_set_progname (rb_str_new (fl.c_str (), long (fl.size ())));
|
||||
|
||||
rb_set_errinfo (Qnil);
|
||||
int error = 0;
|
||||
|
|
@ -1961,7 +1961,7 @@ RubyInterpreter::load_file (const std::string &filename_utf8)
|
|||
rb_protect_init (); // see above
|
||||
|
||||
RUBY_BEGIN_EXEC
|
||||
rb_load_protect (rb_str_new (fl.c_str (), fl.size ()), wrap, &error);
|
||||
rb_load_protect (rb_str_new (fl.c_str (), long (fl.size ())), wrap, &error);
|
||||
RUBY_END_EXEC
|
||||
|
||||
if (error) {
|
||||
|
|
@ -2003,7 +2003,7 @@ RubyInterpreter::eval_string_and_print (const char *expr, const char *file, int
|
|||
void
|
||||
RubyInterpreter::define_variable (const std::string &name, const std::string &value)
|
||||
{
|
||||
rb_gv_set (name.c_str (), rb_str_new (value.c_str (), value.size ()));
|
||||
rb_gv_set (name.c_str (), rb_str_new (value.c_str (), long (value.size ())));
|
||||
}
|
||||
|
||||
gsi::Inspector *
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@ inline VALUE c2ruby<float> (const float &c)
|
|||
template <>
|
||||
inline VALUE c2ruby<std::string> (const std::string &c)
|
||||
{
|
||||
return rb_str_new (c.c_str (), c.size ());
|
||||
return rb_str_new (c.c_str (), long (c.size ()));
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
|
@ -468,7 +468,7 @@ inline VALUE c2ruby<QString> (const QString &qs)
|
|||
return Qnil;
|
||||
} else {
|
||||
std::string c (tl::to_string (qs));
|
||||
return rb_str_new (c.c_str (), c.size ());
|
||||
return rb_str_new (c.c_str (), long (c.size ()));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -489,7 +489,7 @@ inline VALUE c2ruby<const char *> (const char * const & s)
|
|||
static const char null_string[] = "(null)";
|
||||
return rb_str_new (null_string, sizeof (null_string) - 1);
|
||||
} else {
|
||||
return rb_str_new (s, strlen (s));
|
||||
return rb_str_new (s, long (strlen (s)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -495,7 +495,7 @@ Proxy::initialize_callbacks ()
|
|||
// There is no place in the ruby API to determine whether a method is defined.
|
||||
// Instead we explicitly call "method_defined?" to check, whether the given method
|
||||
// is defined.
|
||||
VALUE name = rb_str_new (nstr, strlen (nstr));
|
||||
VALUE name = rb_str_new (nstr, long (strlen (nstr)));
|
||||
RB_GC_GUARD (name);
|
||||
|
||||
for (int prot = 0; prot < 2; ++prot) {
|
||||
|
|
|
|||
|
|
@ -538,7 +538,7 @@ struct reader<gsi::StringType>
|
|||
if (!a.get ()) {
|
||||
*ret = Qnil;
|
||||
} else {
|
||||
*ret = rb_str_new (a->c_str (), a->size ());
|
||||
*ret = rb_str_new (a->c_str (), long (a->size ()));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -720,7 +720,7 @@ RubyBasedVectorAdaptorIterator::RubyBasedVectorAdaptorIterator (VALUE array, con
|
|||
|
||||
void RubyBasedVectorAdaptorIterator::get (gsi::SerialArgs &w, tl::Heap &heap) const
|
||||
{
|
||||
gsi::do_on_type<writer> () (mp_ainner->type (), &w, rb_ary_entry (m_array, m_i), *mp_ainner, &heap);
|
||||
gsi::do_on_type<writer> () (mp_ainner->type (), &w, rb_ary_entry (m_array, long (m_i)), *mp_ainner, &heap);
|
||||
}
|
||||
|
||||
bool RubyBasedVectorAdaptorIterator::at_end () const
|
||||
|
|
|
|||
|
|
@ -505,15 +505,15 @@ VALUE rba_eval_string_in_context (const char *expr, const char *file, int line,
|
|||
rb_set_errinfo (Qnil);
|
||||
|
||||
if (file) {
|
||||
rb_set_progname (rb_str_new (file, strlen (file)));
|
||||
rb_set_progname (rb_str_new (file, long (strlen (file))));
|
||||
} else {
|
||||
const char *e = "<immediate>";
|
||||
rb_set_progname (rb_str_new (e, strlen (e)));
|
||||
rb_set_progname (rb_str_new (e, long (strlen (e))));
|
||||
}
|
||||
|
||||
int argc;
|
||||
VALUE args[4];
|
||||
args[0] = rb_str_new (expr, strlen (expr));
|
||||
args[0] = rb_str_new (expr, long (strlen (expr)));
|
||||
// use the current binding if there is one. This allows to eval in the context of a current trace callback
|
||||
// when eval is called from the trace handler.
|
||||
if (context < 0) {
|
||||
|
|
@ -529,7 +529,7 @@ VALUE rba_eval_string_in_context (const char *expr, const char *file, int line,
|
|||
args[1] = rb_binding_new ();
|
||||
}
|
||||
if (file) {
|
||||
args[2] = rb_str_new (file, strlen (file));
|
||||
args[2] = rb_str_new (file, long (strlen (file)));
|
||||
args[3] = INT2NUM(line);
|
||||
argc = 4;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue