glib2 0.90.7-x86-mingw32 → 0.90.8-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. data/ChangeLog +68 -0
  2. data/ext/glib2/rbglib.c +51 -15
  3. data/ext/glib2/rbglib.h +10 -2
  4. data/ext/glib2/rbglib_bookmarkfile.c +37 -74
  5. data/ext/glib2/rbglib_completion.c +8 -16
  6. data/ext/glib2/rbglib_convert.c +8 -18
  7. data/ext/glib2/rbglib_error.c +2 -8
  8. data/ext/glib2/rbglib_i18n.c +1 -2
  9. data/ext/glib2/rbglib_iochannel.c +81 -127
  10. data/ext/glib2/rbglib_keyfile.c +38 -86
  11. data/ext/glib2/rbglib_maincontext.c +29 -64
  12. data/ext/glib2/rbglib_mainloop.c +4 -8
  13. data/ext/glib2/rbglib_messages.c +7 -17
  14. data/ext/glib2/rbglib_pollfd.c +7 -14
  15. data/ext/glib2/rbglib_shell.c +3 -6
  16. data/ext/glib2/rbglib_source.c +14 -28
  17. data/ext/glib2/rbglib_spawn.c +7 -14
  18. data/ext/glib2/rbglib_threads.c +2 -4
  19. data/ext/glib2/rbglib_timer.c +7 -14
  20. data/ext/glib2/rbglib_unicode.c +45 -16
  21. data/ext/glib2/rbglib_utils.c +25 -50
  22. data/ext/glib2/rbglib_win32.c +10 -17
  23. data/ext/glib2/rbgobj_boxed.c +9 -21
  24. data/ext/glib2/rbgobj_closure.c +5 -11
  25. data/ext/glib2/rbgobj_enums.c +1 -2
  26. data/ext/glib2/rbgobj_object.c +23 -59
  27. data/ext/glib2/rbgobj_param.c +7 -15
  28. data/ext/glib2/rbgobj_signal.c +25 -65
  29. data/ext/glib2/rbgobj_type.c +36 -81
  30. data/ext/glib2/rbgobj_typeinstance.c +3 -6
  31. data/ext/glib2/rbgobj_typeinterface.c +3 -6
  32. data/ext/glib2/rbgobj_typemodule.c +4 -8
  33. data/ext/glib2/rbgobj_typeplugin.c +2 -4
  34. data/ext/glib2/rbgobj_valuetypes.c +7 -15
  35. data/ext/glib2/rbgobject.c +8 -18
  36. data/ext/glib2/rbgobject.h +3 -0
  37. data/ext/glib2/rbgprivate.h +0 -1
  38. data/ext/glib2/rbgutil.c +3 -6
  39. data/lib/1.8/glib2.so +0 -0
  40. data/lib/1.9/glib2.so +0 -0
  41. data/lib/gnome2-raketask.rb +1 -0
  42. data/lib/mkmf-gnome2.rb +12 -9
  43. data/test-unit/History.txt +43 -1
  44. data/test-unit/Manifest.txt +1 -1
  45. data/test-unit/html/index.html +62 -24
  46. data/test-unit/html/index.html.ja +54 -25
  47. data/test-unit/html/test-unit.css +3 -3
  48. data/test-unit/lib/test/unit/assertions.rb +489 -36
  49. data/test-unit/lib/test/unit/autorunner.rb +40 -0
  50. data/test-unit/lib/test/unit/collector.rb +6 -4
  51. data/test-unit/lib/test/unit/collector/load.rb +48 -5
  52. data/test-unit/lib/test/unit/collector/xml.rb +250 -0
  53. data/test-unit/lib/test/unit/error.rb +4 -3
  54. data/test-unit/lib/test/unit/fixture.rb +12 -3
  55. data/test-unit/lib/test/unit/runner/xml.rb +15 -0
  56. data/test-unit/lib/test/unit/testcase.rb +48 -16
  57. data/test-unit/lib/test/unit/testresult.rb +6 -2
  58. data/test-unit/lib/test/unit/testsuite.rb +24 -2
  59. data/test-unit/lib/test/unit/ui/console/testrunner.rb +65 -28
  60. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +11 -2
  61. data/test-unit/lib/test/unit/ui/xml/testrunner.rb +224 -0
  62. data/test-unit/lib/test/unit/version.rb +1 -1
  63. data/test-unit/test/run-test.rb +7 -0
  64. data/test-unit/test/{test_assertions.rb → test-assertions.rb} +708 -77
  65. data/test-unit/test/test-fixture.rb +37 -0
  66. data/test-unit/test/test-testcase.rb +24 -7
  67. data/test-unit/test/test_testsuite.rb +19 -11
  68. data/test/test_iochannel.rb +9 -9
  69. data/test/test_unicode.rb +44 -31
  70. metadata +8 -5
@@ -19,8 +19,7 @@ static ID id_items_internal;
19
19
 
20
20
  /*****************************************/
21
21
  static GCompletion*
22
- completion_copy(comp)
23
- GCompletion* comp;
22
+ completion_copy(GCompletion *comp)
24
23
  {
25
24
  GCompletion* new_comp;
26
25
  g_return_val_if_fail (comp != NULL, NULL);
@@ -48,8 +47,7 @@ g_completion_get_type(void)
48
47
 
49
48
  /* data should be [self, data] */
50
49
  static gchar*
51
- comp_func(compdata)
52
- gpointer compdata;
50
+ comp_func(gpointer compdata)
53
51
  {
54
52
  VALUE ret;
55
53
  VALUE self = RARRAY_PTR((VALUE)compdata)[0];
@@ -66,8 +64,7 @@ comp_func(compdata)
66
64
  }
67
65
 
68
66
  static VALUE
69
- comp_initialize(self)
70
- VALUE self;
67
+ comp_initialize(VALUE self)
71
68
  {
72
69
  VALUE block = Qnil;
73
70
 
@@ -85,8 +82,7 @@ comp_initialize(self)
85
82
  }
86
83
 
87
84
  static VALUE
88
- comp_add_items(self, items)
89
- VALUE self, items;
85
+ comp_add_items(VALUE self, VALUE items)
90
86
  {
91
87
  gint i, len;
92
88
  GList* list = (GList*)NULL;
@@ -106,8 +102,7 @@ comp_add_items(self, items)
106
102
  }
107
103
 
108
104
  static VALUE
109
- comp_remove_items(self, items)
110
- VALUE self, items;
105
+ comp_remove_items(VALUE self, VALUE items)
111
106
  {
112
107
  gint i, len;
113
108
  GList* list = (GList*)NULL;
@@ -127,8 +122,7 @@ comp_remove_items(self, items)
127
122
  }
128
123
 
129
124
  static VALUE
130
- comp_clear_items(self)
131
- VALUE self;
125
+ comp_clear_items(VALUE self)
132
126
  {
133
127
  VALUE items_internal = rb_ivar_get(self, id_items_internal);
134
128
  rb_funcall(items_internal, id_clear, 0);
@@ -137,15 +131,13 @@ comp_clear_items(self)
137
131
  }
138
132
 
139
133
  static VALUE
140
- comp_items(self)
141
- VALUE self;
134
+ comp_items(VALUE self)
142
135
  {
143
136
  return rb_ivar_get(self, id_items_internal);
144
137
  }
145
138
 
146
139
  static VALUE
147
- comp_complete(self, prefix)
148
- VALUE self, prefix;
140
+ comp_complete(VALUE self, VALUE prefix)
149
141
  {
150
142
  gchar* new_prefix;
151
143
  VALUE ary = rb_ary_new();
@@ -14,8 +14,7 @@
14
14
  #include "rbglib.h"
15
15
 
16
16
  static VALUE
17
- rbglib_m_convert(self, str, to, from)
18
- VALUE self, str, to, from;
17
+ rbglib_m_convert(VALUE self, VALUE str, VALUE to, VALUE from)
19
18
  {
20
19
  GError *err = NULL;
21
20
  gchar* ret;
@@ -35,8 +34,7 @@ rbglib_m_convert(self, str, to, from)
35
34
  }
36
35
 
37
36
  static VALUE
38
- rbglib_m_locale_to_utf8(self, str)
39
- VALUE self, str;
37
+ rbglib_m_locale_to_utf8(VALUE self, VALUE str)
40
38
  {
41
39
  GError *err = NULL;
42
40
  VALUE s = Qnil;
@@ -55,8 +53,7 @@ rbglib_m_locale_to_utf8(self, str)
55
53
  }
56
54
 
57
55
  static VALUE
58
- rbglib_m_locale_from_utf8(self, str)
59
- VALUE self, str;
56
+ rbglib_m_locale_from_utf8(VALUE self, VALUE str)
60
57
  {
61
58
  GError *err = NULL;
62
59
  VALUE s = Qnil;
@@ -75,8 +72,7 @@ rbglib_m_locale_from_utf8(self, str)
75
72
  }
76
73
 
77
74
  static VALUE
78
- rbglib_m_filename_to_utf8(self, str)
79
- VALUE self, str;
75
+ rbglib_m_filename_to_utf8(VALUE self, VALUE str)
80
76
  {
81
77
  GError *err = NULL;
82
78
  VALUE s = Qnil;
@@ -95,8 +91,7 @@ rbglib_m_filename_to_utf8(self, str)
95
91
  }
96
92
 
97
93
  static VALUE
98
- rbglib_m_filename_from_utf8(self, str)
99
- VALUE self, str;
94
+ rbglib_m_filename_from_utf8(VALUE self, VALUE str)
100
95
  {
101
96
  GError *err = NULL;
102
97
  VALUE s = Qnil;
@@ -115,10 +110,7 @@ rbglib_m_filename_from_utf8(self, str)
115
110
  }
116
111
 
117
112
  static VALUE
118
- rbglib_m_filename_to_uri(argc, argv, self)
119
- int argc;
120
- VALUE *argv;
121
- VALUE self;
113
+ rbglib_m_filename_to_uri(int argc, VALUE *argv, VALUE self)
122
114
  {
123
115
  VALUE filename, hostname, s;
124
116
  GError *err = NULL;
@@ -138,8 +130,7 @@ rbglib_m_filename_to_uri(argc, argv, self)
138
130
  }
139
131
 
140
132
  static VALUE
141
- rbglib_m_filename_from_uri(self, str)
142
- VALUE self, str;
133
+ rbglib_m_filename_from_uri(VALUE self, VALUE str)
143
134
  {
144
135
  GError *err = NULL;
145
136
  VALUE s;
@@ -158,8 +149,7 @@ rbglib_m_filename_from_uri(self, str)
158
149
  }
159
150
 
160
151
  static VALUE
161
- rbglib_m_utf8_validate(self, str)
162
- VALUE self, str;
152
+ rbglib_m_utf8_validate(VALUE self, VALUE str)
163
153
  {
164
154
  rb_warning("GLib.utf8_validate is deprecated. Use GLib::UTF8.validate instead.");
165
155
  StringValue(str);
@@ -18,8 +18,7 @@ static VALUE gerror_table;
18
18
  static VALUE generic_error;
19
19
 
20
20
  VALUE
21
- rbgerr_gerror2exception(error)
22
- GError *error;
21
+ rbgerr_gerror2exception(GError *error)
23
22
  {
24
23
  VALUE exc = Qnil;
25
24
  VALUE klass = Qnil;
@@ -43,12 +42,7 @@ rbgerr_gerror2exception(error)
43
42
  }
44
43
 
45
44
  VALUE
46
- rbgerr_define_gerror(domain, name, module, parent, gtype)
47
- GQuark domain;
48
- const gchar* name;
49
- VALUE module;
50
- VALUE parent;
51
- VALUE gtype;
45
+ rbgerr_define_gerror(GQuark domain, const gchar *name, VALUE module, VALUE parent, VALUE gtype)
52
46
  {
53
47
  VALUE klass = rb_define_class_under(module, name, parent);
54
48
  rb_funcall(klass, rbgutil_id_module_eval, 1, CSTR2RVAL("def code; @code; end\n"));
@@ -17,8 +17,7 @@
17
17
 
18
18
  #if GLIB_CHECK_VERSION(2,6,0)
19
19
  static VALUE
20
- rbglib_m_language_names(self)
21
- VALUE self;
20
+ rbglib_m_language_names(VALUE self)
22
21
  {
23
22
  const gchar * const *languages;
24
23
  const gchar *language;
@@ -16,9 +16,7 @@ static ID id_call;
16
16
  #define _SELF(s) ((GIOChannel*)RVAL2BOXED(s, G_TYPE_IO_CHANNEL))
17
17
 
18
18
  static void
19
- ioc_error(status, err)
20
- GIOStatus status;
21
- GError* err;
19
+ ioc_error(GIOStatus status, GError *err)
22
20
  {
23
21
  if (err != NULL) RAISE_GERROR(err);
24
22
 
@@ -34,10 +32,7 @@ ioc_error(status, err)
34
32
  }
35
33
 
36
34
  static VALUE
37
- ioc_initialize(argc, argv, self)
38
- gint argc;
39
- VALUE* argv;
40
- VALUE self;
35
+ ioc_initialize(gint argc, VALUE *argv, VALUE self)
41
36
  {
42
37
  VALUE arg1, arg2;
43
38
 
@@ -69,8 +64,7 @@ ioc_initialize(argc, argv, self)
69
64
  }
70
65
 
71
66
  static VALUE
72
- ioc_close(self)
73
- VALUE self;
67
+ ioc_close(VALUE self)
74
68
  {
75
69
  GError* err = NULL;
76
70
  GIOStatus status = g_io_channel_shutdown(_SELF(self), TRUE, &err);
@@ -80,10 +74,7 @@ ioc_close(self)
80
74
  }
81
75
 
82
76
  static VALUE
83
- ioc_s_open(argc, argv, self)
84
- gint argc;
85
- VALUE* argv;
86
- VALUE self;
77
+ ioc_s_open(gint argc, VALUE *argv, VALUE self)
87
78
  {
88
79
  VALUE arg1, arg2;
89
80
  VALUE rio;
@@ -114,8 +105,7 @@ ioc_s_open(argc, argv, self)
114
105
  }
115
106
 
116
107
  static VALUE
117
- ioc_get_fd(self)
118
- VALUE self;
108
+ ioc_get_fd(VALUE self)
119
109
  {
120
110
  #ifdef G_OS_UNIX
121
111
  return INT2NUM(g_io_channel_unix_get_fd(_SELF(self)));
@@ -131,50 +121,56 @@ void g_io_channel_init (GIOChannel *channel);
131
121
 
132
122
 
133
123
  static VALUE
134
- ioc_read_chars(argc, argv, self)
135
- gint argc;
136
- VALUE* argv;
137
- VALUE self;
124
+ ioc_read_chars(gint argc, VALUE *argv, VALUE self)
138
125
  {
139
126
  VALUE count, ret;
140
127
  gchar* buf;
141
128
  gsize bytes_read;
142
129
  GError* err = NULL;
143
130
  GIOStatus status;
131
+ GIOChannel *channel;
144
132
 
145
133
  rb_scan_args(argc, argv, "01", &count);
146
134
 
147
- if (NIL_P(count)){
135
+ channel = _SELF(self);
136
+ if (NIL_P(count)) {
148
137
  gsize length;
149
- status = g_io_channel_read_to_end(_SELF(self), &buf,
150
- &length, &err);
151
138
 
152
- if (status == G_IO_STATUS_EOF){
139
+ status = g_io_channel_read_to_end(channel, &buf, &length, &err);
140
+
141
+ if (status == G_IO_STATUS_EOF) {
153
142
  ret = CSTR2RVAL("");
154
143
  } else {
155
144
  ioc_error(status, err);
156
145
  }
157
- ret = buf ? rb_str_new(buf, length) : CSTR2RVAL("");
158
- g_free(buf);
146
+ if (buf) {
147
+ ret = CSTR2RVAL_LEN(buf, length);
148
+ g_free(buf);
149
+ } else {
150
+ ret = CSTR2RVAL("");
151
+ }
159
152
  } else {
160
153
  buf = ALLOCA_N(gchar, count);
161
154
  memset(buf, '\0', count);
162
-
163
- status = g_io_channel_read_chars(_SELF(self), buf, NUM2UINT(count),
155
+
156
+ status = g_io_channel_read_chars(channel, buf, NUM2UINT(count),
164
157
  &bytes_read, &err);
165
- if (status == G_IO_STATUS_EOF){
158
+ if (status == G_IO_STATUS_EOF) {
166
159
  ret = CSTR2RVAL("");
167
160
  } else {
168
161
  ioc_error(status, err);
169
162
  }
170
- ret = buf ? CSTR2RVAL(buf) : CSTR2RVAL("");
163
+ if (buf) {
164
+ ret = CSTR2RVAL_LEN(buf, bytes_read);
165
+ } else {
166
+ ret = CSTR2RVAL("");
167
+ }
171
168
  }
172
169
  return ret;
173
170
  }
174
171
 
175
172
  static VALUE
176
- ioc_read_unichar(self)
177
- VALUE self;
173
+ ioc_read_unichar(VALUE self)
178
174
  {
179
175
  gunichar thechar;
180
176
  GError* err = NULL;
@@ -186,8 +182,7 @@ ioc_read_unichar(self)
186
182
  }
187
183
 
188
184
  static VALUE
189
- ioc_getuc(self)
190
- VALUE self;
185
+ ioc_getuc(VALUE self)
191
186
  {
192
187
  gunichar thechar;
193
188
  GError* err = NULL;
@@ -205,8 +200,7 @@ ioc_getuc(self)
205
200
  }
206
201
 
207
202
  static VALUE
208
- ioc_each_char(self)
209
- VALUE self;
203
+ ioc_each_char(VALUE self)
210
204
  {
211
205
  if (!rb_block_given_p()) {
212
206
  rb_raise(rb_eArgError, "called without a block");
@@ -227,10 +221,7 @@ ioc_each_char(self)
227
221
  }
228
222
 
229
223
  static VALUE
230
- ioc_read_line(argc, argv, self)
231
- gint argc;
232
- VALUE* argv;
233
- VALUE self;
224
+ ioc_read_line(gint argc, VALUE *argv, VALUE self)
234
225
  {
235
226
  gchar* str;
236
227
  VALUE line_term, ret;
@@ -265,10 +256,7 @@ ioc_read_line(argc, argv, self)
265
256
  }
266
257
 
267
258
  static VALUE
268
- ioc_gets(argc, argv, self)
269
- gint argc;
270
- VALUE* argv;
271
- VALUE self;
259
+ ioc_gets(gint argc, VALUE *argv, VALUE self)
272
260
  {
273
261
  gchar* str;
274
262
  VALUE line_term, ret;
@@ -307,8 +295,7 @@ ioc_gets(argc, argv, self)
307
295
 
308
296
  /* Internal use only */
309
297
  static VALUE
310
- ioc_set_line_term(args)
311
- VALUE args;
298
+ ioc_set_line_term(VALUE args)
312
299
  {
313
300
  VALUE self = RARRAY_PTR(args)[0];
314
301
  VALUE doit = RARRAY_PTR(args)[1];
@@ -323,16 +310,13 @@ ioc_set_line_term(args)
323
310
  }
324
311
 
325
312
  static VALUE
326
- ioc_each_line(argc, argv, self)
327
- gint argc;
328
- VALUE* argv;
329
- VALUE self;
313
+ ioc_each_line(gint argc, VALUE *argv, VALUE self)
330
314
  {
331
315
  gchar* str;
332
316
  VALUE line_term;
333
317
  GIOStatus status;
334
318
  GError* err = NULL;
335
-
319
+ GIOChannel *channel;
336
320
  const gchar* old_line_term = NULL;
337
321
  gint old_line_term_len;
338
322
 
@@ -342,27 +326,32 @@ ioc_each_line(argc, argv, self)
342
326
 
343
327
  rb_scan_args(argc, argv, "01", &line_term);
344
328
 
345
- if (! NIL_P(line_term)){
329
+ channel = _SELF(self);
330
+ if (!NIL_P(line_term)) {
346
331
  StringValue(line_term);
347
332
 
348
- old_line_term = g_io_channel_get_line_term(_SELF(self), &old_line_term_len);
349
- g_io_channel_set_line_term(_SELF(self), RVAL2CSTR(line_term),
333
+ old_line_term = g_io_channel_get_line_term(channel, &old_line_term_len);
334
+ g_io_channel_set_line_term(channel, RVAL2CSTR(line_term),
350
335
  RSTRING_LEN(line_term));
351
336
  }
352
337
 
353
- while (TRUE){
354
- status = g_io_channel_read_line(_SELF(self), &str, NULL, NULL, &err);
355
- if (status == G_IO_STATUS_EOF){
338
+ while (TRUE) {
339
+ status = g_io_channel_read_line(channel, &str, NULL, NULL, &err);
340
+ if (status == G_IO_STATUS_EOF) {
356
341
  break;
357
342
  } else {
358
343
  VALUE rstr;
359
344
  ioc_error(status, err);
360
- rstr = str ? CSTR2RVAL(str) : CSTR2RVAL("");
345
+ if (str) {
346
+ rstr = CSTR2RVAL(str);
347
+ } else {
348
+ rstr = CSTR2RVAL("");
349
+ }
361
350
  g_free(str);
362
- rb_ensure(rb_yield, rstr, ioc_set_line_term,
363
- rb_ary_new3(3, self,
351
+ rb_ensure(rb_yield, rstr, ioc_set_line_term,
352
+ rb_ary_new3(3, self,
364
353
  NIL_P(line_term) ? Qfalse : Qtrue,
365
- old_line_term ? rb_str_new(old_line_term, old_line_term_len) : Qnil));
354
+ CSTR2RVAL(old_line_term)));
366
355
  }
367
356
  }
368
357
  return self;
@@ -378,8 +367,7 @@ GIOStatus g_io_channel_read_line_string (GIOChannel *channel,
378
367
 
379
368
  /* Use GLib::IOChannel#read instead.
380
369
  static VALUE
381
- ioc_read_to_end(self)
382
- VALUE self;
370
+ ioc_read_to_end(VALUE self)
383
371
  {
384
372
  gchar* str;
385
373
  gsize length;
@@ -399,8 +387,7 @@ ioc_read_to_end(self)
399
387
  */
400
388
 
401
389
  static VALUE
402
- ioc_write_chars(self, buf)
403
- VALUE self, buf;
390
+ ioc_write_chars(VALUE self, VALUE buf)
404
391
  {
405
392
  gssize count;
406
393
  gsize bytes_written;
@@ -423,8 +410,7 @@ ioc_write_chars(self, buf)
423
410
  static ID id_unpack;
424
411
 
425
412
  static VALUE
426
- ioc_write_unichar(self, thechar)
427
- VALUE self, thechar;
413
+ ioc_write_unichar(VALUE self, VALUE thechar)
428
414
  {
429
415
  GError* err = NULL;
430
416
  GIOStatus status;
@@ -446,8 +432,7 @@ ioc_write_unichar(self, thechar)
446
432
  }
447
433
 
448
434
  static VALUE
449
- ioc_flush(self)
450
- VALUE self;
435
+ ioc_flush(VALUE self)
451
436
  {
452
437
  GError* err = NULL;
453
438
  GIOStatus status = g_io_channel_flush(_SELF(self), &err);
@@ -456,10 +441,7 @@ ioc_flush(self)
456
441
  }
457
442
 
458
443
  static VALUE
459
- ioc_seek(argc, argv, self)
460
- gint argc;
461
- VALUE* argv;
462
- VALUE self;
444
+ ioc_seek(gint argc, VALUE *argv, VALUE self)
463
445
  {
464
446
  VALUE ofs, type;
465
447
  GIOStatus status;
@@ -478,8 +460,7 @@ ioc_seek(argc, argv, self)
478
460
  }
479
461
 
480
462
  static VALUE
481
- ioc_seek_pos(self, pos)
482
- VALUE self, pos;
463
+ ioc_seek_pos(VALUE self, VALUE pos)
483
464
  {
484
465
  GError* err = NULL;
485
466
  GIOStatus status = g_io_channel_seek_position(_SELF(self), NUM2INT(pos),
@@ -489,10 +470,7 @@ ioc_seek_pos(self, pos)
489
470
  }
490
471
 
491
472
  static VALUE
492
- ioc_shutdown(argc, argv, self)
493
- gint argc;
494
- VALUE* argv;
495
- VALUE self;
473
+ ioc_shutdown(gint argc, VALUE *argv, VALUE self)
496
474
  {
497
475
  VALUE flush;
498
476
  GError* err = NULL;
@@ -512,18 +490,14 @@ ioc_shutdown(argc, argv, self)
512
490
  }
513
491
 
514
492
  static VALUE
515
- ioc_create_watch(self, condition)
516
- VALUE self, condition;
493
+ ioc_create_watch(VALUE self, VALUE condition)
517
494
  {
518
495
  return BOXED2RVAL(g_io_create_watch(_SELF(self), NUM2INT(condition)),
519
496
  G_TYPE_SOURCE);
520
497
  }
521
498
 
522
499
  static gboolean
523
- io_func(source, condition, func)
524
- GIOChannel* source;
525
- GIOCondition condition;
526
- gpointer func;
500
+ io_func(GIOChannel *source, GIOCondition condition, gpointer func)
527
501
  {
528
502
  return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 2,
529
503
  BOXED2RVAL(source, G_TYPE_IO_CHANNEL),
@@ -531,8 +505,7 @@ io_func(source, condition, func)
531
505
  }
532
506
 
533
507
  static VALUE
534
- ioc_add_watch(self, condition)
535
- VALUE self, condition;
508
+ ioc_add_watch(VALUE self, VALUE condition)
536
509
  {
537
510
  VALUE func = rb_block_proc();
538
511
  G_RELATIVE(self, func);
@@ -550,37 +523,32 @@ guint g_io_add_watch_full (GIOChannel *channel,
550
523
  */
551
524
 
552
525
  static VALUE
553
- ioc_get_buffer_size(self)
554
- VALUE self;
526
+ ioc_get_buffer_size(VALUE self)
555
527
  {
556
528
  return UINT2NUM(g_io_channel_get_buffer_size(_SELF(self)));
557
529
  }
558
530
 
559
531
  static VALUE
560
- ioc_set_buffer_size(self, buffer_size)
561
- VALUE self, buffer_size;
532
+ ioc_set_buffer_size(VALUE self, VALUE buffer_size)
562
533
  {
563
534
  g_io_channel_set_buffer_size(_SELF(self), NUM2UINT(buffer_size));
564
535
  return self;
565
536
  }
566
537
 
567
538
  static VALUE
568
- ioc_get_buffer_condition(self)
569
- VALUE self;
539
+ ioc_get_buffer_condition(VALUE self)
570
540
  {
571
541
  return INT2NUM(g_io_channel_get_buffer_condition(_SELF(self)));
572
542
  }
573
543
 
574
544
  static VALUE
575
- ioc_get_flags(self)
576
- VALUE self;
545
+ ioc_get_flags(VALUE self)
577
546
  {
578
547
  return INT2NUM(g_io_channel_get_flags(_SELF(self)));
579
548
  }
580
549
 
581
550
  static VALUE
582
- ioc_set_flags(self, flags)
583
- VALUE self, flags;
551
+ ioc_set_flags(VALUE self, VALUE flags)
584
552
  {
585
553
  GError* err = NULL;
586
554
  GIOStatus status = g_io_channel_set_flags(_SELF(self),
@@ -591,8 +559,7 @@ ioc_set_flags(self, flags)
591
559
 
592
560
  /* Use them with GLib::IOChannel#gets, #readline, #readlines
593
561
  static VALUE
594
- ioc_get_line_term(self)
595
- VALUE self;
562
+ ioc_get_line_term(VALUE self)
596
563
  {
597
564
  gint length;
598
565
  const gchar* ret = g_io_channel_get_line_term(_SELF(self), &length);
@@ -607,8 +574,7 @@ ioc_get_line_term(self)
607
574
  }
608
575
 
609
576
  static VALUE
610
- ioc_set_line_term(self, line_term)
611
- VALUE self, line_term;
577
+ ioc_set_line_term(VALUE self, VALUE line_term)
612
578
  {
613
579
  StringValue(line_term);
614
580
  g_io_channel_set_line_term(_SELF(self), RVAL2CSTR(line_term),
@@ -618,37 +584,36 @@ ioc_set_line_term(self, line_term)
618
584
  */
619
585
 
620
586
  static VALUE
621
- ioc_get_buffered(self)
622
- VALUE self;
587
+ ioc_get_buffered(VALUE self)
623
588
  {
624
589
  return CBOOL2RVAL(g_io_channel_get_buffered(_SELF(self)));
625
590
  }
626
591
 
627
592
  static VALUE
628
- ioc_set_buffered(self, buffered)
629
- VALUE self, buffered;
593
+ ioc_set_buffered(VALUE self, VALUE buffered)
630
594
  {
631
595
  g_io_channel_set_buffered(_SELF(self), RVAL2CBOOL(buffered));
632
596
  return self;
633
597
  }
634
598
 
635
599
  static VALUE
636
- ioc_get_encoding(self)
637
- VALUE self;
600
+ ioc_get_encoding(VALUE self)
638
601
  {
639
602
  return CSTR2RVAL(g_io_channel_get_encoding(_SELF(self)));
640
603
  }
641
604
 
642
605
  static VALUE
643
- ioc_set_encoding(self, encoding)
644
- VALUE self, encoding;
606
+ ioc_set_encoding(VALUE self, VALUE encoding)
645
607
  {
646
608
  GError* err = NULL;
647
- GIOStatus status = g_io_channel_set_encoding(_SELF(self),
648
- encoding ? RVAL2CSTR(encoding) : NULL, &err);
609
+ GIOStatus status;
610
+
611
+ status = g_io_channel_set_encoding(_SELF(self),
612
+ RVAL2CSTR_ACCEPT_NIL(encoding),
613
+ &err);
649
614
  ioc_error(status, err);
650
615
  return self;
651
- }
616
+ }
652
617
 
653
618
  /* Don't we need them ?
654
619
  gboolean g_io_channel_get_close_on_unref (GIOChannel *channel);
@@ -673,8 +638,7 @@ void g_io_channel_close (GIOChannel *channel);
673
638
  */
674
639
 
675
640
  static VALUE
676
- ioc_error_s_from_errno(self, errno_)
677
- VALUE self, errno_;
641
+ ioc_error_s_from_errno(VALUE self, VALUE errno_)
678
642
  {
679
643
  return INT2NUM(g_io_channel_error_from_errno(NUM2INT(errno_)));
680
644
  }
@@ -683,10 +647,7 @@ ioc_error_s_from_errno(self, errno_)
683
647
  * Stolen some convenient methods from io.c
684
648
  */
685
649
  static VALUE
686
- ioc_printf(argc, argv, self)
687
- int argc;
688
- VALUE* argv;
689
- VALUE self;
650
+ ioc_printf(int argc, VALUE *argv, VALUE self)
690
651
  {
691
652
  ioc_write_chars(self, rb_f_sprintf(argc, argv));
692
653
  return Qnil;
@@ -695,8 +656,7 @@ ioc_printf(argc, argv, self)
695
656
  static VALUE ioc_puts(int argc, VALUE* argv, VALUE self);
696
657
 
697
658
  static VALUE
698
- ioc_puts_ary(ary, out, recur)
699
- VALUE ary, out;
659
+ ioc_puts_ary(VALUE ary, VALUE out, int recur)
700
660
  {
701
661
  VALUE tmp;
702
662
  long i;
@@ -712,10 +672,7 @@ ioc_puts_ary(ary, out, recur)
712
672
  }
713
673
 
714
674
  static VALUE
715
- ioc_puts(argc, argv, self)
716
- int argc;
717
- VALUE *argv;
718
- VALUE self;
675
+ ioc_puts(int argc, VALUE *argv, VALUE self)
719
676
  {
720
677
  int i;
721
678
  VALUE line;
@@ -756,10 +713,7 @@ ioc_puts(argc, argv, self)
756
713
  }
757
714
 
758
715
  static VALUE
759
- ioc_print(argc, argv, out)
760
- int argc;
761
- VALUE *argv;
762
- VALUE out;
716
+ ioc_print(int argc, VALUE *argv, VALUE out)
763
717
  {
764
718
  int i;
765
719
  VALUE line;