diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2014-08-12 05:56:45 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2014-08-12 05:56:45 +0300 |
commit | a9298670aee293adad4693604b6b92cac8139d9f (patch) | |
tree | ede9b1e047814bb12179920a6b496ec8b20e7d65 /builtin.c | |
parent | 01f1baef24748e4741572fbd7ed8a1dce522fe95 (diff) | |
parent | 6b9d87b595278e606096018ea16615033c5571fe (diff) | |
download | egawk-a9298670aee293adad4693604b6b92cac8139d9f.tar.gz egawk-a9298670aee293adad4693604b6b92cac8139d9f.tar.bz2 egawk-a9298670aee293adad4693604b6b92cac8139d9f.zip |
Merge branch 'master' into cmake
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -1066,13 +1066,29 @@ check_pos: size_t count; memset(& mbs, 0, sizeof(mbs)); + + /* handle systems with too small wchar_t */ + if (sizeof(wchar_t) < 4 && uval > 0xffff) { + if (do_lint) + lintwarn( + _("[s]printf: value %g is too big for %%c format"), + arg->numbr); + + goto out0; + } + wc = uval; count = wcrtomb(buf, wc, & mbs); if (count == 0 - || count == (size_t)-1 - || count == (size_t)-2) + || count == (size_t) -1) { + if (do_lint) + lintwarn( + _("[s]printf: value %g is not a valid wide character"), + arg->numbr); + goto out0; + } memcpy(cpbuf, buf, count); prec = count; @@ -1084,10 +1100,6 @@ out0: /* else, fall through */ #endif - if (do_lint && uval > 255) { - lintwarn("[s]printf: value %g is too big for %%c format", - arg->numbr); - } cpbuf[0] = uval; prec = 1; cp = cpbuf; |