Commit 3ed3dec1568d1232fcfb2aa8c5f9e3f38940c9d8
Committed by
OGAWA Hirofumi
1 parent
a3d3203e4b
Exists in
master
and in
4 other branches
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>
Showing 1 changed file with 6 additions and 11 deletions Side-by-side Diff
fs/fat/dir.c
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | #include <linux/buffer_head.h> |
20 | 20 | #include <linux/compat.h> |
21 | 21 | #include <asm/uaccess.h> |
22 | +#include <linux/kernel.h> | |
22 | 23 | #include "fat.h" |
23 | 24 | |
24 | 25 | /* |
25 | 26 | |
26 | 27 | |
27 | 28 | |
... | ... | @@ -140,28 +141,22 @@ |
140 | 141 | { |
141 | 142 | const wchar_t *ip; |
142 | 143 | wchar_t ec; |
143 | - unsigned char *op, nc; | |
144 | + unsigned char *op; | |
144 | 145 | int charlen; |
145 | - int k; | |
146 | 146 | |
147 | 147 | ip = uni; |
148 | 148 | op = ascii; |
149 | 149 | |
150 | 150 | while (*ip && ((len - NLS_MAX_CHARSET_SIZE) > 0)) { |
151 | 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 | 153 | op += charlen; |
154 | 154 | len -= charlen; |
155 | 155 | } else { |
156 | 156 | if (uni_xlate == 1) { |
157 | - *op = ':'; | |
158 | - for (k = 4; k > 0; k--) { | |
159 | - nc = ec & 0xF; | |
160 | - op[k] = nc > 9 ? nc + ('a' - 10) | |
161 | - : nc + '0'; | |
162 | - ec >>= 4; | |
163 | - } | |
164 | - op += 5; | |
157 | + *op++ = ':'; | |
158 | + op = pack_hex_byte(op, ec >> 8); | |
159 | + op = pack_hex_byte(op, ec); | |
165 | 160 | len -= 5; |
166 | 161 | } else { |
167 | 162 | *op++ = '?'; |