From e70cb72f73117c32167fcbbb05569906437945d3 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 12 Jan 2012 22:13:20 +0100 Subject: [PATCH] * grub-core/normal/charset.c: Move comment to right place. --- ChangeLog | 4 ++++ grub-core/normal/charset.c | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index df581a2b4..76dea17a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-01-12 Vladimir Serbinenko + + * grub-core/normal/charset.c: Move comment to right place. + 2012-01-11 Vladimir Serbinenko * grub-core/fs/affs.c (grub_affs_bblock): Revert flags. diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c index 4d6cbfac0..2b8246662 100644 --- a/grub-core/normal/charset.c +++ b/grub-core/normal/charset.c @@ -42,13 +42,6 @@ Most underline diacritics aren't displayed in gfxterm */ -/* Convert a (possibly null-terminated) UTF-8 string of at most SRCSIZE - bytes (if SRCSIZE is -1, it is ignored) in length to a UTF-16 string. - Return the number of characters converted. DEST must be able to hold - at least DESTSIZE characters. If an invalid sequence is found, return -1. - If SRCEND is not NULL, then *SRCEND is set to the next byte after the - last byte used in SRC. */ - #include #include #include @@ -67,6 +60,7 @@ grub_utf8_process (grub_uint8_t c, grub_uint32_t *code, int *count) { if ((c & GRUB_UINT8_2_LEADINGBITS) != GRUB_UINT8_1_LEADINGBIT) { + *count = 0; /* invalid */ return 0; } @@ -105,6 +99,12 @@ grub_utf8_process (grub_uint8_t c, grub_uint32_t *code, int *count) return 0; } +/* Convert a (possibly null-terminated) UTF-8 string of at most SRCSIZE + bytes (if SRCSIZE is -1, it is ignored) in length to a UTF-16 string. + Return the number of characters converted. DEST must be able to hold + at least DESTSIZE characters. If an invalid sequence is found, return -1. + If SRCEND is not NULL, then *SRCEND is set to the next byte after the + last byte used in SRC. */ grub_ssize_t grub_utf8_to_utf16 (grub_uint16_t *dest, grub_size_t destsize, const grub_uint8_t *src, grub_size_t srcsize,