diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ext/win32ole/win32ole.c | 18 | ||||
-rw-r--r-- | test/win32ole/test_win32ole.rb | 20 |
3 files changed, 23 insertions, 22 deletions
@@ -1,3 +1,10 @@ +Mon Oct 13 08:59:08 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp> + + * ext/win32ole/win32ole.c (load_conv_function51932): support + CP51932 on cygwin and mingw32. thanks to arton. + + * test/win32ole/test_win32ole.rb (test_cp51932): ditto. + Mon Oct 13 07:54:00 2008 Yukihiro Matsumoto <matz@ruby-lang.org> * ruby.c (proc_options): add -U command line option to specify diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c index d5dfc94345..c6db9e0c5f 100644 --- a/ext/win32ole/win32ole.c +++ b/ext/win32ole/win32ole.c @@ -82,6 +82,15 @@ #define V_UINTREF(X) V_UNION(X, puintVal) #endif +/* + * unfortunately IID_IMultiLanguage2 is not included in any libXXX.a + * in Cygwin(mingw32). + */ +#if defined(__CYGWIN__) || defined(__MINGW32__) +#undef IID_IMultiLanguage2 +const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00, 0xC0, 0x4F, 0x8F, 0x5D, 0x9A}}; +#endif + #define OLE_RELEASE(X) (X) ? ((X)->lpVtbl->Release(X)) : 0 #define OLE_ADDREF(X) (X) ? ((X)->lpVtbl->AddRef(X)) : 0 @@ -119,7 +128,7 @@ #define WC2VSTR(x) ole_wc2vstr((x), TRUE) -#define WIN32OLE_VERSION "1.3.5" +#define WIN32OLE_VERSION "1.3.6" typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX) (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*); @@ -965,15 +974,8 @@ load_conv_function51932() HRESULT hr; void *p; if (!pIMultiLanguage2) { -#ifdef _MSC_VER hr = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER, &IID_IMultiLanguage2, &p); -#else - /* - * unfortunately, fail to link IID_IMultiLanguage2 on Cygwin or mingw32. - */ - hr = E_FAIL; -#endif if (FAILED(hr)) { rb_raise(eWIN32OLERuntimeError, "fail to load convert function for CP51932"); } diff --git a/test/win32ole/test_win32ole.rb b/test/win32ole/test_win32ole.rb index 44d9a35071..983c47929e 100644 --- a/test/win32ole/test_win32ole.rb +++ b/test/win32ole/test_win32ole.rb @@ -365,20 +365,12 @@ if defined?(WIN32OLE) cp = WIN32OLE.codepage begin obj = WIN32OLE_VARIANT.new([0x3042].pack("U*").force_encoding("UTF-8")) - # mswin32 ruby only supports CP51932 - if /mswin/ =~ RUBY_PLATFORM - begin - WIN32OLE.codepage = 51932 - rescue - end - if WIN32OLE.codepage == 51932 - assert_equal("\xA4\xA2".force_encoding("CP51932"), obj.value) - end - else - # cygwin, mingw32 ruby does not support CP51932 - assert_raise(WIN32OLERuntimeError) { - WIN32OLE.codepage = 51932 - } + begin + WIN32OLE.codepage = 51932 + rescue + end + if WIN32OLE.codepage == 51932 + assert_equal("\xA4\xA2".force_encoding("CP51932"), obj.value) end ensure WIN32OLE.codepage = cp |