diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-10-12 14:47:07 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-10-12 14:47:07 +0000 |
commit | 1de50c518b9a5244bef0473eab46d4b892fe817d (patch) | |
tree | 5a1787e4323d3568f08f52b860ceeb503a89a074 /win32 | |
parent | 31ab445fead6824a54f8162d19d5681dd85ebbf0 (diff) |
* win32/win32.c (rb_w32_putc): wrong condition to fill or flush on
bccwin32. [ruby-win32:408]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/win32/win32.c b/win32/win32.c index 0e155ef9e6..c4086fe159 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -51,7 +51,12 @@ #ifdef __BORLANDC__ # define _filbuf _fgetc -# define _flsbuf fputc +# define _flsbuf _fputc +# define enough_to_get(n) (--(n) >= 0) +# define enough_to_put(n) (++(n) < 0) +#else +# define enough_to_get(n) (--(n) >= 0) +# define enough_to_put(n) (--(n) >= 0) #endif #if HAVE_WSAWAITFORMULTIPLEEVENTS @@ -2788,7 +2793,7 @@ static void catch_interrupt(void) int rb_w32_getc(FILE* stream) { int c, trap_immediate = rb_trap_immediate; - if (--stream->FILE_COUNT >= 0) { + if (enough_to_get(stream->FILE_COUNT)) { c = (unsigned char)*stream->FILE_READPTR++; rb_trap_immediate = trap_immediate; } @@ -2810,7 +2815,7 @@ int rb_w32_getc(FILE* stream) int rb_w32_putc(int c, FILE* stream) { int trap_immediate = rb_trap_immediate; - if (--stream->FILE_COUNT >= 0) { + if (enough_to_put(stream->FILE_COUNT)) { c = (unsigned char)(*stream->FILE_READPTR++ = (char)c); rb_trap_immediate = trap_immediate; } |