summaryrefslogtreecommitdiff
path: root/pack.c
AgeCommit message (Collapse)Author
2020-08-15RARRAY_AREF: convert into an inline function卜部昌平
RARRAY_AREF has been a macro for reasons. We might not be able to change that for public APIs, but why not relax the situation internally to make it an inline function. Notes: Merged: https://github.com/ruby/ruby/pull/3419
2020-05-11sed -i 's|ruby/impl|ruby/internal|'卜部昌平
To fix build failures. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-05-11sed -i s|ruby/3|ruby/impl|g卜部昌平
This shall fix compile errors. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-04-08Merge pull request #2991 from shyouhei/ruby.h卜部昌平
Split ruby.h Notes: Merged-By: shyouhei <shyouhei@ruby-lang.org>
2019-12-29Separate builtin initialization callsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2792
2019-12-26decouple internal.h headers卜部昌平
Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies). Notes: Merged: https://github.com/ruby/ruby/pull/2711
2019-11-18Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans
This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby. Notes: Merged: https://github.com/ruby/ruby/pull/2476
2019-11-14try to remove vm_core.hKoichi Sasada
2019-11-13Try to fix error on solarisKazuhiro NISHIYAMA
Add vm_core.h before builtin.h to pack.c for VM_CORE_H_EC_DEFINED. https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris11s-sunc/ruby-master/log/20191112T102505Z.fail.html.gz ``` compiling dmyenc.c linking miniruby Undefined first referenced symbol in file rb_vm_lvar_exposed pack.o ld: fatal: symbol referencing errors gmake: *** [miniruby] Error 2 ```
2019-11-08Rubified the APIs of pack.cYusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/2659
2019-08-09Added some examples to the documentation for String#unpack1 becauseiain barnett
there are currently no examples and to contrast with String#unpack.
2019-07-22Fix documentation for Array#pack m directive count specifier [ci skip]Jeremy Evans
Fixes [Bug #10025]
2019-03-28[DOC] fix markups [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-16pack.c: cast from double to float can be undefinedshyouhei
Generally speaking, a value of double is not always representable when demoted to a float. ISO C defines what to do when such conversion loses precision, but leaves it undefined when the value is completely out of range. (cf: ISO/IEC 9899:1990 section 6.2.1.4). Because ruby do not have half-precision floating-point types this is not a frequent headache but for pack / unpack, there are specifiers that has something to do with C float types. We have to explicitly care these situations. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-16pack.c: refine warningnobu
* pack.c (unknown_directive): refine warning message at unknown directive in unpack too, and quote unprintable characters. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-16pack.c: adjust indent [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-17* expand tabs.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-17infect taint flag on Array#pack and String#unpacknagachika
with the directives "B", "b", "H" and "h". * pack.c (pack_pack, pack_unpack_internal): infect taint flag. * test/ruby/test_pack.rb: add test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-24UNREACHABLE_RETURNnobu
* include/ruby/ruby.h (UNREACHABLE_RETURN): UNREACHABLE at the end of non-void functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19pack/unpack M only handles LF line breaks [Feature #14352]naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28pack.c: fix underflownobu
* pack.c (pack_unpack_internal): get rid of underflow. https://hackerone.com/reports/298246 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09internal.h: remove dependecy on ruby/encoding.hnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-19Workaround for optimization bug of Oracle Developer Studio 12.4-12.6ngoto
* pack.c (pack_unpack, AVOID_CC_BUG): Very ugly workaround for optimization bug of Oracle Developer Studio (Oracle Solaris Studio) 12.4, 12.5, and 12.6 on Solaris 10 with -xO4 optimization option. [Bug #11684] [ruby-core:84351] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-29pack.c: unpack "M" may be ASCII onlynobu
* pack.c (pack_unpack_internal): set ASCII only properly on "M", may be ASCII only. [ruby-core:83055] [Bug #13949] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-14Workaround for optimization bug of Oracle Solaris Studio 12.4 and 12.5ngoto
* pack.c (pack_unpack, AVOID_CC_BUG): Very ugly workaround for optimization bug of Oracle Solaris Studio 12.4 and 12.5 (Oracle Developer Studio 12.5) on Solaris with -xO4 optimization option. [Bug #11684] [ruby-core:80690] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-21backward.h: 2.2 deprecated featuresnobu
* include/ruby/backward.h (DECLARE_DEPRECATED_FEATURE): move features deprecated at 2.2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-17DEPRECATED_INTERNAL_FEATUREnobu
* error.c (ruby_deprecated_internal_feature): renamed, to explicitly represent deprecation. * internal.h (DEPRECATED_INTERNAL_FEATURE): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-26pack.c: avoid returning uninitialized Stringrhe
Fix unpacking with 'b', 'B', 'h' and 'H' format. Do not return an uninitialized String to Ruby before filling the content bytes. Fixes r11175 ("pack.c (pack_unpack): execute block if given with unpacked value instead of creating an array", 2006-10-15). [ruby-core:78841] [Bug #13075] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-01Remove unused variablenaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-01String#unpack1 [Feature #12752]naruse
Returns the first value of String#unpack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-01Remove `offset:` from `Array#pack`usa
* pack.c (pack_pack): can use `@` instead of `offset:`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-01Supports `buffer` and `offset` in `Array#pack`usa
* pack.c (pack_pack): Supports `buffer` and `offset` in `Array#pack`. [Feature #12754] [ruby-dev:49798] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12pack.c: simplifynobu
* pack.c (str_associate): remove unnecessary branch. the argument must be a plain vanilla string object. * pack.c (str_associated): use rb_ivar_lookup to give the undefined value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-25[DOC] table format refined.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-25[DOC] add description of j and J for unpack.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-05* pack.c (pack_pack): use union instead of bare variable to easenaruse
optimizations and avoid assigning x87 floating point number. [ruby-core:74496] [Bug #12209] * pack.c (pack_unpack): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-27internal.h: ONLY_FOR_INTERNAL_USEnobu
* error.c (ruby_only_for_internal_use): raise fatal error when deprecated function only for internal use is called, not just a warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13pack.c: check index rangenobu
* pack.c (pack_pack): always check index range against the receiver array length, which can be shortened by elements conversion. reported by Marcin 'Icewall' Noga of Cisco Talos. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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