[OpenBIOS] [PATCH 2/3] Fix HFS+ display for non-ASCII characters.

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Thu Oct 4 21:31:31 CEST 2012


On 03/10/12 13:00, Andreas Färber wrote:

>> Replace any non-ASCII characters with a ? to prevent display
>> errors when converting from Unicode filenames.
>>
>> Signed-off-by: Mark Cave-Ayland<mark.cave-ayland at ilande.co.uk>
>> ---
>>   openbios-devel/fs/hfsplus/hfsp_unicode.c |    5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/openbios-devel/fs/hfsplus/hfsp_unicode.c b/openbios-devel/fs/hfsplus/hfsp_unicode.c
>> index a798085..22da3fa 100644
>> --- a/openbios-devel/fs/hfsplus/hfsp_unicode.c
>> +++ b/openbios-devel/fs/hfsplus/hfsp_unicode.c
>> @@ -43,7 +43,10 @@ uni2asc( char *astr, const unsigned char *ustr, int ustrlen, int maxlen )
>>   		/* might be unrepresentable (or too complicated for us) */
>>   		if( ustr[0] || !ustr[1] )
>>   			continue;
>> -		*astr++ = ustr[1];
>> +		if( ustr[1]<  0x20 || ustr[1]>  0x80 )
>
> ASCII didn't have the upper bit, so>= 0x80 would be more correct.
> Does this correspond to any "upstream" that we should patch as well?

I'm not sure the official upstream exists anymore, but I took a quick 
look at the latest Ubuntu packages. There are some very significant 
differences between what is in OpenBIOS and what is upstream - in 
particular they've renamed all the files, and they use functions from 
wchar.h to do the conversion instead. So it's big enough to be a 
separate task, and well outside the scope of this patch.

Incidentally their "fix" for the incorrect seek offset for the second 
volume descriptor is ridiculous - instead of parsing the volume for the 
information and converting based upon the block size in the volume 
header, they completely break the abstraction and add another optional 
argument to volume_open() which points to the partition map which is 
guaranteed to store the offests in 512 byte blocks. If it is specified 
at open time, it simply overrides the values read from the volume. Sigh.

> Do we have any kind of agreed-upon Coding Style for C btw?

For external code sourced elsewhere, I'd say it's blend in with what's 
around you.


ATB,

Mark.



More information about the OpenBIOS mailing list