The R Project SVN R

Rev

Rev 41944 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 41944 Rev 41966
Line 258... Line 258...
258
#include <R_ext/rlocale.h>
258
#include <R_ext/rlocale.h>
259
 
259
 
260
static int wd(const char * buf)
260
static int wd(const char * buf)
261
{
261
{
262
    int nc = mbstowcs(NULL, buf, 0), nw;
262
    int nc = mbstowcs(NULL, buf, 0), nw;
263
    if(nc >= 0 || nc < 200) {
263
    if(nc > 0 && nc < 2000) {
264
	wchar_t wc[200];
264
	wchar_t wc[2000];
265
	mbstowcs(wc, buf, nc + 1);
265
	mbstowcs(wc, buf, nc + 1);
266
	nw = Ri18n_wcswidth(wc, 2147483647);
266
	nw = Ri18n_wcswidth(wc, 2147483647);
267
	return (nw < 1) ? nc : nw;
267
	return (nw < 1) ? nc : nw;
268
    }
268
    }
269
    return nc;
269
    return nc;