iconv 1.0.6 → 1.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f18f6f9c75a01045651000747af72f97d71a633a1e3612597bc0afe4beeec73b
4
- data.tar.gz: 1b7782c0429b79ab5d6b971e2c1ccc98878c7fe20e91baf5cb10aafc01cc7e50
3
+ metadata.gz: 8f5a276d2517ce5592e1bbe94c3c8897bdaa70eb8d52fe334746ea8dd287013f
4
+ data.tar.gz: ec2d9899c3ce1f58aefab4516f2d79da7b301ded1e27473bc825645f7710e919
5
5
  SHA512:
6
- metadata.gz: a94e61fcf05f7a20d5046c8dc589115d0f4efb0683c051d8cf69d4908bb6848a641959d079442d2d7a8261cbe58706f7bc1aca6ae6e2d8bde24b7e114d904f8a
7
- data.tar.gz: 1c8020bf2888c9fdefcdbb1b34675b2943d1a871cc54756b34e17f3dae6908c9ba94a2a38550ddbaf0453fd82a1b0c12cc103d9d8cb2053d2c78c79a3b7b0514
6
+ metadata.gz: b43b19ba95361b57c2a3ff7778f344cb9ad5aeef98b24089fc4a698c5ebd286590ac76fcf9e274c799050fc02220219b090c6dd3c0df07697904348bbde36a9b
7
+ data.tar.gz: 609d4ab133902601820e5c4478387c7049fbedb2ce74b0def6c66c390e6fe886cf39697a4a2eb31544bfde98e1375b9a5aced9cd223711b64c0db84d5ace4623
data/.gitignore CHANGED
@@ -2,6 +2,7 @@
2
2
  *.o
3
3
  *.rbc
4
4
  *.so
5
+ *.bundle
5
6
  *.swp
6
7
  .bundle
7
8
  .config
@@ -12,7 +12,7 @@ rvm:
12
12
  - 1.9.2
13
13
  - 1.8.7
14
14
 
15
- before_install: gem install bundler
15
+ before_install: gem install bundler -v '<2'
16
16
 
17
17
  branches:
18
18
  only:
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ NAME = 'iconv'
7
7
  # rule to build the extension: this says
8
8
  # that the extension should be rebuilt
9
9
  # after any change to the files in ext
10
- file "lib/#{NAME}/#{NAME}.so" =>
10
+ file "lib/#{NAME}/#{NAME}.#{RbConfig::CONFIG['DLEXT']}" =>
11
11
  Dir.glob("ext/#{NAME}/*{.rb,.c}") do
12
12
  Dir.chdir("ext/#{NAME}") do
13
13
  # this does essentially the same thing
@@ -15,19 +15,19 @@ file "lib/#{NAME}/#{NAME}.so" =>
15
15
  ruby "extconf.rb", *ARGV.grep(/\A--/)
16
16
  sh "make", *ARGV.grep(/\A(?!--)/)
17
17
  end
18
- cp "ext/#{NAME}/#{NAME}.so", "lib/#{NAME}"
18
+ cp "ext/#{NAME}/#{NAME}.#{RbConfig::CONFIG['DLEXT']}", "lib/#{NAME}"
19
19
  end
20
20
 
21
21
  # make the :test task depend on the shared
22
22
  # object, so it will be built automatically
23
23
  # before running the tests
24
- task :test => "lib/#{NAME}/#{NAME}.so"
24
+ task :test => "lib/#{NAME}/#{NAME}.#{RbConfig::CONFIG['DLEXT']}"
25
25
 
26
26
  # use 'rake clean' and 'rake clobber' to
27
27
  # easily delete generated files
28
- CLEAN.include('ext/**/*{.o,.log,.so}')
29
- CLEAN.include('ext/**/Makefile')
30
- CLOBBER.include('lib/**/*.so')
28
+ CLEAN.include("ext/**/*{.o,.log,.#{RbConfig::CONFIG['DLEXT']}}")
29
+ CLEAN.include("ext/**/Makefile")
30
+ CLOBBER.include("lib/**/*.#{RbConfig::CONFIG['DLEXT']}")
31
31
 
32
32
  # the same as before
33
33
  Rake::TestTask.new do |t|
@@ -75,8 +75,14 @@ rb_sys_fail_str(VALUE msg)
75
75
  #endif
76
76
 
77
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)))
78
+ # define ICONV_ENCODING_SET(obj,idx) rb_ivar_set(obj, id_encindex, INT2FIX(idx))
79
+ static int
80
+ iconv_get_encindex(VALUE obj, ID id_encindex)
81
+ {
82
+ VALUE num_or_nil = rb_ivar_get(obj, id_encindex);
83
+ return NIL_P(num_or_nil) ? 0 : FIX2INT(num_or_nil);
84
+ }
85
+ # define ICONV_ENCODING_GET(obj) iconv_get_encindex(obj, id_encindex)
80
86
  #else
81
87
  # define ICONV_ENCODING_GET(a) 0
82
88
  #endif
@@ -156,7 +162,7 @@ struct rb_iconv_opt_t
156
162
  VALUE discard_ilseq;
157
163
  };
158
164
 
159
- static ID id_transliterate, id_discard_ilseq, id_encoding;
165
+ static ID id_transliterate, id_discard_ilseq, id_encindex;
160
166
 
161
167
  static VALUE rb_eIconvInvalidEncoding;
162
168
  static VALUE rb_eIconvFailure;
@@ -1317,7 +1323,7 @@ Init_iconv(void)
1317
1323
  rb_failed = rb_intern("failed");
1318
1324
  id_transliterate = rb_intern("transliterate");
1319
1325
  id_discard_ilseq = rb_intern("discard_ilseq");
1320
- id_encoding = rb_intern("encoding");
1326
+ id_encindex = rb_intern("encindex");
1321
1327
 
1322
1328
  rb_gc_register_address(&charset_map);
1323
1329
  charset_map = rb_hash_new();
@@ -1,3 +1,3 @@
1
1
  class Iconv
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.7"
3
3
  end
@@ -56,4 +56,12 @@ class TestIconv::Basic < TestIconv
56
56
  Iconv.iconv("X-UNKNOWN-1", "X-UNKNOWN-2") {break}
57
57
  }
58
58
  end
59
+
60
+ def test_github_issue_16
61
+ i = Iconv.new('SHIFT_JISX0213', 'UTF-8')
62
+ ret = i.iconv('ほげ')
63
+ ret << i.iconv(nil)
64
+ i.close
65
+ assert_equal "\x82\xD9\x82\xB0".b, ret
66
+ end
59
67
  end
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.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - NARUSE, Yui
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-10 00:00:00.000000000 Z
11
+ date: 2019-01-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: iconv wrapper library
14
14
  email:
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  requirements: []
57
- rubygems_version: 3.0.1
57
+ rubygems_version: 3.0.0.beta3
58
58
  signing_key:
59
59
  specification_version: 4
60
60
  summary: iconv wrapper library