summaryrefslogtreecommitdiff
path: root/pack.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix a typo in BUG message [ci skip]Nobuyoshi Nakada2023-01-201-1/+1
|
* Add RBIMPL_ATTR_NORETURN to unknown_directivePeter Zhu2023-01-051-0/+1
| | | | | | Fixes a compiler warning about the function unknown_directive: pack.c:160:1: warning: function 'unknown_directive' could be declared with attribute 'noreturn' [-Wmissing-noreturn]
* Raise an ArgumentError for unknown pack/unpack directiveBenoit Daloze2023-01-051-1/+1
| | | | * [Bug #19150]
* Unconditionally warn "unknown pack/unpack directive"Yusuke Endoh2022-12-161-2/+2
| | | | [Bug #19150]
* [Bug #19108] Check for the encoding of pack/unpack formatNobuyoshi Nakada2022-12-011-0/+2
|
* Reduce duplication in pack by sharing code for some casesJeremy Evans2022-11-241-16/+0
| | | | | | | | | s/S, i/I, l/L, and q/Q had the same code in both cases, so combine the cases. Alternatively, we could actually the size of the unsigned type, but I doubt there are any platforms where the unsigned type is a different size than the signed type.
* Use `enum` over `int`Nobuyoshi Nakada2022-11-221-6/+7
|
* Fix bug in array pack with shared stringsJemma Issroff2022-11-101-0/+1
| | | | | If string literals are long and they become shared, we need to make them independent before we can write to them. [Bug #19116]
* Expand tabs [ci skip]Takashi Kokubun2022-07-211-1121/+1121
| | | | [Misc #18891]
* pack.c: add an offset argument to unpack and unpack1Jean Boussier2021-10-261-6/+13
| | | | | | [Feature #18254] This is useful to avoid repeteadly copying strings when parsing binary formats
* Refactor associated pointerNobuyoshi Nakada2021-10-241-43/+25
|
* Extract UNPACK_FETCHNobuyoshi Nakada2021-10-221-18/+10
|
* Moved exported symbols in internal/util.h to ruby/util.hNobuyoshi Nakada2021-08-241-1/+1
| | | | [Feature #18051]
* Escape unprintable chars only, without surrounding quotesNobuyoshi Nakada2021-07-241-5/+1
|
* RARRAY_AREF: convert into an inline function卜部昌平2020-08-151-0/+1
| | | | | | 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.
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-1/+1
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-1/+1
| | | | This shall fix compile errors.
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-1/+1
| | | Split ruby.h
* Separate builtin initialization callsNobuyoshi Nakada2019-12-291-2/+0
|
* decouple internal.h headers卜部昌平2019-12-261-3/+11
| | | | | | | | | | | | | | | | | | 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).
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-181-26/+7
| | | | | | 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.
* try to remove vm_core.hKoichi Sasada2019-11-141-1/+0
|
* Try to fix error on solarisKazuhiro NISHIYAMA2019-11-131-0/+1
| | | | | | | | | | | | | | | 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 ```
* Rubified the APIs of pack.cYusuke Endoh2019-11-081-295/+14
|
* Added some examples to the documentation for String#unpack1 becauseiain barnett2019-08-091-0/+14
| | | | there are currently no examples and to contrast with String#unpack.
* Fix documentation for Array#pack m directive count specifier [ci skip]Jeremy Evans2019-07-221-1/+3
| | | | Fixes [Bug #10025]
* [DOC] fix markups [ci skip]nobu2019-03-281-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* pack.c: cast from double to float can be undefinedshyouhei2018-11-161-3/+24
| | | | | | | | | | | | | | | | 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
* pack.c: refine warningnobu2018-11-161-12/+23
| | | | | | | * 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
* pack.c: adjust indent [ci skip]nobu2018-11-161-18/+18
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * expand tabs.svn2018-10-171-7/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* infect taint flag on Array#pack and String#unpacknagachika2018-10-171-0/+7
| | | | | | | | | | 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
* UNREACHABLE_RETURNnobu2018-07-241-1/+1
| | | | | | | * 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
* pack/unpack M only handles LF line breaks [Feature #14352]naruse2018-04-191-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* pack.c: fix underflownobu2018-03-281-1/+1
| | | | | | | * 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
* internal.h: remove dependecy on ruby/encoding.hnobu2018-01-091-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Workaround for optimization bug of Oracle Developer Studio 12.4-12.6ngoto2017-12-191-2/+3
| | | | | | | | | | * 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
* pack.c: unpack "M" may be ASCII onlynobu2017-09-291-3/+5
| | | | | | | * 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
* Workaround for optimization bug of Oracle Solaris Studio 12.4 and 12.5ngoto2017-04-141-2/+2
| | | | | | | | | | * 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
* backward.h: 2.2 deprecated featuresnobu2017-02-211-12/+0
| | | | | | | * 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
* DEPRECATED_INTERNAL_FEATUREnobu2017-02-171-2/+2
| | | | | | | | | * 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
* pack.c: avoid returning uninitialized Stringrhe2016-12-261-4/+8
| | | | | | | | | | 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
* Remove unused variablenaruse2016-12-011-2/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* String#unpack1 [Feature #12752]naruse2016-12-011-125/+155
| | | | | | Returns the first value of String#unpack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Remove `offset:` from `Array#pack`usa2016-12-011-30/+9
| | | | | | | * 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
* Supports `buffer` and `offset` in `Array#pack`usa2016-12-011-5/+56
| | | | | | | | * 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
* pack.c: simplifynobu2016-11-121-13/+3
| | | | | | | | | | * 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
* [DOC] table format refined.akr2016-10-251-166/+156
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* [DOC] add description of j and J for unpack.akr2016-10-251-0/+10
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * pack.c (pack_pack): use union instead of bare variable to easenaruse2016-07-051-149/+54
| | | | | | | | | 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