iconv 1.0.5 → 1.0.6
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.
- checksums.yaml +5 -5
- data/.travis.yml +1 -0
- data/ext/iconv/iconv.c +14 -7
- data/lib/iconv/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f18f6f9c75a01045651000747af72f97d71a633a1e3612597bc0afe4beeec73b
|
4
|
+
data.tar.gz: 1b7782c0429b79ab5d6b971e2c1ccc98878c7fe20e91baf5cb10aafc01cc7e50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a94e61fcf05f7a20d5046c8dc589115d0f4efb0683c051d8cf69d4908bb6848a641959d079442d2d7a8261cbe58706f7bc1aca6ae6e2d8bde24b7e114d904f8a
|
7
|
+
data.tar.gz: 1c8020bf2888c9fdefcdbb1b34675b2943d1a871cc54756b34e17f3dae6908c9ba94a2a38550ddbaf0453fd82a1b0c12cc103d9d8cb2053d2c78c79a3b7b0514
|
data/.travis.yml
CHANGED
data/ext/iconv/iconv.c
CHANGED
@@ -50,7 +50,6 @@ rb_set_errinfo(VALUE err)
|
|
50
50
|
extern VALUE ruby_errinfo;
|
51
51
|
ruby_errinfo = err;
|
52
52
|
}
|
53
|
-
#define ENCODING_GET(a) 0
|
54
53
|
VALUE
|
55
54
|
rb_sprintf(const char *format, ...)
|
56
55
|
{
|
@@ -75,6 +74,13 @@ rb_sys_fail_str(VALUE msg)
|
|
75
74
|
}
|
76
75
|
#endif
|
77
76
|
|
77
|
+
#ifdef HAVE_RUBY_ENCODING_H
|
78
|
+
# define ICONV_ENCODING_SET(obj,idx) rb_ivar_set(obj, id_encoding, rb_enc_from_encoding(rb_enc_from_index(idx)))
|
79
|
+
# define ICONV_ENCODING_GET(obj) rb_enc_to_index(rb_to_encoding(rb_ivar_get(obj, id_encoding)))
|
80
|
+
#else
|
81
|
+
# define ICONV_ENCODING_GET(a) 0
|
82
|
+
#endif
|
83
|
+
|
78
84
|
/*
|
79
85
|
* Document-class: Iconv
|
80
86
|
*
|
@@ -150,7 +156,7 @@ struct rb_iconv_opt_t
|
|
150
156
|
VALUE discard_ilseq;
|
151
157
|
};
|
152
158
|
|
153
|
-
static ID id_transliterate, id_discard_ilseq;
|
159
|
+
static ID id_transliterate, id_discard_ilseq, id_encoding;
|
154
160
|
|
155
161
|
static VALUE rb_eIconvInvalidEncoding;
|
156
162
|
static VALUE rb_eIconvFailure;
|
@@ -734,7 +740,7 @@ iconv_initialize(int argc, VALUE *argv, VALUE self)
|
|
734
740
|
DATA_PTR(self) = NULL;
|
735
741
|
DATA_PTR(self) = (void *)ICONV2VALUE(iconv_create(to, from, &opt, &idx));
|
736
742
|
#ifdef HAVE_RUBY_ENCODING_H
|
737
|
-
if (idx >= 0)
|
743
|
+
if (idx >= 0) ICONV_ENCODING_SET(self, idx);
|
738
744
|
#endif
|
739
745
|
return self;
|
740
746
|
}
|
@@ -760,7 +766,7 @@ iconv_s_open(int argc, VALUE *argv, VALUE self)
|
|
760
766
|
|
761
767
|
self = Data_Wrap_Struct(self, NULL, ICONV_FREE, (void *)cd);
|
762
768
|
#ifdef HAVE_RUBY_ENCODING_H
|
763
|
-
if (idx >= 0)
|
769
|
+
if (idx >= 0) ICONV_ENCODING_SET(self, idx);
|
764
770
|
#endif
|
765
771
|
|
766
772
|
if (rb_block_given_p()) {
|
@@ -946,7 +952,7 @@ iconv_init_state(VALUE self)
|
|
946
952
|
{
|
947
953
|
iconv_t cd = VALUE2ICONV((VALUE)DATA_PTR(self));
|
948
954
|
DATA_PTR(self) = NULL;
|
949
|
-
return iconv_convert(cd, Qnil, 0, 0,
|
955
|
+
return iconv_convert(cd, Qnil, 0, 0, ICONV_ENCODING_GET(self), NULL);
|
950
956
|
}
|
951
957
|
|
952
958
|
static VALUE
|
@@ -1027,7 +1033,7 @@ iconv_iconv(int argc, VALUE *argv, VALUE self)
|
|
1027
1033
|
#endif
|
1028
1034
|
}
|
1029
1035
|
|
1030
|
-
return iconv_convert(VALUE2ICONV(cd), str, start, length,
|
1036
|
+
return iconv_convert(VALUE2ICONV(cd), str, start, length, ICONV_ENCODING_GET(self), NULL);
|
1031
1037
|
}
|
1032
1038
|
|
1033
1039
|
/*
|
@@ -1043,7 +1049,7 @@ iconv_conv(int argc, VALUE *argv, VALUE self)
|
|
1043
1049
|
{
|
1044
1050
|
iconv_t cd = VALUE2ICONV(check_iconv(self));
|
1045
1051
|
VALUE str, s;
|
1046
|
-
int toidx =
|
1052
|
+
int toidx = ICONV_ENCODING_GET(self);
|
1047
1053
|
|
1048
1054
|
str = iconv_convert(cd, Qnil, 0, 0, toidx, NULL);
|
1049
1055
|
if (argc > 0) {
|
@@ -1311,6 +1317,7 @@ Init_iconv(void)
|
|
1311
1317
|
rb_failed = rb_intern("failed");
|
1312
1318
|
id_transliterate = rb_intern("transliterate");
|
1313
1319
|
id_discard_ilseq = rb_intern("discard_ilseq");
|
1320
|
+
id_encoding = rb_intern("encoding");
|
1314
1321
|
|
1315
1322
|
rb_gc_register_address(&charset_map);
|
1316
1323
|
charset_map = rb_hash_new();
|
data/lib/iconv/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iconv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NARUSE, Yui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: iconv wrapper library
|
14
14
|
email:
|
@@ -54,8 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
|
-
|
58
|
-
rubygems_version: 2.6.13
|
57
|
+
rubygems_version: 3.0.1
|
59
58
|
signing_key:
|
60
59
|
specification_version: 4
|
61
60
|
summary: iconv wrapper library
|