Errors that StringIO#seek raises


#1

e$B$3$s$K$A$Oe(B sheepman e$B$G$9!#e(B

e$B%j%U%!%l%s%9$r=q$$$F$$$F5$$,$D$$$?:Y$+$$OC$G$9$,!#e(B

StringIO#seek e$B$,Ej$2$kNc30$r!"e(BIO
e$B%/%i%9$N$=$l$K9g$o$;$k%Q%C%A$G$9!#e(B

  • e$B<+?H$,e(B close e$B$5$l$F$$$?$i!"e(BIOError
    e$B$rEj$2$k$h$&$K$7$^$7$?!#e(B
  • whence e$B$NCM$,@5$7$/$J$$>l9g$O!"e(BErrno::EINVAL
    e$B$rEj$2$k$h$&$K$7$^$7$?!#e(B

$ svn diff
Index: stringio.c

— stringio.c (revision 12131)
+++ stringio.c (working copy)
@@ -643,6 +643,9 @@
struct StringIO *ptr = StringIO(self);
long offset;

  • if (CLOSED(ptr)) {
  •   rb_raise(rb_eIOError, "closed stream");
    
  • }
    rb_scan_args(argc, argv, “11”, NULL, &whence);
    offset = NUM2LONG(argv[0]);
    switch (NIL_P(whence) ? 0 : NUM2LONG(whence)) {
    @@ -655,7 +658,7 @@
    offset += RSTRING(ptr->string)->len;
    break;
    default:
  •   rb_raise(rb_eArgError, "invalid whence %ld", NUM2LONG(whence));
    
  •   error_inval("invalid whence");
    
    }
    if (offset < 0) {
    error_inval(0);

e$B$=$l$G$O!#e(B


#2

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:30710] errors that StringIO#seek raises”
on Sat, 14 Apr 2007 14:01:13 +0900, sheepman
removed_email_address@domain.invalid writes:

|StringIO#seek e$B$,Ej$2$kNc30$r!"e(BIO e$B%/%i%9$N$=$l$K9g$o$;$k%Q%C%A$G$9!#e(B
|
|* e$B<+?H$,e(B close e$B$5$l$F$$$?$i!"e(BIOError e$B$rEj$2$k$h$&$K$7$^$7$?!#e(B
|* whence e$B$NCM$,@5$7$/$J$$>l9g$O!"e(BErrno::EINVAL e$B$rEj$2$k$h$&$K$7$^$7$?!#e(B

e$B%3%_%C%H$7$F$b$$$$$s$8$c$J$$$G$7$g$&$+!#e(B
e$B$I$&$G$7$g$&!)e(B e$B!de(B e$B$J$+$@$5$se(B


#3

e$B$J$+$@$G$9!#e(B

At Sat, 14 Apr 2007 14:01:13 +0900,
sheepman wrote in [ruby-dev:30710]:

StringIO#seek e$B$,Ej$2$kNc30$r!"e(BIO e$B%/%i%9$N$=$l$K9g$o$;$k%Q%C%A$G$9!#e(B

e$B$"$j$,$H$&$4$6$$$^$9!#$=$3$^$G%A%’%C%/$7$F$b$i$($k$H$O!#e(B

  • e$B<+?H$,e(B close e$B$5$l$F$$$?$i!"e(BIOError e$B$rEj$2$k$h$&$K$7$^$7$?!#e(B
  • whence e$B$NCM$,@5$7$/$J$$>l9g$O!"e(BErrno::EINVAL e$B$rEj$2$k$h$&$K$7$^$7$?!#e(B

IOe$B$G$Oe(Bwhencee$B$+$I$&$+$b=P$^$;$s$M!#e(BStringIO#truncatee$B$KIi$ND9$5$re(B
e$B;XDj$7$?$H$-$K$b!“e(BIO#truncatee$B$H$O%a%C%;!<%8$,0c$$$^$9$,!”$3$N$Xe(B
e$B$s$O$I$&$7$^$7$g$&$+$M$’!#e(B