1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

ext/win32ole/*.c, ext/win32ole/win32ole.h: use RB_INT2FIX instead of

INT2FIX, and so on.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
suke 2016-10-07 10:24:56 +00:00
parent 6b35c34c68
commit 5dd01af28f
11 changed files with 137 additions and 132 deletions

View file

@ -1,3 +1,8 @@
Fri Oct 7 19:18:33 2016 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/*.c, ext/win32ole/win32ole.h: use RB_INT2FIX instead of
INT2FIX, and so on.
Fri Oct 7 14:18:40 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
* basictest/test.rb: Adjust spaces in class declarations

View file

@ -421,12 +421,12 @@ rbtime2vtdate(VALUE tmobj)
double t;
double nsec;
st.wYear = FIX2INT(rb_funcall(tmobj, rb_intern("year"), 0));
st.wMonth = FIX2INT(rb_funcall(tmobj, rb_intern("month"), 0));
st.wDay = FIX2INT(rb_funcall(tmobj, rb_intern("mday"), 0));
st.wHour = FIX2INT(rb_funcall(tmobj, rb_intern("hour"), 0));
st.wMinute = FIX2INT(rb_funcall(tmobj, rb_intern("min"), 0));
st.wSecond = FIX2INT(rb_funcall(tmobj, rb_intern("sec"), 0));
st.wYear = RB_FIX2INT(rb_funcall(tmobj, rb_intern("year"), 0));
st.wMonth = RB_FIX2INT(rb_funcall(tmobj, rb_intern("month"), 0));
st.wDay = RB_FIX2INT(rb_funcall(tmobj, rb_intern("mday"), 0));
st.wHour = RB_FIX2INT(rb_funcall(tmobj, rb_intern("hour"), 0));
st.wMinute = RB_FIX2INT(rb_funcall(tmobj, rb_intern("min"), 0));
st.wSecond = RB_FIX2INT(rb_funcall(tmobj, rb_intern("sec"), 0));
st.wMilliseconds = 0;
SystemTimeToVariantTime(&st, &t);
@ -435,7 +435,7 @@ rbtime2vtdate(VALUE tmobj)
* wMilliseconds of SYSTEMTIME struct.
* So, we need to calculate milliseconds by ourselves.
*/
nsec = FIX2INT(rb_funcall(tmobj, rb_intern("nsec"), 0));
nsec = RB_FIX2INT(rb_funcall(tmobj, rb_intern("nsec"), 0));
nsec /= 1000000.0;
nsec /= (24.0 * 3600.0);
nsec /= 1000;
@ -451,18 +451,18 @@ vtdate2rbtime(double date)
double sec;
VariantTimeToSystemTime(date, &st);
v = rb_funcall(rb_cTime, rb_intern("new"), 6,
INT2FIX(st.wYear),
INT2FIX(st.wMonth),
INT2FIX(st.wDay),
INT2FIX(st.wHour),
INT2FIX(st.wMinute),
INT2FIX(st.wSecond));
st.wYear = FIX2INT(rb_funcall(v, rb_intern("year"), 0));
st.wMonth = FIX2INT(rb_funcall(v, rb_intern("month"), 0));
st.wDay = FIX2INT(rb_funcall(v, rb_intern("mday"), 0));
st.wHour = FIX2INT(rb_funcall(v, rb_intern("hour"), 0));
st.wMinute = FIX2INT(rb_funcall(v, rb_intern("min"), 0));
st.wSecond = FIX2INT(rb_funcall(v, rb_intern("sec"), 0));
RB_INT2FIX(st.wYear),
RB_INT2FIX(st.wMonth),
RB_INT2FIX(st.wDay),
RB_INT2FIX(st.wHour),
RB_INT2FIX(st.wMinute),
RB_INT2FIX(st.wSecond));
st.wYear = RB_FIX2INT(rb_funcall(v, rb_intern("year"), 0));
st.wMonth = RB_FIX2INT(rb_funcall(v, rb_intern("month"), 0));
st.wDay = RB_FIX2INT(rb_funcall(v, rb_intern("mday"), 0));
st.wHour = RB_FIX2INT(rb_funcall(v, rb_intern("hour"), 0));
st.wMinute = RB_FIX2INT(rb_funcall(v, rb_intern("min"), 0));
st.wSecond = RB_FIX2INT(rb_funcall(v, rb_intern("sec"), 0));
st.wMilliseconds = 0;
SystemTimeToVariantTime(&st, &sec);
/*
@ -871,7 +871,7 @@ ole_vstr2wc(VALUE vstr)
enc = rb_enc_get(vstr);
if (st_lookup(tbl, (VALUE)enc | FIXNUM_FLAG, &data)) {
cp = FIX2INT((VALUE)data);
cp = RB_FIX2INT((VALUE)data);
} else {
cp = ole_encoding2cp(enc);
if (code_page_installed(cp) ||
@ -883,7 +883,7 @@ ole_vstr2wc(VALUE vstr)
cp == CP_UTF7 ||
cp == CP_UTF8 ||
cp == 51932) {
st_insert(tbl, (VALUE)enc | FIXNUM_FLAG, INT2FIX(cp));
st_insert(tbl, (VALUE)enc | FIXNUM_FLAG, RB_INT2FIX(cp));
} else {
rb_raise(eWIN32OLERuntimeError, "not installed Windows codepage(%d) according to `%s'", cp, rb_enc_name(enc));
}
@ -1271,7 +1271,7 @@ ole_val2variant(VALUE val, VARIANT *var)
case T_FIXNUM:
V_VT(var) = VT_I4;
{
long v = NUM2LONG(val);
long v = RB_NUM2LONG(val);
V_I4(var) = (LONG)v;
#if SIZEOF_LONG > 4
if (V_I4(var) != v) {
@ -1486,58 +1486,58 @@ ole_variant2val(VARIANT *pvar)
break;
case VT_I1:
if(V_ISBYREF(pvar))
obj = INT2NUM((long)*V_I1REF(pvar));
obj = RB_INT2NUM((long)*V_I1REF(pvar));
else
obj = INT2NUM((long)V_I1(pvar));
obj = RB_INT2NUM((long)V_I1(pvar));
break;
case VT_UI1:
if(V_ISBYREF(pvar))
obj = INT2NUM((long)*V_UI1REF(pvar));
obj = RB_INT2NUM((long)*V_UI1REF(pvar));
else
obj = INT2NUM((long)V_UI1(pvar));
obj = RB_INT2NUM((long)V_UI1(pvar));
break;
case VT_I2:
if(V_ISBYREF(pvar))
obj = INT2NUM((long)*V_I2REF(pvar));
obj = RB_INT2NUM((long)*V_I2REF(pvar));
else
obj = INT2NUM((long)V_I2(pvar));
obj = RB_INT2NUM((long)V_I2(pvar));
break;
case VT_UI2:
if(V_ISBYREF(pvar))
obj = INT2NUM((long)*V_UI2REF(pvar));
obj = RB_INT2NUM((long)*V_UI2REF(pvar));
else
obj = INT2NUM((long)V_UI2(pvar));
obj = RB_INT2NUM((long)V_UI2(pvar));
break;
case VT_I4:
if(V_ISBYREF(pvar))
obj = INT2NUM((long)*V_I4REF(pvar));
obj = RB_INT2NUM((long)*V_I4REF(pvar));
else
obj = INT2NUM((long)V_I4(pvar));
obj = RB_INT2NUM((long)V_I4(pvar));
break;
case VT_UI4:
if(V_ISBYREF(pvar))
obj = INT2NUM((long)*V_UI4REF(pvar));
obj = RB_INT2NUM((long)*V_UI4REF(pvar));
else
obj = INT2NUM((long)V_UI4(pvar));
obj = RB_INT2NUM((long)V_UI4(pvar));
break;
case VT_INT:
if(V_ISBYREF(pvar))
obj = INT2NUM((long)*V_INTREF(pvar));
obj = RB_INT2NUM((long)*V_INTREF(pvar));
else
obj = INT2NUM((long)V_INT(pvar));
obj = RB_INT2NUM((long)V_INT(pvar));
break;
case VT_UINT:
if(V_ISBYREF(pvar))
obj = INT2NUM((long)*V_UINTREF(pvar));
obj = RB_INT2NUM((long)*V_UINTREF(pvar));
else
obj = INT2NUM((long)V_UINT(pvar));
obj = RB_INT2NUM((long)V_UINT(pvar));
break;
#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
@ -1596,9 +1596,9 @@ ole_variant2val(VARIANT *pvar)
case VT_ERROR:
if(V_ISBYREF(pvar))
obj = INT2NUM(*V_ERRORREF(pvar));
obj = RB_INT2NUM(*V_ERRORREF(pvar));
else
obj = INT2NUM(V_ERROR(pvar));
obj = RB_INT2NUM(V_ERROR(pvar));
break;
case VT_BOOL:
@ -2127,7 +2127,7 @@ fole_s_reference_count(VALUE self, VALUE obj)
{
struct oledata * pole = NULL;
pole = oledata_get_struct(obj);
return INT2NUM(reference_count(pole));
return RB_INT2NUM(reference_count(pole));
}
/*
@ -2150,7 +2150,7 @@ fole_s_free(VALUE self, VALUE obj)
n = OLE_RELEASE(pole->pDispatch);
}
}
return INT2NUM(n);
return RB_INT2NUM(n);
}
static HWND
@ -2167,10 +2167,10 @@ ole_show_help(VALUE helpfile, VALUE helpcontext)
if (!pfnHtmlHelp)
return hwnd;
hwnd = pfnHtmlHelp(GetDesktopWindow(), StringValuePtr(helpfile),
0x0f, NUM2INT(helpcontext));
0x0f, RB_NUM2INT(helpcontext));
if (hwnd == 0)
hwnd = pfnHtmlHelp(GetDesktopWindow(), StringValuePtr(helpfile),
0, NUM2INT(helpcontext));
0, RB_NUM2INT(helpcontext));
return hwnd;
}
@ -2227,7 +2227,7 @@ fole_s_show_help(int argc, VALUE *argv, VALUE self)
static VALUE
fole_s_get_code_page(VALUE self)
{
return INT2FIX(cWIN32OLE_cp);
return RB_INT2FIX(cWIN32OLE_cp);
}
static BOOL CALLBACK
@ -2264,7 +2264,7 @@ code_page_installed(UINT cp)
static VALUE
fole_s_set_code_page(VALUE self, VALUE vcp)
{
UINT cp = FIX2INT(vcp);
UINT cp = RB_FIX2INT(vcp);
set_ole_codepage(cp);
/*
* Should this method return old codepage?
@ -2284,7 +2284,7 @@ fole_s_set_code_page(VALUE self, VALUE vcp)
static VALUE
fole_s_get_locale(VALUE self)
{
return INT2FIX(cWIN32OLE_lcid);
return RB_INT2FIX(cWIN32OLE_lcid);
}
static BOOL
@ -2319,7 +2319,7 @@ lcid_installed(LCID lcid)
static VALUE
fole_s_set_locale(VALUE self, VALUE vlcid)
{
LCID lcid = FIX2INT(vlcid);
LCID lcid = RB_FIX2INT(vlcid);
if (lcid_installed(lcid)) {
cWIN32OLE_lcid = lcid;
} else {
@ -2841,7 +2841,7 @@ ole_invoke2(VALUE self, VALUE dispid, VALUE args, VALUE types, USHORT dispkind)
VariantInit(&realargs[i]);
VariantInit(&dispParams.rgvarg[i]);
tp = rb_ary_entry(types, j);
vt = (VARTYPE)FIX2INT(tp);
vt = (VARTYPE)RB_FIX2INT(tp);
V_VT(&dispParams.rgvarg[i]) = vt;
param = rb_ary_entry(args, j);
if (param == Qnil)
@ -2976,7 +2976,7 @@ ole_invoke2(VALUE self, VALUE dispid, VALUE args, VALUE types, USHORT dispkind)
dispParams.rgdispidNamedArgs[0] = DISPID_PROPERTYPUT;
}
hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, NUM2INT(dispid),
hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, RB_NUM2INT(dispid),
&IID_NULL, cWIN32OLE_lcid,
dispkind,
&dispParams, &result,
@ -2985,7 +2985,7 @@ ole_invoke2(VALUE self, VALUE dispid, VALUE args, VALUE types, USHORT dispkind)
if (FAILED(hr)) {
v = ole_excepinfo2msg(&excepinfo);
ole_raise(hr, eWIN32OLERuntimeError, "(in OLE method `<dispatch id:%d>': )%s",
NUM2INT(dispid),
RB_NUM2INT(dispid),
StringValuePtr(v));
}
@ -3761,7 +3761,7 @@ ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails)
break;
default:
typestr = rb_str_new2("Unknown Type ");
rb_str_concat(typestr, rb_fix2str(INT2FIX(pTypeDesc->vt), 10));
rb_str_concat(typestr, rb_fix2str(RB_INT2FIX(pTypeDesc->vt), 10));
break;
}
if (typedetails != Qnil)
@ -4007,50 +4007,50 @@ Init_win32ole(void)
/*
* 0: ANSI code page. See WIN32OLE.codepage and WIN32OLE.codepage=.
*/
rb_define_const(cWIN32OLE, "CP_ACP", INT2FIX(CP_ACP));
rb_define_const(cWIN32OLE, "CP_ACP", RB_INT2FIX(CP_ACP));
/*
* 1: OEM code page. See WIN32OLE.codepage and WIN32OLE.codepage=.
*/
rb_define_const(cWIN32OLE, "CP_OEMCP", INT2FIX(CP_OEMCP));
rb_define_const(cWIN32OLE, "CP_OEMCP", RB_INT2FIX(CP_OEMCP));
/*
* 2
*/
rb_define_const(cWIN32OLE, "CP_MACCP", INT2FIX(CP_MACCP));
rb_define_const(cWIN32OLE, "CP_MACCP", RB_INT2FIX(CP_MACCP));
/*
* 3: current thread ANSI code page. See WIN32OLE.codepage and
* WIN32OLE.codepage=.
*/
rb_define_const(cWIN32OLE, "CP_THREAD_ACP", INT2FIX(CP_THREAD_ACP));
rb_define_const(cWIN32OLE, "CP_THREAD_ACP", RB_INT2FIX(CP_THREAD_ACP));
/*
* 42: symbol code page. See WIN32OLE.codepage and WIN32OLE.codepage=.
*/
rb_define_const(cWIN32OLE, "CP_SYMBOL", INT2FIX(CP_SYMBOL));
rb_define_const(cWIN32OLE, "CP_SYMBOL", RB_INT2FIX(CP_SYMBOL));
/*
* 65000: UTF-7 code page. See WIN32OLE.codepage and WIN32OLE.codepage=.
*/
rb_define_const(cWIN32OLE, "CP_UTF7", INT2FIX(CP_UTF7));
rb_define_const(cWIN32OLE, "CP_UTF7", RB_INT2FIX(CP_UTF7));
/*
* 65001: UTF-8 code page. See WIN32OLE.codepage and WIN32OLE.codepage=.
*/
rb_define_const(cWIN32OLE, "CP_UTF8", INT2FIX(CP_UTF8));
rb_define_const(cWIN32OLE, "CP_UTF8", RB_INT2FIX(CP_UTF8));
/*
* 0x0800: default locale for the operating system. See WIN32OLE.locale
* and WIN32OLE.locale=.
*/
rb_define_const(cWIN32OLE, "LOCALE_SYSTEM_DEFAULT", INT2FIX(LOCALE_SYSTEM_DEFAULT));
rb_define_const(cWIN32OLE, "LOCALE_SYSTEM_DEFAULT", RB_INT2FIX(LOCALE_SYSTEM_DEFAULT));
/*
* 0x0400: default locale for the user or process. See WIN32OLE.locale
* and WIN32OLE.locale=.
*/
rb_define_const(cWIN32OLE, "LOCALE_USER_DEFAULT", INT2FIX(LOCALE_USER_DEFAULT));
rb_define_const(cWIN32OLE, "LOCALE_USER_DEFAULT", RB_INT2FIX(LOCALE_USER_DEFAULT));
Init_win32ole_variant_m();
Init_win32ole_typelib();

View file

@ -85,13 +85,13 @@
#ifdef HAVE_LONG_LONG
#define I8_2_NUM LL2NUM
#define UI8_2_NUM ULL2NUM
#define NUM2I8 NUM2LL
#define NUM2UI8 NUM2ULL
#define NUM2I8 RB_NUM2LL
#define NUM2UI8 RB_NUM2ULL
#else
#define I8_2_NUM INT2NUM
#define UI8_2_NUM UINT2NUM
#define NUM2I8 NUM2INT
#define NUM2UI8 NUM2UINT
#define I8_2_NUM RB_INT2NUM
#define UI8_2_NUM RB_UINT2NUM
#define NUM2I8 RB_NUM2INT
#define NUM2UI8 RB_NUM2UINT
#endif
#define OLE_ADDREF(X) (X) ? ((X)->lpVtbl->AddRef(X)) : 0

View file

@ -342,19 +342,19 @@ ole_val2ptr_variant(VALUE val, VARIANT *var)
case T_FIXNUM:
switch(V_VT(var)) {
case (VT_UI1 | VT_BYREF) :
*V_UI1REF(var) = NUM2CHR(val);
*V_UI1REF(var) = RB_NUM2CHR(val);
break;
case (VT_I2 | VT_BYREF) :
*V_I2REF(var) = (short)NUM2INT(val);
*V_I2REF(var) = (short)RB_NUM2INT(val);
break;
case (VT_I4 | VT_BYREF) :
*V_I4REF(var) = NUM2INT(val);
*V_I4REF(var) = RB_NUM2INT(val);
break;
case (VT_R4 | VT_BYREF) :
*V_R4REF(var) = (float)NUM2INT(val);
*V_R4REF(var) = (float)RB_NUM2INT(val);
break;
case (VT_R8 | VT_BYREF) :
*V_R8REF(var) = NUM2INT(val);
*V_R8REF(var) = RB_NUM2INT(val);
break;
default:
break;
@ -363,10 +363,10 @@ ole_val2ptr_variant(VALUE val, VARIANT *var)
case T_FLOAT:
switch(V_VT(var)) {
case (VT_I2 | VT_BYREF) :
*V_I2REF(var) = (short)NUM2INT(val);
*V_I2REF(var) = (short)RB_NUM2INT(val);
break;
case (VT_I4 | VT_BYREF) :
*V_I4REF(var) = NUM2INT(val);
*V_I4REF(var) = RB_NUM2INT(val);
break;
case (VT_R4 | VT_BYREF) :
*V_R4REF(var) = (float)NUM2DBL(val);
@ -417,7 +417,7 @@ hash2ptr_dispparams(VALUE hash, ITypeInfo *pTypeInfo, DISPID dispid, DISPPARAMS
for (i = 0; i < len - 1; i++) {
key = WC2VSTR(bstrs[i + 1]);
val = rb_hash_aref(hash, INT2FIX(i));
val = rb_hash_aref(hash, RB_UINT2NUM(i));
if (val == Qnil)
val = rb_hash_aref(hash, key);
if (val == Qnil)

View file

@ -344,7 +344,7 @@ ole_method_return_vtype(ITypeInfo *pTypeInfo, UINT method_index)
if (FAILED(hr))
ole_raise(hr, eWIN32OLERuntimeError, "failed to GetFuncDesc");
vvt = INT2FIX(pFuncDesc->elemdescFunc.tdesc.vt);
vvt = RB_INT2FIX(pFuncDesc->elemdescFunc.tdesc.vt);
pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
return vvt;
}
@ -410,7 +410,7 @@ ole_method_invkind(ITypeInfo *pTypeInfo, UINT method_index)
hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
if(FAILED(hr))
ole_raise(hr, eWIN32OLERuntimeError, "failed to GetFuncDesc");
invkind = INT2FIX(pFuncDesc->invkind);
invkind = RB_INT2FIX(pFuncDesc->invkind);
pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
return invkind;
}
@ -420,16 +420,16 @@ ole_method_invoke_kind(ITypeInfo *pTypeInfo, UINT method_index)
{
VALUE type = rb_str_new2("UNKNOWN");
VALUE invkind = ole_method_invkind(pTypeInfo, method_index);
if((FIX2INT(invkind) & INVOKE_PROPERTYGET) &&
(FIX2INT(invkind) & INVOKE_PROPERTYPUT) ) {
if((RB_FIX2INT(invkind) & INVOKE_PROPERTYGET) &&
(RB_FIX2INT(invkind) & INVOKE_PROPERTYPUT) ) {
type = rb_str_new2("PROPERTY");
} else if(FIX2INT(invkind) & INVOKE_PROPERTYGET) {
} else if(RB_FIX2INT(invkind) & INVOKE_PROPERTYGET) {
type = rb_str_new2("PROPERTYGET");
} else if(FIX2INT(invkind) & INVOKE_PROPERTYPUT) {
} else if(RB_FIX2INT(invkind) & INVOKE_PROPERTYPUT) {
type = rb_str_new2("PROPERTYPUT");
} else if(FIX2INT(invkind) & INVOKE_PROPERTYPUTREF) {
} else if(RB_FIX2INT(invkind) & INVOKE_PROPERTYPUTREF) {
type = rb_str_new2("PROPERTYPUTREF");
} else if(FIX2INT(invkind) & INVOKE_FUNC) {
} else if(RB_FIX2INT(invkind) & INVOKE_FUNC) {
type = rb_str_new2("FUNC");
}
return type;
@ -712,7 +712,7 @@ ole_method_helpcontext(ITypeInfo *pTypeInfo, UINT method_index)
&helpcontext, NULL);
if (FAILED(hr))
return Qnil;
return INT2FIX(helpcontext);
return RB_INT2FIX(helpcontext);
}
/*
@ -741,7 +741,7 @@ ole_method_dispid(ITypeInfo *pTypeInfo, UINT method_index)
hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
if (FAILED(hr))
return dispid;
dispid = INT2NUM(pFuncDesc->memid);
dispid = RB_INT2NUM(pFuncDesc->memid);
pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
return dispid;
}
@ -772,7 +772,7 @@ ole_method_offset_vtbl(ITypeInfo *pTypeInfo, UINT method_index)
hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
if (FAILED(hr))
return offset_vtbl;
offset_vtbl = INT2FIX(pFuncDesc->oVft);
offset_vtbl = RB_INT2FIX(pFuncDesc->oVft);
pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
return offset_vtbl;
}
@ -803,7 +803,7 @@ ole_method_size_params(ITypeInfo *pTypeInfo, UINT method_index)
hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
if (FAILED(hr))
return size_params;
size_params = INT2FIX(pFuncDesc->cParams);
size_params = RB_INT2FIX(pFuncDesc->cParams);
pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
return size_params;
}
@ -835,7 +835,7 @@ ole_method_size_opt_params(ITypeInfo *pTypeInfo, UINT method_index)
hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
if (FAILED(hr))
return size_opt_params;
size_opt_params = INT2FIX(pFuncDesc->cParamsOpt);
size_opt_params = RB_INT2FIX(pFuncDesc->cParamsOpt);
pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
return size_opt_params;
}

View file

@ -149,7 +149,7 @@ foleparam_initialize(VALUE self, VALUE olemethod, VALUE n)
if (!rb_obj_is_kind_of(olemethod, cWIN32OLE_METHOD)) {
rb_raise(rb_eTypeError, "1st parameter must be WIN32OLE_METHOD object");
}
idx = FIX2INT(n);
idx = RB_FIX2INT(n);
return oleparam_ole_param(self, olemethod, idx);
}

View file

@ -468,7 +468,7 @@ ole_type_major_version(ITypeInfo *pTypeInfo)
hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
if (FAILED(hr))
ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
ver = INT2FIX(pTypeAttr->wMajorVerNum);
ver = RB_INT2FIX(pTypeAttr->wMajorVerNum);
OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
return ver;
}
@ -497,7 +497,7 @@ ole_type_minor_version(ITypeInfo *pTypeInfo)
hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
if (FAILED(hr))
ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
ver = INT2FIX(pTypeAttr->wMinorVerNum);
ver = RB_INT2FIX(pTypeAttr->wMinorVerNum);
OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
return ver;
}
@ -526,7 +526,7 @@ ole_type_typekind(ITypeInfo *pTypeInfo)
hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
if (FAILED(hr))
ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
typekind = INT2FIX(pTypeAttr->typekind);
typekind = RB_INT2FIX(pTypeAttr->typekind);
OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
return typekind;
}
@ -645,7 +645,7 @@ ole_type_helpcontext(ITypeInfo *pTypeInfo)
&helpcontext, NULL);
if(FAILED(hr))
return Qnil;
return INT2FIX(helpcontext);
return RB_INT2FIX(helpcontext);
}
/*

View file

@ -539,7 +539,7 @@ foletypelib_major_version(VALUE self)
pTypeLib = itypelib(self);
oletypelib_get_libattr(pTypeLib, &pTLibAttr);
major = INT2NUM(pTLibAttr->wMajorVerNum);
major = RB_INT2NUM(pTLibAttr->wMajorVerNum);
pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
return major;
}
@ -561,7 +561,7 @@ foletypelib_minor_version(VALUE self)
ITypeLib *pTypeLib;
pTypeLib = itypelib(self);
oletypelib_get_libattr(pTypeLib, &pTLibAttr);
minor = INT2NUM(pTLibAttr->wMinorVerNum);
minor = RB_INT2NUM(pTLibAttr->wMinorVerNum);
pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
return minor;
}

View file

@ -319,7 +319,7 @@ ole_variable_varkind(ITypeInfo *pTypeInfo, UINT var_index)
if (FAILED(hr))
return kind;
pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
kind = INT2FIX(pVarDesc->varkind);
kind = RB_INT2FIX(pVarDesc->varkind);
return kind;
}

View file

@ -160,7 +160,7 @@ ole_val2variant_err(VALUE val, VARIANT *var)
}
V_VT(var) = VT_ERROR;
if (v != Qnil) {
V_ERROR(var) = NUM2LONG(val);
V_ERROR(var) = RB_NUM2LONG(val);
} else {
V_ERROR(var) = 0;
}
@ -294,7 +294,7 @@ folevariant_s_array(VALUE klass, VALUE elems, VALUE vvt)
ole_initialize();
vt = NUM2UINT(vvt);
vt = RB_NUM2UINT(vvt);
vt = (vt | VT_ARRAY);
Check_Type(elems, T_ARRAY);
obj = folevariant_s_allocate(klass);
@ -309,7 +309,7 @@ folevariant_s_array(VALUE klass, VALUE elems, VALUE vvt)
}
for (i = 0; i < dim; i++) {
psab[i].cElements = FIX2INT(rb_ary_entry(elems, i));
psab[i].cElements = RB_FIX2INT(rb_ary_entry(elems, i));
psab[i].lLbound = 0;
}
@ -420,7 +420,7 @@ folevariant_initialize(VALUE self, VALUE args)
ole_val2variant(val, &(pvar->var));
} else {
vvt = rb_ary_entry(args, 1);
vt = NUM2INT(vvt);
vt = RB_NUM2INT(vvt);
if ((vt & VT_TYPEMASK) == VT_RECORD) {
rb_raise(rb_eArgError, "not supported VT_RECORD WIN32OLE_VARIANT object");
}
@ -465,7 +465,7 @@ ary2safe_array_index(int ary_size, VALUE *ary, SAFEARRAY *psa)
rb_raise(rb_eRuntimeError, "failed to allocate memory for indices");
}
for (i = 0; i < dim; i++) {
pid[i] = NUM2INT(ary[i]);
pid[i] = RB_NUM2INT(ary[i]);
}
return pid;
}
@ -649,7 +649,7 @@ folevariant_vartype(VALUE self)
{
struct olevariantdata *pvar;
TypedData_Get_Struct(self, struct olevariantdata, &olevariant_datatype, pvar);
return INT2FIX(V_VT(&pvar->var));
return RB_INT2FIX(V_VT(&pvar->var));
}
/*
@ -706,19 +706,19 @@ Init_win32ole_variant(void)
* represents VT_EMPTY OLE object.
*/
rb_define_const(cWIN32OLE_VARIANT, "Empty",
rb_funcall(cWIN32OLE_VARIANT, rb_intern("new"), 2, Qnil, INT2FIX(VT_EMPTY)));
rb_funcall(cWIN32OLE_VARIANT, rb_intern("new"), 2, Qnil, RB_INT2FIX(VT_EMPTY)));
/*
* represents VT_NULL OLE object.
*/
rb_define_const(cWIN32OLE_VARIANT, "Null",
rb_funcall(cWIN32OLE_VARIANT, rb_intern("new"), 2, Qnil, INT2FIX(VT_NULL)));
rb_funcall(cWIN32OLE_VARIANT, rb_intern("new"), 2, Qnil, RB_INT2FIX(VT_NULL)));
/*
* represents Nothing of VB.NET or VB.
*/
rb_define_const(cWIN32OLE_VARIANT, "Nothing",
rb_funcall(cWIN32OLE_VARIANT, rb_intern("new"), 2, Qnil, INT2FIX(VT_DISPATCH)));
rb_funcall(cWIN32OLE_VARIANT, rb_intern("new"), 2, Qnil, RB_INT2FIX(VT_DISPATCH)));
/*
* represents VT_ERROR variant with DISP_E_PARAMNOTFOUND.
@ -728,5 +728,5 @@ Init_win32ole_variant(void)
* fso.openTextFile(filename, WIN32OLE_VARIANT::NoParam, false)
*/
rb_define_const(cWIN32OLE_VARIANT, "NoParam",
rb_funcall(cWIN32OLE_VARIANT, rb_intern("new"), 2, INT2NUM(DISP_E_PARAMNOTFOUND), INT2FIX(VT_ERROR)));
rb_funcall(cWIN32OLE_VARIANT, rb_intern("new"), 2, INT2NUM(DISP_E_PARAMNOTFOUND), RB_INT2FIX(VT_ERROR)));
}

View file

@ -17,133 +17,133 @@ void Init_win32ole_variant_m(void)
/*
* represents VT_EMPTY type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_EMPTY", INT2FIX(VT_EMPTY));
rb_define_const(mWIN32OLE_VARIANT, "VT_EMPTY", RB_INT2FIX(VT_EMPTY));
/*
* represents VT_NULL type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_NULL", INT2FIX(VT_NULL));
rb_define_const(mWIN32OLE_VARIANT, "VT_NULL", RB_INT2FIX(VT_NULL));
/*
* represents VT_I2 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_I2", INT2FIX(VT_I2));
rb_define_const(mWIN32OLE_VARIANT, "VT_I2", RB_INT2FIX(VT_I2));
/*
* represents VT_I4 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_I4", INT2FIX(VT_I4));
rb_define_const(mWIN32OLE_VARIANT, "VT_I4", RB_INT2FIX(VT_I4));
/*
* represents VT_R4 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_R4", INT2FIX(VT_R4));
rb_define_const(mWIN32OLE_VARIANT, "VT_R4", RB_INT2FIX(VT_R4));
/*
* represents VT_R8 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_R8", INT2FIX(VT_R8));
rb_define_const(mWIN32OLE_VARIANT, "VT_R8", RB_INT2FIX(VT_R8));
/*
* represents VT_CY type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_CY", INT2FIX(VT_CY));
rb_define_const(mWIN32OLE_VARIANT, "VT_CY", RB_INT2FIX(VT_CY));
/*
* represents VT_DATE type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_DATE", INT2FIX(VT_DATE));
rb_define_const(mWIN32OLE_VARIANT, "VT_DATE", RB_INT2FIX(VT_DATE));
/*
* represents VT_BSTR type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_BSTR", INT2FIX(VT_BSTR));
rb_define_const(mWIN32OLE_VARIANT, "VT_BSTR", RB_INT2FIX(VT_BSTR));
/*
* represents VT_USERDEFINED type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_USERDEFINED", INT2FIX(VT_USERDEFINED));
rb_define_const(mWIN32OLE_VARIANT, "VT_USERDEFINED", RB_INT2FIX(VT_USERDEFINED));
/*
* represents VT_PTR type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_PTR", INT2FIX(VT_PTR));
rb_define_const(mWIN32OLE_VARIANT, "VT_PTR", RB_INT2FIX(VT_PTR));
/*
* represents VT_DISPATCH type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_DISPATCH", INT2FIX(VT_DISPATCH));
rb_define_const(mWIN32OLE_VARIANT, "VT_DISPATCH", RB_INT2FIX(VT_DISPATCH));
/*
* represents VT_ERROR type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_ERROR", INT2FIX(VT_ERROR));
rb_define_const(mWIN32OLE_VARIANT, "VT_ERROR", RB_INT2FIX(VT_ERROR));
/*
* represents VT_BOOL type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_BOOL", INT2FIX(VT_BOOL));
rb_define_const(mWIN32OLE_VARIANT, "VT_BOOL", RB_INT2FIX(VT_BOOL));
/*
* represents VT_VARIANT type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_VARIANT", INT2FIX(VT_VARIANT));
rb_define_const(mWIN32OLE_VARIANT, "VT_VARIANT", RB_INT2FIX(VT_VARIANT));
/*
* represents VT_UNKNOWN type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_UNKNOWN", INT2FIX(VT_UNKNOWN));
rb_define_const(mWIN32OLE_VARIANT, "VT_UNKNOWN", RB_INT2FIX(VT_UNKNOWN));
/*
* represents VT_I1 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_I1", INT2FIX(VT_I1));
rb_define_const(mWIN32OLE_VARIANT, "VT_I1", RB_INT2FIX(VT_I1));
/*
* represents VT_UI1 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_UI1", INT2FIX(VT_UI1));
rb_define_const(mWIN32OLE_VARIANT, "VT_UI1", RB_INT2FIX(VT_UI1));
/*
* represents VT_UI2 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_UI2", INT2FIX(VT_UI2));
rb_define_const(mWIN32OLE_VARIANT, "VT_UI2", RB_INT2FIX(VT_UI2));
/*
* represents VT_UI4 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_UI4", INT2FIX(VT_UI4));
rb_define_const(mWIN32OLE_VARIANT, "VT_UI4", RB_INT2FIX(VT_UI4));
#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
/*
* represents VT_I8 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_I8", INT2FIX(VT_I8));
rb_define_const(mWIN32OLE_VARIANT, "VT_I8", RB_INT2FIX(VT_I8));
/*
* represents VT_UI8 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_UI8", INT2FIX(VT_UI8));
rb_define_const(mWIN32OLE_VARIANT, "VT_UI8", RB_INT2FIX(VT_UI8));
#endif
/*
* represents VT_INT type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_INT", INT2FIX(VT_INT));
rb_define_const(mWIN32OLE_VARIANT, "VT_INT", RB_INT2FIX(VT_INT));
/*
* represents VT_UINT type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_UINT", INT2FIX(VT_UINT));
rb_define_const(mWIN32OLE_VARIANT, "VT_UINT", RB_INT2FIX(VT_UINT));
/*
* represents VT_ARRAY type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_ARRAY", INT2FIX(VT_ARRAY));
rb_define_const(mWIN32OLE_VARIANT, "VT_ARRAY", RB_INT2FIX(VT_ARRAY));
/*
* represents VT_BYREF type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_BYREF", INT2FIX(VT_BYREF));
rb_define_const(mWIN32OLE_VARIANT, "VT_BYREF", RB_INT2FIX(VT_BYREF));
}