ox 2.4.2 → 2.4.3
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.
Potentially problematic release.
This version of ox might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/ext/ox/buf.h +1 -1
- data/ext/ox/builder.c +29 -5
- data/ext/ox/cache8.c +5 -3
- data/ext/ox/cache8.h +1 -1
- data/ext/ox/ox.c +14 -6
- data/lib/ox/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: d290437be6f76cdfe1bafdad90ec6a057e1e028a
         | 
| 4 | 
            +
              data.tar.gz: 082a458a1848f01a68455b687ee155ab7eb81ddf
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4c6b1a63c3df6dd7c06ee00366dd871aea2153794d70b815f3d1582b032866d57310f22225a8f35e03529a3decb89f282b9b50bf5185865d11b3d1b72924cb55
         | 
| 7 | 
            +
              data.tar.gz: 7e7a0ed99dfa2f85335a7e68d85346385852e89f55b3fcc0a47a059de8c2fb28345f5bbdc69889d13af9cfad1ef8d6058a512a035e9622ac94bb9f9b17862c39
         | 
    
        data/README.md
    CHANGED
    
    | @@ -34,6 +34,12 @@ A fast XML parser and Object marshaller as a Ruby gem. | |
| 34 34 |  | 
| 35 35 | 
             
            ## Release Notes
         | 
| 36 36 |  | 
| 37 | 
            +
            ### Release 2.4.3
         | 
| 38 | 
            +
             | 
| 39 | 
            +
             - Fixed compiler warnings and errors.
         | 
| 40 | 
            +
             | 
| 41 | 
            +
             - Updated for Ruby 2.4.0.
         | 
| 42 | 
            +
             | 
| 37 43 | 
             
            ### Release 2.4.2
         | 
| 38 44 |  | 
| 39 45 | 
             
             - Added methods to Ox::Builder to provide output position information.
         | 
    
        data/ext/ox/buf.h
    CHANGED
    
    | @@ -45,7 +45,7 @@ typedef struct _Buf { | |
| 45 45 |  | 
| 46 46 | 
             
            inline static void
         | 
| 47 47 | 
             
            buf_init(Buf buf, int fd, long initial_size) {
         | 
| 48 | 
            -
                if (sizeof(buf->base) < initial_size) {
         | 
| 48 | 
            +
                if (sizeof(buf->base) < (size_t)initial_size) {
         | 
| 49 49 | 
             
            	buf->head = ALLOC_N(char, initial_size);
         | 
| 50 50 | 
             
            	buf->end = buf->head + initial_size - 1;
         | 
| 51 51 | 
             
                } else {
         | 
    
        data/ext/ox/builder.c
    CHANGED
    
    | @@ -67,7 +67,7 @@ append_indent(Builder b) { | |
| 67 67 | 
             
                if (b->buf.head < b->buf.tail) {
         | 
| 68 68 | 
             
            	int	cnt = (b->indent * (b->depth + 1)) + 1;
         | 
| 69 69 |  | 
| 70 | 
            -
            	if (sizeof(indent_spaces) <= | 
| 70 | 
            +
            	if (sizeof(indent_spaces) <=  (size_t)cnt) {
         | 
| 71 71 | 
             
            	    cnt = sizeof(indent_spaces) - 1;
         | 
| 72 72 | 
             
            	}
         | 
| 73 73 | 
             
            	buf_append_string(&b->buf, indent_spaces, cnt);
         | 
| @@ -87,7 +87,7 @@ append_string(Builder b, const char *str, size_t size) { | |
| 87 87 |  | 
| 88 88 | 
             
            	buf_append_string(&b->buf, str, size);
         | 
| 89 89 | 
             
            	b->col += size;
         | 
| 90 | 
            -
            	while (NULL != (s =  | 
| 90 | 
            +
            	while (NULL != (s = strchr(s, '\n'))) {
         | 
| 91 91 | 
             
            	    b->line++;
         | 
| 92 92 | 
             
            	    b->col = end - s;
         | 
| 93 93 | 
             
            	}
         | 
| @@ -326,13 +326,21 @@ builder_new(int argc, VALUE *argv, VALUE self) { | |
| 326 326 |  | 
| 327 327 | 
             
            	rb_check_type(*argv, T_HASH);
         | 
| 328 328 | 
             
            	if (Qnil != (v = rb_hash_lookup(*argv, ox_indent_sym))) {
         | 
| 329 | 
            +
            #ifdef RUBY_INTEGER_UNIFICATION
         | 
| 330 | 
            +
            	    if (rb_cInteger != rb_obj_class(v)) {
         | 
| 331 | 
            +
            #else
         | 
| 329 332 | 
             
            	    if (rb_cFixnum != rb_obj_class(v)) {
         | 
| 333 | 
            +
            #endif
         | 
| 330 334 | 
             
            		rb_raise(ox_parse_error_class, ":indent must be a fixnum.\n");
         | 
| 331 335 | 
             
            	    }
         | 
| 332 336 | 
             
            	    indent = NUM2INT(v);
         | 
| 333 337 | 
             
            	}
         | 
| 334 338 | 
             
            	if (Qnil != (v = rb_hash_lookup(*argv, ox_size_sym))) {
         | 
| 339 | 
            +
            #ifdef RUBY_INTEGER_UNIFICATION
         | 
| 340 | 
            +
            	    if (rb_cInteger != rb_obj_class(v)) {
         | 
| 341 | 
            +
            #else
         | 
| 335 342 | 
             
            	    if (rb_cFixnum != rb_obj_class(v)) {
         | 
| 343 | 
            +
            #endif
         | 
| 336 344 | 
             
            		rb_raise(ox_parse_error_class, ":size must be a fixnum.\n");
         | 
| 337 345 | 
             
            	    }
         | 
| 338 346 | 
             
            	    buf_size = NUM2LONG(v);
         | 
| @@ -382,13 +390,21 @@ builder_file(int argc, VALUE *argv, VALUE self) { | |
| 382 390 |  | 
| 383 391 | 
             
            	rb_check_type(argv[1], T_HASH);
         | 
| 384 392 | 
             
            	if (Qnil != (v = rb_hash_lookup(argv[1], ox_indent_sym))) {
         | 
| 393 | 
            +
            #ifdef RUBY_INTEGER_UNIFICATION
         | 
| 394 | 
            +
            	    if (rb_cInteger != rb_obj_class(v)) {
         | 
| 395 | 
            +
            #else
         | 
| 385 396 | 
             
            	    if (rb_cFixnum != rb_obj_class(v)) {
         | 
| 397 | 
            +
            #endif
         | 
| 386 398 | 
             
            		rb_raise(ox_parse_error_class, ":indent must be a fixnum.\n");
         | 
| 387 399 | 
             
            	    }
         | 
| 388 400 | 
             
            	    indent = NUM2INT(v);
         | 
| 389 401 | 
             
            	}
         | 
| 390 402 | 
             
            	if (Qnil != (v = rb_hash_lookup(argv[1], ox_size_sym))) {
         | 
| 403 | 
            +
            #ifdef RUBY_INTEGER_UNIFICATION
         | 
| 404 | 
            +
            	    if (rb_cInteger != rb_obj_class(v)) {
         | 
| 405 | 
            +
            #else
         | 
| 391 406 | 
             
            	    if (rb_cFixnum != rb_obj_class(v)) {
         | 
| 407 | 
            +
            #endif
         | 
| 392 408 | 
             
            		rb_raise(ox_parse_error_class, ":size must be a fixnum.\n");
         | 
| 393 409 | 
             
            	    }
         | 
| 394 410 | 
             
            	    buf_size = NUM2LONG(v);
         | 
| @@ -437,13 +453,21 @@ builder_io(int argc, VALUE *argv, VALUE self) { | |
| 437 453 |  | 
| 438 454 | 
             
            	rb_check_type(argv[1], T_HASH);
         | 
| 439 455 | 
             
            	if (Qnil != (v = rb_hash_lookup(argv[1], ox_indent_sym))) {
         | 
| 456 | 
            +
            #ifdef RUBY_INTEGER_UNIFICATION
         | 
| 457 | 
            +
            	    if (rb_cInteger != rb_obj_class(v)) {
         | 
| 458 | 
            +
            #else
         | 
| 440 459 | 
             
            	    if (rb_cFixnum != rb_obj_class(v)) {
         | 
| 460 | 
            +
            #endif
         | 
| 441 461 | 
             
            		rb_raise(ox_parse_error_class, ":indent must be a fixnum.\n");
         | 
| 442 462 | 
             
            	    }
         | 
| 443 463 | 
             
            	    indent = NUM2INT(v);
         | 
| 444 464 | 
             
            	}
         | 
| 445 465 | 
             
            	if (Qnil != (v = rb_hash_lookup(argv[1], ox_size_sym))) {
         | 
| 466 | 
            +
            #ifdef RUBY_INTEGER_UNIFICATION
         | 
| 467 | 
            +
            	    if (rb_cInteger != rb_obj_class(v)) {
         | 
| 468 | 
            +
            #else
         | 
| 446 469 | 
             
            	    if (rb_cFixnum != rb_obj_class(v)) {
         | 
| 470 | 
            +
            #endif
         | 
| 447 471 | 
             
            		rb_raise(ox_parse_error_class, ":size must be a fixnum.\n");
         | 
| 448 472 | 
             
            	    }
         | 
| 449 473 | 
             
            	    buf_size = NUM2LONG(v);
         | 
| @@ -570,7 +594,7 @@ builder_element(int argc, VALUE *argv, VALUE self) { | |
| 570 594 | 
             
            	break;
         | 
| 571 595 | 
             
                }
         | 
| 572 596 | 
             
                e = &b->stack[b->depth];
         | 
| 573 | 
            -
                if (sizeof(e->buf) <= len) {
         | 
| 597 | 
            +
                if (sizeof(e->buf) <= (size_t)len) {
         | 
| 574 598 | 
             
            	e->name = strdup(name);
         | 
| 575 599 | 
             
            	*e->buf = '\0';
         | 
| 576 600 | 
             
                } else {
         | 
| @@ -689,7 +713,7 @@ builder_cdata(VALUE self, VALUE data) { | |
| 689 713 | 
             
                b->pos += 9;
         | 
| 690 714 | 
             
                buf_append_string(&b->buf, str, len);
         | 
| 691 715 | 
             
                b->col += len;
         | 
| 692 | 
            -
                while (NULL != (s =  | 
| 716 | 
            +
                while (NULL != (s = strchr(s, '\n'))) {
         | 
| 693 717 | 
             
            	b->line++;
         | 
| 694 718 | 
             
            	b->col = end - s;
         | 
| 695 719 | 
             
                }
         | 
| @@ -726,7 +750,7 @@ builder_raw(VALUE self, VALUE text) { | |
| 726 750 | 
             
                i_am_a_child(b, true);
         | 
| 727 751 | 
             
                buf_append_string(&b->buf, str, len);
         | 
| 728 752 | 
             
                b->col += len;
         | 
| 729 | 
            -
                while (NULL != (s =  | 
| 753 | 
            +
                while (NULL != (s = strchr(s, '\n'))) {
         | 
| 730 754 | 
             
            	b->line++;
         | 
| 731 755 | 
             
            	b->col = end - s;
         | 
| 732 756 | 
             
                }
         | 
    
        data/ext/ox/cache8.c
    CHANGED
    
    | @@ -27,7 +27,7 @@ struct _Cache8 { | |
| 27 27 | 
             
            };
         | 
| 28 28 |  | 
| 29 29 | 
             
            static void	cache8_delete(Cache8 cache, int depth);
         | 
| 30 | 
            -
            static void	slot_print(Cache8 cache, sid_t key, unsigned int depth);
         | 
| 30 | 
            +
            //static void	slot_print(Cache8 cache, sid_t key, unsigned int depth);
         | 
| 31 31 |  | 
| 32 32 | 
             
            void
         | 
| 33 33 | 
             
            ox_cache8_new(Cache8 *cache) {
         | 
| @@ -80,9 +80,10 @@ ox_cache8_get(Cache8 cache, sid_t key, slot_t **slot) { | |
| 80 80 | 
             
                return **slot;
         | 
| 81 81 | 
             
            }
         | 
| 82 82 |  | 
| 83 | 
            +
            #if 0
         | 
| 83 84 | 
             
            void
         | 
| 84 85 | 
             
            ox_cache8_print(Cache8 cache) {
         | 
| 85 | 
            -
                 | 
| 86 | 
            +
                //printf("-------------------------------------------\n");
         | 
| 86 87 | 
             
                slot_print(cache, 0, 0);
         | 
| 87 88 | 
             
            }
         | 
| 88 89 |  | 
| @@ -96,7 +97,7 @@ slot_print(Cache8 c, sid_t key, unsigned int depth) { | |
| 96 97 | 
             
                for (i = 0, b = c->buckets; i < SLOT_CNT; i++, b++) {
         | 
| 97 98 | 
             
            	if (0 != b->child) {
         | 
| 98 99 | 
             
            	    k = (k8 << BITS) | i;
         | 
| 99 | 
            -
            	     | 
| 100 | 
            +
            	    //printf("*** key: 0x%016llx  depth: %u  i: %u\n", k, depth, i);
         | 
| 100 101 | 
             
            	    if (DEPTH - 1 == depth) {
         | 
| 101 102 | 
             
            		printf("0x%016llx: %4llu\n", (unsigned long long)k, (unsigned long long)b->value);
         | 
| 102 103 | 
             
            	    } else {
         | 
| @@ -105,3 +106,4 @@ slot_print(Cache8 c, sid_t key, unsigned int depth) { | |
| 105 106 | 
             
            	}
         | 
| 106 107 | 
             
                }
         | 
| 107 108 | 
             
            }
         | 
| 109 | 
            +
            #endif
         | 
    
        data/ext/ox/cache8.h
    CHANGED
    
    
    
        data/ext/ox/ox.c
    CHANGED
    
    | @@ -509,7 +509,7 @@ set_def_opts(VALUE self, VALUE opts) { | |
| 509 509 |  | 
| 510 510 | 
             
            	Check_Type(v, T_STRING);
         | 
| 511 511 | 
             
            	slen = RSTRING_LEN(v);
         | 
| 512 | 
            -
            	if (sizeof(ox_default_options.inv_repl) - 2 < | 
| 512 | 
            +
            	if (sizeof(ox_default_options.inv_repl) - 2 <  (size_t)slen) {
         | 
| 513 513 | 
             
            	    rb_raise(ox_parse_error_class, ":invalid_replace can be no longer than %ld characters.",
         | 
| 514 514 | 
             
            		     sizeof(ox_default_options.inv_repl) - 2);
         | 
| 515 515 | 
             
            	}
         | 
| @@ -530,7 +530,7 @@ set_def_opts(VALUE self, VALUE opts) { | |
| 530 530 |  | 
| 531 531 | 
             
            	Check_Type(v, T_STRING);
         | 
| 532 532 | 
             
            	slen = RSTRING_LEN(v);
         | 
| 533 | 
            -
            	if (sizeof(ox_default_options.strip_ns) - 1 < | 
| 533 | 
            +
            	if (sizeof(ox_default_options.strip_ns) - 1 <  (size_t)slen) {
         | 
| 534 534 | 
             
            	    rb_raise(ox_parse_error_class, ":strip_namespace can be no longer than %ld characters.",
         | 
| 535 535 | 
             
            		     sizeof(ox_default_options.strip_ns) - 1);
         | 
| 536 536 | 
             
            	}
         | 
| @@ -720,7 +720,7 @@ load(char *xml, int argc, VALUE *argv, VALUE self, VALUE encoding, Err err) { | |
| 720 720 |  | 
| 721 721 | 
             
            	    Check_Type(v, T_STRING);
         | 
| 722 722 | 
             
            	    slen = RSTRING_LEN(v);
         | 
| 723 | 
            -
            	    if (sizeof(options.inv_repl) - 2 < | 
| 723 | 
            +
            	    if (sizeof(options.inv_repl) - 2 <  (size_t)slen) {
         | 
| 724 724 | 
             
            		rb_raise(ox_parse_error_class, ":invalid_replace can be no longer than %ld characters.",
         | 
| 725 725 | 
             
            			 sizeof(options.inv_repl) - 2);
         | 
| 726 726 | 
             
            	    }
         | 
| @@ -740,7 +740,7 @@ load(char *xml, int argc, VALUE *argv, VALUE self, VALUE encoding, Err err) { | |
| 740 740 |  | 
| 741 741 | 
             
            	    Check_Type(v, T_STRING);
         | 
| 742 742 | 
             
            	    slen = RSTRING_LEN(v);
         | 
| 743 | 
            -
            	    if (sizeof(options.strip_ns) - 1 < | 
| 743 | 
            +
            	    if (sizeof(options.strip_ns) - 1 <  (size_t)slen) {
         | 
| 744 744 | 
             
            		rb_raise(ox_parse_error_class, ":strip_namespace can be no longer than %ld characters.",
         | 
| 745 745 | 
             
            			 sizeof(options.strip_ns) - 1);
         | 
| 746 746 | 
             
            	    }
         | 
| @@ -980,7 +980,7 @@ sax_parse(int argc, VALUE *argv, VALUE self) { | |
| 980 980 |  | 
| 981 981 | 
             
            		Check_Type(v, T_STRING);
         | 
| 982 982 | 
             
            		slen = RSTRING_LEN(v);
         | 
| 983 | 
            -
            		if (sizeof(options.strip_ns) - 1 < | 
| 983 | 
            +
            		if (sizeof(options.strip_ns) - 1 <  (size_t)slen) {
         | 
| 984 984 | 
             
            		    rb_raise(ox_parse_error_class, ":strip_namespace can be no longer than %ld characters.",
         | 
| 985 985 | 
             
            			     sizeof(options.strip_ns) - 1);
         | 
| 986 986 | 
             
            		}
         | 
| @@ -1085,13 +1085,21 @@ parse_dump_options(VALUE ropts, Options copts) { | |
| 1085 1085 | 
             
            	VALUE	v;
         | 
| 1086 1086 |  | 
| 1087 1087 | 
             
            	if (Qnil != (v = rb_hash_lookup(ropts, ox_indent_sym))) {
         | 
| 1088 | 
            +
            #ifdef RUBY_INTEGER_UNIFICATION
         | 
| 1089 | 
            +
            	    if (rb_cInteger != rb_obj_class(v)) {
         | 
| 1090 | 
            +
            #else
         | 
| 1088 1091 | 
             
            	    if (rb_cFixnum != rb_obj_class(v)) {
         | 
| 1092 | 
            +
            #endif
         | 
| 1089 1093 | 
             
            		rb_raise(ox_parse_error_class, ":indent must be a Fixnum.\n");
         | 
| 1090 1094 | 
             
            	    }
         | 
| 1091 1095 | 
             
            	    copts->indent = NUM2INT(v);
         | 
| 1092 1096 | 
             
            	}
         | 
| 1093 1097 | 
             
            	if (Qnil != (v = rb_hash_lookup(ropts, trace_sym))) {
         | 
| 1098 | 
            +
            #ifdef RUBY_INTEGER_UNIFICATION
         | 
| 1099 | 
            +
            	    if (rb_cInteger != rb_obj_class(v)) {
         | 
| 1100 | 
            +
            #else
         | 
| 1094 1101 | 
             
            	    if (rb_cFixnum != rb_obj_class(v)) {
         | 
| 1102 | 
            +
            #endif
         | 
| 1095 1103 | 
             
            		rb_raise(ox_parse_error_class, ":trace must be a Fixnum.\n");
         | 
| 1096 1104 | 
             
            	    }
         | 
| 1097 1105 | 
             
            	    copts->trace = NUM2INT(v);
         | 
| @@ -1123,7 +1131,7 @@ parse_dump_options(VALUE ropts, Options copts) { | |
| 1123 1131 |  | 
| 1124 1132 | 
             
            	    Check_Type(v, T_STRING);
         | 
| 1125 1133 | 
             
            	    slen = RSTRING_LEN(v);
         | 
| 1126 | 
            -
            	    if (sizeof(copts->inv_repl) - 2 < | 
| 1134 | 
            +
            	    if (sizeof(copts->inv_repl) - 2 <  (size_t)slen) {
         | 
| 1127 1135 | 
             
            		rb_raise(ox_parse_error_class, ":invalid_replace can be no longer than %ld characters.",
         | 
| 1128 1136 | 
             
            			 sizeof(copts->inv_repl) - 2);
         | 
| 1129 1137 | 
             
            	    }
         | 
    
        data/lib/ox/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: ox
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.4. | 
| 4 | 
            +
              version: 2.4.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Peter Ohler
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2016-06- | 
| 11 | 
            +
            date: 2016-06-26 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies: []
         | 
| 13 13 | 
             
            description: "A fast XML parser and object serializer that uses only standard C lib.\n
         | 
| 14 14 | 
             
              \           \nOptimized XML (Ox), as the name implies was written to provide speed
         |