search for: mb_cur_max

Displaying 8 results from an estimated 8 matches for "mb_cur_max".

2007 Jun 24
2
problem gsub in the locale of CP932 and SJIS (PR#9751)
...900 @@ -986,6 +986,17 @@ char *p = repl; n = strlen(repl) - (regmatch[0].rm_eo - regmatch[0].rm_so); while (*p) { +#ifdef SUPPORT_MBCS + if(mbcslocale){ + int clen; + mbstate_t mb_st; + mbs_init(&mb_st); + if((clen = Mbrtowc(NULL, p, MB_CUR_MAX, &mb_st)) > 1){ + p+=clen; + continue; + } + } +#endif if (*p == '\\') { if ('1' <= p[1] && p[1] <= '9') { k = p[1] - '0'; @@ -1014,6 +1025,18 @@ int i, k;...
2015 Mar 02
2
Errors on Windows with grep(fixed=TRUE) on UTF-8 strings
On Windows, grep(fixed=TRUE) throws errors with some UTF-8 strings. Here's an example (must be run on Windows to reproduce the error): Sys.setlocale("LC_CTYPE", "chinese") y <- rawToChar(as.raw(c(0xe6, 0xb8, 0x97))) Encoding(y) <- "UTF-8" y # [1] "?" grep("\n", y, fixed = TRUE) # Error in grep("\n", y, fixed = TRUE) : invalid
2015 Mar 04
0
Errors on Windows with grep(fixed=TRUE) on UTF-8 strings
...bstate_t mb_st; + if (!useBytes && use_UTF8) { int ib, used; - mbs_init(&mb_st); for (ib = 0, i = 0; ib <= len-plen; i++) { if (strncmp(pat, target+ib, plen) == 0) { if (next != NULL) *next = ib + plen; return i; } - used = (int) Mbrtowc(NULL, target+ib, MB_CUR_MAX, &mb_st); + used = utf8clen(target[ib]); if (used <= 0) break; ib += used; } - } else if (!useBytes && use_UTF8) { + } else if (!useBytes && mbcslocale) { /* skip along by chars */ + mbstate_t mb_st; int ib, used; + mbs_init(&mb_st); for (ib =...
2011 Aug 04
1
slightly speeding up readChar()
...dated readFixedString(), which would drop 2 O(N) operations. --- static SEXP readFixedString(Rconnection con, int len, int useBytes) { SEXP ans; char *buf; int m; const void *vmax = vmaxget(); if(utf8locale && !useBytes) { int i, clen; char *p, *q; p = buf = (char *) R_alloc(MB_CUR_MAX*len+1, sizeof(char)); memset(buf, 0, MB_CUR_MAX*len+1); for(i = 0; i < len; i++) { q = p; m = con->read(p, sizeof(char), 1, con); if(!m) { if(i == 0) return R_NilValue; else break;} clen = utf8clen(*p++); if(clen > 1) { m = con->read(p, sizeof(char), clen - 1, con...
2016 Jan 19
6
FWD: [patch] scp + UTF-8
...i = len; i < file_len; i++) - buf[i] = ' '; - buf[file_len] = '\0'; + file_width = win_size - 36; + if (file_width > 0) { + buf[0] = '\r'; + for (i = 0, buf_width = 0, buf_size = 1; + file[i] != '\0';) { + if ((size = mbtowc(&wc, &(file[i]), MB_CUR_MAX)) == -1) { + (void)mbtowc(NULL, NULL, MB_CUR_MAX); + buf[buf_size++] = '?'; + buf_width++; + i++; + } else if ((width = wcwidth(wc)) == -1) { + buf[buf_size++] = '?'; + buf_width++; + i++; + } else if (buf_width + width <= file_width && + bu...
2009 Apr 09
3
type.convert (PR#13646)
Full_Name: Stefan Raberger Version: 2.8.1 OS: Windows XP Submission from: (NULL) (213.185.163.242) Hi there, I recently noticed some strange behaviour of the command "type.convert", depending on the startup mode used. But there also seems to be different behaviour on different PCs (all running the same OS and the same version of R). On PC1: When I start R in SDI mode (RGui --no-save
2011 Oct 21
0
Wine release 1.3.31
...lementations. ddraw: Keep track of interface attached by AddAttachedSurface and detach correct interface when parent is released. Piotr Caban (36): msvcrt: Don't overwrite mbcinfo inside setlocale. msvcrt: Handle C locale in _setmbcp. msvcrt: Use ismbcodepage instead of mb_cur_max in mbcodepage dependent functions. msvcrt: Use _ismbblead instead of _isleadbyte in mbcodepage dependent functions. msvcrt: Move _pctype definition to locale.c. msvcrt: Added _mbtowc_l implementation. msvcrt: Don't duplicate _setmbcp functionality inside _create_locale f...
2016 Aug 18
5
[PATCH v2 0/4] New getprogname module
Hi, as discussed in [1], this series adds a new getprogname module. All it does is providing a getprogname function, much like what is found on e.g. *BSD systems, and using it in gnulib instead of progname. Also, using it explicitly by modules avoids gnulib users the need of either use the progname module (GPL), or to provide program_name (and call set_program_name manually, which is not always