]> git.baikalelectronics.ru Git - kernel.git/commit
lib/ucs2_string: Correct ucs2 -> utf8 conversion
authorJason Andryuk <jandryuk@gmail.com>
Fri, 12 Feb 2016 23:13:33 +0000 (23:13 +0000)
committerMatt Fleming <matt@codeblueprint.co.uk>
Tue, 16 Feb 2016 12:49:05 +0000 (12:49 +0000)
commit834dd207f19ce661cab78ed72a71fb9d3e77e532
tree2e8aa46386585d6a9f4744ce3d2207823660a205
parentd79bbf81720c2f5216b66fcfaa361f2a28692e47
lib/ucs2_string: Correct ucs2 -> utf8 conversion

The comparisons should be >= since 0x800 and 0x80 require an additional bit
to store.

For the 3 byte case, the existing shift would drop off 2 more bits than
intended.

For the 2 byte case, there should be 5 bits bits in byte 1, and 6 bits in
byte 2.

Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Cc: Peter Jones <pjones@redhat.com>
Cc: Matthew Garrett <mjg59@coreos.com>
Cc: "Lee, Chun-Yi" <jlee@suse.com>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
lib/ucs2_string.c