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

251 Коммитов

Автор SHA1 Сообщение Дата
nobu fecda0d9f7 * encoding.c (require_enc): reject only loading from untrusted
load paths.  [ruby-dev:44541] [Bug #5279]
* transcode.c (load_transcoder_entry): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-25 07:54:35 +00:00
nobu 3a6c3a672f * encoding.c (load_encoding): predefined encoding names are safe.
[ruby-dev:44469] [Bug #5279]
* transcode.c (load_transcoder_entry): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-06 04:15:49 +00:00
nobu a0b9f48674 * encoding.c (enc_find): mistakenly remained !. [Bug #5150]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-02 22:46:34 +00:00
naruse 7340796338 Revert "* encoding.c (enc_find): simplified with RB_TYPE_P."
This reverts commit r32817.
It has less code on the surface, but it needs more condition.
Moreover it doesn't need !.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-02 22:39:28 +00:00
nobu 048202f446 * encoding.c (enc_find): simplified with RB_TYPE_P.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-02 14:50:54 +00:00
naruse 48bc63fa7a Fix r32811: add UNSPECIFIED_ENCODING case.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-02 14:27:56 +00:00
naruse faf295f1e1 * encoding.c (str_to_encoding): rename from to_encoding and
use str_to_encindex.

* encoding.c (str_to_encindex): split from to_encoding.

* encoding.c (rb_to_encoding): use str_to_encoding.

* encoding.c (rb_obj_encoding): don't bypass rb_encoding*.
  If it uses rb_encoding*, it bypass encindex. If it uses encindex,
  it doesn't bypass.

* encoding.c (enc_find): add shortcut for encoding object, use
  str_to_encindex, and avoid bypass rb_encoding*.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-02 07:35:21 +00:00
nobu cfa0035962 * encoding.c (rb_enc_set_index, rb_enc_associate_index): should
check if frozen.
* parse.y (rb_intern3), ruby.c (process_options, ruby_script):
  defer freezing after associating encodings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-07 06:44:46 +00:00
akr e7996eb3cc * internal.h: declare internal functions here.
* node.h: declare NODE dependent internal functions here.

* iseq.h: declare rb_iseq_t dependent internal functions here.

* vm_core.h: declare rb_thread_t dependent internal functions here.

* bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
  enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
  iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
  proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
  thread.c, time.c, transcode.c, variable.c, vm.c,
  tool/compile_prelude.rb: don't declare internal functions declared
  in above headers.  include above headers if required.

  Note that rb_thread_mark() was declared as
  void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
  void rb_thread_mark(void *ptr) in vm.c.  Now it is declared as
  the later in internal.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 22:43:38 +00:00
naruse c479bde4fe * encoding.c (rb_locale_charmap): When ruby process is run as Windows
Service the console codepage is not set, GetConsoleCP returns 0.
  So on such environment, use GetACP().
  http://blogs.msdn.com/b/michkap/archive/2005/02/08/369197.aspx
  patched by Rafal Bigaj [ruby-core:36832] [Bug #4854]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-10 07:42:24 +00:00
drbrain 58b14e7892 * encoding.c: Mention that Encoding.compatible? can work with more
than just Strings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-10 00:52:54 +00:00
nobu d371e3583e * lib: revert r31635-r31638 and untabify with expand(1).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-19 00:07:25 +00:00
drbrain 40e6facf51 * encoding.c: Improve documentation for Encoding#default_external and
Encoding#default_internal.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18 20:58:19 +00:00
nobu 21e6862cd5 * encoding.c (enc_find): accept Encoding objects.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-26 16:17:01 +00:00
naruse a8f5a06a68 * encoding.c (rb_enc_compatible): change the rule for empty strings:
remove the special treatment of the US-ASCII encoded empty string.
  Now Encoding.compatible? usually respect the encoding of the
  receiver.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-15 07:08:15 +00:00
akr 864f60b837 * encoding.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-11 00:28:25 +00:00
naruse e59b9e9e43 * encoding.c (enc_alias_internal): use st_insert2 and change return
value to int.

* encoding.c (enc_alias): follow enc_alias_internal.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-02 19:19:47 +00:00
naruse c99a895e28 * encoding.c (enc_alias_internal): use xfree instead of free.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-02 17:40:10 +00:00
naruse 260e8ce637 * encoding.c (enc_alias_internal): free the copied key and
return NULL when given key is already regisitered.

* encoding.c (enc_alias): call set_encoding_const only when the
  alias is not registered yet.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-02 12:28:42 +00:00
nobu 0bd71ff354 * configure.in (XCFLAGS): use -fvisibility=hidden if possible.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-21 21:38:25 +00:00
nobu 25b9eb5e57 * include/ruby/ruby.h (rb_data_type_t): restructured. [ruby-dev:41862]
add parent member.

* error.c (rb_typeddata_inherited_p): new function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-18 07:31:54 +00:00
akr abb855513c update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-17 23:33:16 +00:00
akr a4702079b8 update comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-31 13:37:50 +00:00
naruse d13e191d25 * encoding.c (rb_enc_unicode_p): check the encoding is Unicode
or not by the name; not function's pointer. [ruby-dev:41479]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-31 05:46:58 +00:00
naruse 2f9d028202 * encoding.c (rb_filesystem_encindex): avoid infinite require
loop. [ruby-core:30467]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 03:57:36 +00:00
naruse f39ad4cab2 * include/ruby/encoding.h (rb_filesystem_encindex): defined.
* include/ruby/encoding.h (rb_locale_encindex): ditto.

* encoding.c (rb_filesystem_encindex): remove static.

* encoding.c (rb_locale_encindex): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-27 14:47:16 +00:00
marcandre 7729de4d91 * 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

* 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/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
nobu 9f9ace81f8 * encoding.c (enc_replicate): new encoding name must be valid
c-string.  [ruby-dev:40954]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-11 03:08:51 +00:00
kazu 1edc8d3b9e fix rdoc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-11 02:20:29 +00:00
naruse 8a144fdedc * encoding.c (enc_set_filesystem_encoding):
filesystem encoding on Mac OS X is now
  default external encoding. so Mac OS X is now
  treated as one of Unix. [ruby-dev:40439]

* file.c (file_path_convert): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-06 17:11:28 +00:00
naruse 3da3230f0c * encoding.c (Init_Encoding): undef Encoding.new because
a class which is rb_undef_alloc-func-ed can't call new method.
  [ruby-dev:39862]

* vm.c (Init_VM): undef RubyVM.new and RubyVM::Env.new.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-21 10:12:21 +00:00
naruse 07f81c06ca Add rdoc and test of Encoding#replicate.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-12 16:35:10 +00:00
naruse 614a8427ce * encoding.c (enc_replicate): add Encoding#replicate(name).
* encoding.c (enc_replicate_with_index): renamed from old
  enc_replicate.

* encoding.c (rb_enc_from_encoding_index): split from
  rb_enc_from_encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-10 03:59:34 +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
naruse a7db2c1efd * encoding.c (enc_set_default_encoding): reset filesytem
encoding because on resetting default_external because
  Unix's filesystem encoding depends on default_external.

* encoding.c (enc_set_filesystem_encoding): added.

* ruby.c (process_options): don't call rb_filesystem_encoding
  because filesystem encoding is reset when default_external
  is reset.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-18 03:38:20 +00:00
akr 1aba3f9d76 * encoding.c (rb_filesystem_encindex): use default external encoding
instead of locale encoding in Unix.

* ruby.c (process_options): delay inifilesystem encoding
  initialization after default external encoding initialization.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-15 16:37:38 +00:00
naruse 0859e7cb87 * encoding.c (rb_filesystem_encindex): add fallback to
ASCII-8BIT on Windows.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-06 00:33:56 +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
naruse 2f2e8455e3 Revert set locale and filesystem encindex in Init_Encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 09:40:25 +00:00
naruse 06346d5849 * encoding.c (Init_Encoding): set locale and filesystem encindex.
* ruby.c (process_options): move setting func of filesystem
  encoding to Init_Encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 08:14:09 +00:00
nobu feb34709fe * encoding.c (enc_find): fixed rdoc formatting.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-28 08:02:02 +00:00
naruse 7a884fe466 * encoding.c (get_filesystem_encoding): removed.
* encoding.c (rb_locale_encindex): added.

* encoding.c (rb_filesystem_encindex): added.

* encoding.c (rb_filesystem_encindex): add an alias 'filesystem'.
  [ruby-dev:39574]

* encoding.c (enc_find): add rdoc about special aliases.

* gem_prelude.rb (Gem.set_home): use Encoding.find('filesystem').

* gem_prelude.rb (Gem.set_paths): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-28 07:34:24 +00:00
naruse 8d9e64fb38 * encoding.c (get_filesystem_encoding):
add Encoding.filesystem_encoding [ruby-dev:39546]
  also see [ruby-core:25959]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-28 06:06:10 +00:00
akr 525be7f048 fix a typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-23 13:30:29 +00:00
naruse f7554133b2 * encoding.c (rb_enc_unicode_p): defined.
Returns 1 when the encoding is Unicode series
  other than UTF-7 else 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-29 00:34:00 +00:00
naruse 5f5706c38f * encoding.c (rb_filesystem_encoding): On Unix systems,
filesystem encoding should be locale encoding.
  [ruby-dev:39393] and see also [ruby-dev:35617]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-28 19:24:24 +00:00
nobu b46cd0e400 * include/ruby/ruby.h (rb_data_type_struct): constified dsize.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09 02:11:35 +00:00
naruse e666111955 * encoding.c (rb_enc_compatible): If a string is empty and
other's encoding is US-ASCII, returns the empty string's encoding.
  [ruby-list:46274]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-11 22:52:39 +00:00
naruse 8b83fc2704 * encoding.c (is_data_encoding): fix condition.
* encoding.c (enc_capable): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-11 22:39:54 +00:00
naruse e56bf07b16 New API Encoding#ascii_compatible?.
* encoding.c (enc_ascii_compatible_p): added. [ruby-core:24793]
  (Init_Encoding): New API Encoding#ascii_compatible?.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-08 23:25:32 +00:00