stringio 3.0.0 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/stringio/stringio.c +16 -12
- metadata +8 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36d42b708a5834d7fb5b4fc7080f995fa620aa8a579515a3be446e952bb795db
|
4
|
+
data.tar.gz: d41342f6f4f5ea0046f21bb1274f856e38f01420de77176518cf3cc135208337
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8a9f45ac75b1baa8bb8c0e91bc45eb556329a40e5211ecf3525bd3fb089fc9e39a19e1f1671e0f7c8e79a8b24e27464a6e307e74c6a69d9fd32ccf849ced938
|
7
|
+
data.tar.gz: eb2c1d93bc7a91ee5bff2aeaeb64f1e2d5817358447fd26fe65bfc4a48ef3745087fa169289139b3b7e408baca4dd66517a86764bcbd3a67a4b0f2e0d600f863
|
data/ext/stringio/stringio.c
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
/* -*- mode: c; indent-tabs-mode: t -*- */
|
1
2
|
/**********************************************************************
|
2
3
|
|
3
4
|
stringio.c -
|
@@ -11,7 +12,7 @@
|
|
11
12
|
|
12
13
|
**********************************************************************/
|
13
14
|
|
14
|
-
#define STRINGIO_VERSION "3.0.
|
15
|
+
#define STRINGIO_VERSION "3.0.2"
|
15
16
|
|
16
17
|
#include "ruby.h"
|
17
18
|
#include "ruby/io.h"
|
@@ -64,7 +65,7 @@ strio_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash,
|
|
64
65
|
n = strchr(n, '|');
|
65
66
|
}
|
66
67
|
e = strchr(++n, ':');
|
67
|
-
len = e ? e - n : strlen(n);
|
68
|
+
len = e ? e - n : (long)strlen(n);
|
68
69
|
if (len > 0 && len <= ENCODING_MAXNAMELEN) {
|
69
70
|
if (e) {
|
70
71
|
memcpy(encname, n, len);
|
@@ -599,6 +600,14 @@ strio_closed_write(VALUE self)
|
|
599
600
|
return Qtrue;
|
600
601
|
}
|
601
602
|
|
603
|
+
static struct StringIO *
|
604
|
+
strio_to_read(VALUE self)
|
605
|
+
{
|
606
|
+
struct StringIO *ptr = readable(self);
|
607
|
+
if (ptr->pos < RSTRING_LEN(ptr->string)) return ptr;
|
608
|
+
return NULL;
|
609
|
+
}
|
610
|
+
|
602
611
|
/*
|
603
612
|
* call-seq:
|
604
613
|
* strio.eof -> true or false
|
@@ -610,8 +619,7 @@ strio_closed_write(VALUE self)
|
|
610
619
|
static VALUE
|
611
620
|
strio_eof(VALUE self)
|
612
621
|
{
|
613
|
-
|
614
|
-
if (ptr->pos < RSTRING_LEN(ptr->string)) return Qfalse;
|
622
|
+
if (strio_to_read(self)) return Qfalse;
|
615
623
|
return Qtrue;
|
616
624
|
}
|
617
625
|
|
@@ -821,11 +829,11 @@ strio_get_sync(VALUE self)
|
|
821
829
|
static VALUE
|
822
830
|
strio_each_byte(VALUE self)
|
823
831
|
{
|
824
|
-
struct StringIO *ptr
|
832
|
+
struct StringIO *ptr;
|
825
833
|
|
826
834
|
RETURN_ENUMERATOR(self, 0, 0);
|
827
835
|
|
828
|
-
while (ptr
|
836
|
+
while ((ptr = strio_to_read(self)) != NULL) {
|
829
837
|
char c = RSTRING_PTR(ptr->string)[ptr->pos++];
|
830
838
|
rb_yield(CHR2FIX(c));
|
831
839
|
}
|
@@ -1064,11 +1072,7 @@ strio_each_codepoint(VALUE self)
|
|
1064
1072
|
|
1065
1073
|
ptr = readable(self);
|
1066
1074
|
enc = get_enc(ptr);
|
1067
|
-
|
1068
|
-
if (ptr->pos >= RSTRING_LEN(ptr->string)) {
|
1069
|
-
return self;
|
1070
|
-
}
|
1071
|
-
|
1075
|
+
while ((ptr = strio_to_read(self)) != NULL) {
|
1072
1076
|
c = rb_enc_codepoint_len(RSTRING_PTR(ptr->string)+ptr->pos,
|
1073
1077
|
RSTRING_END(ptr->string), &n, enc);
|
1074
1078
|
ptr->pos += n;
|
@@ -1755,7 +1759,7 @@ Init_stringio(void)
|
|
1755
1759
|
rb_ext_ractor_safe(true);
|
1756
1760
|
#endif
|
1757
1761
|
|
1758
|
-
VALUE StringIO = rb_define_class("StringIO",
|
1762
|
+
VALUE StringIO = rb_define_class("StringIO", rb_cObject);
|
1759
1763
|
|
1760
1764
|
rb_define_const(StringIO, "VERSION", rb_str_new_cstr(STRINGIO_VERSION));
|
1761
1765
|
|
metadata
CHANGED
@@ -1,45 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stringio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nobu Nakada
|
8
|
+
- Charles Oliver Nutter
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rake-compiler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: test-unit
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
12
|
+
date: 2022-05-09 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
41
14
|
description: Pseudo `IO` class from/to `String`.
|
42
|
-
email:
|
15
|
+
email:
|
16
|
+
- nobu@ruby-lang.org
|
17
|
+
- headius@headius.com
|
43
18
|
executables: []
|
44
19
|
extensions:
|
45
20
|
- ext/stringio/extconf.rb
|
@@ -68,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
43
|
- !ruby/object:Gem::Version
|
69
44
|
version: '2.6'
|
70
45
|
requirements: []
|
71
|
-
rubygems_version: 3.
|
46
|
+
rubygems_version: 3.3.7
|
72
47
|
signing_key:
|
73
48
|
specification_version: 4
|
74
49
|
summary: Pseudo IO on String
|