Support non-BMP characters on Joliet.
Subsystems (2)
PATCH 5/8 Support non-BMP characters on Joliet.
Signed-off-by Vladimir Serbinenko <[email protected]>
--- fs/isofs/joliet.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
fs/isofs/joliet.c +18 -5
@@ -16,22 +16,35 @@static int uni16_to_x8 (unsigned char *ascii,__be16 *uni,int len,struct nls_table *nls) { -__be16 *ip, ch; +__be16 *ip, ch[2 ];unsigned char *op; ip = uni; op = ascii; -while ((ch =get_unaligned (ip)) && len) { + ch[1 ] =get_unaligned (ip); + +while (len) {int llen; - llen = nls->uni2char (be16_to_cpu (ch), op,NLS_MAX_CHARSET_SIZE ); +int s; +unicode_t uni; + ch[0 ] = ch[1 ]; +if (len >1 ) + ch[1 ] =get_unaligned (ip +1 ); + s =utf16s_to_unicode (ch, len >1 ?2 :1 ,UTF16_BIG_ENDIAN , + &uni); +if (s <=0 ) { + llen =-1 ; + s =1 ; + }else + llen = nls->uni2char (uni, op,NLS_MAX_CHARSET_SIZE );if (llen >0 ) op += llen;else *op++ ='?' ; - ip++; + ip += s; - len--; + len -= s; } *op =0 ;return (op - ascii);
Signature · 5 lines
1.7.10 -- Regards Vladimir 'φ-coder/phcoder' Serbinenko