Messages in this thread | | | Subject | Re: [PATCHv2] fat: don't use custom hex_to_bin() | From | Andy Shevchenko <> | Date | Thu, 29 Sep 2011 16:07:21 +0300 |
| |
On Wed, 2011-09-28 at 08:15 +0900, OGAWA Hirofumi wrote: > Andy Shevchenko <andy.shevchenko@gmail.com> writes: > > > Actually here we will change endianess. > > So, my question is what endianess is right here? If the original code > > okay, then patch should be rewritten like this: > > > > rc = hex2bin(op++, ip + 3, 1); > > if (rc < 0) > > return -EINVAL; > > > > rc = hex2bin(op++, ip + 1, 1); > > if (rc < 0) > > return -EINVAL; > > Original code may work only for little endian. Well, anyway, the output > should be wchar_t (u16) of native endian.
> So, I think it should be something like > > u8 uc[2]; > if (hex2bin(uc, ip + 1, 2) < 0) > return -EINVAL; > *(wchar_t *)op = uc[0] << 8 | uc[1]; > This should be readable more. It might be so, but it's not okay to do such constructions in C
fs/fat/namei_vfat.c:535:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
So, I will resend patch as I proposed with additional comments.
-- Andy Shevchenko <andriy.shevchenko@linux.intel.com> Intel Finland Oy
| |