Fix the fix. (-:

(Logical change 1.284)
edge.strict_endians
cantab.net!aia21 2004-02-26 12:08:23 +00:00
parent 3949cb41a6
commit 42e3faba21
1 changed files with 8 additions and 0 deletions

View File

@ -567,12 +567,20 @@ int ucstos(char *dest, const uchar_t *src, int maxlen)
*
* Return the number of characters written to @dest, not including the
* terminating null unicode character.
*
* If @maxlen is less than the size of a single unicode character we cannot
* write the terminating null unicode character and hence return -1 with errno
* set to EINVAL.
*/
int stoucs(uchar_t *dest, const char *src, int maxlen)
{
char c;
int i;
if (maxlen < sizeof(uchar_t)) {
errno = EINVAL;
return -1;
}
/* Convert maxlen from bytes to unicode characters. */
maxlen /= sizeof(uchar_t);
/* Need space for null terminator. */