Skip to content

Commit

Permalink
* pack.c (pack_pack): remove unnecessary negative value check.
Browse files Browse the repository at this point in the history
  [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
  • Loading branch information
matz committed Dec 23, 2003
1 parent d5ae983 commit dbc5af9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Tue Dec 23 18:09:40 2003 Yukihiro Matsumoto <[email protected]>

* 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 <[email protected]>

* bcc32/Makefile.sub (config.h): bcc has finite(). [ruby-list:38940]
Expand Down
2 changes: 1 addition & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ if test "$with_dln_a_out" != yes; then
aix*) : ${LDSHARED='/usr/ccs/bin/ld'}
XLDFLAGS="$XLDFLAGS -Wl,-bE:ruby.imp"
DLDFLAGS="$DLDFLAGS "'-brtl -eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 -lc'
LDFLAGS="$LDFLAGS -brtl"
: LDFLAGS="$LDFLAGS -brtl"
: ${ARCHFILE="ruby.imp"}
rb_cv_dlopen=yes ;;

Expand Down
1 change: 1 addition & 0 deletions io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,7 @@ rb_io_ungetc(io, c)

GetOpenFile(io, fptr);
rb_io_check_readable(fptr);
flush_before_seek(fptr);

if (ungetc(cc, fptr->f) == EOF && cc != EOF)
rb_sys_fail(fptr->path);
Expand Down
2 changes: 1 addition & 1 deletion lib/rexml/encodings/US-ASCII.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def encode content
# Convert to UTF-8
def decode(str)
str.unpack('C*').pack('U*')
b str.unpack('C*').pack('U*')
end
EOL
end
Expand Down
17 changes: 7 additions & 10 deletions pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ TOKEN_PASTE(swap,x)(z) \
|(((x)&0x0000FF00)<<8) \
|(((x)&0x00FF0000)>>8) )
#else
define_swapx(s,short);
define_swapx(s,short)
#endif
#endif

Expand All @@ -113,7 +113,7 @@ define_swapx(s,short);
|(((x)&0x00000000FF000000)<<8) \
|(((x)&0x000000FF00000000)>>8))
#else
define_swapx(l,long);
define_swapx(l,long)
#endif
#endif

Expand All @@ -126,11 +126,11 @@ define_swapx(l,long);
#define swapf(x) swaps(x)
#define FLOAT_SWAPPER unsigned short
#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_LONG == 4 */
#else /* SIZEOF_FLOAT != 4 */
define_swapx(f,float);
define_swapx(f,float)
#endif /* #if SIZEOF_FLOAT == 4 */

#if SIZEOF_DOUBLE == 8
Expand Down Expand Up @@ -174,12 +174,12 @@ swapd(d)
return dtmp;
}
#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_LONG == 4 */
#endif /* #if SIZEOF_LONG == 8 */
#else /* SIZEOF_DOUBLE != 8 */
define_swapx(d, double);
define_swapx(d, double)
#endif /* #if SIZEOF_DPOUBLE == 8 */

#undef define_swapx
Expand Down Expand Up @@ -929,10 +929,7 @@ pack_pack(ary, fmt)
from = NEXTFROM;
if (NIL_P(from)) l = 0;
else {
l = NUM2ULONG(from);
}
if (l < 0) {
rb_raise(rb_eArgError, "pack(U): negative value");
l = NUM2UINT(from);
}
le = uv_to_utf8(buf, l);
rb_str_buf_cat(res, (char*)buf, le);
Expand Down

0 comments on commit dbc5af9

Please sign in to comment.