version 1.71, 2016/01/14 20:41:23 |
version 1.71.4.1, 2017/04/21 16:53:09 |
Line 405 istrsenvisx(char **mbdstp, size_t *dlen, |
|
Line 405 istrsenvisx(char **mbdstp, size_t *dlen, |
|
_DIAGASSERT(mbsrc != NULL || mblength == 0); |
_DIAGASSERT(mbsrc != NULL || mblength == 0); |
_DIAGASSERT(mbextra != NULL); |
_DIAGASSERT(mbextra != NULL); |
|
|
|
mbslength = (ssize_t)mblength; |
|
/* |
|
* When inputing a single character, must also read in the |
|
* next character for nextc, the look-ahead character. |
|
*/ |
|
if (mbslength == 1) |
|
mbslength++; |
|
|
/* |
/* |
* Input (mbsrc) is a char string considered to be multibyte |
* Input (mbsrc) is a char string considered to be multibyte |
* characters. The input loop will read this string pulling |
* characters. The input loop will read this string pulling |
Line 421 istrsenvisx(char **mbdstp, size_t *dlen, |
|
Line 429 istrsenvisx(char **mbdstp, size_t *dlen, |
|
/* Allocate space for the wide char strings */ |
/* Allocate space for the wide char strings */ |
psrc = pdst = extra = NULL; |
psrc = pdst = extra = NULL; |
mdst = NULL; |
mdst = NULL; |
if ((psrc = calloc(mblength + 1, sizeof(*psrc))) == NULL) |
if ((psrc = calloc(mbslength + 1, sizeof(*psrc))) == NULL) |
return -1; |
return -1; |
if ((pdst = calloc((4 * mblength) + 1, sizeof(*pdst))) == NULL) |
if ((pdst = calloc((4 * mbslength) + 1, sizeof(*pdst))) == NULL) |
goto out; |
goto out; |
if (*mbdstp == NULL) { |
if (*mbdstp == NULL) { |
if ((mdst = calloc((4 * mblength) + 1, sizeof(*mdst))) == NULL) |
if ((mdst = calloc((4 * mbslength) + 1, sizeof(*mdst))) == NULL) |
goto out; |
goto out; |
*mbdstp = mdst; |
*mbdstp = mdst; |
} |
} |
Line 449 istrsenvisx(char **mbdstp, size_t *dlen, |
|
Line 457 istrsenvisx(char **mbdstp, size_t *dlen, |
|
* stop at NULs because we may be processing a block of data |
* stop at NULs because we may be processing a block of data |
* that includes NULs. |
* that includes NULs. |
*/ |
*/ |
mbslength = (ssize_t)mblength; |
|
/* |
|
* When inputing a single character, must also read in the |
|
* next character for nextc, the look-ahead character. |
|
*/ |
|
if (mbslength == 1) |
|
mbslength++; |
|
while (mbslength > 0) { |
while (mbslength > 0) { |
/* Convert one multibyte character to wchar_t. */ |
/* Convert one multibyte character to wchar_t. */ |
if (!cerr) |
if (!cerr) |
Line 481 istrsenvisx(char **mbdstp, size_t *dlen, |
|
Line 482 istrsenvisx(char **mbdstp, size_t *dlen, |
|
} |
} |
len = src - psrc; |
len = src - psrc; |
src = psrc; |
src = psrc; |
|
|
/* |
/* |
* In the single character input case, we will have actually |
* In the single character input case, we will have actually |
* processed two characters, c and nextc. Reset len back to |
* processed two characters, c and nextc. Reset len back to |