summaryrefslogtreecommitdiff
path: root/pack.c
AgeCommit message (Collapse)Author
2015-11-13* pack.c (pack_unpack, AVOID_CC_BUG): Very ugly workaround forngoto
optimization bug of Oracle Solaris Studio 12.4 on Solaris with -xO4 optimization option. [Bug #11684] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-12* pack.c (pack_{un,}pack): new template character `j` and `J`, pointerusa
with signed and unsigned integers. * NEWS: mention bout this featre. [Feature #11215] [ruby-dev:49015] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-13util.c: hexdigitnobu
* util.c (hexdigit): extract identical constants. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15* internal.h: Include ruby.h and ruby/encoding.h to beakr
includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-06pack.c: escape and encodingnobu
* pack.c (pack_pack): escape unprintable characters and preserve the encoding of warning message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-17* pack.c (pack_unpack): Add casts for char references for 'u'.akr
Fix line ending recognition algorithm. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-17* pack.c (pack_unpack): Add casts for char references for 'b' and 'h'.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-17* Avoid undefined behaviors found by gcc -fsanitize=undefined.akr
gcc (Debian 4.9.1-16) 4.9.1 * include/ruby/ruby.h (INT2FIX): Avoid undefined behavior. * node.h (nd_set_line): Ditto. * pack.c (encodes): Ditto. (pack_unpack): Ditto. * regint.h (BIT_STATUS_AT): Ditto. (BS_BIT): Ditto. * time.c (time_mdump): Ditto. (time_mload): Ditto. * vm_core.h (VM_FRAME_MAGIC_MASK): Ditto. * vm_trace.c (recalc_add_ruby_vm_event_flags): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10pack.c: no nil.taintnobu
* pack.c (pack_pack): nil is not taintable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-04pack.c (encodes): name a magic numbernobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-11pack.c: fix buffer overrunnobu
* pack.c (encodes): fix buffer overrun by tail_lf. Thanks to Mamoru Tasaka and Tomas Hoger. [ruby-core:63604] [Bug #10019] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-11* compile.c (BUFSIZE): Unused macro removed.akr
* vm.c (BUFSIZE): Ditto. * pack.c (INT64toNUM): Ditto. (UINT64toNUM): Ditto. (BYTEWIDTH): Ditto. * time.c (lshift): Ditto. (UINT64toNUM): Ditto. (id_lshift): Unused variable removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-11* pack.c (swaps): Unused macro removed.akr
(swapi): Ditto. (swapl): Ditto. (swapll): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-05pack.c: hide associated objectsnobu
* marshal.c (to_be_skipped_id): ignore anonymous attributes. * pack.c (Init_pack): use anonymous ID so that associated objects do not appear in the packed result. * parse.y (rb_make_internal_id): return an anonymous ID for internal use. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-04pack.c: use ivar for associated objectsnobu
* pack.c (str_associate, str_associated): keep associated objects in an instance variables, instead of in the internal structure. * string.c (rb_str_associate, rb_str_associated): deprecate. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-08* dir.c, pack.c, ruby.c, struct.c, vm_eval.c: use RARRAY_CONST_PTR().glass
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-03* internal.h (ruby_digit36_to_number_table): Declared.akr
* util.c (ruby_digit36_to_number_table): Moved from scan_digits. * bignum.c (conv_digit): Use ruby_digit36_to_number_table. * pack.c (hex2num): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22* pack.c (pack_unpack): Remove specialized unpackers for integers.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22* pack.c (num2i32): Removed.akr
(pack_pack): Don't use num2i32. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* bignum.c (bary_pack): Specialized packers implemented.akr
(HOST_BIGENDIAN_P): New macro. (ALIGNOF): New macro. (CLEAR_LOWBITS): New macro. (FILL_LOWBITS): New macro. (swap_bdigit): New macro. (bary_2comp): Returns an int. * internal.h (swap16): Moved from pack.c (swap32): Ditto. (swap64): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* pack.c (pack_pack): Move the implementation for 'c' directive afterakr
pack_integer label. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-16* bignum.c (bary_2comp): Extracted from get2comp.akr
(integer_unpack_num_bdigits): Extracted from rb_integer_unpack_internal. (bary_unpack_internal): Renamed from bary_unpack and support INTEGER_PACK_2COMP. (bary_unpack): New function to validate arguments and invoke bary_unpack_internal. (rb_integer_unpack_internal): Removed. (rb_integer_unpack): Invoke bary_unpack_internal. (rb_integer_unpack_2comp): Removed. * internal.h (rb_integer_unpack_2comp): Removed. * pack.c: Follow the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-16* internal.h (INTEGER_PACK_2COMP): Defined.akr
(rb_integer_pack_2comp): Removed. * bignum.c (bary_pack): Support INTEGER_PACK_2COMP. (rb_integer_pack): Invoke bary_pack directly. (rb_integer_pack_2comp): Removed. (rb_integer_pack_internal): Ditto. (absint_numwords_generic): Follow the above change. * pack.c (pack_pack): Ditto. * sprintf.c (rb_str_format): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12* bignum.c (rb_integer_unpack_2comp): New function.akr
(rb_integer_unpack_internal): Extracted from rb_integer_unpack and nlp_bits_ret argument added. (integer_unpack_num_bdigits_small): nlp_bits_ret argument added to return number of leading padding bits. (integer_unpack_num_bdigits_generic): Ditto. * internal.h (rb_integer_unpack_2comp): Declared. * pack.c (pack_unpack): Use rb_integer_unpack_2comp and rb_integer_unpack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12* pack.c (pack_pack): Use rb_integer_pack_2comp.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-11* internal.h (INTEGER_PACK_NEGATIVE): Defined.akr
(rb_integer_unpack): sign argument removed. * bignum.c (rb_integer_unpack): sign argument removed. Non-negative integers generated by default. INTEGER_PACK_NEGATIVE flag is used to generate non-positive integers. * pack.c (pack_unpack): Follow the above change. * random.c (int_pair_to_real_inclusive): Ditto. (make_seed_value): Ditto. (mt_state): Ditto. (limited_big_rand): Ditto. * marshal.c (r_object0): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-10* bignum.c (rb_integer_pack): Returns sign instead of words.akr
(absint_numwords_generic): Follow the above change. (big2str_base_powerof2): Follow the above change. * internal.h: Ditto. * hash.c (rb_hash): Ditto. * pack.c (pack_pack): Ditto. * random.c (int_pair_to_real_inclusive): Ditto. (rand_init): Ditto. (random_load): Ditto. (limited_big_rand): Ditto. * time.c (v2w_bignum): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-09* bignum.c (rb_absint_numwords): Renamed from rb_absint_size_in_word.akr
* internal.h (rb_absint_numwords): Follow the above change. * pack.c (pack_pack): Ditto. * random.c (rand_init): Ditto. (limited_big_rand): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-09* bignum.c (rb_integer_pack): numwords_allocated argument removed.akr
* internal.h (rb_integer_pack): Follow the above change. * hash.c (rb_hash): Ditto. * time.c (v2w_bignum): Ditto. * pack.c (pack_pack): Ditto. * random.c (int_pair_to_real_inclusive): Ditto. (rand_init): Ditto. (random_load): Ditto. (limited_big_rand): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07* bignum.c (rb_integer_pack): Arguments changed. Use flags toakr
specify word order and byte order. (rb_integer_unpack): Ditto. (validate_integer_format): Follow the above change. (integer_format_loop_setup): Ditto. * pack.c: Ditto. * internal.h: Ditto. (INTEGER_PACK_MSWORD_FIRST): Defined. (INTEGER_PACK_LSWORD_FIRST): Ditto. (INTEGER_PACK_MSBYTE_FIRST): Ditto. (INTEGER_PACK_LSBYTE_FIRST): Ditto. (INTEGER_PACK_NATIVE_BYTE_ORDER): Ditto. (INTEGER_PACK_LITTLE_ENDIAN): Ditto. (INTEGER_PACK_BIG_ENDIAN): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07* bignum.c (rb_integer_pack): Renamed from rb_int_export.akr
(rb_integer_unpack): Renamed from rb_int_import. * internal.h, pack.c: Follow the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-06* internal.h (rb_int_export): countp argument is split intoakr
wordcount_allocated and wordcount. * bignum.c (rb_int_export): Follow the above change. * pack.c (pack_pack): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-06* bignum.c (rb_int_import): New function.akr
(int_import_push_bits): Ditto. * internal.h (rb_int_import): Declared. * pack.c (pack_unpack): Use rb_int_import for BER compressed integer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-06* configure.in: Invoke RUBY_REPLACE_TYPE for size_t.akr
Don't invoke RUBY_CHECK_PRINTF_PREFIX for size_t to avoid conflict with RUBY_REPLACE_TYPE. * internal.h (rb_absint_size): Declared. (rb_absint_size_in_word): Ditto. (rb_int_export): Ditto. * bignum.c (rb_absint_size): New function. (rb_absint_size_in_word): Ditto. (int_export_fill_dd): Ditto. (int_export_take_lowbits): Ditto. (rb_int_export): Ditto. * pack.c (pack_pack): Use rb_int_export for BER compressed integer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* *.c, parse.y, insns.def: use RARRAY_AREF/ASET macroko1
instead of using RARRAY_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-07* pack.c (swap32): Don't redefine it if it is already defined.akr
Bionic defines it. (swap64): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-18pack.c: refix unpack base64nobu
* pack.c (pack_unpack): increase buffer size to fix buffer overflow, and fix garbages just after unpacking without missing paddings. [Bug #8286] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-18Increase capacity for skipping paddingsnaruse
fix for r40342 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-18* pack.c (pack_unpack): output characters even if the input doesn'tnaruse
have paddings. [Bug #8286] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-12* bignum.c (ones): Use __builtin_popcountl if available.akr
* internal.h (GCC_VERSION_SINCE): Macro moved from pack.c. * pack.c: Include internal.h for GCC_VERSION_SINCE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-06pack.c: fix definition ordernobu
* pack.c (NATINT_LEN): fix definition order, must be after NATINT_PACK. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-05Add a comment.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-05update comments.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-05* include/ruby/defines.h (HAVE_TRUE_LONG_LONG): Defined to distinguishakr
availability of long long and availability of 64bit integer type. * pack.c: Use HAVE_TRUE_LONG_LONG to distinguish q! and Q! support. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-05pack.c: use LONG_LONGnobu
* pack.c (NATINT_LEN_Q): do not use long long directly, use LONG_LONG instead. fix compilation error on mswin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-02* pack.c: Support Q! and q! for long long.akr
(natstr): Moved to toplevel. Add q and Q if there is long long type. (endstr): Moved to toplevel. (NATINT_PACK): Consider long long. (NATINT_LEN_Q): New macro. (pack_pack): Support Q! and q!. (pack_unpack): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-19set encoding to ASCII for appropriate String#unpack modifierseregon
* pack.c (pack_unpack): set encoding of the 'H','h','B' and 'B' modifiers to US-ASCII. * test/ruby/test_pack.rb: tests for the above. [ruby-core:47653][Bug #7050] * test/test_securerandom.rb: tests for SecureRandom.hex from tenderlove. [ruby-core:46792][Bug #6799] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-14* pack.c: fix typo.eregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-24test_pack.rb: fix assertionnobu
* pack.c (pack_unpack): fix indent. * test/ruby/test_pack.rb (test_pack_unpack_M): fix assertion. ignore invalid quoted-printable and just skip. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-18pack.c: round down too long uuencode widthnobu
* pack.c (pack_pack): round down too long uuencode width. folding width in uuencode format cannot be longer than 63 bytes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e