rjb 1.6.7 → 1.6.9

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: a210706c728d5d00f5c4c34fc0b4309404ec5303a5b7cd6d52264d0c0e838be5
4
- data.tar.gz: 49968075c5e92ccd2083d1943fd95dd5856b8cc6a1c2372f48f4284ce9db7ac2
3
+ metadata.gz: db68bd4fe5b0ad8ab33ded261ddfbddac69c2f1713b3be5ccec7c19bf6d504ef
4
+ data.tar.gz: 05cfef71f471a7e181964971cc9efdbf14a6be594957c8f7f2cc79d66abcb634
5
5
  SHA512:
6
- metadata.gz: 811023ee8c809b9221cf3e7c802d0697bc2bec4c8491d832fef925e65005c355967bb8429e4f3bcf195856e11a6fb46fbdb89469784746260a9d8a07d6c728fd
7
- data.tar.gz: 14ac35e925c6a0bdb09cc8ace7f1f2157e617cdafef5c64689fcb2da76bd67bfceee0638023240da35d34f51dfa9131ed508ff7df6f05346cdf8594ca09a51e2
6
+ metadata.gz: d03e67bbe85d5d21ad9368d9956d48e802d2948260f9df551ebf9c3ea5c98753400dfe0446bd0a6fa5711e1f23ce2ed3144e2529c88a6507d8d5ca01fbb91d79
7
+ data.tar.gz: 1811c379afd0cfae646b3fd055399d706e3ee94270c9585f34b0ddbe4c7225694480fce0b390e9762e54292c1d6e8d9073a7deb71e6561b3923b46f79585109b
data/ChangeLog CHANGED
@@ -1,3 +1,18 @@
1
+ Thu Nov 9 2023 arton
2
+ * ext/rjb.c
3
+ RJB_VERSION -> 1.6.9
4
+ * ext/riconv.c
5
+ fix CESU-8 check
6
+ * test/est.rb
7
+ add test_jav_hangul_syllable for checking CESU-8 bug (char start with 0xed)
8
+ Thu Sep 28 2023 chaddow
9
+ #93 fake allocation framework to remove T_DATA warning
10
+ * ext/rjb.c
11
+ call rb_undef_alloc_fund if HAV_RB_DEFINE_ALLOC_FUNC
12
+ Wed Mar 1 2023 mahendrapk
13
+ Fix typo and broken URI
14
+ * README.md
15
+ * readme.txt
1
16
  Wed Feb 15 2023 geekontheway
2
17
  Fix aarch64 checking exception
3
18
  * ext/load.c
data/ext/extconf.h CHANGED
@@ -4,5 +4,5 @@
4
4
  #define HAVE_NL_LANGINFO 1
5
5
  #define HAVE_SETLOCALE 1
6
6
  #define HAVE_GETENV 1
7
- #define RJB_RUBY_VERSION_CODE 320
7
+ #define RJB_RUBY_VERSION_CODE 322
8
8
  #endif
data/ext/riconv.c CHANGED
@@ -14,7 +14,6 @@
14
14
  *
15
15
  * $Id: riconv.c 117 2010-06-04 12:16:25Z arton $
16
16
  */
17
-
18
17
  #include "ruby.h"
19
18
  #include "extconf.h"
20
19
 
@@ -196,12 +195,15 @@ static int contains_auxchar(const unsigned char* p)
196
195
  {
197
196
  while (*p)
198
197
  {
199
- if (*p == 0xed)
198
+ if (*p == 0xed && *(p + 1) && *(p + 1))
200
199
  {
201
200
  #if defined(DEBUG)
202
- printf("find %02x %02x %02x %02x %02x %02x\n", *p, *(p + 1), *(p + 2), *(p + 3), *(p + 4), *(p + 5));
201
+ printf("find %02x %02x %02x %02x %02x %02x\n", *p, *(p + 1), *(p + 2), *(p + 3), *(p + 4), *(p + 5));
203
202
  #endif
204
- return 1;
203
+ if ((*(p + 1) & 0xa0) == 0xa0 && (*(p + 2) & 0xb0) == 0xb0)
204
+ {
205
+ return 1;
206
+ }
205
207
  }
206
208
  switch (*p & 0xe0)
207
209
  {
data/ext/rjb.c CHANGED
@@ -14,7 +14,7 @@
14
14
  *
15
15
  */
16
16
 
17
- #define RJB_VERSION "1.6.7"
17
+ #define RJB_VERSION "1.6.9"
18
18
 
19
19
  #include "ruby.h"
20
20
  #include "extconf.h"
@@ -64,6 +64,10 @@
64
64
  #define IS_RJB_OBJECT(v) (CLASS_INHERITED(rjbi, rb_obj_class(v)) || rb_obj_class(v) == rjb || CLASS_INHERITED(rjbb, rb_obj_class(v)))
65
65
  #define USER_INITIALIZE "@user_initialize"
66
66
 
67
+ #if !defined(HAVE_RB_DEFINE_ALLOC_FUNC)
68
+ static void rb_undef_alloc_func(v) {}
69
+ #endif
70
+
67
71
  static void register_class(VALUE, VALUE);
68
72
  static VALUE import_class(JNIEnv* jenv, jclass, VALUE);
69
73
  static VALUE register_instance(JNIEnv* jenv, VALUE klass, struct jv_data*, jobject);
@@ -2095,6 +2099,7 @@ static VALUE import_class(JNIEnv* jenv, jclass jcls, VALUE clsname)
2095
2099
  }
2096
2100
  }
2097
2101
  rexp = rb_define_class_under(rjb, nm, rjbc);
2102
+ rb_undef_alloc_func(rexp);
2098
2103
  ptr = ALLOC(struct jv_data);
2099
2104
  memset(ptr, 0, sizeof(struct jv_data));
2100
2105
  v = Data_Wrap_Struct(rexp, NULL, rjb_s_free, ptr);
@@ -3333,6 +3338,7 @@ void Init_rjbcore()
3333
3338
 
3334
3339
  /* Java instance object */
3335
3340
  rjbi = CLASS_NEW(rb_cObject, "Rjb_JavaProxy");
3341
+ rb_undef_alloc_func(rjbi);
3336
3342
  rb_gc_register_address(&rjbi);
3337
3343
  rb_define_method(rjbi, "method_missing", rjb_i_missing, -1);
3338
3344
  rb_define_method(rjbi, "_invoke", rjb_i_invoke, -1);
@@ -3342,6 +3348,7 @@ void Init_rjbcore()
3342
3348
 
3343
3349
  /* Ruby-Java Bridge object */
3344
3350
  rjbb = CLASS_NEW(rb_cObject, "Rjb_JavaBridge");
3351
+ rb_undef_alloc_func(rjbb);
3345
3352
  rb_gc_register_address(&rjbb);
3346
3353
 
3347
3354
  /* anonymous interface object */
data/readme.txt CHANGED
@@ -28,10 +28,10 @@ see test/readme.unix
28
28
  you must set LD_LIBRARY_PATH environmental variable to run rjb.
29
29
 
30
30
  -- Notice for opening non-ASCII 7bit filename
31
- If you'll plan to open the non-ascii character named file by Java class through Rjb, it may require to set LC_ALL environment variable in you sciprt.
31
+ If you'll plan to open the non-ascii character named file by Java class through Rjb, it may require to set LC_ALL environment variable in your script.
32
32
  For example in Rails, set above line in production.rb as your environment.
33
33
  ENV['LC_ALL'] = 'en_us.utf8' # or ja_JP.utf8 etc.
34
- cf: http://bugs.sun.com/view_bug.do?bug_id=4733494
34
+ cf: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4733494
35
35
  (Thanks Paul for this information).
36
36
 
37
37
  artonx@yahoo.co.jp
data/test/test.rb CHANGED
@@ -960,10 +960,20 @@ class TestRjb < Test::Unit::TestCase
960
960
  end
961
961
 
962
962
  def test_java_utf8
963
- y = @jString.new('𠮷野家')
963
+ y = @jString.new('𠮷野家') # with surrogate pair
964
964
  assert_equal '𠮷野家', y.toString
965
965
  end
966
966
 
967
+ def test_java_hangul_syllable
968
+ # 토 \uD1A => ED 86 A0 (utf-8)
969
+ test_string = "토" # simple unicode char (not surrogate pair)
970
+ y = @jString.new_with_sig('Ljava.lang.String;', test_string)
971
+ assert_equal(test_string, y.toString)
972
+ test_string = "토토" # simple unicode char (not surrogate pair)
973
+ y = @jString.new_with_sig('Ljava.lang.String;', test_string)
974
+ assert_equal(test_string, y.toString)
975
+ end
976
+
967
977
  def test_respond_to
968
978
  str = @jString.new('blabla')
969
979
  assert str.respond_to? :substring
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rjb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.7
4
+ version: 1.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - arton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-15 00:00:00.000000000 Z
11
+ date: 2023-11-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'RJB is a bridge program that connect between Ruby and Java with Java
14
14
  Native Interface.
15
15
 
16
- '
16
+ '
17
17
  email: artonx@gmail.com
18
18
  executables: []
19
19
  extensions:
@@ -44,10 +44,7 @@ files:
44
44
  - readme.txt
45
45
  - samples/filechooser.rb
46
46
  - samples/unzip.rb
47
- - test/anon-test-50.rb
48
47
  - test/anon-test-60.rb
49
- - test/anon.rb
50
- - test/b.rb
51
48
  - test/exttest.rb
52
49
  - test/gctest.rb
53
50
  - test/jartest.jar
@@ -71,7 +68,6 @@ files:
71
68
  - test/test_osxjvm.rb
72
69
  - test/test_osxload.rb
73
70
  - test/test_unload.rb
74
- - test/x.rb
75
71
  homepage: https://www.artonx.org/collabo/backyard/?RubyJavaBridge
76
72
  licenses:
77
73
  - LGPL-2.1-or-later
@@ -93,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
89
  requirements:
94
90
  - none
95
91
  - JDK 5.0
96
- rubygems_version: 3.4.2
92
+ rubygems_version: 3.4.10
97
93
  signing_key:
98
94
  specification_version: 4
99
95
  summary: Ruby Java bridge
data/test/anon-test-50.rb DELETED
@@ -1,13 +0,0 @@
1
- require 'rjb'
2
- Rjb::load
3
- begin
4
- Rjb::throw('java.lang.NumberFormatException', 'test')
5
- Rjb::throw(Rjb::import('java.lang.NumberFormatException').new('test'))
6
- rescue NumberFormatException => e
7
- puts "I expect a NumberFormatException to be thrown"
8
- rescue Exception => e
9
- puts "I at least expect *some* excetpion to be thrown"
10
- else
11
- puts "Unexpectedly no exception is thrown"
12
- end
13
-
data/test/anon.rb DELETED
@@ -1,23 +0,0 @@
1
- require 'rjb'
2
- Rjb::load
3
- begin
4
- Rjb::import('java.lang.Integer').parseInt('x')
5
- rescue NumberFormatException => e
6
- puts e.class
7
- puts e.message
8
- begin
9
- puts (StandardError === e).to_s
10
- raise e
11
- rescue => f
12
- puts f.class
13
- puts f.message
14
- puts f.cause.inspect
15
- puts f.exception.inspect
16
- if e.class == f.class
17
- puts "I expect the equality to be true"
18
- else
19
- puts "Unexpectedly the re-raised Java exception has changed " +
20
- "from a #{e.class} into a #{f.class}"
21
- end
22
- end
23
- end
data/test/b.rb DELETED
@@ -1,13 +0,0 @@
1
- class TestError < StandardError
2
- end
3
-
4
- begin
5
- raise TestError.new
6
- rescue => e
7
- puts e.class
8
- begin
9
- raise e, 'abc'
10
- rescue => f
11
- puts f.class
12
- end
13
- end
data/test/x.rb DELETED
@@ -1,10 +0,0 @@
1
- begin
2
- i.foo
3
- rescue => e
4
- puts e.class
5
- begin
6
- raise e
7
- rescue => f
8
- puts f.class
9
- end
10
- end