summaryrefslogtreecommitdiff
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
commit9d0012b0e7d5b658bc62856b36666a9e5d684646 (patch)
tree07457489a9f9d4b988309ad1b2e6dc085252ef83 /ext/io
parent9853cb05f63af45331d7fb5e97d65bf39d50eb8e (diff)
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 6716d32..dc494c2 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");
}