Commit graph

772 commits

Author SHA1 Message Date
yugui
b657c159e9 merges r32349 from trunk into ruby_1_9_2.
--
* string.c (tr_trans): free heap ptr when the str is not embeded.
  patched by Eric Wong. [Bug #4956] [ruby-core:37708]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@34430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-05 03:27:41 +00:00
yugui
69e5d34b40 merges r31310 from trunk into ruby_1_9_2.
--
* string.c (rb_str_each_line): check string's length when compare
  separator and string. [ruby-core:35815] fixes #4586

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-30 04:43:29 +00:00
yugui
0ca24ab21d merges r30779 from trunk into ruby_1_9_2.
--
	* string.c (str_utf8_nth): fixed a conditon of optimized lead
	  byte counting. [Bug #4366][ruby-dev:43170]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-01 09:37:04 +00:00
yugui
25394cb929 merges r30654 from trunk into ruby_1_9_2.
--
* string.c (=~): documentation fix; the return value is nil when
  it doesn't match. patched by Andrei Kulakov [ruby-core:34562]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-28 02:25:56 +00:00
yugui
32fdf95a32 merges r30652 from trunk into ruby_1_9_2.
--
* string.c (rb_str_resize): get rid of out-of-bound access.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-28 02:25:49 +00:00
yugui
ce02662c0b merges r30648 from trunk into ruby_1_9_2.
--
* string.c (rb_string_value_cstr): rb_str_modify can change
  RSTRING_PTR.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-28 02:25:44 +00:00
yugui
d341834304 merges r29868 and r29872 from trunk into ruby_1_9_2.
--
* string.c (rb_str_inspect): append for each chars instead of bulk
  copy if encoding conversion is needed.  [ruby-core:33283]
--
* string.c (rb_str_inspect): fix for ascii-compatible external
  encoding and different encoding string.  [ruby-core:33283]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-20 13:22:53 +00:00
yugui
0d0636d22c merges r29848 and r29852 from trunk into ruby_1_9_2.
--
* string.c (rb_str_concat): set ENC_CODERANGE_VALID when the
  receiver is 7BIT and the argument is non ASCII.
--
Fix r29848's test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-20 13:22:48 +00:00
yugui
aeebb6e538 * string.c (rb_str_concat): partially reverts r30040 because
it unpexpectedly changed the behavior of String#<<.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-08 08:09:28 +00:00
yugui
40236a58c6 merges r29676 from trunk into ruby_1_9_2.
--
* string.c (rb_enc_cr_str_buf_cat): concatenation of valid
  encoding string and invalid encoding string should result
  invalid encoding.  [ruby-core:33027]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-08 08:09:14 +00:00
yugui
04bc7dbc8b merges r29622 from trunk into ruby_1_9_2.
--
* string.c (rb_str_dump): fix expected length. [ruby-core:32935]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-08 08:09:02 +00:00
yugui
931e3b6a67 merges r29453 from trunk into ruby_1_9_2.
--
* string.c (rb_str_concat): use unsigned int for GB18030.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-02 08:06:58 +00:00
yugui
45ba464561 merges r29335 from trunk into ruby_1_9_2.
--
* string.c (sym_call), vm.c (invoke_block_from_c),
  vm_insnhelper.c (vm_yield_with_cfunc): pass given block.
  [ruby-core:32075]

* vm_eval.c (rb_funcall_passing_block): new function to call
  method with passing given block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-02 08:05:24 +00:00
yugui
0d5b448906 merges r29332 from trunk into ruby_1_9_2.
--
* string.c (rb_str_to_i): fix rdoc: String#to_i raises an
  exception when base is invalid. [ruby-core:31685]

Fri Sep 24 15:28:35 2010  NARUSE, Yui  <naruse@ruby-lang.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@29921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-24 09:38:02 +00:00
yugui
c2a3a47f40 merges r29254 from trunk into ruby_1_9_2.
--
* string.c (rb_str_times): mentioned about Hash argument.  a patch
  from Daniel Bovensiepen at [ruby-core:32386].

* sprintf.c (get_hash): ditto, and fix typo.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@29797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-15 11:44:05 +00:00
yugui
d9cd722638 merges r29146 and r29148 from trunk into ruby_1_9_2.
--
* string.c (tr_setup_table): initialize negating table when
  negating string is given. [ruby-core:31851]

* string.c (tr_find): add a sentence for the time when
  target characters include negating one.

* string.c (rb_str_count): move definition.
--
* string.c (tr_setup_table): fix bug in r29146.
  Initialize table even if cflag is 0; tr_find see whether
  del is empty or not.

* string.c (tr_find): nodel can't be NULL; if NULL, it means
  it is not specified.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@29569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-23 10:02:41 +00:00
yugui
e70ad1897b merges r28577 from trunk into ruby_1_9_2.
--
* string.c (rb_str_conv_enc_opts): fix infinite loop because
  of ISO-2022-JP conversion with empty string.
  patched by Brian Buchanan [ruby-core:31107]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-10 04:06:12 +00:00
mame
c13a97f6fc merges r28544 from trunk into ruby_1_9_2.
--
* string.c (NONASCII_MASK): NONASCII_MASK must be unsigned.
  [ruby-dev:41782]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-05 15:34:14 +00:00
marcandre
ac77f633a4 merge from trunk (r28492)
* string.c (rb_str_gsub_bang, rb_str_sub_bang, str_gsub): rdoc fix
  based on patch by Run Paint [ruby-core:30938]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-30 22:16:53 +00:00
nobu
ce4a6e685d * string.c (rb_str_buf_cat_escaped_char): get rid of buffer
overflow on platforms int is bigger than 32bit, and warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-06 13:37:23 +00:00
naruse
09e9807a89 merge revision(s) 28174:28178:
* re.c (rb_reg_expr_str): ASCII incompatible strings
	  must always escape or converted.

	* re.c (rb_reg_expr_str): use rb_str_buf_cat_escaped_char
	  when resenc is given: for Regexp#inspect or error message.
	  * re.c (rb_reg_desc): add 'n' for ENCODING_NONE.

	* string.c (sym_inspect): Escape when the symbol is not
	  resulted encoding and not ascii_only. It had escaped
	  ascii-incompatible string, but it is wrong.

	* string.c (rb_str_buf_cat_escaped_char): defined.
	  Splited from rb_str_inspect.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-05 14:16:05 +00:00
naruse
e1c14eabd5 merge revision(s) 28104:
* string.c (rb_str_inspect): inspect as ASCII when the codepoint
	  of a character in Unicode string is ASCII printable one.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-05 14:15:15 +00:00
mame
57569615ea merges r28072 from trunk into ruby_1_9_2.
--
* string.c (str_replace_shared): change embedded state atomically.
  [ruby-core:29953] [ruby-dev:41456]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 15:12:20 +00:00
nobu
5f3f080504 * string.c (sym_inspect): escape ASCII-compatible strings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-28 09:39:41 +00:00
nobu
2dfa488b2a * string.c (rb_str_inspect): escape ASCII-compatible strings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-28 09:37:06 +00:00
marcandre
c98396334f * proc.c: Small documentation fixes.
* re.c: ditto

* string.c: ditto

* time.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@27872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:50:17 +00:00
marcandre
26134a6dc1 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* hash.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@27870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:50:00 +00:00
marcandre
d6b1887dd3 * array.c: Harmonize documentation, in particular regarding:
- methods returning enumerators
    - array methods and argument naming (array -> ary, an_array -> new_ary)
    - minor improvements, typo fixed and styling issues

  Other documentation errors fixed:
    - return value was self instead of a new array (or vice-versa) for
      Array#{pop,shift,permutation,repeated_permutation,keep_if}
    - Array#rindex was missing the form with a block.

* dir.c: ditto.

* enum.c: ditto. Modified Enumerable#reverse_each' documentation to clarify
  that #each will be finish before any element is yielded.

* error.c: ditto.

* gc.c: ditto.

* hash.c: ditto.

* io.c: ditto. IO#{codepoints,each_codepoint} fixed as per [ruby-core:23948]

* numeric.c: ditto.

* range.c: ditto.

* string.c: ditto.

* struct.c: ditto.

* vm_eval.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@27778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-13 05:52:16 +00:00
naruse
ca3c007f05 * string.c (rb_str_match_m): add description about optional
position parameter. [ruby-list:47064]
  patched by KISHIMOTO, Makoto <ksmakoto AT dd.iij4u.or.jp>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-06 06:07:05 +00:00
marcandre
479fa40778 * string.c (rb_str_sub_bang): String#sub! now raises an error when
called on a frozen string, even if no change is made.
  See [ruby-core:23657]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 02:48:49 +00:00
marcandre
478c3e080b * eval.c (make_exception, rb_obj_extend): Fix error messages in case of wrong
number of arguments

* file.c (rb_f_test, rb_file_s_umask): ditto

* numeric.c (int_chr, num_step): ditto

* process.c (rb_f_sleep): ditto

* re.c (rb_reg_initialize_m): ditto

* signal.c (rb_f_kill, sig_trap): ditto

* string.c (rb_str_aref_m, rb_str_aset_m, rb_str_count, rb_str_delete_bang,
  rb_str_slice_bang, rb_str_sub_bang, str_gsub): ditto

* proc.c (curry): rdoc fix

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 02:40:57 +00:00
nobu
92496d73eb * string.c (rb_string_value_cstr): make NUL terminated if it is
not done.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-14 06:58:13 +00:00
akr
d0fa628d06 * string.c (rb_str_sum): use UCHAR_MAX.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-20 13:52:34 +00:00
akr
053d89ca2b * string.c (rb_str_sum): don't call method for each byte.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-18 20:35:18 +00:00
marcandre
51ae7f6e9a * io.c: Fix documentation for each/each_line/lines, bytes/each_byte,
codepoints/each_code_point [ruby-core:23948]

* string.c: ditto

* ext/stringio/stringio.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-07 10:22:05 +00:00
mame
24684a8a34 * string.c (str_new_empty): String#split, partition, rpartition
taints the resulting strings if self is tainted.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-23 15:41:34 +00:00
nobu
f3f43cdbee * array.c (rb_ary_push_m, rb_ary_unshift_m, rb_ary_aset),
(rb_ary_insert, rb_ary_replace, rb_ary_concat),
  (rb_ary_uniq_bang, rb_ary_flatten_bang): check if frozen after
  wrong number of arguments but before TypeError.
  [ruby-core:28140]

* hash.c (rb_hash_replace): ditto.

* string.c (rb_str_replace): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-10 07:31:06 +00:00
mame
f26bb91386 * fix the previous previous commit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-31 13:44:19 +00:00
mame
21523e3a98 * string.c (rb_string_value): make no exception for Symbol.
[ruby-dev:40274]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-31 12:46:36 +00:00
nobu
68e111176f * string.c (rb_str_inspect): suppress a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-25 02:50:05 +00:00
akr
83d9e9f42e * string.c (rb_str_inspect): increment by rb_enc_mbminlen(enc) for
broken byte sequence.  [ruby-core:27748]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-24 05:22:51 +00:00
akr
4b8e14c978 * string.c (rb_enc_strlen_cr): increment by rb_enc_mbminlen(enc) for
broken byte sequence.  [ruby-core:27748]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-24 04:59:31 +00:00
nobu
441dbecf43 * string.c (rb_str_concat): fixed range check for Fixnum, and
added checks for integer overflow and invalid char code.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-14 03:50:39 +00:00
naruse
b3d8a4060c * string.c (rb_str_concat): raise RangeError when the argument is
negative value. [ruby-core:27583]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-14 00:39:40 +00:00
akr
f6f3d1bc0e * string.c (rb_str_set_len): call rb_str_modify.
* file.c (realpath_rec): don't call rb_str_modify before
  rb_str_set_len.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-12 12:56:15 +00:00
naruse
a3973ab1ba * string.c (rb_str_strlen): added. [ruby-dev:40028]
* include/ruby/intern.h (rb_str_strlen): declared.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-11 07:58:26 +00:00
naruse
e5dc8988af * string.c (rb_str_inspect): CHAR_ESC_LEN should be 13.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-10 00:26:41 +00:00
nobu
c9c095fc7b * string.c (rb_str_justify): fixed the case a fill size is a
multiple of the length of the padding.  [ruby-dev:39856]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-09 00:50:37 +00:00
yugui
1c2ef61035 * string.c (rb_str_justify): CVE-2009-4124.
Fixes a bug reported by 
  Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;
  Patch by nobu.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-07 04:11:26 +00:00
nobu
4d786d21e3 * removed spaces just before tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-26 05:25:08 +00:00