1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/win32ole/win32ole_variant_m.c
usa 1bce19a7e5 merge revision(s) a0bc3f2a1c2c98f225612101cb4e1ea1a6813546,75a0447c15a7ab017bd4240c2a9cc69b134b80b9,f1699314147bad2cf5550cc582693424fdbc2510: [Backport #16846]
Suppress C4267 "possible loss of data" warnings

	---
	 ext/win32ole/win32ole.c | 2 +-
	 1 file changed, 1 insertion(+), 1 deletion(-)

	Suppress C4267 "possible loss of data" warnings

	Just cast down explicitly.
	---
	 ext/win32ole/win32ole.c | 2 +-
	 1 file changed, 1 insertion(+), 1 deletion(-)

	win32ole: separate global variable declarations and definitions

	https://gcc.gnu.org/gcc-10/changes.html#c

	> * GCC now defaults to `-fno-common`.  As a result, global
	>   variable accesses are more efficient on various targets.  In
	>   C, global variables with multiple tentative definitions now
	>   result in linker errors.  With `-fcommon` such definitions are
	>   silently merged during linking.
	---
	 ext/win32ole/win32ole.c           | 1 +
	 ext/win32ole/win32ole.h           | 4 ++--
	 ext/win32ole/win32ole_error.c     | 3 +++
	 ext/win32ole/win32ole_error.h     | 4 ++--
	 ext/win32ole/win32ole_method.c    | 2 ++
	 ext/win32ole/win32ole_method.h    | 2 +-
	 ext/win32ole/win32ole_record.c    | 2 ++
	 ext/win32ole/win32ole_record.h    | 2 +-
	 ext/win32ole/win32ole_type.c      | 2 ++
	 ext/win32ole/win32ole_type.h      | 2 +-
	 ext/win32ole/win32ole_typelib.c   | 2 ++
	 ext/win32ole/win32ole_typelib.h   | 2 +-
	 ext/win32ole/win32ole_variable.c  | 2 ++
	 ext/win32ole/win32ole_variable.h  | 2 +-
	 ext/win32ole/win32ole_variant.c   | 2 ++
	 ext/win32ole/win32ole_variant.h   | 2 +-
	 ext/win32ole/win32ole_variant_m.c | 2 ++
	 ext/win32ole/win32ole_variant_m.h | 2 +-
	 18 files changed, 29 insertions(+), 11 deletions(-)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2021-04-04 22:58:46 +00:00

151 lines
3.8 KiB
C

#include "win32ole.h"
VALUE mWIN32OLE_VARIANT;
void Init_win32ole_variant_m(void)
{
/*
* Document-module: WIN32OLE::VARIANT
*
* The WIN32OLE::VARIANT module includes constants of VARIANT type constants.
* The constants is used when creating WIN32OLE_VARIANT object.
*
* obj = WIN32OLE_VARIANT.new("2e3", WIN32OLE::VARIANT::VT_R4)
* obj.value # => 2000.0
*
*/
mWIN32OLE_VARIANT = rb_define_module_under(cWIN32OLE, "VARIANT");
/*
* represents VT_EMPTY type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_EMPTY", RB_INT2FIX(VT_EMPTY));
/*
* represents VT_NULL type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_NULL", RB_INT2FIX(VT_NULL));
/*
* represents VT_I2 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_I2", RB_INT2FIX(VT_I2));
/*
* represents VT_I4 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_I4", RB_INT2FIX(VT_I4));
/*
* represents VT_R4 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_R4", RB_INT2FIX(VT_R4));
/*
* represents VT_R8 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_R8", RB_INT2FIX(VT_R8));
/*
* represents VT_CY type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_CY", RB_INT2FIX(VT_CY));
/*
* represents VT_DATE type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_DATE", RB_INT2FIX(VT_DATE));
/*
* represents VT_BSTR type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_BSTR", RB_INT2FIX(VT_BSTR));
/*
* represents VT_USERDEFINED type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_USERDEFINED", RB_INT2FIX(VT_USERDEFINED));
/*
* represents VT_PTR type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_PTR", RB_INT2FIX(VT_PTR));
/*
* represents VT_DISPATCH type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_DISPATCH", RB_INT2FIX(VT_DISPATCH));
/*
* represents VT_ERROR type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_ERROR", RB_INT2FIX(VT_ERROR));
/*
* represents VT_BOOL type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_BOOL", RB_INT2FIX(VT_BOOL));
/*
* represents VT_VARIANT type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_VARIANT", RB_INT2FIX(VT_VARIANT));
/*
* represents VT_UNKNOWN type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_UNKNOWN", RB_INT2FIX(VT_UNKNOWN));
/*
* represents VT_I1 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_I1", RB_INT2FIX(VT_I1));
/*
* represents VT_UI1 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_UI1", RB_INT2FIX(VT_UI1));
/*
* represents VT_UI2 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_UI2", RB_INT2FIX(VT_UI2));
/*
* represents VT_UI4 type constant.
*/
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", RB_INT2FIX(VT_I8));
/*
* represents VT_UI8 type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_UI8", RB_INT2FIX(VT_UI8));
#endif
/*
* represents VT_INT type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_INT", RB_INT2FIX(VT_INT));
/*
* represents VT_UINT type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_UINT", RB_INT2FIX(VT_UINT));
/*
* represents VT_ARRAY type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_ARRAY", RB_INT2FIX(VT_ARRAY));
/*
* represents VT_BYREF type constant.
*/
rb_define_const(mWIN32OLE_VARIANT, "VT_BYREF", RB_INT2FIX(VT_BYREF));
}