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

139 Коммитов

Автор SHA1 Сообщение Дата
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
akr 7ff702406a * include/ruby/intern.h (rb_uv_to_utf8): declared.
* re.c (rb_reg_preprocess): new function for dynamic regexp with
  \u{} such as Regexp.new("\\u{6666}").
  (rb_reg_prepare_re): preprocess regexp for recompiling.
  (read_escaped_byte): new function.
  (unescape_escaped_nonascii): new function.
  (append_utf8): new function.
  (unescape_unicode_list): new function.
  (unescape_unicode_bmp): new function.
  (unescape_nonascii): new function.
  (rb_reg_initialize): preprocess regexp.

* pack.c (rb_uv_to_utf8): renamed from uv_to_utf8.

* parse.y (STR_NEW3): take func instead of has8 and hasmb.
  (parser_str_new): use default coderange mechanism except for regexp.
  (parser_tokadd_utf8): copy regexp source as-is.
  (parser_read_escape): UTF-8 stuff removed.
  (parser_tokadd_escape): has8bit and hasmb removed.
  (parser_tokadd_string): fix 8-bit single byte character with \u.
  (parser_parse_string): has8bit and hasmb removed.
  (parser_here_document): has8bit and hasmb removed.
  (parser_yylex): call parser_tokadd_utf8 instead of read_escape for
  UTF-8 character.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-01 16:56:19 +00:00
ko1 25c0cb981a * include/ruby/ruby.h: introduce 2 macros:
RFLOAT_VALUE(v), DOUBLE2NUM(dbl).
  Rename RFloat#value -> RFloat#double_value.
  Do not touch RFloat#double_value directly.
* bignum.c, insns.def, marshal.c, math.c, numeric.c, object.c,
  pack.c, parse.y, process.c, random.c, sprintf.c, string.c,
  time.c: apply above changes.
* ext/dl/mkcallback.rb, ext/json/ext/generator/generator.c:
  ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-13 16:00:53 +00:00
matz a25fbe3b3e * encoding.c: provide basic features for M17N.
* parse.y: encoding aware parsing.

* parse.y (pragma_encoding): encoding specification pragma.

* parse.y (rb_intern3): encoding specified symbols.

* string.c (rb_str_length): length based on characters.  
  for older behavior, bytesize method added.

* string.c (rb_str_index_m): index based on characters.  rindex as
  well.

* string.c (succ_char): encoding aware succeeding string.

* string.c (rb_str_reverse): reverse based on characters.

* string.c (rb_str_inspect): encoding aware string description.

* string.c (rb_str_upcase_bang): encoding aware case conversion.
  downcase, capitalize, swapcase as well.

* string.c (rb_str_tr_bang): tr based on characters.  delete,
  squeeze, tr_s, count as well.

* string.c (rb_str_split_m): split based on characters.

* string.c (rb_str_each_line): encoding aware each_line.

* string.c (rb_str_each_char): added.  iteration based on
  characters.

* string.c (rb_str_strip_bang): encoding aware whitespace
  stripping.  lstrip, rstrip as well.

* string.c (rb_str_justify): encoding aware justifying (ljust,
  rjust, center).

* string.c (str_encoding): get encoding attribute from a string. 

* re.c (rb_reg_initialize): encoding aware regular expression

* sprintf.c (rb_str_format): formatting (i.e. length count) based
  on characters.

* io.c (rb_io_getc): getc to return one-character string.
  for older behavior, getbyte method added.

* ext/stringio/stringio.c (strio_getc): ditto.

* io.c (rb_io_ungetc): allow pushing arbitrary string at the
  current reading point.

* ext/stringio/stringio.c (strio_ungetc): ditto.

* ext/strscan/strscan.c: encoding support.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 03:29:39 +00:00
nobu 2b592580bf * include/ruby: moved public headers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-10 03:06:15 +00:00
nobu 194a01a484 * compile.c: fixed indentation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-05 04:49:54 +00:00
nobu 99d65b14b4 * compile.c, dir.c, eval.c, eval_jump.h, eval_method.h, numeric.c,
pack.c, parse.y, re.c, thread.c, vm.c, vm_dump.c, call_cfunc.ci,
  thread_pthread.ci, thread_win32.ci: fixed indentation.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-05 04:25:10 +00:00
shyouhei 7f005938cf * pack.c (pack_unpack): properly ignore non-base64 octets such as
UTF-8 encoded BOMs; submitted by SOUMA Yutaka <holon@radastery.jp>
  to fix [ruby-core:10437]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-28 11:55:19 +00:00
matz eb68fb0c58 * pack.c (pack_unpack): execute block if given with unpacked value
instead of creating an array.  an idea from Tim Bray.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-15 22:57:37 +00:00
matz 2156870525 * ruby.h (struct RArray): embed small arrays.
(RARRAY_LEN): defined for accessing array members.
  (RARRAY_PTR): ditto.

* array.c: use RARRAY_LEN and RARRAY_PTR.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-02 14:42:08 +00:00
matz 54af80844f * ruby.h (struct RString): embed small strings.
(RSTRING_LEN): defined for accessing string members.
  (RSTRING_PTR): ditto.

* string.c: use RSTRING_LEN and RSTRING_PTR.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-31 10:47:44 +00:00