diff options
author | Andy Shevchenko <ext-andriy.shevchenko@nokia.com> | 2010-03-15 16:48:08 -0400 |
---|---|---|
committer | OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> | 2010-03-15 16:49:01 -0400 |
commit | 3ed3dec1568d1232fcfb2aa8c5f9e3f38940c9d8 (patch) | |
tree | c13f22940cc8bd4bfd7c214354b218dd675a259e | |
parent | a3d3203e4bb40f253b1541e310dc0f9305be7c84 (diff) |
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>
-rw-r--r-- | fs/fat/dir.c | 17 |
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 @@ | |||
19 | #include <linux/buffer_head.h> | 19 | #include <linux/buffer_head.h> |
20 | #include <linux/compat.h> | 20 | #include <linux/compat.h> |
21 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
22 | #include <linux/kernel.h> | ||
22 | #include "fat.h" | 23 | #include "fat.h" |
23 | 24 | ||
24 | /* | 25 | /* |
@@ -140,28 +141,22 @@ static int uni16_to_x8(unsigned char *ascii, const wchar_t *uni, int len, | |||
140 | { | 141 | { |
141 | const wchar_t *ip; | 142 | const wchar_t *ip; |
142 | wchar_t ec; | 143 | wchar_t ec; |
143 | unsigned char *op, nc; | 144 | unsigned char *op; |
144 | int charlen; | 145 | int charlen; |
145 | int k; | ||
146 | 146 | ||
147 | ip = uni; | 147 | ip = uni; |
148 | op = ascii; | 148 | op = ascii; |
149 | 149 | ||
150 | while (*ip && ((len - NLS_MAX_CHARSET_SIZE) > 0)) { | 150 | while (*ip && ((len - NLS_MAX_CHARSET_SIZE) > 0)) { |
151 | ec = *ip++; | 151 | ec = *ip++; |
152 | if ( (charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE)) > 0) { | 152 | if ((charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE)) > 0) { |
153 | op += charlen; | 153 | op += charlen; |
154 | len -= charlen; | 154 | len -= charlen; |
155 | } else { | 155 | } else { |
156 | if (uni_xlate == 1) { | 156 | if (uni_xlate == 1) { |
157 | *op = ':'; | 157 | *op++ = ':'; |
158 | for (k = 4; k > 0; k--) { | 158 | op = pack_hex_byte(op, ec >> 8); |
159 | nc = ec & 0xF; | 159 | op = pack_hex_byte(op, ec); |
160 | op[k] = nc > 9 ? nc + ('a' - 10) | ||
161 | : nc + '0'; | ||
162 | ec >>= 4; | ||
163 | } | ||
164 | op += 5; | ||
165 | len -= 5; | 160 | len -= 5; |
166 | } else { | 161 | } else { |
167 | *op++ = '?'; | 162 | *op++ = '?'; |