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

Andreas Färber afaerber at suse.de
Wed Oct 3 14:00:19 CEST 2012


Am 18.09.2012 17:31, schrieb Mark Cave-Ayland:
> 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?

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

Regards,
Andreas

> +		    *astr++ = '?';
> +		else
> +		    *astr++ = ustr[1];
>  		len++;
>  	}
>  	*astr = 0;
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



More information about the OpenBIOS mailing list