glib2 4.2.3 → 4.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b45ce3056fb7100dc8a3e62431925bfb0bca762d0835c9da0bff9fa3d1d409f
4
- data.tar.gz: 55e73580612b3aced2dd6753162fb352ff722f8e8b48fdca537cb1e8676d5472
3
+ metadata.gz: 1ce8e0b69eabe0515d6f899e3811fa77ac794481531500e84fdea9fb33b28fec
4
+ data.tar.gz: 4ab29fea64953b54d7d903bef16ec0572276b4f892312f475b37af8eb70ef246
5
5
  SHA512:
6
- metadata.gz: cc7b6ad7a331af646b6b4e7c92d7cf0b606dc57a7ceaa72c6f1c995d8f8e168ef593658692105f45f2adf9a0a639044263a6c776d8dd5b21e3711c185d78ad41
7
- data.tar.gz: bbf363a2ba3d4831c117803f4484b2f4ca9c3ee2b7aa1af3ef8a9694b1ac24521cf3eec87b90cb2c4edb6dd30ccdaf14af06aa58e845aa297a092b37dda0fb56
6
+ metadata.gz: 1af9b09699eeeff8fbce562c64be5c19514b4ce0d59a9d0ff7798b5c675215e54a853a7d6546b1f21aac122150256ed48714f2cd9b883f564a1a2d775367dce2
7
+ data.tar.gz: '079135b962c74881c9a24e110dae2de86792281817321ff42ee96dfabe34741b1a815e386043de63c8b647c110cb5718a7a5a3268e65ca7af06ceca6daa3a346'
data/Rakefile CHANGED
@@ -19,10 +19,10 @@
19
19
  base_dir = __dir__
20
20
 
21
21
  $LOAD_PATH.unshift(File.join(base_dir, "lib"))
22
- require "gnome2/rake/package-task"
22
+ require "gnome/rake/package-task"
23
23
 
24
24
  package_name = File.basename(base_dir)
25
25
  spec = Gem::Specification.load(File.join(base_dir, "#{package_name}.gemspec"))
26
26
 
27
- GNOME2::Rake::PackageTask.define(spec, __dir__) do |package|
27
+ GNOME::Rake::PackageTask.define(spec, __dir__) do |package|
28
28
  end
data/ext/glib2/glib2.def CHANGED
@@ -175,7 +175,6 @@ EXPORTS
175
175
  rbglib_num_to_uint64
176
176
  rbglib_uint64_to_num
177
177
  rbglib_num_to_int64
178
- rbglib_int64_to_num
179
178
  rbg_variant_to_ruby
180
179
  rbg_variant_from_ruby
181
180
  rbg_variant_type_from_ruby
data/ext/glib2/rbglib.c CHANGED
@@ -1248,7 +1248,6 @@ union GDoubleIEEE754;
1248
1248
  Init_gutil_callback();
1249
1249
 
1250
1250
  Init_glib_gettext();
1251
- Init_glib_int64();
1252
1251
  Init_glib_error();
1253
1252
  Init_glib_threads();
1254
1253
  Init_glib_convert();
data/ext/glib2/rbglib.h CHANGED
@@ -33,49 +33,14 @@ G_BEGIN_DECLS
33
33
 
34
34
  #define RBGLIB_MAJOR_VERSION 4
35
35
  #define RBGLIB_MINOR_VERSION 2
36
- #define RBGLIB_MICRO_VERSION 3
36
+ #define RBGLIB_MICRO_VERSION 5
37
37
 
38
- #ifndef RB_ZALLOC
39
- # ifdef ZALLOC
40
- # define RB_ZALLOC(type) ZALLOC(type)
41
- # else
42
- # define RB_ZALLOC(type) rbg_memzero(ALLOC(type), sizeof(type))
43
- # endif
38
+ /* For Ruby < 3.0 */
39
+ #ifndef RB_LL2NUM
40
+ # define RB_LL2NUM LL2NUM
44
41
  #endif
45
-
46
- #ifndef RB_ALLOC
47
- # define RB_ALLOC(type) ALLOC(type)
48
- #endif
49
-
50
- #ifndef RB_ALLOC_N
51
- # define RB_ALLOC_N(type, n) ALLOC_N(type, n)
52
- #endif
53
-
54
- /* For Ruby < 2.3 */
55
- #ifndef RB_OBJ_FROZEN
56
- # define RB_OBJ_FROZEN(obj) OBJ_FROZEN(obj)
57
- #endif
58
-
59
- #ifndef RSTRING_PTR
60
- # define RSTRING_PTR(s) (RSTRING(s)->ptr)
61
- # define RSTRING_LEN(s) (RSTRING(s)->len)
62
- #endif
63
-
64
- #ifndef RARRAY_PTR
65
- # define RARRAY_PTR(a) (RARRAY(a)->ptr)
66
- # define RARRAY_LEN(a) (RARRAY(a)->len)
67
- #endif
68
-
69
- #ifndef RARRAY_CONST_PTR
70
- # define RARRAY_CONST_PTR(a) RARRAY_PTR(a)
71
- #endif
72
-
73
- #ifndef DBL2NUM
74
- # define DBL2NUM(v) (rb_float_new(v))
75
- #endif
76
-
77
- #ifndef RBASIC_CLASS
78
- # define RBASIC_CLASS(obj) (RBASIC(obj)->klass)
42
+ #ifndef RB_ULL2NUM
43
+ # define RB_ULL2NUM ULL2NUM
79
44
  #endif
80
45
 
81
46
  #ifndef G_SOURCE_REMOVE
@@ -143,11 +108,11 @@ G_BEGIN_DECLS
143
108
  #define POINTER2RVAL(pointer) ((VALUE)(pointer))
144
109
 
145
110
  #if SIZEOF_VOIDP == SIZEOF_LONG
146
- # define NUM2POINTER(number) ((gpointer)NUM2ULONG(number))
147
- # define POINTER2NUM(pointer) ULONG2NUM((unsigned long)pointer)
111
+ # define NUM2POINTER(number) ((gpointer)RB_NUM2ULONG(number))
112
+ # define POINTER2NUM(pointer) RB_ULONG2NUM((unsigned long)pointer)
148
113
  #else
149
- # define NUM2POINTER(number) ((gpointer)NUM2ULL(number))
150
- # define POINTER2NUM(pointer) ULL2NUM((unsigned LONG_LONG)pointer)
114
+ # define NUM2POINTER(number) ((gpointer)RB_NUM2ULL(number))
115
+ # define POINTER2NUM(pointer) RB_ULL2NUM((unsigned LONG_LONG)pointer)
151
116
  #endif
152
117
 
153
118
  #define GINTS2RVAL(ary, n) rbg_gints2rval(ary, n)
@@ -245,6 +210,8 @@ extern GQuark rbgerr_ruby_error_quark(void);
245
210
  extern VALUE rbgerr_gerror2exception(GError *error);
246
211
  extern VALUE rbgerr_define_gerror(GQuark domain, const gchar* name, VALUE module, VALUE parent, GType gtype);
247
212
 
213
+ /* Deprecated. Use RB_LL2NUM()/RB_ULL2NUM()/RB_NUM2LL()/RB_NUM2ULL()
214
+ * directly. */
248
215
  extern VALUE rbglib_int64_to_num(guint64 val);
249
216
  extern VALUE rbglib_uint64_to_num(guint64 val);
250
217
  extern gint64 rbglib_num_to_int64(VALUE val);
@@ -1,9 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2003 Masahiro Sakai
5
- * Copyright (C) 2002 Masahiro Sakai
6
- * Kenichi Komiya
3
+ * Copyright (C) 2011-2024 Ruby-GNOME Project Team
7
4
  *
8
5
  * This library is free software; you can redistribute it and/or
9
6
  * modify it under the terms of the GNU Lesser General Public
@@ -23,143 +20,30 @@
23
20
 
24
21
  #include "rbgprivate.h"
25
22
 
26
- static ID id_and;
27
- static ID id_rshift;
28
- static ID id_lshift;
29
- static ID id_lt;
30
- static ID id_plus;
31
- static ID id_uminus;
32
- static ID id_abs;
33
- static VALUE max_PRUint32;
34
-
35
- typedef guint64 PRUint64;
36
- typedef gint64 PRInt64;
37
-
38
- #define LL_ZERO G_GINT64_CONSTANT(0)
39
- #define LL_UI2L(lhs,rhs) ((lhs)=(rhs))
40
- #define LL_L2UI(lhs,rhs) ((lhs)=(guint32)(rhs))
41
- #define LL_SHL(lhs,v1,v2) ((lhs)=(v1)<<(v2))
42
- #define LL_SHR(lhs,v1,v2) ((lhs)=(v1)>>(v2))
43
- #define LL_ADD(lhs,v1,v2) ((lhs)=(v1)+(v2))
44
- #define LL_NEG(lhs,rhs) ((lhs)=-(rhs))
45
- #define LL_CMP(v1,op,v2) ((v1) op (v2))
46
-
47
- /**********************************************************************/
48
- /*
49
- following is ripped from rbXPCOM-0.0.3
50
- http://www.ruby-lang.org/en/raa-list.rhtml?name=rbXPCOM
51
- Copyright (C) 2001 Kenichi Komiya <kom@mail1.accsnet.ne.jp>
52
- */
53
-
54
- static PRUint64
55
- RubyTo64BitInt(VALUE aRuby)
56
- {
57
- VALUE bitMask = max_PRUint32;
58
- VALUE lo = rb_funcall(aRuby, id_and, 1, bitMask);
59
- VALUE hi = rb_funcall(aRuby, id_rshift, 1, INT2FIX(32));
60
- PRUint64 result, hi64, lo64;
61
- LL_UI2L(hi64, NUM2UINT(hi));
62
- LL_UI2L(lo64, NUM2UINT(lo));
63
- LL_SHL(result, hi64, 32);
64
- LL_ADD(result, result, lo64);
65
- return result;
66
- }
67
-
68
-
69
- static inline PRUint64
70
- RubyToPRUint64(VALUE aRuby)
71
- {
72
- return RubyTo64BitInt(aRuby);
73
- }
74
-
75
-
76
- static PRInt64
77
- RubyToPRInt64(VALUE aRuby)
78
- {
79
- if(RVAL2CBOOL(rb_funcall(aRuby, id_lt, 1, INT2FIX(0))))
80
- {
81
- VALUE absRuby = rb_funcall(aRuby, id_abs, 0);
82
- PRInt64 result;
83
- LL_NEG(result, RubyTo64BitInt(absRuby));
84
- return result;
85
- } else
86
- return (PRInt64)RubyTo64BitInt(aRuby);
87
-
88
- }
89
-
90
- static VALUE
91
- RubyFrom64BitInt(PRUint64 aNative)
92
- {
93
- PRUint64 lo64, hi64;
94
- LL_L2UI(lo64, aNative);
95
- LL_SHR(hi64, aNative, 32);
96
- {
97
- VALUE lo = UINT2NUM(lo64);
98
- VALUE hi = UINT2NUM(hi64);
99
- VALUE hiRuby = rb_funcall(hi, id_lshift, 1, INT2FIX(32));
100
- return rb_funcall(hiRuby, id_plus, 1, lo);
101
- }
102
- }
103
-
104
- static inline VALUE
105
- PRUint64ToRuby(PRUint64 aNative)
106
- {
107
- return RubyFrom64BitInt(aNative);
108
- }
109
-
110
- static VALUE
111
- PRInt64ToRuby(PRInt64 aNative)
112
- {
113
- if(LL_CMP(aNative, <, LL_ZERO))
114
- {
115
- PRUint64 abs64;
116
- LL_NEG(abs64, aNative);
117
- return rb_funcall(RubyFrom64BitInt(abs64), id_uminus, 0);
118
- }
119
- else
120
- return RubyFrom64BitInt((PRUint64)aNative);
121
- }
122
-
123
- /* end of ripping */
124
- /**********************************************************************/
125
-
23
+ /* Deprecated. Use RB_LL2NUM() directly. */
126
24
  VALUE
127
25
  rbglib_int64_to_num(guint64 val)
128
26
  {
129
- return PRInt64ToRuby(val);
27
+ return RB_LL2NUM(val);
130
28
  }
131
29
 
30
+ /* Deprecated. Use RB_ULL2NUM() directly. */
132
31
  VALUE
133
32
  rbglib_uint64_to_num(guint64 val)
134
33
  {
135
- return PRUint64ToRuby(val);
34
+ return RB_ULL2NUM(val);
136
35
  }
137
36
 
37
+ /* Deprecated. Use RB_NUM2LL() directly. */
138
38
  gint64
139
39
  rbglib_num_to_int64(VALUE val)
140
40
  {
141
- return RubyToPRInt64(val);
41
+ return RB_NUM2LL(val);
142
42
  }
143
43
 
44
+ /* Deprecated. Use RB_NUM2ULL() directly. */
144
45
  guint64
145
46
  rbglib_num_to_uint64(VALUE val)
146
47
  {
147
- return RubyToPRUint64(val);
148
- }
149
-
150
- /**********************************************************************/
151
-
152
- void
153
- Init_glib_int64(void)
154
- {
155
- id_and = rb_intern("&");
156
- id_rshift = rb_intern(">>");
157
- id_lshift = rb_intern("<<");
158
- id_lt = rb_intern("<");
159
- id_plus = rb_intern("+");
160
- id_uminus = rb_intern("-@");
161
- id_abs = rb_intern("abs");
162
-
163
- rb_global_variable(&max_PRUint32);
164
- max_PRUint32 = UINT2NUM(0xffffffffL);
48
+ return RB_NUM2ULL(val);
165
49
  }
@@ -638,7 +638,7 @@ rg_s_try_convert(VALUE self, VALUE value)
638
638
  return value;
639
639
 
640
640
  if (RVAL2CBOOL(rb_obj_is_kind_of(value, rb_cInteger))) {
641
- GType gtype = NUM2ULONG(value);
641
+ GType gtype = NUM2SIZET(value);
642
642
  if (!g_type_name(gtype))
643
643
  return Qnil;
644
644
  return rb_funcall(self, id_new, 1, value);
@@ -672,7 +672,7 @@ rg_s_try_convert(VALUE self, VALUE value)
672
672
  } else {
673
673
  Data_Get_Struct(data, RGObjClassInfo, cinfo);
674
674
  }
675
- return rb_funcall(self, id_new, 1, ULONG2NUM(cinfo->gtype));
675
+ return rb_funcall(self, id_new, 1, SIZET2NUM(cinfo->gtype));
676
676
  }
677
677
  return Qnil;
678
678
  }
@@ -374,7 +374,7 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
374
374
 
375
375
  rb_scan_args(argc, argv, "11", &rb_gtype, &rb_value);
376
376
 
377
- g_value_init(&value, NUM2ULONG(rb_to_int(rb_gtype)));
377
+ g_value_init(&value, NUM2SIZET(rb_to_int(rb_gtype)));
378
378
  if (argc == 2) {
379
379
  rbgobj_rvalue_to_gvalue(rb_value, &value);
380
380
  }
@@ -146,7 +146,6 @@ G_GNUC_INTERNAL void Init_glib_gc(void);
146
146
  G_GNUC_INTERNAL void Init_gutil(void);
147
147
  G_GNUC_INTERNAL void Init_gutil_callback(void);
148
148
  G_GNUC_INTERNAL void Init_glib_gettext(void);
149
- G_GNUC_INTERNAL void Init_glib_int64(void);
150
149
  G_GNUC_INTERNAL void Init_glib_error(void);
151
150
  G_GNUC_INTERNAL void Init_glib_error_conversions(void);
152
151
  G_GNUC_INTERNAL void Init_glib_threads(void);
data/test/test-glib2.rb CHANGED
@@ -1,6 +1,4 @@
1
- # coding: ascii-8bit
2
- #
3
- # Copyright (C) 2015-2022 Ruby-GNOME Project Team
1
+ # Copyright (C) 2015-2024 Ruby-GNOME Project Team
4
2
  #
5
3
  # This library is free software; you can redistribute it and/or
6
4
  # modify it under the terms of the GNU Lesser General Public
@@ -49,9 +47,12 @@ class TestGLib < Test::Unit::TestCase
49
47
  def test_convert
50
48
  assert_kind_of(String, GLib.charset)
51
49
 
52
- sjis = "\202\261\202\361\202\311\202\277\202\315\220\242\212E".force_encoding("Shift_JIS")
53
- euc = "\244\263\244\363\244\313\244\301\244\317\300\244\263\246".force_encoding("EUC-JP")
54
- utf8 = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257\344\270\226\347\225\214".force_encoding("UTF-8")
50
+ # U+3042 HIRAGANA LETTER A
51
+ # U+3044 HIRAGANA LETTER I
52
+ # U+3046 HIRAGANA LETTER U
53
+ utf8 = "\u3042\u3044\u3046"
54
+ sjis = utf8.encode("Shift_JIS")
55
+ euc = utf8.encode("EUC-JP")
55
56
  assert_equal(utf8, GLib.convert(sjis, "UTF-8", "SHIFT_JIS"))
56
57
  assert_equal(euc, GLib.convert(sjis, "EUC-JP", "SHIFT_JIS"))
57
58
  assert_equal(sjis, GLib.convert(sjis, "SHIFT_JIS", "SHIFT_JIS"))
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib2
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.3
4
+ version: 4.2.5
5
5
  platform: ruby
6
+ original_platform: ''
6
7
  authors:
7
8
  - The Ruby-GNOME Project Team
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 2024-09-19 00:00:00.000000000 Z
11
+ date: 2024-12-15 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: pkg-config