* grub-core/fs/jfs.c (grub_jfs_diropen): Likewise.
* grub-core/fs/fat.c (grub_fat_iterate_dir): Likewise.
+2011-12-13 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/fs/udf.c (read_string): Macroify GRUB_MAX_UTF8_PER_UTF16.
+ * grub-core/fs/jfs.c (grub_jfs_diropen): Likewise.
+ * grub-core/fs/fat.c (grub_fat_iterate_dir): Likewise.
+
2011-12-13 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/term/at_keyboard.c (set_scancodes): Fix preprocessor
char *filename;
unibuf = grub_malloc (15 * 256 * 2);
- filename = grub_malloc (15 * 256 * 4 + 1);
+ filename = grub_malloc (15 * 256 * GRUB_MAX_UTF8_PER_UTF16 + 1);
while (1)
{
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
/* Allocate space enough to hold a long name. */
- filename = grub_malloc (0x40 * 13 * 4 + 1);
+ filename = grub_malloc (0x40 * 13 * GRUB_MAX_UTF8_PER_UTF16 + 1);
unibuf = (grub_uint16_t *) grub_malloc (0x40 * 13 * 2);
if (! filename || ! unibuf)
{
/* On-disk name is at most 255 UTF-16 codepoints.
Every UTF-16 codepoint is at most 4 UTF-8 bytes.
*/
- char name[256 * 4 + 1];
+ char name[256 * GRUB_MAX_UTF8_PER_UTF16 + 1];
grub_uint32_t ino;
} __attribute__ ((packed));
for (i = 0; i < utf16len; i++)
utf16[i] = (raw[2 * i + 1] << 8) | raw[2*i + 2];
}
- ret = grub_malloc (utf16len * 3 + 1);
+ ret = grub_malloc (utf16len * GRUB_MAX_UTF8_PER_UTF16 + 1);
if (ret)
*grub_utf16_to_utf8 ((grub_uint8_t *) ret, utf16, utf16len) = '\0';
grub_free (utf16);