diff options
| author | Po Lu | 2024-04-04 13:52:52 +0800 |
|---|---|---|
| committer | Po Lu | 2024-04-04 13:52:52 +0800 |
| commit | daefd6771a4879bb8e71ea67f69522700155df01 (patch) | |
| tree | 17dc4a1fcde79c3e7f568d8abd901f9a50a28751 | |
| parent | 42c0603c7aab191c9cc15a7eca1253060ff5b71a (diff) | |
| download | emacs-daefd6771a4879bb8e71ea67f69522700155df01.tar.gz emacs-daefd6771a4879bb8e71ea67f69522700155df01.zip | |
Remove redundant byte-swapping boundary
* src/sfnt.c (sfnt_read_OS_2_table):
* src/sfnt.h (struct sfnt_OS_2_table): Don't redundantly realign
after s_family_class.
| -rw-r--r-- | src/sfnt.c | 20 | ||||
| -rw-r--r-- | src/sfnt.h | 2 |
2 files changed, 3 insertions, 19 deletions
diff --git a/src/sfnt.c b/src/sfnt.c index 8598b052044..d909fba7677 100644 --- a/src/sfnt.c +++ b/src/sfnt.c | |||
| @@ -16650,10 +16650,10 @@ sfnt_read_OS_2_table (int fd, struct sfnt_offset_subtable *subtable) | |||
| 16650 | 16650 | ||
| 16651 | OS_2 = xmalloc (sizeof *OS_2); | 16651 | OS_2 = xmalloc (sizeof *OS_2); |
| 16652 | 16652 | ||
| 16653 | /* Read data up to the end of `panose'. */ | 16653 | /* Read data into the structure. */ |
| 16654 | 16654 | ||
| 16655 | wanted = SFNT_ENDOF (struct sfnt_OS_2_table, panose, | 16655 | wanted = SFNT_ENDOF (struct sfnt_OS_2_table, fs_last_char_index, |
| 16656 | unsigned char[10]); | 16656 | uint16_t); |
| 16657 | rc = read (fd, OS_2, wanted); | 16657 | rc = read (fd, OS_2, wanted); |
| 16658 | 16658 | ||
| 16659 | if (rc == -1 || rc != wanted) | 16659 | if (rc == -1 || rc != wanted) |
| @@ -16680,20 +16680,6 @@ sfnt_read_OS_2_table (int fd, struct sfnt_offset_subtable *subtable) | |||
| 16680 | sfnt_swap16 (&OS_2->y_strikeout_size); | 16680 | sfnt_swap16 (&OS_2->y_strikeout_size); |
| 16681 | sfnt_swap16 (&OS_2->y_strikeout_position); | 16681 | sfnt_swap16 (&OS_2->y_strikeout_position); |
| 16682 | sfnt_swap16 (&OS_2->s_family_class); | 16682 | sfnt_swap16 (&OS_2->s_family_class); |
| 16683 | |||
| 16684 | /* Read fields between ul_unicode_range and fs_last_char_index. */ | ||
| 16685 | wanted = (SFNT_ENDOF (struct sfnt_OS_2_table, fs_last_char_index, | ||
| 16686 | uint16_t) | ||
| 16687 | - offsetof (struct sfnt_OS_2_table, ul_unicode_range)); | ||
| 16688 | rc = read (fd, &OS_2->ul_unicode_range, wanted); | ||
| 16689 | |||
| 16690 | if (rc == -1 || rc != wanted) | ||
| 16691 | { | ||
| 16692 | xfree (OS_2); | ||
| 16693 | return NULL; | ||
| 16694 | } | ||
| 16695 | |||
| 16696 | /* Swap the remainder and return the table. */ | ||
| 16697 | sfnt_swap32 (&OS_2->ul_unicode_range[0]); | 16683 | sfnt_swap32 (&OS_2->ul_unicode_range[0]); |
| 16698 | sfnt_swap32 (&OS_2->ul_unicode_range[1]); | 16684 | sfnt_swap32 (&OS_2->ul_unicode_range[1]); |
| 16699 | sfnt_swap32 (&OS_2->ul_unicode_range[2]); | 16685 | sfnt_swap32 (&OS_2->ul_unicode_range[2]); |
diff --git a/src/sfnt.h b/src/sfnt.h index 444b1dfe427..ecc3876b394 100644 --- a/src/sfnt.h +++ b/src/sfnt.h | |||
| @@ -1395,8 +1395,6 @@ struct sfnt_OS_2_table | |||
| 1395 | /* Microsoft ``panose'' classification. */ | 1395 | /* Microsoft ``panose'' classification. */ |
| 1396 | unsigned char panose[10]; | 1396 | unsigned char panose[10]; |
| 1397 | 1397 | ||
| 1398 | /* Alignment boundary! */ | ||
| 1399 | |||
| 1400 | /* Unicode range specification. */ | 1398 | /* Unicode range specification. */ |
| 1401 | uint32_t ul_unicode_range[4]; | 1399 | uint32_t ul_unicode_range[4]; |
| 1402 | 1400 | ||