kernels/linux-2.4.0/fs/smbfs/proc.c
/* convert from one "codepage" to another (possibly being utf8). */
convert from one "codepage" to another (possibly being utf8).
convert from one " codepage " to another ( possibly being utf8 ) .
static int convert_cp(char *output, int olen,
		      const char *input, int ilen,
		      struct nls_table *nls_from,
		      struct nls_table *nls_to)
{
	int len = 0;
	int n;
	wchar_t ch;
	if (!nls_from || !nls_to) {
		PARANOIA("nls_from=%p, nls_to=%p\n", nls_from, nls_to);
		return convert_memcpy(output, olen, input, ilen, NULL, NULL);
	}
	while (ilen > 0) {
		n = nls_from->char2uni((unsigned char *)input, ilen, &ch);
		if (n < 0)
			goto out;
		input += n;
		ilen -= n;
		n = nls_to->uni2char(ch, output, olen);
		if (n < 0)
			goto out;
		output += n;
		olen -= n;
		len += n;
	}
out:
	return len;
}
static int convert_cp ( char * output , int olen , const char * input , int ilen , struct nls_table * nls_from , struct nls_table * nls_to ) { int len = 0 ; int n ; wchar_t ch ; if ( ! nls_from || ! nls_to ) { PARANOIA ( " \n " , nls_from , nls_to ) ; return convert_memcpy ( output , olen , input , ilen , NULL , NULL ) ; } while ( ilen > 0 ) { n = nls_from -> char2uni ( ( unsigned char * ) input , ilen , & ch ) ; if ( n < 0 ) goto out ; input += n ; ilen -= n ; n = nls_to -> uni2char ( ch , output , olen ) ; if ( n < 0 ) goto out ; output += n ; olen -= n ; len += n ; } out : return len ; }
convert from one "codepage" to another (possibly being utf8).
convert from one " codepage " to another ( possibly being utf8 ) .
/* convert by changing to unicode and back to the new cp */