mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
	linux-kernel@vger.kernel.org
Cc: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Subject: [PATCHv2] fs: fat: use pack_hex_byte() instead of custom one
Date: Thu, 11 Mar 2010 17:00:14 +0200	[thread overview]
Message-ID: <1268319614-21252-1-git-send-email-andy.shevchenko@gmail.com> (raw)
In-Reply-To: <87iq93s013.fsf@devron.myhome.or.jp>

From: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 fs/fat/dir.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 530b4ca..5de1a70 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"
 
 /*
@@ -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++ = '?';
-- 
1.5.6.5


  reply	other threads:[~2010-03-11 15:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1268261495-686-1-git-send-email-andy.shevchenko@gmail.com>
     [not found] ` <1268261495-686-2-git-send-email-andy.shevchenko@gmail.com>
     [not found]   ` <1268261495-686-3-git-send-email-andy.shevchenko@gmail.com>
     [not found]     ` <1268261495-686-4-git-send-email-andy.shevchenko@gmail.com>
     [not found]       ` <1268261495-686-5-git-send-email-andy.shevchenko@gmail.com>
2010-03-10 23:18         ` [PATCH 4/5] fs: fat: use hex_asc_lo/hex_asc_hi " OGAWA Hirofumi
2010-03-11  7:14           ` Andy Shevchenko
2010-03-11  9:03             ` OGAWA Hirofumi
2010-03-11 15:00               ` Andy Shevchenko [this message]
2010-03-11 15:12                 ` [PATCHv2] fs: fat: use pack_hex_byte() " OGAWA Hirofumi
2010-03-11 15:15                   ` Andy Shevchenko
     [not found]                   ` <1268468961-17033-1-git-send-email-andy.shevchenko@gmail.com>
2010-03-13 11:09                     ` [PATCHv3] " OGAWA Hirofumi
2010-03-11  7:21           ` [PATCH 4/5] fs: fat: use hex_asc_lo/hex_asc_hi " Joe Perches
2010-03-11  7:59             ` Andy Shevchenko
2010-03-11  8:10               ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1268319614-21252-1-git-send-email-andy.shevchenko@gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=ext-andriy.shevchenko@nokia.com \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome