aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/unicode.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2014-07-09 08:35:30 -0400
committerJan Kara <jack@suse.cz>2014-07-15 16:40:24 -0400
commitc7ff48212d3ede34aa41842929a5b3ebf8f5ca4d (patch)
tree549a218291f73fd7335336b892ebef73b03c8bd6 /fs/udf/unicode.c
parent2c15ac5bdb0009645f1f5962086021daa6b52d3f (diff)
fs/udf: re-use hex_asc_upper_{hi,lo} macros
This patch cleans up udf_translate_to_linux() a bit by using globally defined macros instead of custom code. We can use sprintf(buf, "%04X", ...) there as well, but this one faster. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/unicode.c')
-rw-r--r--fs/udf/unicode.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c
index 44b815e57f94..afd470e588ff 100644
--- a/fs/udf/unicode.c
+++ b/fs/udf/unicode.c
@@ -412,7 +412,6 @@ static int udf_translate_to_linux(uint8_t *newName, uint8_t *udfName,
412 int extIndex = 0, newExtIndex = 0, hasExt = 0; 412 int extIndex = 0, newExtIndex = 0, hasExt = 0;
413 unsigned short valueCRC; 413 unsigned short valueCRC;
414 uint8_t curr; 414 uint8_t curr;
415 const uint8_t hexChar[] = "0123456789ABCDEF";
416 415
417 if (udfName[0] == '.' && 416 if (udfName[0] == '.' &&
418 (udfLen == 1 || (udfLen == 2 && udfName[1] == '.'))) { 417 (udfLen == 1 || (udfLen == 2 && udfName[1] == '.'))) {
@@ -477,10 +476,10 @@ static int udf_translate_to_linux(uint8_t *newName, uint8_t *udfName,
477 newIndex = 250; 476 newIndex = 250;
478 newName[newIndex++] = CRC_MARK; 477 newName[newIndex++] = CRC_MARK;
479 valueCRC = crc_itu_t(0, fidName, fidNameLen); 478 valueCRC = crc_itu_t(0, fidName, fidNameLen);
480 newName[newIndex++] = hexChar[(valueCRC & 0xf000) >> 12]; 479 newName[newIndex++] = hex_asc_upper_hi(valueCRC >> 8);
481 newName[newIndex++] = hexChar[(valueCRC & 0x0f00) >> 8]; 480 newName[newIndex++] = hex_asc_upper_lo(valueCRC >> 8);
482 newName[newIndex++] = hexChar[(valueCRC & 0x00f0) >> 4]; 481 newName[newIndex++] = hex_asc_upper_hi(valueCRC);
483 newName[newIndex++] = hexChar[(valueCRC & 0x000f)]; 482 newName[newIndex++] = hex_asc_upper_lo(valueCRC);
484 483
485 if (hasExt) { 484 if (hasExt) {
486 newName[newIndex++] = EXT_MARK; 485 newName[newIndex++] = EXT_MARK;