summaryrefslogtreecommitdiff
path: root/io.c
AgeCommit message (Collapse)Author
2012-05-24Bug #6487nobu
* io.c (io_strip_bom): check EOF. [Bug #6487][ruby-core:45203] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-23use RB_TYPE_P() instead of comparison of TYPE()nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-17* io.c: re-fix merge miss.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-17* io.c: Fix a mistake on merging the patch in the previous commit.yugui
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-17Imports Ruby's port to NativeClient (a.k.a NaCl).yugui
Patch by Google Inc. [ruby-core:45073]. * configure.in (RUBY_NACL): New M4 func to configure variables for NaCl. (RUBY_NACL_CHECK_PEPPER_TYPES): New M4 func to check the old names of Pepper interface types. (BTESTRUBY): New variable to specify which ruby should be run on "make btest". NaCl can run the built binary by sel_ldr, but it need rbconfig.rb. So this variable is distinguished from $MINIRUBY. * thread_pthread.c: Disabled some features on NaCl. * io.c: ditto. * process.c: ditto. * signal.c: ditto. * file.c: ditto. * missing/flock.c: ditto. * nacl/pepper_main.c: An example implementation of Pepper application that embeds Ruby. * nacl/example.html: An example of web page that uses the Pepper application. * nacl/nacl-config.rb: Detects variants of NaCl SDK. * nacl/GNUmakefile.in: Makefile template for NaCl specific build process. * nacl/package.rb: script for packaging a NaCl-Ruby embedding application. * nacl/reate_nmf.rb: Wrapper script of create_nmf.py * dln.c (dln_load): Added a hack to call on NaCl. * util.c (ruby_getcwd): Path to the current directort is not available on NaCl. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-16* io.c: fixed a merge mistake of r33878, reported by nobu via IRC.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-08* io.c (io_unread): fix IO#pos with mode 'r' bug on Windows.shirosaki
If the end of reading buffer is CR, io_unread() needs to unread one more byte. [ruby-core:44874] [Bug #6401] * test/ruby/test_io_m17n.rb (TestIO_M17N#test_pos_with_buffer_end_cr): add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-06* io.c (io_encoding_set): suppress warnings. [ruby-dev:45627]naruse
this tmp1 is not required after r35538. * addr2line.c: suppress warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-04* io.c (parse_mode_enc): remove warnings 'Ignoring internal encoding'.naruse
[ruby-core:44455] [Bug #6324] * io.c (io_encoding_set): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-18* io.c (io_readpartial): Document the output buffer parameter isdrbrain
overwritten with the read contents even when non-empty. Patch by yu nobuoka. [ruby-trunk - Bug #6285] * io.c (io_read_nonblock): ditto. * io.c (io_read): ditto. * io.c (rb_io_sysread): ditto. * io.c (argf_read): ditto. * io.c (argf_readpartial): ditto. * ext/stringio/stringio.c (strio_read): ditto. * test/ruby/test_argf.rb (class TestArgf): Add test for existing behavior of read outbuf. * test/ruby/test_io.rb (class TestIO): ditto. * test/stringio/test_stringio.rb (class TestStringIO): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-15* reduce UNREACHABLE.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-14* variable.c (trace_ev): Removed "not reached" comment as this line isdrbrain
reached. * variable.c (rb_obj_remove_instance_variable): Replaced "not reached" comment with the UNREACHABLE macro. * variable.c (rb_mod_const_missing): ditto. * variable.c (rb_mod_remove_cvar): ditto. * enum.c (first_i): ditto. * string.c (rb_str_aref): ditto. * string.c (str_byte_aref): ditto. * string.c (rb_to_id): ditto. * io.c (rb_io_fmode_modestr): ditto. * io.c (rb_io_oflags_modestr): ditto. * pack.c (num2i32): ditto. * vm_eval.c (rb_method_missing): ditto. * vm_eval.c (rb_f_throw): ditto. * dir.c (dir_read): ditto. * win32/win32.c (child_result): ditto. * struct.c (rb_struct_getmember): ditto. * struct.c (rb_struct_set): ditto. * struct.c (rb_struct_aref_id): ditto. * eval.c (rb_f_raise): ditto. * process.c (rb_f_exit_bang): ditto. * process.c (rb_f_exit): ditto. * process.c (rb_f_abort): ditto. * ext/-test-/iter/break.c (iter_break_value): ditto. * ext/pty/pty.c (pty_check): ditto. * ext/openssl/ossl_pkey.c (ossl_pkey_new): ditto. * ext/readline/readline.c (rb_remove_history): ditto. * ext/stringio/stringio.c (strio_unimpl): ditto. * numeric.c (num_sadded): ditto. * numeric.c (num_init_copy): ditto. * numeric.c (rb_num2ll): ditto. * numeric.c (rb_num2ull): ditto. * vm_insnhelper.c (call_cfunc): ditto. * ruby.c (opt_W_getter): ditto. * bignum.c (rb_big_coerce): ditto. * file.c (rb_f_test): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-13* encoding.c (rb_enc_codepoint_len): Use UNREACHABLE to avoid "controldrbrain
reaches end of non-void function" warnings. [ruby-trunk - Bug #6066] * re.c (name_to_backref_number): ditto. * object.c (rb_Float): ditto. * io.c (io_readpartial): ditto. * io.c (io_read_nonblock): ditto. * pack.c (rb_uv_to_utf8): ditto. * proc.c (rb_method_entry_arity): ditto. * vm_method.c (rb_f_notimplement): ditto. * struct.c (rb_struct_aset_id): ditto. * class.c (rb_scan_args): ditto. * process.c (rlimit_resource_type): ditto. * process.c (rlimit_resource_value): ditto. * process.c (p_uid_switch): ditto. * process.c (p_gid_switch): ditto. * ext/digest/digest.c (rb_digest_instance_update): ditto. * ext/digest/digest.c (rb_digest_instance_finish): ditto. * ext/digest/digest.c (rb_digest_instance_reset): ditto. * ext/digest/digest.c (rb_digest_instance_block_length): ditto. * ext/bigdecimal/bigdecimal.c (BigDecimalCmp): ditto. * ext/dl/handle.c (rb_dlhandle_close): ditto. * ext/tk/tcltklib.c (pending_exception_check0): ditto. * ext/tk/tcltklib.c (pending_exception_check1): ditto. * ext/tk/tcltklib.c (ip_cancel_eval_core): ditto. * ext/tk/tcltklib.c (lib_get_reltype_name): ditto. * ext/tk/tcltklib.c (create_dummy_encoding_for_tk_core): ditto. * ext/tk/tkutil/tkutil.c (tk_hash_kv): ditto. * ext/openssl/ossl_ssl.c (ossl_ssl_session_reused): ditto. * ext/openssl/ossl_pkey_ec.c (ossl_ec_key_dsa_verify_asn1): ditto. * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_at_infinit): ditto. * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_on_curve): ditto. * ext/fiddle/conversions.c (generic_to_value): ditto. * ext/socket/raddrinfo.c (rsock_io_socket_addrinfo): ditto. * ext/socket/socket.c (sock_s_getnameinfo): ditto. * ext/ripper/eventids2.c (ripper_token2eventid): ditto. * cont.c (return_fiber): ditto. * dmydln.c (dln_load): ditto. * vm_insnhelper.c (vm_search_normal_superclass): ditto. * bignum.c (big_fdiv): ditto. * marshal.c (r_symlink): ditto. * marshal.c (r_symbol): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-11* io.c (rb_io_eof): use eof() instead of io_fillbuf(). It's becauseshirosaki
io_unread() doesn't work properly when reading CRLF with read(length) and mode 'r'. [ruby-core:44189][Bug #6271] * test/ruby/test_io_m17n.rb (TestIO_M17N#test_read_crlf_and_eof): test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-07* io.c (io_unread): cast as long the value for extra_max.naruse
[ruby-core:44137] [Bug #6257] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-27* io.c (io_unread): fixed memory leak. report by nagachika via IRC.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-22* io.c (static int io_fflush): add the definition.shirosaki
Use it in set_binary_mode_with_seek_cur(). * io.c (set_binary_mode_with_seek_cur): refactoring to split the content into io_unread(). Fix the possibility of buffer overflow. * io.c (io_unread): add new implementation for Windows. Previous one caused invalid cursor position using IO#pos with OS text mode. New one fixes the bug. * test/ruby/test_io_m17n.rb (TestIO_M17N#test_pos_dont_move_cursor_position): add a test for above bug. [ruby-core:43497] [Bug #6179] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-13* io.c (io_encoding_set): always warn if external encoding and internalnaruse
encoding are identical. [ruby-core:40727] [Bug #5568] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-12* encoding.c (rb_find_encoding): new function find encoding fromnobu
arbitrary object as a pointer to rb_encoding, and return NULL if not found. * io.c (io_encoding_set): just warn unsupported encodings, but not exception. [ruby-core:40726] [Bug #5567] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-11* io.c: fix rdoc of `IO.binwrite` to show same as `IO.write` exceptsorah
it opens file with mode "wb:ASCII-8BIT". [Bug #5782] [ruby-core:42592] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-02* io.c (pipe_open): cmd is no longer used if fork is available.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-28* io.c (io_binwrite, rb_io_syswrite): use shared frozen sourcenobu
strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-28* io.c (io_fread, io_getpartial, rb_io_sysread): set buffer sizenobu
after check if readable, which can cause thread switch. [ruby-dev:45297][Bug #6099] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-27* io.c (rb_io_set_pos): add rdoc about textmode.usa
* test/ruby/test_io.rb (TestIO#test_setpos): use binmode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-27* io.c, process.c, time.c, ext: use rb_sys_fail_str instead ofnobu
rb_sys_fail. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24* dir.c (dir_inspect), io.c (rb_io_inspect): keep encoding of path.nobu
[Bug #6072] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24* dir.c, file.c, io.c (rb_sys_fail_path): use rb_sys_fail_str.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24* dir.c, file.c, io.c: use rb_sys_fail_path.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24* io.c (set_binary_mode_with_seek_cur): reorder function qualifiers.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-23* io.c (rb_io_f_sync): Fix double-negative typo. [ruby-trunk - #5837]drbrain
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-22* io.c (rb_io_extract_modeenc): fail only if conflictingnobu
text/binary modes given explicitly. [ruby-dev:45268][Bug #6055] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-22* io.c (rb_io_s_foreach): argument check before making Enumerator.nobu
[ruby-dev:31525] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-22* io.c (rb_io_s_foreach): return enumerator including kerwordnobu
arguments. [ruby-dev:45267][Bug #6054] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-15* io.c (io_strsetbuf): call rb_str_modify to make str independentnaruse
before calling rb_str_set_len for r34580. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-14* io.c (io_setstrbuf): cut down the buffer if longer.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-13* io.c (io_setstrbuf): defer resizing buffer string until data isnobu
read actually. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-13* io.c (Init_IO): use directive hack to make ARGF documentablenobu
in other tools. [ruby-core:42515][Bug #6007] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-02* io.c (argf_next_argv): reset ARGF.next_p on ARGV.replace.naruse
r34409 breaks replacing ARGV. [ruby-dev:45160] [Bug #5952] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-31* io.c (argf_close): skip stdin, which should be readable again.nobu
[ruby-dev:45160] [Bug #5952] * io.c (argf_readlines): reinitialize after all read to be readable again. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-23* io.c (extract_binmode): raise an exception if binmode/textmodenaruse
is specified with both vmode and opthash. [ruby-core:42199] [Bug #5918] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-23* io.c (rb_io_extract_modeenc): set ASCII-8BIT if binmode is specifiednaruse
with opthash. [ruby-core:42197] [Bug #5917] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-13* io.c (rb_io_s_read): Fix formatting of open_args comment. Reporteddrbrain
by Adam Prescott. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-26* io.c (rb_sys_fail_path): move the definition.shirosaki
Move above for using it in set_binary_mode_with_seek_cur(). * io.c (set_binary_mode_with_seek_cur): fix improper seek cursor. Seeking file cursor with setting binary mode has possibility to cause infinite loop. Fixed the bug and refined error handling. Introduced at r34043. And cleanups as below. Remove unnecessary parentheses of `fptr`. Use return value of setmode(). * test/ruby/test_io_m17n.rb (TestIO_M17N#test_seek_with_setting_binmode): add a test for abobe. [ruby-core:41671] [Bug #5714] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-20* io.c: Improve rdoc for {File|IO}.writemarcandre
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-15* io.c (argf_type): make typed data.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-14* win32/win32.c, include/ruby/win32.h (rb_w32_fd_is_text): new function.usa
* win32/win32.c (init_stdhandle): set default mode of stdin as binmode. * io.c (set_binary_mode_with_seek_cur): new function to replace SET_BINARY_MODE_WITH_SEEK_CUR macro. now returns previous mode of the fd and take care of LF in rbuf. * io.c (do_writeconv): set text mode when needed. * io.c (io_read): need to change the mode of the IO to binmode temporally when the length for IO#read, because IO#read with length must behave so. * test/ruby/test_io_m17n.rb (TestIO_M17N#est_{read_with_length, read_with_length_binmode,get[cs]_and_read_with_binmode, read_with_binmode_and_get[cs],read_write_with_binmode}): tests for above changes. all patches are written by Hiroshi Shirosaki. [ruby-core:41496] [Feature #5714] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-07* io.c (Init_IO): Mention io/console methods. [Ruby 1.9 - Bug #5602]drbrain
* ext/io/console/console.c: Mention that io/console must be required similar to lib/time.rb git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-05* bignum.c (big_rshift), compile.c (validate_label,nobu
iseq_build_from_ary_exception), cont.c (cont_capture), dir.c (dir_open_dir), gc.c (objspace_each_objects), io.c (pipe_open) (rb_io_advise), parse.y (parser_compile_string) (rb_parser_compile_file), proc.c (binding_free), process.c (rb_proc_exec_n, rb_seteuid_core, proc_setegid, rb_setegid_core) (p_uid_exchange, p_gid_exchange), regparse.c (strdup_with_null), signal.c (sig_dfl), vm.c (rb_iseq_eval, rb_iseq_eval_main), vm_insnhelper.c (vm_expandarray): suppress unused-but-set-variable warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-04* io.c: suppress unused-value warnings. fixup of r33937.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-04Introduce NEED_READCONV and NEED_WRITECONV to replace universal newline ↵luislavena
decorator Use CRLF only when required to improve file reading and writing under Windows. Patch by Hiroshi Shirosaki. [ruby-core:40706] [Feature #5562] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e