json 2.6.1 → 2.6.3

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: 28754306f4a5a73cb18a8a02a519b8efcfb84ff59c2cece37ba9c37dd157c29c
4
- data.tar.gz: 3bdeda4996bde6e7f28e55cfd47dd278d5f65ed709ac5ec444da46a0fa878621
3
+ metadata.gz: dc2f560520b0ab901bb8e064664fc74f0c818947048be8519ec8828c14573009
4
+ data.tar.gz: 91463f0e0c677b0f431780da2362324a00d3f51baf7ea77485636dee2b400c6b
5
5
  SHA512:
6
- metadata.gz: 2b760312c30f7a69b57abc61f19ca2ca06a7d592d2dd5f51fe8d06c42763a74f91ef5474c339c4c8f8e6a1e29de1886e5e3e63ecc474ed205a9a1a49c4c1014c
7
- data.tar.gz: 54a87c4287805b5af55c34578623d79b33f7a1c04ed739e3265423153a1e95952bc888adc5c0613c6e6ba48df96aa995eff9e74cc715491200db61707d3aa356
6
+ metadata.gz: 6eea451caa191ebe5a93de37238799d2b04ce0657f23a1098243c996a1d5047322c276241c0adb8ffe60cdd8436d46488edcd7aaebb8e2065c7406b387a4b553
7
+ data.tar.gz: d5cd65f836be70cc02c078589c20c98a85995d75f71a6d02be7bedb5a43d7bc02538859f7fe621eedbe2112a29dc8bc57f995a51c336cc36b85b53a38f82becb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.6.1
1
+ 2.6.3
@@ -997,10 +997,10 @@ static void generate_json_float(FBuffer *buffer, VALUE Vstate, JSON_Generator_St
997
997
  if (!allow_nan) {
998
998
  if (isinf(value)) {
999
999
  fbuffer_free(buffer);
1000
- rb_raise(eGeneratorError, "%u: %"PRIsVALUE" not allowed in JSON", __LINE__, RB_OBJ_STRING(tmp));
1000
+ rb_raise(eGeneratorError, "%"PRIsVALUE" not allowed in JSON", RB_OBJ_STRING(tmp));
1001
1001
  } else if (isnan(value)) {
1002
1002
  fbuffer_free(buffer);
1003
- rb_raise(eGeneratorError, "%u: %"PRIsVALUE" not allowed in JSON", __LINE__, RB_OBJ_STRING(tmp));
1003
+ rb_raise(eGeneratorError, "%"PRIsVALUE" not allowed in JSON", RB_OBJ_STRING(tmp));
1004
1004
  }
1005
1005
  }
1006
1006
  fbuffer_append_str(buffer, tmp);
@@ -948,7 +948,7 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
948
948
 
949
949
  {p = p - 1; } {p+= 1; cs = 29; goto _out;}
950
950
  } else {
951
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p);
951
+ rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p);
952
952
  }
953
953
  }
954
954
  np = JSON_parse_float(json, p, pe, result);
@@ -990,7 +990,7 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
990
990
  if (json->allow_nan) {
991
991
  *result = CInfinity;
992
992
  } else {
993
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p - 8);
993
+ rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p - 8);
994
994
  }
995
995
  }
996
996
 
@@ -1002,7 +1002,7 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
1002
1002
  if (json->allow_nan) {
1003
1003
  *result = CNaN;
1004
1004
  } else {
1005
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p - 2);
1005
+ rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p - 2);
1006
1006
  }
1007
1007
  }
1008
1008
 
@@ -2348,7 +2348,7 @@ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *resul
2348
2348
  if(cs >= JSON_array_first_final) {
2349
2349
  return p + 1;
2350
2350
  } else {
2351
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p);
2351
+ rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p);
2352
2352
  return NULL;
2353
2353
  }
2354
2354
  }
@@ -2363,9 +2363,17 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
2363
2363
  char buf[4];
2364
2364
 
2365
2365
  if (bufferSize > MAX_STACK_BUFFER_SIZE) {
2366
+ # ifdef HAVE_RB_ENC_INTERNED_STR
2367
+ bufferStart = buffer = ALLOC_N(char, bufferSize ? bufferSize : 1);
2368
+ # else
2366
2369
  bufferStart = buffer = ALLOC_N(char, bufferSize);
2370
+ # endif
2367
2371
  } else {
2372
+ # ifdef HAVE_RB_ENC_INTERNED_STR
2373
+ bufferStart = buffer = ALLOCA_N(char, bufferSize ? bufferSize : 1);
2374
+ # else
2368
2375
  bufferStart = buffer = ALLOCA_N(char, bufferSize);
2376
+ # endif
2369
2377
  }
2370
2378
 
2371
2379
  while (pe < stringEnd) {
@@ -2405,7 +2413,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
2405
2413
  }
2406
2414
  rb_enc_raise(
2407
2415
  EXC_ENCODING eParserError,
2408
- "%u: incomplete unicode character escape sequence at '%s'", __LINE__, p
2416
+ "incomplete unicode character escape sequence at '%s'", p
2409
2417
  );
2410
2418
  } else {
2411
2419
  UTF32 ch = unescape_unicode((unsigned char *) ++pe);
@@ -2418,7 +2426,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
2418
2426
  }
2419
2427
  rb_enc_raise(
2420
2428
  EXC_ENCODING eParserError,
2421
- "%u: incomplete surrogate pair at '%s'", __LINE__, p
2429
+ "incomplete surrogate pair at '%s'", p
2422
2430
  );
2423
2431
  }
2424
2432
  if (pe[0] == '\\' && pe[1] == 'u') {
@@ -2950,6 +2958,7 @@ static const char MAYBE_UNUSED(_JSON_nfa_pop_trans)[] = {
2950
2958
  *
2951
2959
  * Parses the current JSON text _source_ and returns the complete data
2952
2960
  * structure as a result.
2961
+ * It raises JSON::ParseError if fail to parse.
2953
2962
  */
2954
2963
  static VALUE cParser_parse(VALUE self)
2955
2964
  {
@@ -3216,7 +3225,7 @@ static VALUE cParser_parse(VALUE self)
3216
3225
  if (cs >= JSON_first_final && p == pe) {
3217
3226
  return result;
3218
3227
  } else {
3219
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p);
3228
+ rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p);
3220
3229
  return Qnil;
3221
3230
  }
3222
3231
  }
@@ -222,14 +222,14 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
222
222
  if (json->allow_nan) {
223
223
  *result = CNaN;
224
224
  } else {
225
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p - 2);
225
+ rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p - 2);
226
226
  }
227
227
  }
228
228
  action parse_infinity {
229
229
  if (json->allow_nan) {
230
230
  *result = CInfinity;
231
231
  } else {
232
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p - 8);
232
+ rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p - 8);
233
233
  }
234
234
  }
235
235
  action parse_string {
@@ -245,7 +245,7 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
245
245
  fexec p + 10;
246
246
  fhold; fbreak;
247
247
  } else {
248
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p);
248
+ rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p);
249
249
  }
250
250
  }
251
251
  np = JSON_parse_float(json, fpc, pe, result);
@@ -447,7 +447,7 @@ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *resul
447
447
  if(cs >= JSON_array_first_final) {
448
448
  return p + 1;
449
449
  } else {
450
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p);
450
+ rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p);
451
451
  return NULL;
452
452
  }
453
453
  }
@@ -462,9 +462,17 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
462
462
  char buf[4];
463
463
 
464
464
  if (bufferSize > MAX_STACK_BUFFER_SIZE) {
465
+ # ifdef HAVE_RB_ENC_INTERNED_STR
466
+ bufferStart = buffer = ALLOC_N(char, bufferSize ? bufferSize : 1);
467
+ # else
465
468
  bufferStart = buffer = ALLOC_N(char, bufferSize);
469
+ # endif
466
470
  } else {
471
+ # ifdef HAVE_RB_ENC_INTERNED_STR
472
+ bufferStart = buffer = ALLOCA_N(char, bufferSize ? bufferSize : 1);
473
+ # else
467
474
  bufferStart = buffer = ALLOCA_N(char, bufferSize);
475
+ # endif
468
476
  }
469
477
 
470
478
  while (pe < stringEnd) {
@@ -504,7 +512,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
504
512
  }
505
513
  rb_enc_raise(
506
514
  EXC_ENCODING eParserError,
507
- "%u: incomplete unicode character escape sequence at '%s'", __LINE__, p
515
+ "incomplete unicode character escape sequence at '%s'", p
508
516
  );
509
517
  } else {
510
518
  UTF32 ch = unescape_unicode((unsigned char *) ++pe);
@@ -517,7 +525,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
517
525
  }
518
526
  rb_enc_raise(
519
527
  EXC_ENCODING eParserError,
520
- "%u: incomplete surrogate pair at '%s'", __LINE__, p
528
+ "incomplete surrogate pair at '%s'", p
521
529
  );
522
530
  }
523
531
  if (pe[0] == '\\' && pe[1] == 'u') {
@@ -839,6 +847,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
839
847
  *
840
848
  * Parses the current JSON text _source_ and returns the complete data
841
849
  * structure as a result.
850
+ * It raises JSON::ParseError if fail to parse.
842
851
  */
843
852
  static VALUE cParser_parse(VALUE self)
844
853
  {
@@ -855,7 +864,7 @@ static VALUE cParser_parse(VALUE self)
855
864
  if (cs >= JSON_first_final && p == pe) {
856
865
  return result;
857
866
  } else {
858
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p);
867
+ rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p);
859
868
  return Qnil;
860
869
  }
861
870
  }
@@ -179,7 +179,7 @@ module JSON
179
179
  bytes << c[6 * i + 2, 2].to_i(16) << c[6 * i + 4, 2].to_i(16)
180
180
  i += 1
181
181
  end
182
- JSON.iconv('utf-8', 'utf-16be', bytes)
182
+ JSON.iconv('utf-8', 'utf-16be', bytes).force_encoding(::Encoding::ASCII_8BIT)
183
183
  end
184
184
  end
185
185
  if string.respond_to?(:force_encoding)
data/lib/json/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
  module JSON
3
3
  # JSON version
4
- VERSION = '2.6.1'
4
+ VERSION = '2.6.3'
5
5
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
6
6
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
7
7
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-24 00:00:00.000000000 Z
11
+ date: 2022-12-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This is a JSON implementation as a Ruby extension in C.
14
14
  email: flori@ping.de
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  requirements: []
90
- rubygems_version: 3.3.0.dev
90
+ rubygems_version: 3.4.0.dev
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: JSON Implementation for Ruby