lkml.org 
[lkml]   [2011]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCHv2] fat: don't use custom hex_to_bin()
Date
Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:

>> 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.

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];

op += 2;
ip += 5;
i += 5;
} else {

This should be work?

Thanks.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>


\
 
 \ /
  Last update: 2011-09-29 16:45    [W:0.515 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site