summaryrefslogtreecommitdiffstats
path: root/fs/fat/dir.c
diff options
context:
space:
mode:
authorAndy Shevchenko2010-03-15 21:48:08 +0100
committerOGAWA Hirofumi2010-03-15 21:49:01 +0100
commit3ed3dec1568d1232fcfb2aa8c5f9e3f38940c9d8 (patch)
treec13f22940cc8bd4bfd7c214354b218dd675a259e /fs/fat/dir.c
parentMerge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/... (diff)
downloadkernel-qcow2-linux-3ed3dec1568d1232fcfb2aa8c5f9e3f38940c9d8.tar.gz
kernel-qcow2-linux-3ed3dec1568d1232fcfb2aa8c5f9e3f38940c9d8.tar.xz
kernel-qcow2-linux-3ed3dec1568d1232fcfb2aa8c5f9e3f38940c9d8.zip
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>
Diffstat (limited to 'fs/fat/dir.c')
-rw-r--r--fs/fat/dir.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 530b4ca01510..20a1b92e035e 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -19,6 +19,7 @@
#include <linux/buffer_head.h>
#include <linux/compat.h>
#include <asm/uaccess.h>
+#include <linux/kernel.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;
wchar_t ec;
- unsigned char *op, nc;
+ unsigned char *op;
int charlen;
- int k;
ip = uni;
op = ascii;
while (*ip && ((len - NLS_MAX_CHARSET_SIZE) > 0)) {
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;
len -= charlen;
} else {
if (uni_xlate == 1) {
- *op = ':';
- for (k = 4; k > 0; k--) {
- nc = ec & 0xF;
- op[k] = nc > 9 ? nc + ('a' - 10)
- : nc + '0';
- ec >>= 4;
- }
- op += 5;
+ *op++ = ':';
+ op = pack_hex_byte(op, ec >> 8);
+ op = pack_hex_byte(op, ec);
len -= 5;
} else {
*op++ = '?';