glib2 1.0.0-x86-mingw32 → 1.0.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -184,7 +184,7 @@ gobj_mark(gpointer ptr)
184
184
  guint n_properties;
185
185
  GParamSpec** properties;
186
186
  GValue gval = {0,};
187
- int i;
187
+ guint i;
188
188
 
189
189
  properties = g_object_class_list_properties(G_OBJECT_GET_CLASS(gobj), &n_properties);
190
190
 
@@ -292,7 +292,7 @@ gobj_new_body(struct param_setup_arg* arg)
292
292
  static VALUE
293
293
  gobj_new_ensure(struct param_setup_arg* arg)
294
294
  {
295
- int i;
295
+ guint i;
296
296
  g_type_class_unref(arg->gclass);
297
297
  for (i = 0; i < arg->param_size; i++) {
298
298
  if (G_IS_VALUE(&arg->params[i].value))
@@ -396,7 +396,7 @@ gobj_s_properties(int argc, VALUE* argv, VALUE self)
396
396
  GParamSpec** props;
397
397
  VALUE inherited_too;
398
398
  VALUE ary;
399
- int i;
399
+ guint i;
400
400
 
401
401
  if (rb_scan_args(argc, argv, "01", &inherited_too) == 0)
402
402
  inherited_too = Qtrue;
@@ -376,7 +376,8 @@ Init_gobject_gparam_spec()
376
376
 
377
377
  /**********************************************************************/
378
378
 
379
- void Init_gobject_gparam()
379
+ void
380
+ Init_gobject_gparam()
380
381
  {
381
382
  Init_gobject_gparam_spec();
382
383
  }
@@ -79,8 +79,7 @@ gobj_s_signal_new(int argc, VALUE* argv, VALUE self)
79
79
  VALUE signal_name, signal_flags, accumulator, return_type, params;
80
80
  GClosure* class_closure;
81
81
  GType* param_types;
82
- guint n_params;
83
- int i;
82
+ long i, n_params;
84
83
  guint sig;
85
84
 
86
85
  rb_scan_args(argc, argv, "4*", &signal_name, &signal_flags,
@@ -287,7 +286,7 @@ gobj_sig_get_invocation_hint(VALUE self)
287
286
  }
288
287
  #endif
289
288
 
290
- struct emit_arg{
289
+ struct emit_arg {
291
290
  VALUE self;
292
291
  VALUE args;
293
292
 
@@ -307,7 +306,7 @@ emit_body(struct emit_arg* arg)
307
306
  g_value_unset(&param);
308
307
 
309
308
  {
310
- int i;
309
+ guint i;
311
310
  for (i = 0; i < arg->query.n_params; i++){
312
311
  GType gtype = arg->query.param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE;
313
312
 
@@ -370,7 +369,7 @@ gobj_sig_emit(int argc, VALUE *argv, VALUE self)
370
369
 
371
370
  g_signal_query(signal_id, &arg.query);
372
371
 
373
- if (arg.query.n_params != RARRAY_LEN(arg.args))
372
+ if (arg.query.n_params != (guint)RARRAY_LEN(arg.args))
374
373
  rb_raise(rb_eArgError, "wrong number of arguments(%ld for %d)",
375
374
  RARRAY_LEN(arg.args) + 1,
376
375
  arg.query.n_params + 1);
@@ -484,7 +483,7 @@ chain_from_overridden_body(struct emit_arg* arg)
484
483
 
485
484
  {
486
485
  GValue* params = arg->instance_and_params->values + 1;
487
- int i;
486
+ guint i;
488
487
  for (i = 0; i < arg->query.n_params; i++) {
489
488
  GType gtype = arg->query.param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE;
490
489
  g_value_init(params + i, gtype);
@@ -526,7 +525,7 @@ gobj_sig_chain_from_overridden(int argc, VALUE *argv, VALUE self)
526
525
  g_signal_query(hint->signal_id, &arg.query);
527
526
  }
528
527
 
529
- if (arg.query.n_params != argc)
528
+ if (arg.query.n_params != (guint)argc)
530
529
  rb_raise(rb_eArgError, "wrong number of arguments(%d for %d)",
531
530
  argc, arg.query.n_params);
532
531
 
@@ -687,7 +686,7 @@ query_param_types(VALUE self)
687
686
  {
688
687
  GSignalQuery* query;
689
688
  VALUE result;
690
- int i;
689
+ guint i;
691
690
  Data_Get_Struct(self, GSignalQuery, query);
692
691
 
693
692
  result = rb_ary_new2(query->n_params);
@@ -866,7 +865,7 @@ rbgobj_define_action_methods(VALUE klass)
866
865
  GString* source;
867
866
  guint n_ids;
868
867
  guint* ids;
869
- int i;
868
+ guint i;
870
869
 
871
870
  if (gtype == G_TYPE_INTERFACE)
872
871
  return;
@@ -884,7 +883,7 @@ rbgobj_define_action_methods(VALUE klass)
884
883
  gchar* method_name = g_strdup(query.signal_name);
885
884
  gchar* p;
886
885
  GString* args;
887
- int j;
886
+ guint j;
888
887
 
889
888
  for (p = method_name; *p; p++)
890
889
  if (*p == '-')
@@ -14,48 +14,25 @@
14
14
  #if GLIB_CHECK_VERSION(2,6,0)
15
15
 
16
16
  static VALUE
17
- strv_to_ruby(const GValue* from)
17
+ strv_to_ruby(const GValue *from)
18
18
  {
19
- VALUE ary;
20
- const gchar** boxed = (const gchar**)g_value_get_boxed(from);
21
- if (!boxed)
22
- return Qnil;
23
-
24
- ary = rb_ary_new();
25
- while (*boxed){
26
- rb_ary_push(ary, CSTR2RVAL(*boxed));
27
- boxed++;
28
- }
29
- return ary;
19
+ return STRV2RVAL((const gchar **)g_value_get_boxed(from));
30
20
  }
31
21
 
32
22
  static void
33
- strv_from_ruby(VALUE from, GValue* to)
23
+ strv_from_ruby(VALUE from, GValue *to)
34
24
  {
35
- int i;
36
- gchar** gstrv;
37
-
38
- if (NIL_P(from)) {
39
- g_value_set_boxed(to, NULL);
40
- return;
41
- }
42
-
43
- Check_Type(from, T_ARRAY);
44
- gstrv = g_new(gchar*, RARRAY_LEN(from) + 1);
45
-
46
- for (i = 0; i < RARRAY_LEN(from); i++) {
47
- VALUE v = RARRAY_PTR(from)[i];
48
- gstrv[i] = g_strdup(StringValuePtr(v));
49
- }
50
- gstrv[RARRAY_LEN(from)] = NULL;
51
-
52
- g_value_set_boxed(to, gstrv);
25
+ const gchar **strings = RVAL2STRV(from);
26
+ g_value_set_boxed(to, strings);
27
+ g_free(strings);
53
28
  }
54
29
 
55
- void Init_gobject_gstrv()
30
+ void
31
+ Init_gobject_gstrv()
56
32
  {
57
33
  /* GStrv is treated as Array */
58
34
  rbgobj_register_g2r_func(G_TYPE_STRV, strv_to_ruby);
59
35
  rbgobj_register_r2g_func(G_TYPE_STRV, strv_from_ruby);
60
36
  }
37
+
61
38
  #endif
@@ -192,7 +192,7 @@ rbgobj_lookup_class_by_gtype_without_lock(GType gtype, VALUE parent,
192
192
  if (G_TYPE_IS_INSTANTIATABLE(gtype)){
193
193
  GType* interfaces = NULL;
194
194
  guint n_interfaces = 0;
195
- int i;
195
+ guint i;
196
196
 
197
197
  interfaces = g_type_interfaces(gtype, &n_interfaces);
198
198
  for (i = 0; i < n_interfaces; i++){
@@ -663,7 +663,7 @@ type_children(VALUE self)
663
663
  guint n_children;
664
664
  GType* types;
665
665
  VALUE result;
666
- int i;
666
+ guint i;
667
667
 
668
668
  types = g_type_children(rbgobj_gtype_get(self), &n_children);
669
669
  result = rb_ary_new2(n_children);
@@ -680,7 +680,7 @@ type_interfaces(VALUE self)
680
680
  guint n_interfaces;
681
681
  GType* types;
682
682
  VALUE result;
683
- int i;
683
+ guint i;
684
684
 
685
685
  types = g_type_interfaces(rbgobj_gtype_get(self), &n_interfaces);
686
686
  result = rb_ary_new2(n_interfaces);
@@ -708,8 +708,8 @@ type_instance_size(VALUE self)
708
708
  }
709
709
 
710
710
 
711
- static inline
712
- void _def_fundamental_type(VALUE ary, GType gtype, const char* name)
711
+ static inline void
712
+ _def_fundamental_type(VALUE ary, GType gtype, const char* name)
713
713
  {
714
714
  VALUE c = rbgobj_gtype_new(gtype);
715
715
  rb_define_const(rbgobj_cType, name, c);
@@ -798,7 +798,8 @@ Init_type()
798
798
 
799
799
  /**********************************************************************/
800
800
 
801
- void Init_gobject_gtype()
801
+ void
802
+ Init_gobject_gtype()
802
803
  {
803
804
  g_type_init();
804
805
  Init_typemap();
@@ -1,145 +1,145 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /**********************************************************************
3
-
4
- rbgobj_typeinterface.c -
5
-
6
- $Author: ggc $
7
- $Date: 2007/07/13 16:07:28 $
8
- created at: Sat May 27 16:04:13 JST 2006
9
-
10
- Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
11
- Copyright (C) 2002,2003 Masahiro Sakai
12
-
13
- **********************************************************************/
14
-
15
- #include "rbgprivate.h"
16
-
17
- VALUE rbgobj_mInterface;
18
- VALUE mMetaInterface;
19
-
20
- static VALUE
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /**********************************************************************
3
+
4
+ rbgobj_typeinterface.c -
5
+
6
+ $Author: ggc $
7
+ $Date: 2007/07/13 16:07:28 $
8
+ created at: Sat May 27 16:04:13 JST 2006
9
+
10
+ Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
11
+ Copyright (C) 2002,2003 Masahiro Sakai
12
+
13
+ **********************************************************************/
14
+
15
+ #include "rbgprivate.h"
16
+
17
+ VALUE rbgobj_mInterface;
18
+ VALUE mMetaInterface;
19
+
20
+ static VALUE
21
21
  interface_s_append_features(VALUE self, VALUE klass)
22
- {
23
- if (!rb_obj_is_kind_of(klass, cInstantiatable))
24
- rb_raise(rb_eTypeError, "Not a subclass of GLib::Instantiatable");
25
- return rb_call_super(1, &klass);
26
- }
27
-
28
- #if GLIB_CHECK_VERSION(2,4,0)
29
-
30
- static VALUE
22
+ {
23
+ if (!rb_obj_is_kind_of(klass, cInstantiatable))
24
+ rb_raise(rb_eTypeError, "Not a subclass of GLib::Instantiatable");
25
+ return rb_call_super(1, &klass);
26
+ }
27
+
28
+ #if GLIB_CHECK_VERSION(2,4,0)
29
+
30
+ static VALUE
31
31
  interface_s_install_property(VALUE self, VALUE pspec_obj)
32
- {
33
- const RGObjClassInfo* cinfo = rbgobj_lookup_class(self);
34
- gpointer ginterface;
35
- GParamSpec* pspec;
36
-
37
- if (cinfo->klass != self)
38
- rb_raise(rb_eTypeError, "%s isn't registered class", rb_class2name(self));
39
-
40
- pspec = G_PARAM_SPEC(RVAL2GOBJ(pspec_obj));
41
- ginterface = g_type_default_interface_ref(cinfo->gtype);
42
- g_object_interface_install_property(ginterface, pspec);
43
- g_type_default_interface_unref(ginterface);
44
-
45
- /* FIXME: define accessor methods */
46
- return Qnil;
47
- }
48
-
49
- static VALUE
32
+ {
33
+ const RGObjClassInfo* cinfo = rbgobj_lookup_class(self);
34
+ gpointer ginterface;
35
+ GParamSpec* pspec;
36
+
37
+ if (cinfo->klass != self)
38
+ rb_raise(rb_eTypeError, "%s isn't registered class", rb_class2name(self));
39
+
40
+ pspec = G_PARAM_SPEC(RVAL2GOBJ(pspec_obj));
41
+ ginterface = g_type_default_interface_ref(cinfo->gtype);
42
+ g_object_interface_install_property(ginterface, pspec);
43
+ g_type_default_interface_unref(ginterface);
44
+
45
+ /* FIXME: define accessor methods */
46
+ return Qnil;
47
+ }
48
+
49
+ static VALUE
50
50
  interface_s_property(VALUE self, VALUE property_name)
51
- {
52
- gpointer ginterface;
53
- const char* name;
54
- GParamSpec* prop;
55
- VALUE result;
56
- GType gtype = CLASS2GTYPE(self);
57
-
58
- if (SYMBOL_P(property_name))
59
- name = rb_id2name(SYM2ID(property_name));
60
- else
61
- name = StringValuePtr(property_name);
62
-
63
- if (!G_TYPE_IS_INTERFACE(gtype))
64
- rb_raise(rb_eTypeError, "%s isn't interface module", rb_class2name(self));
65
- /* XXX: g_type_default_interface_ref(G_TYPE_INTERFACE) causes SEGV. */
66
- if (gtype == G_TYPE_INTERFACE) {
67
- rb_raise(rb_const_get(mGLib, rb_intern("NoPropertyError")),
68
- "No such property: %s", name);
69
- }
70
-
71
- ginterface = g_type_default_interface_ref(gtype);
72
- prop = g_object_interface_find_property(ginterface, name);
73
- if (!prop){
74
- g_type_default_interface_unref(ginterface);
75
- rb_raise(rb_const_get(mGLib, rb_intern("NoPropertyError")),
76
- "No such property: %s", name);
77
- }
78
- result = GOBJ2RVAL(prop);
79
- g_type_default_interface_unref(ginterface);
80
-
81
- return result;
82
- }
83
-
84
- static VALUE
85
- interface_s_properties(int argc, VALUE* argv, VALUE self)
86
- {
87
- guint n_properties;
88
- GParamSpec** props;
89
- VALUE inherited_too;
90
- VALUE ary = rb_ary_new();
91
- int i;
92
- gpointer ginterface;
93
- GType gtype = CLASS2GTYPE(self);
94
-
95
- if (rb_scan_args(argc, argv, "01", &inherited_too) == 0)
96
- inherited_too = Qtrue;
97
-
98
- if (!G_TYPE_IS_INTERFACE(gtype))
99
- rb_raise(rb_eTypeError, "%s isn't interface module", rb_class2name(self));
100
- /* XXX: g_type_default_interface_ref(G_TYPE_INTERFACE) causes SEGV. */
101
- if (gtype == G_TYPE_INTERFACE) return ary;
102
-
103
- ginterface = g_type_default_interface_ref(gtype);
104
- props = g_object_interface_list_properties(ginterface, &n_properties);
105
- for (i = 0; i < n_properties; i++){
106
- if (RVAL2CBOOL(inherited_too) || GTYPE2CLASS(props[i]->owner_type) == self)
107
- rb_ary_push(ary, rb_str_new2(props[i]->name));
108
- }
109
- g_free(props);
110
- g_type_default_interface_unref(ginterface);
111
-
112
- return ary;
113
- }
114
-
115
- #endif
116
-
117
- void
118
- rbgobj_init_interface(VALUE interf)
119
- {
120
- static VALUE rb_mGLibInterface = Qnil;
121
-
122
- rb_extend_object(interf, mMetaInterface);
123
- if (CLASS2GTYPE(interf) == G_TYPE_INTERFACE) {
124
- rb_mGLibInterface = interf;
125
- } else {
126
- rb_extend_object(interf, rb_mGLibInterface);
127
- rb_include_module(interf, rb_mGLibInterface);
128
- rbgobj_define_property_accessors(interf);
129
- }
130
- }
131
-
132
- void
133
- Init_gobject_typeinterface()
134
- {
135
- mMetaInterface = rb_define_module_under(mGLib, "MetaInterface");
136
- rb_define_method(mMetaInterface, "gtype", generic_s_gtype, 0);
137
- rb_define_method(mMetaInterface, "append_features", interface_s_append_features, 1);
138
- #if GLIB_CHECK_VERSION(2,4,0)
139
- rb_define_method(mMetaInterface, "install_property", interface_s_install_property, 1);
140
- rb_define_method(mMetaInterface, "property", interface_s_property, 1);
141
- rb_define_method(mMetaInterface, "properties", interface_s_properties, -1);
142
- #endif
143
-
144
- rbgobj_mInterface = G_DEF_INTERFACE(G_TYPE_INTERFACE, "Interface", mGLib);
145
- }
51
+ {
52
+ gpointer ginterface;
53
+ const char* name;
54
+ GParamSpec* prop;
55
+ VALUE result;
56
+ GType gtype = CLASS2GTYPE(self);
57
+
58
+ if (SYMBOL_P(property_name))
59
+ name = rb_id2name(SYM2ID(property_name));
60
+ else
61
+ name = StringValuePtr(property_name);
62
+
63
+ if (!G_TYPE_IS_INTERFACE(gtype))
64
+ rb_raise(rb_eTypeError, "%s isn't interface module", rb_class2name(self));
65
+ /* XXX: g_type_default_interface_ref(G_TYPE_INTERFACE) causes SEGV. */
66
+ if (gtype == G_TYPE_INTERFACE) {
67
+ rb_raise(rb_const_get(mGLib, rb_intern("NoPropertyError")),
68
+ "No such property: %s", name);
69
+ }
70
+
71
+ ginterface = g_type_default_interface_ref(gtype);
72
+ prop = g_object_interface_find_property(ginterface, name);
73
+ if (!prop){
74
+ g_type_default_interface_unref(ginterface);
75
+ rb_raise(rb_const_get(mGLib, rb_intern("NoPropertyError")),
76
+ "No such property: %s", name);
77
+ }
78
+ result = GOBJ2RVAL(prop);
79
+ g_type_default_interface_unref(ginterface);
80
+
81
+ return result;
82
+ }
83
+
84
+ static VALUE
85
+ interface_s_properties(int argc, VALUE* argv, VALUE self)
86
+ {
87
+ guint n_properties;
88
+ GParamSpec** props;
89
+ VALUE inherited_too;
90
+ VALUE ary = rb_ary_new();
91
+ guint i;
92
+ gpointer ginterface;
93
+ GType gtype = CLASS2GTYPE(self);
94
+
95
+ if (rb_scan_args(argc, argv, "01", &inherited_too) == 0)
96
+ inherited_too = Qtrue;
97
+
98
+ if (!G_TYPE_IS_INTERFACE(gtype))
99
+ rb_raise(rb_eTypeError, "%s isn't interface module", rb_class2name(self));
100
+ /* XXX: g_type_default_interface_ref(G_TYPE_INTERFACE) causes SEGV. */
101
+ if (gtype == G_TYPE_INTERFACE) return ary;
102
+
103
+ ginterface = g_type_default_interface_ref(gtype);
104
+ props = g_object_interface_list_properties(ginterface, &n_properties);
105
+ for (i = 0; i < n_properties; i++){
106
+ if (RVAL2CBOOL(inherited_too) || GTYPE2CLASS(props[i]->owner_type) == self)
107
+ rb_ary_push(ary, rb_str_new2(props[i]->name));
108
+ }
109
+ g_free(props);
110
+ g_type_default_interface_unref(ginterface);
111
+
112
+ return ary;
113
+ }
114
+
115
+ #endif
116
+
117
+ void
118
+ rbgobj_init_interface(VALUE interf)
119
+ {
120
+ static VALUE rb_mGLibInterface = Qnil;
121
+
122
+ rb_extend_object(interf, mMetaInterface);
123
+ if (CLASS2GTYPE(interf) == G_TYPE_INTERFACE) {
124
+ rb_mGLibInterface = interf;
125
+ } else {
126
+ rb_extend_object(interf, rb_mGLibInterface);
127
+ rb_include_module(interf, rb_mGLibInterface);
128
+ rbgobj_define_property_accessors(interf);
129
+ }
130
+ }
131
+
132
+ void
133
+ Init_gobject_typeinterface()
134
+ {
135
+ mMetaInterface = rb_define_module_under(mGLib, "MetaInterface");
136
+ rb_define_method(mMetaInterface, "gtype", generic_s_gtype, 0);
137
+ rb_define_method(mMetaInterface, "append_features", interface_s_append_features, 1);
138
+ #if GLIB_CHECK_VERSION(2,4,0)
139
+ rb_define_method(mMetaInterface, "install_property", interface_s_install_property, 1);
140
+ rb_define_method(mMetaInterface, "property", interface_s_property, 1);
141
+ rb_define_method(mMetaInterface, "properties", interface_s_properties, -1);
142
+ #endif
143
+
144
+ rbgobj_mInterface = G_DEF_INTERFACE(G_TYPE_INTERFACE, "Interface", mGLib);
145
+ }