Exemplo n.º 1
0
/*
 * @implemented
 */
int _mbsnbicmp(const unsigned char *s1, const unsigned char *s2, size_t n)
{
  if (n == 0)
    return 0;
  do {
    if (_mbbtoupper(*s1) != _mbbtoupper(*s2))
      return _mbbtoupper(*(unsigned const char *)s1) - _mbbtoupper(*(unsigned const char *)s2);
    s1 += _mbclen2(*s1);
    s2 += _mbclen2(*s2);

    if (*s1 == 0)
      break;
    n--;
  } while (n > 0);
  return 0;
}
Exemplo n.º 2
0
/*
 * @implemented
 */
void _mbccpy(unsigned char *dst, const unsigned char *src)
{
  if (!_ismbblead(*src) )
    return;

  memcpy(dst,src,_mbclen2(*src));
}
Exemplo n.º 3
0
/*
 * @implemented
 */
unsigned char * _mbsnbset(unsigned char *src, unsigned int val, size_t count)
{
	unsigned char *char_src = (unsigned char *)src;
	unsigned short *short_src = (unsigned short *)src;

	if ( _mbclen2(val) == 1 ) {

		while(count > 0) {
			*char_src = val;
			char_src++;
			count--;
		}
		*char_src = 0;
	}
	else {
		while(count > 0) {
			*short_src = val;
			short_src++;
			count-=2;
		}
		*short_src = 0;
	}

	return src;
}
Exemplo n.º 4
0
/*
 * @implemented
 */
size_t _mbslen(const unsigned char *str)
{
	int i = 0;
	unsigned char *s;

	if (str == 0)
		return 0;
		
	for (s = (unsigned char *)str; *s; s+=_mbclen2(*s),i++);
	return i;
}
Exemplo n.º 5
0
/*
 * @implemented
 */
unsigned char * _mbsset(unsigned char *src, unsigned int c)
{
	unsigned char *char_src = src;
	unsigned short *short_src = (unsigned short *)src;

	if ( _mbclen2(c) == 1 ) {

		while(*char_src != 0) {
			*char_src = c;
			char_src++;
		}
		*char_src = 0;
	}
	else {
		while(*short_src != 0) {
			*short_src = c;
			short_src++;
		}
		*short_src = 0;
	}

	return src;
}