fat: use pack_hex_byte() instead of custom one

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
This commit is contained in:
Andy Shevchenko 2010-03-16 05:48:08 +09:00 committed by OGAWA Hirofumi
parent a3d3203e4b
commit 3ed3dec156
1 changed files with 6 additions and 11 deletions

View File

@ -19,6 +19,7 @@
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/compat.h> #include <linux/compat.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/kernel.h>
#include "fat.h" #include "fat.h"
/* /*
@ -140,28 +141,22 @@ static int uni16_to_x8(unsigned char *ascii, const wchar_t *uni, int len,
{ {
const wchar_t *ip; const wchar_t *ip;
wchar_t ec; wchar_t ec;
unsigned char *op, nc; unsigned char *op;
int charlen; int charlen;
int k;
ip = uni; ip = uni;
op = ascii; op = ascii;
while (*ip && ((len - NLS_MAX_CHARSET_SIZE) > 0)) { while (*ip && ((len - NLS_MAX_CHARSET_SIZE) > 0)) {
ec = *ip++; ec = *ip++;
if ( (charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE)) > 0) { if ((charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE)) > 0) {
op += charlen; op += charlen;
len -= charlen; len -= charlen;
} else { } else {
if (uni_xlate == 1) { if (uni_xlate == 1) {
*op = ':'; *op++ = ':';
for (k = 4; k > 0; k--) { op = pack_hex_byte(op, ec >> 8);
nc = ec & 0xF; op = pack_hex_byte(op, ec);
op[k] = nc > 9 ? nc + ('a' - 10)
: nc + '0';
ec >>= 4;
}
op += 5;
len -= 5; len -= 5;
} else { } else {
*op++ = '?'; *op++ = '?';