ruby-changes:33560
From: nobu <ko1@a...>
Date: Sun, 20 Apr 2014 09:12:20 +0900 (JST)
Subject: [ruby-changes:33560] nobu:r45641 (trunk): win32ole.c: suppress warnings
nobu 2014-04-20 09:12:15 +0900 (Sun, 20 Apr 2014) New Revision: 45641 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45641 Log: win32ole.c: suppress warnings * ext/win32ole/win32ole.c: use LONG instead of long to suppress incompatible pointer warnings. Modified files: trunk/ext/win32ole/win32ole.c Index: ext/win32ole/win32ole.c =================================================================== --- ext/win32ole/win32ole.c (revision 45640) +++ ext/win32ole/win32ole.c (revision 45641) @@ -330,10 +330,10 @@ static void oleparam_free(struct olepara https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L330 static LPWSTR ole_vstr2wc(VALUE vstr); static LPWSTR ole_mb2wc(char *pm, int len); static VALUE ole_wc2vstr(LPWSTR pw, BOOL isfree); -static VALUE ole_ary_m_entry(VALUE val, long *pid); +static VALUE ole_ary_m_entry(VALUE val, LONG *pid); static void * get_ptr_of_variant(VARIANT *pvar); -static VALUE is_all_index_under(long *pid, long *pub, long dim); -static void ole_set_safe_array(long n, SAFEARRAY *psa, long *pid, long *pub, VALUE val, long dim, VARTYPE vt); +static VALUE is_all_index_under(LONG *pid, long *pub, long dim); +static void ole_set_safe_array(long n, SAFEARRAY *psa, LONG *pid, long *pub, VALUE val, long dim, VARTYPE vt); static long dimension(VALUE val); static long ary_len_of_dim(VALUE ary, long dim); static HRESULT ole_val_ary2variant_ary(VALUE val, VARIANT *var, VARTYPE vt); @@ -348,8 +348,8 @@ static VALUE default_inspect(VALUE self, https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L348 static VALUE ole_set_member(VALUE self, IDispatch *dispatch); static VALUE fole_s_allocate(VALUE klass); static VALUE create_win32ole_object(VALUE klass, IDispatch *pDispatch, int argc, VALUE *argv); -static VALUE ary_new_dim(VALUE myary, long *pid, long *plb, long dim); -static void ary_store_dim(VALUE myary, long *pid, long *plb, long dim, VALUE val); +static VALUE ary_new_dim(VALUE myary, LONG *pid, LONG *plb, LONG dim); +static void ary_store_dim(VALUE myary, LONG *pid, LONG *plb, LONG dim, VALUE val); static VALUE ole_variant2val(VARIANT *pvar); static LONG reg_open_key(HKEY hkey, const char *name, HKEY *phkey); static LONG reg_open_vkey(HKEY hkey, VALUE key, HKEY *phkey); @@ -586,7 +586,7 @@ static VALUE folevariant_s_allocate(VALU https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L586 static VALUE folevariant_s_array(VALUE klass, VALUE dims, VALUE vvt); static void check_type_val2variant(VALUE val); static VALUE folevariant_initialize(VALUE self, VALUE args); -static long *ary2safe_array_index(int ary_size, VALUE *ary, SAFEARRAY *psa); +static LONG *ary2safe_array_index(int ary_size, VALUE *ary, SAFEARRAY *psa); static void unlock_safe_array(SAFEARRAY *psa); static SAFEARRAY *get_locked_safe_array(VALUE val); static VALUE folevariant_ary_aref(int argc, VALUE *argv, VALUE self); @@ -1180,7 +1180,7 @@ ole_excepinfo2msg(EXCEPINFO *pExInfo) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L1180 pDescription = ole_wc2mb(pExInfo->bstrDescription); } if(pExInfo->wCode == 0) { - sprintf(error_code, "\n OLE error code:%lX in ", pExInfo->scode); + sprintf(error_code, "\n OLE error code:%X in ", pExInfo->scode); } else{ sprintf(error_code, "\n OLE error code:%u in ", pExInfo->wCode); @@ -1418,7 +1418,7 @@ ole_wc2vstr(LPWSTR pw, BOOL isfree) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L1418 } static VALUE -ole_ary_m_entry(VALUE val, long *pid) +ole_ary_m_entry(VALUE val, LONG *pid) { VALUE obj = Qnil; int i = 0; @@ -1500,7 +1500,7 @@ get_ptr_of_variant(VARIANT *pvar) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L1500 } static VALUE -is_all_index_under(long *pid, long *pub, long dim) +is_all_index_under(LONG *pid, long *pub, long dim) { long i = 0; for (i = 0; i < dim; i++) { @@ -1512,7 +1512,7 @@ is_all_index_under(long *pid, long *pub, https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L1512 } static void -ole_set_safe_array(long n, SAFEARRAY *psa, long *pid, long *pub, VALUE val, long dim, VARTYPE vt) +ole_set_safe_array(long n, SAFEARRAY *psa, LONG *pid, long *pub, VALUE val, long dim, VARTYPE vt) { VALUE val1; HRESULT hr = S_OK; @@ -1597,7 +1597,8 @@ ole_val_ary2variant_ary(VALUE val, VARIA https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L1597 SAFEARRAYBOUND *psab = NULL; SAFEARRAY *psa = NULL; - long *pub, *pid; + long *pub; + LONG *pid; Check_Type(val, T_ARRAY); @@ -1605,7 +1606,7 @@ ole_val_ary2variant_ary(VALUE val, VARIA https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L1606 psab = ALLOC_N(SAFEARRAYBOUND, dim); pub = ALLOC_N(long, dim); - pid = ALLOC_N(long, dim); + pid = ALLOC_N(LONG, dim); if(!psab || !pub || !pid) { if(pub) free(pub); @@ -2063,7 +2064,7 @@ create_win32ole_object(VALUE klass, IDis https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L2064 } static VALUE -ary_new_dim(VALUE myary, long *pid, long *plb, long dim) { +ary_new_dim(VALUE myary, LONG *pid, LONG *plb, LONG dim) { long i; VALUE obj = Qnil; VALUE pobj = Qnil; @@ -2089,7 +2090,7 @@ ary_new_dim(VALUE myary, long *pid, long https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L2090 } static void -ary_store_dim(VALUE myary, long *pid, long *plb, long dim, VALUE val) { +ary_store_dim(VALUE myary, LONG *pid, LONG *plb, LONG dim, VALUE val) { long id = pid[dim - 1] - plb[dim - 1]; VALUE obj = ary_new_dim(myary, pid, plb, dim); rb_ary_store(obj, id, val); @@ -2106,7 +2107,7 @@ ole_variant2val(VARIANT *pvar) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L2107 if(V_ISARRAY(pvar)) { SAFEARRAY *psa = V_ISBYREF(pvar) ? *V_ARRAYREF(pvar) : V_ARRAY(pvar); UINT i = 0; - long *pid, *plb, *pub; + LONG *pid, *plb, *pub; VARIANT variant; VALUE val; UINT dim = 0; @@ -2117,9 +2118,9 @@ ole_variant2val(VARIANT *pvar) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L2118 VariantInit(&variant); V_VT(&variant) = (V_VT(pvar) & ~VT_ARRAY) | VT_BYREF; - pid = ALLOC_N(long, dim); - plb = ALLOC_N(long, dim); - pub = ALLOC_N(long, dim); + pid = ALLOC_N(LONG, dim); + plb = ALLOC_N(LONG, dim); + pub = ALLOC_N(LONG, dim); if(!pid || !plb || !pub) { if(pid) free(pid); @@ -3111,7 +3112,7 @@ static BOOL https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L3112 lcid_installed(LCID lcid) { g_lcid_installed = FALSE; - snprintf(g_lcid_to_check, sizeof(g_lcid_to_check), "%08lx", lcid); + snprintf(g_lcid_to_check, sizeof(g_lcid_to_check), "%08x", lcid); EnumSystemLocales(installed_lcid_proc, LCID_INSTALLED); return g_lcid_installed; } @@ -8850,17 +8851,17 @@ get_locked_safe_array(VALUE val) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L8851 return psa; } -static long * +static LONG * ary2safe_array_index(int ary_size, VALUE *ary, SAFEARRAY *psa) { long dim; - long *pid; + LONG *pid; long i; dim = SafeArrayGetDim(psa); if (dim != ary_size) { rb_raise(rb_eArgError, "unmatch number of indices"); } - pid = ALLOC_N(long, dim); + pid = ALLOC_N(LONG, dim); if (pid == NULL) { rb_raise(rb_eRuntimeError, "failed to allocate memory for indices"); } @@ -8907,7 +8908,7 @@ folevariant_ary_aref(int argc, VALUE *ar https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L8908 SAFEARRAY *psa; VALUE val = Qnil; VARIANT variant; - long *pid; + LONG *pid; HRESULT hr; Data_Get_Struct(self, struct olevariantdata, pvar); @@ -8987,7 +8988,7 @@ folevariant_ary_aset(int argc, VALUE *ar https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L8988 SAFEARRAY *psa; VARIANT var; VARTYPE vt; - long *pid; + LONG *pid; HRESULT hr; VOID *p = NULL; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/