mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ext/win32ole/win32ole.c (ole_val2variant, ole_invoke): refactoring.
use ole_variant2variant to convert WIN32OLE_VARIANT object to VARIANT object. ext/win32ole/win32ole_variant.c: refactoring. add ole_variant2variant. ext/win32ole/win32ole_variant.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1fe90db538
commit
5d2ce2fb40
4 changed files with 26 additions and 11 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
Sun Oct 26 07:40:11 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
|
||||||
|
|
||||||
|
* ext/win32ole/win32ole.c (ole_val2variant, ole_invoke): refactoring.
|
||||||
|
use ole_variant2variant to convert WIN32OLE_VARIANT object to
|
||||||
|
VARIANT object.
|
||||||
|
|
||||||
|
* ext/win32ole/win32ole_variant.c: refactoring. add
|
||||||
|
ole_variant2variant.
|
||||||
|
* ext/win32ole/win32ole_variant.h: ditto.
|
||||||
|
|
||||||
Sat Oct 25 22:28:17 2014 Tanaka Akira <akr@fsij.org>
|
Sat Oct 25 22:28:17 2014 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* io.c (io_binwrite_string): Test writev() failure.
|
* io.c (io_binwrite_string): Test writev() failure.
|
||||||
|
|
|
@ -1217,7 +1217,6 @@ void
|
||||||
ole_val2variant(VALUE val, VARIANT *var)
|
ole_val2variant(VALUE val, VARIANT *var)
|
||||||
{
|
{
|
||||||
struct oledata *pole;
|
struct oledata *pole;
|
||||||
struct olevariantdata *pvar;
|
|
||||||
if(rb_obj_is_kind_of(val, cWIN32OLE)) {
|
if(rb_obj_is_kind_of(val, cWIN32OLE)) {
|
||||||
Data_Get_Struct(val, struct oledata, pole);
|
Data_Get_Struct(val, struct oledata, pole);
|
||||||
OLE_ADDREF(pole->pDispatch);
|
OLE_ADDREF(pole->pDispatch);
|
||||||
|
@ -1226,8 +1225,7 @@ ole_val2variant(VALUE val, VARIANT *var)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (rb_obj_is_kind_of(val, cWIN32OLE_VARIANT)) {
|
if (rb_obj_is_kind_of(val, cWIN32OLE_VARIANT)) {
|
||||||
Data_Get_Struct(val, struct olevariantdata, pvar);
|
ole_variant2variant(val, var);
|
||||||
VariantCopy(var, &(pvar->var));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (rb_obj_is_kind_of(val, cWIN32OLE_RECORD)) {
|
if (rb_obj_is_kind_of(val, cWIN32OLE_RECORD)) {
|
||||||
|
@ -2538,7 +2536,6 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
|
||||||
unsigned int cNamedArgs;
|
unsigned int cNamedArgs;
|
||||||
int n;
|
int n;
|
||||||
struct oleparam op;
|
struct oleparam op;
|
||||||
struct olevariantdata *pvar;
|
|
||||||
memset(&excepinfo, 0, sizeof(EXCEPINFO));
|
memset(&excepinfo, 0, sizeof(EXCEPINFO));
|
||||||
|
|
||||||
VariantInit(&result);
|
VariantInit(&result);
|
||||||
|
@ -2633,8 +2630,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
|
||||||
VariantInit(&op.dp.rgvarg[n]);
|
VariantInit(&op.dp.rgvarg[n]);
|
||||||
param = rb_ary_entry(paramS, i-cNamedArgs);
|
param = rb_ary_entry(paramS, i-cNamedArgs);
|
||||||
if (rb_obj_is_kind_of(param, cWIN32OLE_VARIANT)) {
|
if (rb_obj_is_kind_of(param, cWIN32OLE_VARIANT)) {
|
||||||
Data_Get_Struct(param, struct olevariantdata, pvar);
|
ole_variant2variant(param, &op.dp.rgvarg[n]);
|
||||||
VariantCopy(&op.dp.rgvarg[n], &(pvar->var));
|
|
||||||
} else {
|
} else {
|
||||||
ole_val2variant(param, &realargs[n]);
|
ole_val2variant(param, &realargs[n]);
|
||||||
V_VT(&op.dp.rgvarg[n]) = VT_VARIANT | VT_BYREF;
|
V_VT(&op.dp.rgvarg[n]) = VT_VARIANT | VT_BYREF;
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
#include "win32ole.h"
|
#include "win32ole.h"
|
||||||
|
|
||||||
|
struct olevariantdata {
|
||||||
|
VARIANT realvar;
|
||||||
|
VARIANT var;
|
||||||
|
};
|
||||||
|
|
||||||
static void olevariant_free(struct olevariantdata *pvar);
|
static void olevariant_free(struct olevariantdata *pvar);
|
||||||
static void ole_val2olevariantdata(VALUE val, VARTYPE vt, struct olevariantdata *pvar);
|
static void ole_val2olevariantdata(VALUE val, VARTYPE vt, struct olevariantdata *pvar);
|
||||||
static void ole_val2variant_err(VALUE val, VARIANT *var);
|
static void ole_val2variant_err(VALUE val, VARIANT *var);
|
||||||
|
@ -664,6 +669,14 @@ folevariant_set_value(VALUE self, VALUE val)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ole_variant2variant(VALUE val, VARIANT *var)
|
||||||
|
{
|
||||||
|
struct olevariantdata *pvar;
|
||||||
|
Data_Get_Struct(val, struct olevariantdata, pvar);
|
||||||
|
VariantCopy(var, &(pvar->var));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Init_win32ole_variant(void)
|
Init_win32ole_variant(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
#ifndef WIN32OLE_VARIANT_H
|
#ifndef WIN32OLE_VARIANT_H
|
||||||
#define WIN32OLE_VARIANT_H 1
|
#define WIN32OLE_VARIANT_H 1
|
||||||
|
|
||||||
struct olevariantdata {
|
|
||||||
VARIANT realvar;
|
|
||||||
VARIANT var;
|
|
||||||
};
|
|
||||||
|
|
||||||
VALUE cWIN32OLE_VARIANT;
|
VALUE cWIN32OLE_VARIANT;
|
||||||
|
void ole_variant2variant(VALUE val, VARIANT *var);
|
||||||
void Init_win32ole_variant(void);
|
void Init_win32ole_variant(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue