Messages in this thread | | | From | OGAWA Hirofumi <> | Subject | Re: [PATCHv2] fat: don't use custom hex_to_bin() | Date | Fri, 30 Sep 2011 00:19:07 +0900 |
| |
Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:
> On Thu, 2011-09-29 at 23:43 +0900, OGAWA Hirofumi wrote: >> I guess you just did copy&paste. "u8 uc[2];" part should be before >> statement as C90. >> >> I.e. >> >> if (escape && (*ip == ':')) { >> u8 uc[2]; >> >> if (i > len - 5) >> return -EINVAL; >> >> if (hex2bin(uc, ip + 1, 2) < 0) >> return -EINVAL; >> *(wchar_t *)op = uc[0] << 8 | uc[1]; > Actually, why do not use > *(wchar_t *)op++ = ... > instead of additional op+=2?
IMO, the reason would be, complex oneliner is possible to mistake. Well, anyway, it doesn't work. It actually increments 1 byte as "char *", not 2 bytes as "wchar_t *".
>> >> op += 2; >> ip += 5; >> i += 5; >> } else { >> >> This should be work? > Oh, my bad! So much minor mistakes last time. Really need vacation.
-- OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
| |