fs: fat: use hex_asc_lo/hex_asc_hi instead of custom one
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
OGAWA Hirofumi
maintainerQuoted 5 lines · Andy Shevchenko
(quoted diff) +0
-4if (uni_xlate == 1) { - *op = ':'; - for (k = 4; k > 0; k--) { - nc = ec & 0xF; - op[k] = nc > 9 ? nc + ('a' - 10)
Review
Quoted 10 lines
(quoted diff) +5
-4- : nc + '0'; - ec >>= 4; - } - op += 5; + *op++ = ':'; + *op++ = hex_asc_hi(ec >> 8); + *op++ = hex_asc_lo(ec >> 8); + *op++ = hex_asc_hi(ec); + *op++ = hex_asc_lo(ec); len -= 5;
Why doesn't this use pack_hex_byte()?
Thanks.
Signature · 1 line
OGAWA Hirofumi <[email protected]>
On Thu, Mar 11, 2010 at 1:18 AM, OGAWA Hirofumi<[email protected]> wrote:>> + *op++ = hex_asc_hi(ec >> 8);>> + *op++ = hex_asc_lo(ec >> 8);>> + *op++ = hex_asc_hi(ec);>> + *op++ = hex_asc_lo(ec);> Why doesn't this use pack_hex_byte()?No specific reason, it could be so. Would you like me to change this? -- With Best Regards,Andy Shevchenko���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
OGAWA Hirofumi
maintainerQuoted 8 lines · Andy Shevchenko
Quoted 5 lines · OGAWA Hirofumi
Quoted 4 lines
+ *op++ =
hex_asc_hi(ec >> 8);
+ *op++ =hex_asc_lo(ec >> 8);
+ *op++ =hex_asc_hi(ec);
+ *op++ =hex_asc_lo(ec);Why doesn't this use
pack_hex_byte()?No specific reason, it could be so. Would you like me to change this?
Yes, please change it if you have no problem.
Thanks.
Signature · 1 line
OGAWA Hirofumi <[email protected]>
PATCH v2 1/1 fs: fat: use pack_hex_byte() instead of custom one
From: Andy Shevchenko <[email protected]>
--- fs/fat/dir.c | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-)
fs/fat/dir.c +5 -9
@@ -19,6 +19,7 @@#include <linux/buffer_head.h> #include <linux/compat.h> #include <asm/uaccess.h> +#include <linux/kernel.h> #include "fat.h" /*
@@ -149,19 +150,14 @@ static int uni16_to_x8(unsigned char *ascii, const wchar_t *uni, int len,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++ ='?' ;
Signature · 1 line
1.5.6.5
Re: [PATCHv2] fs: fat: use pack_hex_byte() instead of custom one
Quoted 3 lines · Andy Shevchenko
From: Andy Shevchenko <[email protected]>
Signed-off-by Andy Shevchenko <[email protected]>
Looks good to me.
(From 1/4 with previous patch, I guess it's series of patches) Or I should take this patch into my tree?
Thanks.
Quoted 40 lines
--- fs/fat/dir.c | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-)fs/fat/dir.c +5
-9@@ -19,6 +19,7 @@#include <linux/buffer_head.h> #include <linux/compat.h> #include <asm/uaccess.h> +#include <linux/kernel.h> #include "fat.h" /* @@ -149,19 +150,14 @@ static int uni16_to_x8(unsigned char *ascii, const wchar_t *uni, int len,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++ ='?' ;
Signature · 1 line
OGAWA Hirofumi <[email protected]>
Re: [PATCHv2] fs: fat: use pack_hex_byte() instead of custom one
Quoted 2 lines · OGAWA Hirofumi
(From 1/4 with previous patch, I guess it's series of patches) Or I should take this patch into my tree?
It has only one in common - cleanup. Basically it's a bunch of independent fixes.
Please, take it in your tree. thank you.
Signature · 2 lines
With Best Regards, Andy Shevchenko
A message that is not in the archive (sent off-list or not yet received): [email protected]
OGAWA Hirofumi
maintainerRe: [PATCHv3] fs: fat: use pack_hex_byte() instead of custom one
Review
Quoted 6 lines · Andy Shevchenko
(quoted diff) +1
-2const wchar_t *ip; wchar_t ec; - unsigned char *op, nc; + unsigned char *op; int charlen; - int k;
Ah, thanks. I fixed this myself before commit.
Signature · 1 line
OGAWA Hirofumi <[email protected]>
Quoted 11 lines · OGAWA Hirofumi
Quoted 9 lines · Andy Shevchenko
(quoted diff) +0
-8if (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;
Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +5
-0+ *op++ = ':'; + *op++ = hex_asc_hi(ec >> 8); + *op++ = hex_asc_lo(ec >> 8); + *op++ = hex_asc_hi(ec); + *op++ = hex_asc_lo(ec); len -= 5;Why doesn't this use
pack_hex_byte()?
or snprintf
On Thu, Mar 11, 2010 at 9:21 AM, Joe Perches <[email protected]> wrote:>> > + *op++ = hex_asc_hi(ec >> 8);>> > + *op++ = hex_asc_lo(ec >> 8);>> > + *op++ = hex_asc_hi(ec);>> > + *op++ = hex_asc_lo(ec);>> Why doesn't this use pack_hex_byte()?> or snprintfsprintf looks like overkill here. -- With Best Regards,Andy Shevchenko���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 8 lines · Andy Shevchenko
Quoted 6 lines · Joe Perches
Quoted 5 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+ *op++ = hex_asc_hi(ec >> 8); + *op++ = hex_asc_lo(ec >> 8); + *op++ = hex_asc_hi(ec); + *op++ = hex_asc_lo(ec);Why doesn't this use
pack_hex_byte()?or snprintf
sprintf looks like overkill here.
It's shorter and more intelligible though
op += sprintf(op, ":%04x:%04x", etc)
cheers, Joe