Commit graph

378 commits

Author SHA1 Message Date
nobu
d4c32f93e2 * file.c (rb_find_file): reset to real class.
* io.c (io_reopen): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@18378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-05 20:10:16 +00:00
usa
c63b718fea * io.c (rb_open_file, rb_io_s_sysopen): fmode should be unsigned int.
fixed [ruby-dev:34979]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-06 16:50:50 +00:00
nobu
4940cff399 * io.c (rscheck), marshal.c (w_nbyte, w_bytes, w_unique),
(path2class, path2module): constified.

* pack.c (pack_unpack), process.c (rb_syswait): suppress warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-01 20:28:01 +00:00
nobu
9ed3d64d1d * suppress warnings on cygwin, mingw and mswin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-01 19:55:25 +00:00
nobu
1378795e08 * suppress warnings with -Wwrite-string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31 09:28:20 +00:00
knu
e37b7b77a8 * ext/stringio/stringio.c (strio_each): Return an enumerator if no
block is given.
  (strio_each_byte): Return an enumerator if no block is given,
  and return self if one is given as the rdoc says.

* io.c (rb_io_each_byte): Fix rdoc.  IO#each_byte returns self,
  not nil.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 09:16:11 +00:00
knu
1906045a8f * io.c (rb_io_each_char, argf_each_char, Init_IO):
Add {IO#,ARGF.}{each_char,chars}.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 06:39:47 +00:00
knu
30fe2b177c * io.c (Init_IO): Define {IO,ARGF}#{getbyte,readbyte}.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 04:44:12 +00:00
knu
6b7869ae42 * io.c: (rb_io_lines, rb_io_bytes, Init_IO): Define
IO#{lines,bytes} and ARGF.{lines,bytes}.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 04:22:56 +00:00
nobu
722ad8f214 * eval.c (search_method, remove_method, error_print, rb_alias)
(rb_eval, rb_rescue2, search_required, Init_eval, rb_thread_create),
  gc.c (rb_source_filename, Init_stack), io.c (rb_io_getline),
  parse.y (rb_id2name, rb_parser_free): suppress warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-21 14:29:55 +00:00
nobu
9cee075559 * rubyio.h (rb_io_t): renamed from OpenFile.
* ruby.h (struct RHash), file.c, gc.c, io.c, ext/dl/dl.c,
  ext/io/wait/wait.c, ext/pty/pty.c, ext/readline/readline.c,
  ext/socket/socket.c: ditto.

* win32/win32.h: removed workaround for OpenFile.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-15 03:35:55 +00:00
knu
f5f1a18ceb * enum.c (enum_find, enum_reject): Return an enumerator if no
block is given.

* io.c (rb_io_each_line, rb_io_each_byte, rb_io_s_foreach,
  argf_each_line, argf_each_byte): Ditto.

* string.c (str_gsub): Ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14 09:19:52 +00:00
matz
5074a2003f * io.c (rb_open_file): should check NUL in path.
<http://www.rubyist.net/~matz/20080125.html#c01>.

* io.c (rb_io_s_popen): ditto.

* io.c (rb_io_reopen): ditto.

* io.c (next_argv): ditto.

* io.c (rb_io_s_foreach): ditto.

* io.c (rb_io_s_readlines): ditto.

* io.c (rb_io_s_read): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-28 03:33:05 +00:00
knu
a7b5cb96c6 * io.c (rb_io_mode_flags, rb_io_mode_modenum): Ignore encoding
options for forward compatibility.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-21 08:43:58 +00:00
nobu
bf89a51315 * io.c (fptr_finalize): clear errno first. [ruby-talk:284492]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@14858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03 02:29:04 +00:00
nobu
42cff90a29 * io.c (rb_io_tell, rb_io_seek): check errno too. [ruby-dev:32093]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-25 05:19:33 +00:00
nobu
233a94b91e * error.c (rb_notimplement), io.c (pipe_open): removed definite
articles and UNIX manual section from messages.  [ruby-dev:30690]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-04 15:42:16 +00:00
nobu
f67fc8a43f * io.c (pipe_open): refined the message of NotImplementedError.
[ruby-dev:30685]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-04 08:08:46 +00:00
nobu
496371638e * io.c (pipe_open): raise NotImplementedError for command "-" on
platforms where fork(2) is not available.  [ruby-dev:30681]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-04 01:17:34 +00:00
nobu
d33cc535c3 * node.h (struct rb_thread.locals): explicit as struct.
[ruby-core:10585]

* eval.c, node.h (enum rb_thread_status, struct rb_thread,
  rb_curr_thread, rb_main_thread): prefixed.  [ruby-core:10586]

* file.c (chompdirsep): made an unprefixed name static.

* io.c (io_fread): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-24 14:40:08 +00:00
knu
438c4a6fdc * io.c (rb_f_syscall): Fix buffer overflow with syscall
arguments.  [ruby-bugs:PR#8541]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-13 06:21:47 +00:00
matz
43786b302e * io.c (ruby_dup): start GC on ENOMEM as well.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-01-03 03:37:56 +00:00
matz
46fa18da5b Revert r11453
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-01-03 03:14:57 +00:00
matz
4ee717dcae * io.c (ruby_dup): start GC on ENOMEM as well.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-01-03 02:51:44 +00:00
matz
d9d3a1b2fb * io.c (pipe_open): command name should not contain null bytes.
[ruby-dev:29421]

* process.c (proc_spawn): ditto.

* process.c (proc_spawn_n): ditto.

* process.c (rb_f_system): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-04 07:26:47 +00:00
matz
17c3d539f0 * ruby.h: use ifdef (or defined) for macro constants that may or
may not be defined to shut up gcc's -Wundef warnings.
  [ruby-core:08447]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-31 06:34:10 +00:00
matz
6cd74eae6e * io.c (io_close): always calls "close" method of the receiver.
[ruby-core:6911] [ruby-core:8112]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-28 16:27:42 +00:00
matz
e510c0e71f * io.c (pipe_open): avoid closing uninitialized file descriptors.
a patch from <tommy at tmtm.org> [ruby-dev:28600]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-26 07:23:47 +00:00
akr
c4ab77fb3b avoid useless fcntl in rb_io_set_nonblock.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-05-22 22:12:57 +00:00
akr
13ddc9fdd0 * rubyio.h (rb_io_set_nonblock): declared.
* io.c (rb_io_set_nonblock): new function.
  (io_getpartial): nonblocking read support.
  (io_read_nonblock): new method: IO#read_nonblock.
  (io_write_nonblock): new method: IO#write_nonblock.

* ext/socket/socket.c
  (sock_connect_nonblock): new method: Socket#connect_nonblock.
  (sock_accept_nonblock): new method: Socket#accept_nonblock.
  (sock_recvfrom_nonblock): new method: Socket#recvfrom_nonblock.

  [ruby-core:7917]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-05-22 08:38:37 +00:00
akr
238cc5974b update readpartial doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-05-13 07:43:41 +00:00
akr
4c4dd6ca31 note EAGAIN on readpartial document.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-05-09 02:12:11 +00:00
akr
e732bfca12 doc update. [ruby-talk:186294]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-03-28 01:49:32 +00:00
matz
a43c264f80 * io.c (argf_forward): should not use frame->argv.
[ruby-core:07358]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-14 02:23:34 +00:00
akr
9a720a6c07 * io.c (READ_DATA_PENDING, READ_DATA_PENDING_COUNT): defined
for DragonFly BSD 1.4.0.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-01-13 20:41:02 +00:00
akr
91cd9984f7 Tue Jan 11 15:00:00 2006 Ville Mattila <mulperi@iki.fi>
* io.c (READ_PENDING*): Support solaris 64-bit enviroments.
         Solaris defines a opaque FILE struct when compiling 64 bit
         binaries. This means that we dont have access to _ptr etc.
         members anymore. The solution by Steven Lumos is to define
         FILE64 that has needed members available. I've modified
         the origanal patch a bit so that it compiles both with gcc
         and now free sun studio 11 compiler and both amd64 and sparc.
         NOTE! We have to 64 bit solaris FILE structure time to time
         otherwise we'll get breakage.
         [ruby-core:7106]

Fri Jan  6 10:16:20 2006  Steven Lumos <steven@lumos.us>

       * io.c (READ_DATA_PENDING): defined for 64bit Solaris on SPARC.
         [ruby-core:7057]
         (READ_DATA_PENDING_COUNT): ditto.
         (READ_DATA_PENDING_PTR): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-01-13 16:47:34 +00:00
akr
aa9cab871c * io.c (rb_f_backquote): fix a GC problem on
IA64 with gcc 4.0.3 20051216 (prerelease) -O3.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-19 17:11:20 +00:00
akr
f7d72f1e65 precedes registering global VALUE variables before initializing it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-12 03:36:49 +00:00
matz
e585523a2b * ext/digest/digest.c (rb_digest_base_s_digest): add volatile to
protect temporary context object.  [ruby-dev:27979]

* ext/iconv/iconv.c (Init_iconv): rb_gc_register_address() should
  be called before actual variable initialization.
  [ruby-dev:27986]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-12 00:36:54 +00:00
nobu
972e93de97 * configure.in, io.c: use sys/syscall.h if syscall.h is not available.
[ruby-core:06247]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-10-24 12:15:26 +00:00
nobu
9401edfe22 * io.c, pack.c, ext/syck/rubyext.c, ext/syck/syck.h, missing/isinf.c:
get rid of warnings.  fixed: [ruby-core:06247]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-10-13 14:30:54 +00:00
nobu
a9280ca7c9 * io.c (read_buffered_data): check if reached EOF. fixed: [ruby-dev:27334]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-27 23:12:43 +00:00
ocean
2299793709 * io.c: fixed rdoc. [ruby-Bugs:2523]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-27 07:08:58 +00:00
ocean
d07e0ae442 * io.c: PIPE_BUF is not defined on BeOS. use _POSIX_PIPE_BUF instead.
[ruby-dev:27185]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-20 08:14:56 +00:00
matz
4a92946ee2 * io.c (io_close): call rb_io_close() directly if io is a T_FILE
object.  [ruby-dev:27156]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-19 15:43:49 +00:00
akr
5b2eef31aa * file.c (rb_thread_flock): wrap the flock system call by
TRAP_BEG/TRAP_END to enable signals.  [ruby-dev:27122]

* ext/socket/socket.c (bsock_send): wrap the sendto and send system
  call by TRAP_BEG/TRAP_END to enable signals when writing to a socket
  which is full.  [ruby-dev:27132]

* io.c (rb_io_syswrite): wrap the write system call by
  TRAP_BEG/TRAP_END to enable signals when writing to a pipe which is
  full.  [ruby-dev:27134]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-18 18:22:44 +00:00
akr
94636e83dc * io.c (io_fwrite): wrap the write system call by TRAP_BEG/TRAP_END to
enable signals when writing to a pipe which is full.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-18 18:06:51 +00:00
matz
cc24eb8518 * lib/cgi.rb (CGI::Cookie): should handle multiple values for a
cookie name.  [ruby-talk:156140]

* string.c (rb_str_substr): should propagate taintness even for
  empty strings.  [ruby-dev:27121]

* string.c (rb_str_aref): should infect result if range argument
  is tainted.  [ruby-dev:27121]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-17 14:55:06 +00:00
akr
d97f060c6a document a blocking behavior of IO#eof?.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-05 15:02:10 +00:00
matz
6112d65af2 * io.c: check HAVE_SYS_IOCTL_H before including the header.
[ruby-dev:26610]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-07-25 07:29:39 +00:00