1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* pack.c (pack_pack): remove unnecessary negative value check.

[ruby-dev:22329]

* io.c (rb_io_ungetc): need fflush before ungetc if write buffer
  is filled. [ruby-dev:22330]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-12-23 10:02:17 +00:00
parent d5ae9837ff
commit dbc5af97c7
5 changed files with 18 additions and 12 deletions

View file

@ -1,3 +1,11 @@
Tue Dec 23 18:09:40 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* pack.c (pack_pack): remove unnecessary negative value check.
[ruby-dev:22329]
* io.c (rb_io_ungetc): need fflush before ungetc if write buffer
is filled. [ruby-dev:22330]
Tue Dec 23 17:26:55 2003 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp> Tue Dec 23 17:26:55 2003 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
* bcc32/Makefile.sub (config.h): bcc has finite(). [ruby-list:38940] * bcc32/Makefile.sub (config.h): bcc has finite(). [ruby-list:38940]

View file

@ -906,7 +906,7 @@ if test "$with_dln_a_out" != yes; then
aix*) : ${LDSHARED='/usr/ccs/bin/ld'} aix*) : ${LDSHARED='/usr/ccs/bin/ld'}
XLDFLAGS="$XLDFLAGS -Wl,-bE:ruby.imp" XLDFLAGS="$XLDFLAGS -Wl,-bE:ruby.imp"
DLDFLAGS="$DLDFLAGS "'-brtl -eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 -lc' DLDFLAGS="$DLDFLAGS "'-brtl -eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 -lc'
LDFLAGS="$LDFLAGS -brtl" : LDFLAGS="$LDFLAGS -brtl"
: ${ARCHFILE="ruby.imp"} : ${ARCHFILE="ruby.imp"}
rb_cv_dlopen=yes ;; rb_cv_dlopen=yes ;;

1
io.c
View file

@ -1315,6 +1315,7 @@ rb_io_ungetc(io, c)
GetOpenFile(io, fptr); GetOpenFile(io, fptr);
rb_io_check_readable(fptr); rb_io_check_readable(fptr);
flush_before_seek(fptr);
if (ungetc(cc, fptr->f) == EOF && cc != EOF) if (ungetc(cc, fptr->f) == EOF && cc != EOF)
rb_sys_fail(fptr->path); rb_sys_fail(fptr->path);

View file

@ -18,7 +18,7 @@ module REXML
# Convert to UTF-8 # Convert to UTF-8
def decode(str) def decode(str)
str.unpack('C*').pack('U*') b str.unpack('C*').pack('U*')
end end
EOL EOL
end end

17
pack.c
View file

@ -90,7 +90,7 @@ TOKEN_PASTE(swap,x)(z) \
|(((x)&0x0000FF00)<<8) \ |(((x)&0x0000FF00)<<8) \
|(((x)&0x00FF0000)>>8) ) |(((x)&0x00FF0000)>>8) )
#else #else
define_swapx(s,short); define_swapx(s,short)
#endif #endif
#endif #endif
@ -113,7 +113,7 @@ define_swapx(s,short);
|(((x)&0x00000000FF000000)<<8) \ |(((x)&0x00000000FF000000)<<8) \
|(((x)&0x000000FF00000000)>>8)) |(((x)&0x000000FF00000000)>>8))
#else #else
define_swapx(l,long); define_swapx(l,long)
#endif #endif
#endif #endif
@ -126,11 +126,11 @@ define_swapx(l,long);
#define swapf(x) swaps(x) #define swapf(x) swaps(x)
#define FLOAT_SWAPPER unsigned short #define FLOAT_SWAPPER unsigned short
#else /* SIZEOF_FLOAT == 4 but undivide by known size of int */ #else /* SIZEOF_FLOAT == 4 but undivide by known size of int */
define_swapx(f,float); define_swapx(f,float)
#endif /* #if SIZEOF_SHORT == 4 */ #endif /* #if SIZEOF_SHORT == 4 */
#endif /* #if SIZEOF_LONG == 4 */ #endif /* #if SIZEOF_LONG == 4 */
#else /* SIZEOF_FLOAT != 4 */ #else /* SIZEOF_FLOAT != 4 */
define_swapx(f,float); define_swapx(f,float)
#endif /* #if SIZEOF_FLOAT == 4 */ #endif /* #if SIZEOF_FLOAT == 4 */
#if SIZEOF_DOUBLE == 8 #if SIZEOF_DOUBLE == 8
@ -174,12 +174,12 @@ swapd(d)
return dtmp; return dtmp;
} }
#else /* SIZEOF_DOUBLE == 8 but undivied by known size of int */ #else /* SIZEOF_DOUBLE == 8 but undivied by known size of int */
define_swapx(d, double); define_swapx(d, double)
#endif /* #if SIZEOF_SHORT == 4 */ #endif /* #if SIZEOF_SHORT == 4 */
#endif /* #if SIZEOF_LONG == 4 */ #endif /* #if SIZEOF_LONG == 4 */
#endif /* #if SIZEOF_LONG == 8 */ #endif /* #if SIZEOF_LONG == 8 */
#else /* SIZEOF_DOUBLE != 8 */ #else /* SIZEOF_DOUBLE != 8 */
define_swapx(d, double); define_swapx(d, double)
#endif /* #if SIZEOF_DPOUBLE == 8 */ #endif /* #if SIZEOF_DPOUBLE == 8 */
#undef define_swapx #undef define_swapx
@ -929,10 +929,7 @@ pack_pack(ary, fmt)
from = NEXTFROM; from = NEXTFROM;
if (NIL_P(from)) l = 0; if (NIL_P(from)) l = 0;
else { else {
l = NUM2ULONG(from); l = NUM2UINT(from);
}
if (l < 0) {
rb_raise(rb_eArgError, "pack(U): negative value");
} }
le = uv_to_utf8(buf, l); le = uv_to_utf8(buf, l);
rb_str_buf_cat(res, (char*)buf, le); rb_str_buf_cat(res, (char*)buf, le);