/** @file\r
+ Copyright (c) 2016, Daryl McDaniel. All rights reserved.<BR>\r
Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
#include <sys/types.h>\r
#include <limits.h>\r
\r
-typedef int ch_UCS4;\r
+typedef int ch_UCS4;\r
\r
static mbstate_t LocalConvState = {0};\r
\r
// We are in an invalid state\r
ps->A = 0; // Initial State\r
}\r
- ps->C[ps->A] = ch; // Save the current character\r
+ ps->C[ps->A] = ch; // Save the current byte\r
Mask = utf8_code_length[ch];\r
\r
if(ps->A == 0) { // Initial State. First byte of sequence.\r
case 0: // State 0, Code 0\r
errno = EILSEQ;\r
RetVal = -1;\r
- ps->E = 1; // Consume this character\r
+ ps->E = 1; // Consume this byte\r
break;\r
case 1: // State 0, Code 1\r
// ASCII-7 Character\r
ps->A = 0; // Next state is State-0\r
RetVal = 2;\r
}\r
- else { // This isn't the last character, get more. State 1, Code 3 or 4\r
+ else { // This isn't the last byte, get more. State 1, Code 3 or 4\r
ps->A = 2;\r
RetVal = -2;\r
}\r
errno = EILSEQ;\r
ps->A = 0;\r
RetVal = -1;\r
- ps->E = 4; // Can't happen, but consume this character anyway\r
+ ps->E = 4; // Can't happen, but consume this byte anyway\r
}\r
break;\r
}\r
}\r
- else { // Invalid surrogate character\r
+ else { // Invalid surrogate byte\r
errno = EILSEQ;\r
ps->A = 0; // Next is State-0\r
RetVal = -1;\r
\r
@param[in] Src Pointer to a wide character string.\r
@param[in] Limit Maximum number of bytes the converted string may occupy.\r
- @param[out] NumChar Pointer to where to store the number of wide characters, or NULL.\r
+ @param[out] NumChar Pointer to where to store the number of wide characters\r
+ consumed, or NULL.\r
\r
@return The number of bytes required to convert Src to MBCS,\r
not including the terminating NUL. If NumChar is not NULL, the number\r
@return If a wide character is encountered that does not correspond to a\r
valid multibyte character, the wcstombs function returns\r
(size_t)(-1). Otherwise, the wcstombs function returns the number\r
- of bytes modified, not including a terminating null character,\r
- if any.\r
+ of bytes in the resulting multibyte character sequence,\r
+ not including the terminating null character (if any).\r
\r
Declared in: stdlib.h\r
**/\r