Hi Raphael, looking better.  One more point below:

--- Raphael <[EMAIL PROTECTED]> wrote:
> > Index: dlls/msvcrt/mbcs.c
> ===================================================================
> RCS file: /home/wine/wine/dlls/msvcrt/mbcs.c,v
> retrieving revision 1.30
> diff -u -r1.30 mbcs.c
> --- dlls/msvcrt/mbcs.c        25 Feb 2005 14:07:57 -0000      1.30
> +++ dlls/msvcrt/mbcs.c        5 Apr 2005 20:29:51 -0000
> @@ -1143,4 +1144,37 @@
>          str += (MSVCRT_isleadbyte(*str)?2:1);
>      }
>      return NULL;
> +}
> +
> +/*********************************************************************
> + *           _mbsbtype (MSVCRT.@)
> + */
> +int _mbsbtype(const unsigned char* mbstr, size_t count) {
> +  const unsigned char* str;
> +  const unsigned char* start = mbstr;
> +
> +  str = mbstr + count;
> +
> +  /** from _ismbslead */
> +  if (MSVCRT___mb_cur_max > 1)
> +  {
> +    while (start < str) {
> +      if (!*start) {
> +     return _MBC_ILLEGAL;
> +      }
> +      start += MSVCRT_isleadbyte(*str) ? 2 : 1;
> +    }
> +
> +  }
> +  if (!*str) { /** TODO: check *str validity */
> +    return _MBC_ILLEGAL;
> +  }
> +  if (start == str && MSVCRT_isleadbyte(*str)) {
> +    return _MBC_LEAD;
> +  }
> +  if (start == str && MSVCRT_isleadbyte(str[-1])) {
> +    return _MBC_TRAIL;
> +  }

For this last comparison, it's possible that you're indexing before the
array if count is 0.  Also, it seems more natural to check if (start ==
str && !MSVCRT_isleadbyte(*str)) return _MBC_SINGLE, but that would imply
that _MBC_TRAIL is never returned.  A test case would satisfy my
curiosity, at least.

--Juan


                
__________________________________ 
Yahoo! Messenger 
Show us what our next emoticon should look like. Join the fun. 
http://www.advision.webevents.yahoo.com/emoticontest

Reply via email to