[#37959] [Bug:trunk] I can modify literals — Yusuke ENDOH <mame@...>

遠藤です。

13 messages 2009/02/10

[#38005] Is URI.decode() broken? — MOROHASHI Kyosuke <moronatural@...>

もろはしです。いつもお世話になっております。

39 messages 2009/02/14
[#38006] Re: Is URI.decode() broken? — Nobuyoshi Nakada <nobu@...> 2009/02/14

なかだです。

[#38009] Re: Is URI.decode() broken? — "NARUSE, Yui" <naruse@...> 2009/02/14

成瀬です、

[#38016] Re: Is URI.decode() broken? — Fujioka <fuj@...> 2009/02/15

xibbarこと藤岡です。

[#38017] Re: Is URI.decode() broken? — "NARUSE, Yui" <naruse@...> 2009/02/15

成瀬です。

[#38040] Re: Is URI.decode() broken? — akira yamada / やまだあきら <akira@...> 2009/02/17

NARUSE, Yui さんは書きました:

[#38124] Re: Is URI.decode() broken? — "NARUSE, Yui" <naruse@...> 2009/03/03

成瀬です。

[#39214] Re: Is URI.decode() broken? — akira yamada / やまだあきら <akira@...> 2009/09/02

(2009年03月03日 22:45), NARUSE, Yui さんは書きました:

[#39218] Re: Is URI.decode() broken? — "NARUSE, Yui" <naruse@...> 2009/09/02

成瀬です。

[#39236] Re: Is URI.decode() broken? — Tanaka Akira <akr@...> 2009/09/05

In article <4A9E44DD.6050706@airemix.jp>,

[#39242] Re: Is URI.decode() broken? — KOSAKI Motohiro <kosaki.motohiro@...> 2009/09/07

小崎@思いつきを適当に書いてみるテスト

[#39246] Re: Is URI.decode() broken? — Tanaka Akira <akr@...> 2009/09/07

In article <20090907091830.2C7A.A69D9226@jp.fujitsu.com>,

[#38096] 多重代入やメソッド引数の展開でto_aが呼ばれます — nagachika <nagachika00@...>

nagachika と申します。

10 messages 2009/02/26

[#38098] ブロック引数と括弧・引数なしsuper — Shugo Maeda <shugo@...>

前田です。

12 messages 2009/02/27

[ruby-dev:37950] [Bug:1.9] compile error on win32ole with Mingw of MacPorts

From: 中田 伸悦 <nobu@...>
Date: 2009-02-08 14:42:30 UTC
List: ruby-dev #37950
なかだです。

MacPortsにmingw-gccまであるというのに驚いて試してみたのですが、
win32oleでコンパイルエラーになりました。対応が古いのか、
IMultiLanguage2どころかmlang.hもないようです。win32ole.cでは一見
対応しているように見えますが、実際にはvoid*を使うコードになって
しまうためコンパイルできません。IMultiLanguageもないときは以下の
どちらかあたりにするのがよいのではないかと思います。

(1) win32oleはコンパイルさせない
(2) 実行時に常にエラーにする

extconf.rbでexitするだけなので(1)は省略します。(2)のパッチをつけ
ます。


Index: ext/win32ole/win32ole.c
===================================================================
--- ext/win32ole/win32ole.c	(revision 22130)
+++ ext/win32ole/win32ole.c	(working copy)
@@ -24,5 +24,7 @@
 #include <olectl.h>
 #include <ole2.h>
+#if defined(HAVE_TYPE_IMULTILANGUAGE2) || defined(HAVE_TYPE_IMULTILANGUAGE)
 #include <mlang.h>
+#endif
 #include <stdlib.h>
 #include <math.h>
@@ -224,5 +226,5 @@ static IMultiLanguage2 *pIMultiLanguage 
 static IMultiLanguage *pIMultiLanguage = NULL;
 #else
-static void *pIMultiLanguage = NULL; /* dummy */
+#define pIMultiLanguage NULL /* dummy */
 #endif
 
@@ -286,6 +288,9 @@ static VALUE date2time_str(double date);
 static rb_encoding *ole_cp2encoding(UINT cp);
 static UINT ole_encoding2cp(rb_encoding *enc);
-static void load_conv_function51932();
-static UINT ole_init_cp();
+NORETURN(static void failed_load_conv51932(void));
+#ifndef pIMultiLanguage
+static void load_conv_function51932(void);
+#endif
+static UINT ole_init_cp(void);
 static char *ole_wc2mb(LPWSTR pw);
 static VALUE ole_hresult2msg(HRESULT hr);
@@ -977,5 +982,12 @@ static UINT ole_encoding2cp(rb_encoding 
 
 static void
-load_conv_function51932()
+failed_load_conv51932(void)
+{
+    rb_raise(eWIN32OLERuntimeError, "fail to load convert function for CP51932");
+}
+
+#ifndef pIMultiLanguage
+static void
+load_conv_function51932(void)
 {
     HRESULT hr = E_NOINTERFACE;
@@ -988,14 +1000,16 @@ load_conv_function51932()
 	hr = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
 		              &IID_IMultiLanguage, &p);
-#else
-	hr = E_NOINTERFACE;
-	p = NULL;
 #endif
 	if (FAILED(hr)) {
-	    rb_raise(eWIN32OLERuntimeError, "fail to load convert function for CP51932");
+	    failed_load_conv51932();
 	}
 	pIMultiLanguage = p;
     }
 }
+#else
+#define load_conv_function51932() failed_load_conv51932()
+#endif
+
+#define conv_51932(cp) ((cp) == 51932 && (load_conv_function51932(), 1))
 
 static void
@@ -1013,9 +1027,9 @@ set_ole_codepage(UINT cp)
         case CP_UTF7:
         case CP_UTF8:
+            cWIN32OLE_cp = cp;
+            break;
         case 51932:
             cWIN32OLE_cp = cp;
-            if (cp == 51932) {
-                load_conv_function51932();
-            }
+            load_conv_function51932();
             break;
         default:
@@ -1029,5 +1043,5 @@ set_ole_codepage(UINT cp)
 
 static UINT
-ole_init_cp()
+ole_init_cp(void)
 {
     UINT cp;
@@ -1109,10 +1123,9 @@ ole_wc2mb(LPWSTR pw)
 {
     LPSTR pm;
-    HRESULT hr;
     int size = 0;
-    DWORD dw = 0;
-    if (cWIN32OLE_cp == 51932) {
-	load_conv_function51932();
-	hr = pIMultiLanguage->lpVtbl->ConvertStringFromUnicode(pIMultiLanguage,
+    if (conv_51932(cWIN32OLE_cp)) {
+#ifndef pIMultiLanguage
+	DWORD dw = 0;
+	HRESULT hr = pIMultiLanguage->lpVtbl->ConvertStringFromUnicode(pIMultiLanguage,
 		&dw, cWIN32OLE_cp, pw, NULL, NULL, &size);
 	if (FAILED(hr)) {
@@ -1126,4 +1139,5 @@ ole_wc2mb(LPWSTR pw)
 	}
 	pm[size] = '\0';
+#endif
         return pm;
     }
@@ -1328,7 +1342,4 @@ ole_vstr2wc(VALUE vstr)
     int size = 0;
     LPWSTR pw;
-    int len = 0;
-    DWORD dw = 0;
-    HRESULT hr;
     st_data_t data;
     enc = rb_enc_get(vstr);
@@ -1352,9 +1363,9 @@ ole_vstr2wc(VALUE vstr)
         }
     }
-    if (cp == 51932) {
-	load_conv_function51932();
-	len = RSTRING_LEN(vstr);
-	size = 0;
-	hr = pIMultiLanguage->lpVtbl->ConvertStringToUnicode(pIMultiLanguage,
+    if (conv_51932(cp)) {
+#ifndef pIMultiLanguage
+	DWORD dw = 0;
+	int len = RSTRING_LEN(vstr);
+	HRESULT hr = pIMultiLanguage->lpVtbl->ConvertStringToUnicode(pIMultiLanguage,
 		&dw, cp, RSTRING_PTR(vstr), &len, NULL, &size);
 	if (FAILED(hr)) {
@@ -1368,4 +1379,5 @@ ole_vstr2wc(VALUE vstr)
             ole_raise(hr, eWIN32OLERuntimeError, "fail to convert CP%d to Unicode", cp);
 	}
+#endif
 	return pw;
     }
@@ -1381,12 +1393,10 @@ ole_mb2wc(char *pm, int len)
     int size = 0;
     LPWSTR pw;
-    HRESULT hr;
-    DWORD dw = 0;
-    int n = len;
 
-    if (cWIN32OLE_cp == 51932) {
-	load_conv_function51932();
-	size = 0;
-	hr = pIMultiLanguage->lpVtbl->ConvertStringToUnicode(pIMultiLanguage,
+    if (conv_51932(cWIN32OLE_cp)) {
+#ifndef pIMultiLanguage
+	DWORD dw = 0;
+	int n = len;
+	HRESULT hr = pIMultiLanguage->lpVtbl->ConvertStringToUnicode(pIMultiLanguage,
 		&dw, cWIN32OLE_cp, pm, &n, NULL, &size);
 	if (FAILED(hr)) {
@@ -1399,4 +1409,5 @@ ole_mb2wc(char *pm, int len)
             ole_raise(hr, eWIN32OLERuntimeError, "fail to convert CP%d to Unicode", cWIN32OLE_cp);
 	}
+#endif
 	return pw;
     }


-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread

Prev Next