зеркало из https://github.com/github/ruby.git
win32ole.c: use rb_sym2str
* ext/win32ole/win32ole.c: use rb_sym2str when the result strings will not be modified. * ext/win32ole/win32ole_event.c: ditto. * ext/win32ole/win32ole_record.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
659f14b254
Коммит
760ae4a8b9
|
@ -2513,7 +2513,7 @@ hash2named_arg(VALUE key, VALUE val, VALUE pop)
|
|||
rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
|
||||
}
|
||||
if (RB_TYPE_P(key, T_SYMBOL)) {
|
||||
key = rb_sym_to_s(key);
|
||||
key = rb_sym2str(key);
|
||||
}
|
||||
|
||||
/* pNamedArgs[0] is <method name>, so "index + 1" */
|
||||
|
@ -2580,7 +2580,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
|
|||
rb_raise(rb_eTypeError, "method is wrong type (expected String or Symbol)");
|
||||
}
|
||||
if (RB_TYPE_P(cmd, T_SYMBOL)) {
|
||||
cmd = rb_sym_to_s(cmd);
|
||||
cmd = rb_sym2str(cmd);
|
||||
}
|
||||
pole = oledata_get_struct(self);
|
||||
if(!pole->pDispatch) {
|
||||
|
@ -3577,7 +3577,7 @@ fole_respond_to(VALUE self, VALUE method)
|
|||
rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
|
||||
}
|
||||
if (RB_TYPE_P(method, T_SYMBOL)) {
|
||||
method = rb_sym_to_s(method);
|
||||
method = rb_sym2str(method);
|
||||
}
|
||||
pole = oledata_get_struct(self);
|
||||
wcmdname = ole_vstr2wc(method);
|
||||
|
|
|
@ -1041,7 +1041,7 @@ ev_on_event(int argc, VALUE *argv, VALUE self, VALUE is_ary_arg)
|
|||
rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
|
||||
}
|
||||
if (RB_TYPE_P(event, T_SYMBOL)) {
|
||||
event = rb_sym_to_s(event);
|
||||
event = rb_sym2str(event);
|
||||
}
|
||||
}
|
||||
data = rb_ary_new3(4, rb_block_proc(), event, args, is_ary_arg);
|
||||
|
@ -1131,7 +1131,7 @@ fev_off_event(int argc, VALUE *argv, VALUE self)
|
|||
rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
|
||||
}
|
||||
if (RB_TYPE_P(event, T_SYMBOL)) {
|
||||
event = rb_sym_to_s(event);
|
||||
event = rb_sym2str(event);
|
||||
}
|
||||
}
|
||||
events = rb_ivar_get(self, id_events);
|
||||
|
|
|
@ -288,7 +288,7 @@ folerecord_initialize(VALUE self, VALUE typename, VALUE oleobj) {
|
|||
rb_raise(rb_eArgError, "1st argument should be String or Symbol");
|
||||
}
|
||||
if (RB_TYPE_P(typename, T_SYMBOL)) {
|
||||
typename = rb_sym_to_s(typename);
|
||||
typename = rb_sym2str(typename);
|
||||
}
|
||||
|
||||
hr = S_OK;
|
||||
|
@ -452,7 +452,7 @@ folerecord_method_missing(int argc, VALUE *argv, VALUE self)
|
|||
{
|
||||
VALUE name;
|
||||
rb_check_arity(argc, 1, 2);
|
||||
name = rb_sym_to_s(argv[0]);
|
||||
name = rb_sym2str(argv[0]);
|
||||
|
||||
#if SIZEOF_SIZE_T > SIZEOF_LONG
|
||||
{
|
||||
|
@ -508,7 +508,7 @@ folerecord_ole_instance_variable_get(VALUE self, VALUE name)
|
|||
}
|
||||
sname = name;
|
||||
if (RB_TYPE_P(name, T_SYMBOL)) {
|
||||
sname = rb_sym_to_s(name);
|
||||
sname = rb_sym2str(name);
|
||||
}
|
||||
return olerecord_ivar_get(self, sname);
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ folerecord_ole_instance_variable_set(VALUE self, VALUE name, VALUE val)
|
|||
}
|
||||
sname = name;
|
||||
if (RB_TYPE_P(name, T_SYMBOL)) {
|
||||
sname = rb_sym_to_s(name);
|
||||
sname = rb_sym2str(name);
|
||||
}
|
||||
return olerecord_ivar_set(self, sname, val);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче