Граф коммитов

149 Коммитов

Автор SHA1 Сообщение Дата
akr 9d3b304b0b * pack.c (pack_unpack): add a missing break.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-10 14:52:16 +00:00
akr fb1d5520fa add comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-11 13:39:29 +00:00
akr c3c8c1e37c useless lines removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-06 13:52:03 +00:00
akr 9ff10a20b5 * pack.c: fix the prototype of rb_big2ulong_pack.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-06 13:12:24 +00:00
akr 58e8688f69 * pack.c (pack_pack): use union to avoid pointer cast.
(pack_unpack): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-28 06:08:50 +00:00
akr 334244eb5d * pack.c (pack_pack): generalized integer packer implemented.
(pack_unpack): generalized integer unpacker implemented.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-28 02:32:09 +00:00
akr 95fd5f33c0 * pack.c (swap32): use __builtin_bswap32 on gcc 4.3.0 or later.
(swap64): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-27 22:00:15 +00:00
akr 68691ab2dd * pack.c: use integer types with explicit size.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-27 15:39:20 +00:00
akr a971778b39 * pack.c: check assuption on QUAD_SIZE and SIZEOF_LONG.
* bignum.c: check assuption on SIZEOF_LONG and SIZEOF_BDIGITS.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-27 06:56:46 +00:00
akr 8c9024763f * pack.c: fix q and Q for big endian environments which have no
8 bytes integer type.
  (pack_pack): use rb_big_pack.
  (pack_unpack): use rb_big_unpack.

* include/ruby/intern.h (rb_big_pack): declared.
  (rb_big_unpack): ditto.

* bignum.c (rb_big_pack): new function.
  (rb_big_unpack): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-26 18:51:02 +00:00
akr 07298aba22 * pack.c (QUAD_SIZE): it should be always 8.
* bignum.c (rb_quad_pack): use LONG_LONG version only if
  SIZEOF_LONG_LONG == QUAD_SIZE.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-26 11:09:29 +00:00
nobu d191b742bd * pack.c (swap64): fix for VC6.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-26 07:49:21 +00:00
nobu aec58680ec * pack.c (pack_pack, pack_unpack): suppressed warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-26 05:17:13 +00:00
akr b1196bb3d8 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-25 17:27:56 +00:00
akr e599c936d8 * pack.c: consider DYNAMIC_ENDIAN. refactored.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-25 14:00:48 +00:00
akr ee43611393 remove a empty line.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-24 16:52:57 +00:00
akr 10226f6505 remove a empty line.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-24 16:29:53 +00:00
akr d3d57663a3 * pack.c (swap64): don't redefine.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-24 16:01:00 +00:00
akr e53e5edab2 * pack.c (pack_unpack): don't use OFF32 for gcc 4.5.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-24 15:32:06 +00:00
akr e8665a6bc2 * pack.c (pack_unpack): call PACK_ITEM_ADJUST for 'Q'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-18 12:53:31 +00:00
akr b9e0294eda fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 17:46:28 +00:00
nobu f517fb54c7 * pack.c (NATINT_LEN, pack_pack): suppressed warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-04 06:00:33 +00:00
nobu d1abc53721 * array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,
numeric.c, pack.c, strftime.c, string.c, thread.c, transcode.c,
  transcode_data.h, util.c, variable.c, vm_dump.c,
  include/ruby/encoding.h, missing/crypt.c, missing/vsnprintf.c:
  suppress VC type warnings.  [ruby-core:22726]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:16:15 +00:00
matz d5c7938eb4 * pack.c (pack_pack): replace all rb_Float() to rb_to_float().
[ruby-dev:37663]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-30 16:10:23 +00:00
matz ad00464489 * pack.c (pack_pack): template f should not accept non float
values.  [ruby-dev:37656]

* object.c (rb_to_float): new function to type check floats.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-29 13:40:33 +00:00
matz 9f8c309d6e * pack.c (pack_pack): encoding of packed string only from 'm',
'M', and 'u' should be US-ASCII.  [ruby-dev:37284]

* pack.c (pack_pack): encoding of packed string only from 'U'
  should be UTF-8.  also upgrade US-ASCII strings to UTF-8.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-23 15:30:05 +00:00
yugui e41fb7d4ae * pack.c (pack_pck): fixed [ruby-dev:37295].
Array#pack always has returned an US-ASCII string when
  the given format ended with 'u', 'M' or 'm'.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-09 02:51:10 +00:00
yugui 0945f41a5f * pack.c (pack_pack): fixed odd act of 'm*', 'M*', and 'P*'.
just ignores '*' in these cases.
  [ruby-dev:37289]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-08 14:41:44 +00:00
nobu 92e0f99d37 * pack.c (pack_pack): fixed length for odd length string.
[ruby-dev:37283]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-08 09:31:44 +00:00
yugui 4b983b90c4 * pack.c (pack_pack): 'u0' is not special differently from 'm0'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-06 08:55:57 +00:00
naruse 343deb4c39 * pack.c (pack_pack): set US-ASCII and CODERANGE_7BIT
when quoted-printable ('M') and base64 ('m').
  [ruby-dev:37284]

* pack.c (pack_unpack): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-06 05:37:20 +00:00
matz 408ca7cbb1 * pack.c (pack_pack): propagate taint status from format string to
result string.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-04 16:20:02 +00:00
matz 93fa4cbf3d * pack.c (pack_pack): templates a, A, Z should propagate encoding
of original strings.  templates b, B, h, H brings ASCII-8BIT to
  the result.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-30 09:19:13 +00:00
nobu 34c5cea9b5 * pack.c (pack_pack): set encoding from packing string and UTF-8 for
"U".  [ruby-core:19590]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 07:41:21 +00:00
mame 2c1c462747 * pack.c (pack_pack, pack_unpack): 'm0' format (base64) complies with
RFC 4648.  It adds no line feed when encoding, and raise ArgumentError
  if the encoded string contains non-alphabet (including CR and LF).

* lib/base64.rb: added.  This provides encoding/decoding method for
  Base64 in standard RFC 2045, Base64 in standard RFC 4648 and ``Base 64
  Encoding with URL and Filename SafeAlphabet'' in RFC 4648.

* test_pack.c, test/base64/test_base64.rb: add tests for above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-25 12:24:54 +00:00
matz 31b6ea65bb * include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM.
a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp>
  in [ruby-dev:36102].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-05 18:24:21 +00:00
akr 40c771fd45 * pack.c (encodes): make buff fixed length to avoid SEGV by
ruby -e '["a"*10000000].pack("m1000000000")'


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-04 15:06:34 +00:00
nobu 1c30bc4cca * pack.c (pack_unpack): upper half of hexdigits has never been used.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-31 03:23:55 +00:00
nobu e7207d0404 * pack.c (pack_unpack): reduced static variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-30 15:58:36 +00:00
mame df5604ce5d * pack.c (pack_unpack): fix v and V with big endian.
[1].pack("V").unpack("V") was [4294967296].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-17 11:42:17 +00:00
mame 871c83dddf * pack.c (pack_pack): fix i! with big endian. [1].pack("i!") was
"\0\0\0\0".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-17 11:36:54 +00:00
ko1 72ba13aa8e * array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,
enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c,
  io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c,
  string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c,
  vm.c, gc.c:
  allocated memory objects by xmalloc (ruby_xmalloc) should be
  freed by xfree (ruby_xfree).
* ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c,
  ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c,
  ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c,
  ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c,
  ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c:
  ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08 10:01:40 +00:00
nobu 075530a685 * suppress warnings with -Wwrite-string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31 09:28:20 +00:00
mame a0e236f606 * pack.c (pack_pack): check errno to detect error of ruby_strtoul.
* pack.c (pack_unpack): ditto.

* test/ruby/test_pack.rb: add a test for above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-17 17:56:41 +00:00
nobu 89c408704b * enumerator.c (enumerator_each, enumerator_with_index): suppress
warnings.

* pack.c (pack_unpack): ditto.

* process.c (rb_syswait): ditto.

* re.c (rb_reg_prepare_enc, rb_reg_prepare_re,
  rb_reg_adjust_startpos): ditto.

* regparse.c (onig_name_to_group_numbers): ditto.

* missing/vsnprintf.c (BSD_vfprintf): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-22 13:49:43 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
akr 0352d32f05 * util.c (ruby_strtoul): locale independent strtoul is implemented to
avoid "i".to_i(36) cause 0 under tr_TR locale.
  This is newly implemented, not a copy of missing/strtoul.c.

* include/ruby/ruby.h (ruby_strtoul): declared.
  (STRTOUL): defined to use ruby_strtoul.

* bignum.c, pack.c, ext/socket/socket.c: use STRTOUL.

* configure.in (strtoul): don't check.

* missing/strtoul.c: removed.

* include/ruby/missing.h (strtoul): removed.

* common.mk (strtoul.o): removed.

* LEGAL (missing/strtoul.c): removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-02 06:24:27 +00:00
usa e3215a7342 * pack.c (pack_pack): use NUM2LONG instead of NUM2INT.
* numeric.c (fix_lshift, fix_aref): use SIZEOF_LONG instead of
	  SIZEOF_VALUE.

	* bignum.c (big2ulong, rb_big_aref): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 18:12:24 +00:00
duerst 1b79b5be82 Thu Dec 20 17:15:15 2007 Martin Duerst <duerst@it.aoyama.ac.jp>
* pack.c: Slight change to documentation ('character' ->
	  'byte (C char)'). [ruby-core:13126], see also [ruby-core:13998].



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-20 08:16:43 +00:00
matz 65a30eb3e7 * pack.c (pack_pack): RDoc update. a patch from Gary Wright
<radar2002 AT gmail.com>.  [ruby-core:13998]

* pack.c (pack_unpack): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-11 14:05:34 +00:00