arraybuffer 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/arraybuffer/arraybuffer.c +6 -6
- data/ext/arraybuffer/dataview.c +6 -6
- data/lib/arraybuffer_ext.bundle +0 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a052426f4fef84b44cafc3c99a53b33313f1732419710c41d5101cfc062d7f3c
|
4
|
+
data.tar.gz: '0269d413e2d78f96e310c50d3ad9d9bcc81c2289acf8f80d2f819adc5c4d9653'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36d9f193e7b56cad4cc5b08c7e1569872c3987b3eed51235fd834f838b72e541e416327ef5274cbeddbc68d3722d14578e6f33e934e4ae8af0864b9b4375d326
|
7
|
+
data.tar.gz: 60995a4af7efe4ac38c05c099de41ada09c8368106aac51cb2f1059b66104d54cf5d7a2d1f01fefab3429d1710a8faf867daa0c63d2ec24d50af5030dfac762e
|
@@ -13,7 +13,7 @@ extern VALUE cArrayBuffer;
|
|
13
13
|
struct LLC_ArrayBuffer *bb = (struct LLC_ArrayBuffer*)rb_data_object_get((self))
|
14
14
|
|
15
15
|
#define CHECKBOUNDS(bb, idx) \
|
16
|
-
if (!(bb)->ptr || (idx) < 0 || (idx) >= (bb)->size) { \
|
16
|
+
if (!(bb)->ptr || (idx) < 0 || (unsigned int)(idx) >= (bb)->size) { \
|
17
17
|
rb_raise(rb_eArgError, "Index out of bounds: %d", (idx)); \
|
18
18
|
}
|
19
19
|
|
@@ -62,7 +62,7 @@ t_bb_allocator(VALUE klass) {
|
|
62
62
|
struct LLC_ArrayBuffer *bb = (struct LLC_ArrayBuffer*)xmalloc(sizeof(struct LLC_ArrayBuffer));
|
63
63
|
bb->ptr = NULL;
|
64
64
|
bb->size = 0;
|
65
|
-
bb->backing_str =
|
65
|
+
bb->backing_str = 0;
|
66
66
|
|
67
67
|
return Data_Wrap_Struct(klass, t_bb_gc_mark, t_bb_free, bb);
|
68
68
|
}
|
@@ -71,12 +71,12 @@ t_bb_allocator(VALUE klass) {
|
|
71
71
|
// Ruby 3.1 and later
|
72
72
|
|
73
73
|
#define BB_BACKING_PTR(bb) \
|
74
|
-
(FL_TEST((bb)->backing_str, RSTRING_NOEMBED) ? RSTRING((bb)->backing_str)->as.heap.ptr :
|
74
|
+
(FL_TEST((bb)->backing_str, RSTRING_NOEMBED) ? RSTRING((bb)->backing_str)->as.heap.ptr : RSTRING(bb->backing_str)->as.embed.ary)
|
75
75
|
#else
|
76
76
|
// Before ruby 3.1
|
77
77
|
|
78
78
|
#define BB_BACKING_PTR(bb) \
|
79
|
-
(FL_TEST((bb)->backing_str, RSTRING_NOEMBED) ? RSTRING((bb)->backing_str)->as.heap.ptr :
|
79
|
+
(FL_TEST((bb)->backing_str, RSTRING_NOEMBED) ? RSTRING((bb)->backing_str)->as.heap.ptr : RSTRING(bb->backing_str)->as.ary)
|
80
80
|
#endif
|
81
81
|
|
82
82
|
static void
|
@@ -87,7 +87,7 @@ t_bb_reassign_ptr(struct LLC_ArrayBuffer *bb) {
|
|
87
87
|
}
|
88
88
|
|
89
89
|
rb_str_set_len(bb->backing_str, bb->size);
|
90
|
-
bb->ptr = BB_BACKING_PTR(bb);
|
90
|
+
bb->ptr = (unsigned char*)BB_BACKING_PTR(bb);
|
91
91
|
bb->ptr[bb->size] = 0;
|
92
92
|
}
|
93
93
|
|
@@ -139,7 +139,7 @@ t_bb_each(VALUE self) {
|
|
139
139
|
DECLAREBB(self);
|
140
140
|
|
141
141
|
if (rb_block_given_p()) {
|
142
|
-
for (int i = 0; i < bb->size; i++) {
|
142
|
+
for (unsigned int i = 0; i < bb->size; i++) {
|
143
143
|
unsigned int val = (unsigned int)bb->ptr[i];
|
144
144
|
rb_yield(UINT2NUM(val));
|
145
145
|
}
|
data/ext/arraybuffer/dataview.c
CHANGED
@@ -131,8 +131,8 @@ t_dv_initialize(int argc, VALUE *argv, VALUE self) {
|
|
131
131
|
if (offset_val < 0)
|
132
132
|
rb_raise(rb_eArgError, "calculated offset is negative: %d", offset_val);
|
133
133
|
|
134
|
-
dv->offset = (unsigned
|
135
|
-
dv->size = (unsigned
|
134
|
+
dv->offset = (unsigned int)offset_val;
|
135
|
+
dv->size = (unsigned int)size_val;
|
136
136
|
dv->bb_obj = bb_obj;
|
137
137
|
|
138
138
|
if (!keyword_ids[0]) {
|
@@ -214,7 +214,7 @@ t_dv_setoffset(VALUE self, VALUE offset) {
|
|
214
214
|
if (offset_val < 0)
|
215
215
|
rb_raise(rb_eArgError, "calculated offset is negative: %d", offset_val);
|
216
216
|
|
217
|
-
dv->offset = (unsigned
|
217
|
+
dv->offset = (unsigned int)offset_val;
|
218
218
|
return self;
|
219
219
|
}
|
220
220
|
|
@@ -237,13 +237,13 @@ t_dv_setsize(VALUE self, VALUE size) {
|
|
237
237
|
if (size_val < 0)
|
238
238
|
rb_raise(rb_eArgError, "calculated size is negative: %d", size_val);
|
239
239
|
|
240
|
-
dv->size = (unsigned
|
240
|
+
dv->size = (unsigned int)size_val;
|
241
241
|
return self;
|
242
242
|
}
|
243
243
|
|
244
244
|
#define DECLARENCHECKIDX(index) int idx = NUM2INT(index); \
|
245
245
|
if (idx < 0) idx += (int)dv->size; \
|
246
|
-
if (idx < 0 || idx >= dv->size) rb_raise(rb_eArgError, "index out of bounds: %d", idx);
|
246
|
+
if (idx < 0 || idx >= (int)dv->size) rb_raise(rb_eArgError, "index out of bounds: %d", idx);
|
247
247
|
|
248
248
|
#define CHECKBOUNDSBB(v) if ((v) < 0 || (v) >= (bb)->size) \
|
249
249
|
rb_raise(rb_eArgError, "index out of underlying buffer bounds: %d", (v));
|
@@ -263,7 +263,7 @@ t_dv_getbit(VALUE self, VALUE index) {
|
|
263
263
|
int idx = NUM2INT(index);
|
264
264
|
if (idx < 0)
|
265
265
|
idx += (int)dv->size * 8;
|
266
|
-
if (idx < 0 || idx >= dv->size * 8)
|
266
|
+
if (idx < 0 || idx >= (int)dv->size * 8)
|
267
267
|
rb_raise(rb_eArgError, "index out of bounds: %d", idx);
|
268
268
|
|
269
269
|
unsigned int bit_idx = ((unsigned int)idx) & 7;
|
data/lib/arraybuffer_ext.bundle
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arraybuffer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- André Diego Piske
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -68,14 +68,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
68
|
requirements:
|
69
69
|
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: '
|
71
|
+
version: '3.0'
|
72
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
|
-
rubygems_version: 3.
|
78
|
+
rubygems_version: 3.5.22
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: An array buffer (a.k.a. byte array) implementation forRuby, implemented natively.
|