diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2014-07-31 23:07:49 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2014-07-31 23:07:49 +0300 |
commit | d3bd5c88e7505063348d88604180d3e1e6e0f5a9 (patch) | |
tree | 8f02716cef3d945932817a9ccc341ea1d19b5a67 /builtin.c | |
parent | 54146e27c8fd7756a944d0e168aa969624567b55 (diff) | |
parent | e02ffe43c534493a40e9b9403cd91a6357514c85 (diff) | |
download | egawk-d3bd5c88e7505063348d88604180d3e1e6e0f5a9.tar.gz egawk-d3bd5c88e7505063348d88604180d3e1e6e0f5a9.tar.bz2 egawk-d3bd5c88e7505063348d88604180d3e1e6e0f5a9.zip |
Merge branch 'gawk-4.1-stable'
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -1066,13 +1066,30 @@ 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)-2) { + 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 +1101,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; |