* util/grub-mkfont.c (write_font_pf2): Use appropriate type for data

variable. Fixes problem on big endian platforms.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-01-12 12:49:16 +01:00
parent 8fc0a24576
commit f8f479dbbb
2 changed files with 15 additions and 7 deletions

View file

@ -1,3 +1,8 @@
2011-01-12 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkfont.c (write_font_pf2): Use appropriate type for data
variable. Fixes problem on big endian platforms.
2011-01-12 Vladimir Serbinenko <phcoder@gmail.com> 2011-01-12 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/Makefile.core.def (ieee1275_fb): Disable on sparc. * grub-core/Makefile.core.def (ieee1275_fb): Disable on sparc.

View file

@ -859,7 +859,7 @@ void
write_font_pf2 (struct grub_font_info *font_info, char *output_file) write_font_pf2 (struct grub_font_info *font_info, char *output_file)
{ {
FILE *file; FILE *file;
grub_uint32_t leng, data; grub_uint32_t leng;
char style_name[20], *font_name; char style_name[20], *font_name;
int offset; int offset;
struct grub_glyph_info *cur; struct grub_glyph_info *cur;
@ -959,12 +959,14 @@ write_font_pf2 (struct grub_font_info *font_info, char *output_file)
for (cur = font_info->glyphs_sorted; for (cur = font_info->glyphs_sorted;
cur < font_info->glyphs_sorted + font_info->num_glyphs; cur++) cur < font_info->glyphs_sorted + font_info->num_glyphs; cur++)
{ {
data = grub_cpu_to_be32 (cur->char_code); grub_uint32_t data32;
grub_util_write_image ((char *) &data, 4, file); grub_uint8_t data8;
data = 0; data32 = grub_cpu_to_be32 (cur->char_code);
grub_util_write_image ((char *) &data, 1, file); grub_util_write_image ((char *) &data32, 4, file);
data = grub_cpu_to_be32 (offset); data8 = 0;
grub_util_write_image ((char *) &data, 4, file); grub_util_write_image ((char *) &data8, 1, file);
data32 = grub_cpu_to_be32 (offset);
grub_util_write_image ((char *) &data32, 4, file);
offset += 10 + cur->bitmap_size; offset += 10 + cur->bitmap_size;
} }
@ -976,6 +978,7 @@ write_font_pf2 (struct grub_font_info *font_info, char *output_file)
for (cur = font_info->glyphs_sorted; for (cur = font_info->glyphs_sorted;
cur < font_info->glyphs_sorted + font_info->num_glyphs; cur++) cur < font_info->glyphs_sorted + font_info->num_glyphs; cur++)
{ {
grub_uint16_t data;
data = grub_cpu_to_be16 (cur->width); data = grub_cpu_to_be16 (cur->width);
grub_util_write_image ((char *) &data, 2, file); grub_util_write_image ((char *) &data, 2, file);
data = grub_cpu_to_be16 (cur->height); data = grub_cpu_to_be16 (cur->height);