* grub-core/normal/charset.c (grub_ucs4_to_utf8): Return number of

written bytes.
	(grub_get_num_of_utf8_bytes): New function.
	(grub_ucs4_to_utf8_alloc): Use grub_get_num_of_utf8_bytes.
	* grub-core/normal/menu_entry.c (run): Convert entry to UTF-8 before
	executing it.
	* include/grub/charset.h (grub_get_num_of_utf8_bytes): New proto.
	(grub_ucs4_to_utf8): Change return type.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-04-07 20:11:04 +02:00
parent 491c57a815
commit 851ffadac2
4 changed files with 44 additions and 13 deletions

View file

@ -282,7 +282,14 @@ grub_ssize_t grub_utf8_to_ucs4_alloc (const char *msg,
grub_uint32_t **unicode_msg,
grub_uint32_t **last_position);
void
/* Returns the number of bytes the string src would occupy is converted
to UTF-8, excluding \0. */
grub_size_t
grub_get_num_of_utf8_bytes (const grub_uint32_t *src, grub_size_t size);
/* Converts UCS-4 to UTF-8. Returns the number of bytes effectively written
excluding the trailing \0. */
grub_size_t
grub_ucs4_to_utf8 (const grub_uint32_t *src, grub_size_t size,
grub_uint8_t *dest, grub_size_t destsize);
grub_size_t grub_utf8_to_ucs4 (grub_uint32_t *dest, grub_size_t destsize,