From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 5/8] Support non-BMP characters on Joliet.
Date: Wed, 16 May 2012 01:07:51 +0200 [thread overview]
Message-ID: <4FB2E1C7.1070700@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1220 bytes --]
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
fs/isofs/joliet.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/fs/isofs/joliet.c b/fs/isofs/joliet.c
index a048de8..d85e842 100644
--- a/fs/isofs/joliet.c
+++ b/fs/isofs/joliet.c
@@ -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);
--
1.7.10
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
reply other threads:[~2012-05-15 23:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FB2E1C7.1070700@gmail.com \
--to=phcoder@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.