Lines Matching defs:section

84   /* The file this section is in.  */
87 /* FOURCC name of the section. */
90 /* Length of the section contents. */
226 /* Open the next section in the file.
228 On success, the section name is stored in section->name and the length in
229 section->length, and 0 is returned. On failure, 1 is returned and
232 If 1 is returned due to being at the end of the file, then section->eof is
233 set to 1; otherwise, section->eof is set to 0. */
235 open_section (grub_file_t file, struct font_file_section *section)
240 section->file = file;
241 section->eof = 0;
243 /* Read the FOURCC section name. */
244 retval = grub_file_read (file, section->name, 4);
248 section->eof = 1;
257 /* Read the big-endian 32-bit section length. */
262 section->eof = 1;
272 section->length = grub_be_to_cpu32 (raw_length);
277 /* Size in bytes of each character index (CHIX section)
281 /* Load the character index (CHIX) section contents from the font file. This
283 section length for the CHIX section (i.e., at the start of the section
297 /* Sanity check: ensure section length is divisible by the entry size. */
373 /* Read the contents of the specified section as a string, which is
376 read_section_as_string (struct font_file_section *section)
381 str = grub_malloc (section->length + 1);
385 ret = grub_file_read (section->file, str, section->length);
386 if (ret < 0 || ret != (grub_ssize_t) section->length)
392 str[section->length] = '\0';
396 /* Read the contents of the current section as a 16-bit integer value,
400 read_section_as_short (struct font_file_section *section,
405 if (section->length != 2)
408 "font file format error: section %c%c%c%c length "
410 section->name[0], section->name[1],
411 section->name[2], section->name[3], section->length);
414 if (grub_file_read (section->file, &raw_value, 2) != 2)
427 struct font_file_section section;
443 /* Read the FILE section. It indicates the file format. */
444 if (open_section (file, &section) != 0)
448 grub_printf ("opened FILE section\n");
450 if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_FILE,
454 "font file format error: 1st section must be FILE");
459 grub_printf ("section name ok\n");
461 if (section.length != 4)
465 "but should be 4)", section.length);
470 grub_printf ("section length ok\n");
506 if (open_section (file, &section) != 0)
508 if (section.eof)
515 grub_printf ("opened section %c%c%c%c ok\n",
516 section.name[0], section.name[1],
517 section.name[2], section.name[3]);
520 if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_FONT_NAME,
523 font->name = read_section_as_string (&section);
527 else if (grub_memcmp (section.name,
532 if (read_section_as_short (&section, &font->point_size) != 0)
535 else if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_WEIGHT,
540 wt = read_section_as_string (&section);
550 else if (grub_memcmp (section.name,
555 if (read_section_as_short (&section, &font->max_char_width) != 0)
558 else if (grub_memcmp (section.name,
563 if (read_section_as_short (&section, &font->max_char_height) != 0)
566 else if (grub_memcmp (section.name,
571 if (read_section_as_short (&section, &font->ascent) != 0)
574 else if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_DESCENT,
578 if (read_section_as_short (&section, &font->descent) != 0)
581 else if (grub_memcmp (section.name,
586 if (load_font_index (file, section.length, font) != 0)
589 else if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_DATA,
592 /* When the DATA section marker is reached, we stop reading. */
597 /* Unhandled section type, simply skip past it. */
599 grub_printf ("Unhandled section type, skipping.\n");
601 grub_off_t section_end = grub_file_tell (file) + section.length;