aboutsummaryrefslogtreecommitdiffstats
path: root/ext/io
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-07 00:25:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-07 00:25:50 +0000
commit715d79a64c9f7e38b82578c759408383c2ecb5c4 (patch)
tree07457489a9f9d4b988309ad1b2e6dc085252ef83 /ext/io
parent7926c0166005f694d1d8b0e975ba4be5267cc80d (diff)
downloadruby-715d79a64c9f7e38b82578c759408383c2ecb5c4.tar.gz
console.c: check unused args
* ext/io/console/console.c (console_set_winsize): unused arguments also should be nil or integers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/io')
-rw-r--r--ext/io/console/console.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index 6716d32201..dc494c2ddd 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -541,8 +541,12 @@ console_set_winsize(VALUE io, VALUE size)
if (!setwinsize(fd, &ws)) rb_sys_fail(0);
#elif defined _WIN32
wh = (HANDLE)rb_w32_get_osfhandle(fd);
- newrow = (SHORT)NUM2UINT(row);
- newcol = (SHORT)NUM2UINT(col);
+#define SET(m) new##m = NIL_P(m) ? 0 : (unsigned short)NUM2UINT(m)
+ SET(row);
+ SET(col);
+#undef SET
+ if (!NIL_P(xpixel)) (void)NUM2UINT(xpixel);
+ if (!NIL_P(ypixel)) (void)NUM2UINT(ypixel);
if (!GetConsoleScreenBufferInfo(wh, &ws)) {
rb_syserr_fail(LAST_ERROR, "GetConsoleScreenBufferInfo");
}