mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
Buflib is written with a lot of hardcoded offsets to header fields, arbitrary pointer arithmetic, and similar but not quite duplicated code, making maintenance a nightmare. Most of the pointer arithmetic involving header fields is replaced by indexing from two well-defined pointers, the block start and end pointers. The start pointer points to the first header field, and he end pointer is one past the end of the header. Hardcoded field indices are replaced by two enums. Forward indices (fidx_XXX) are used to access fields from a block start pointer and negated backward indices (-bidx_XXX) are used to index from a block end pointer. There is no overlap between the indices because of the variable length name field in the middle of the header. The length of the fixed fields in the block header is now a #define'd constant rather than being open coded. There is now a function to acquire the block end pointer from the user data pointer (ie. the pointer stored in the handle table). The old code was not consistent in this; some functions would handle a non-aligned user pointer, which may occur as a result of shrinking, while other uses just assumed the user pointer was aligned. Block CRC calculations have also been factored out to a function that accepts block start and end pointers. Change-Id: I6a7e8a8c58aec6c6eaf0e5021400032d8e5f841e |
||
|---|---|---|
| .. | ||
| asm | ||
| common | ||
| drivers | ||
| export | ||
| include | ||
| kernel | ||
| libc | ||
| target | ||
| usbstack | ||
| arabjoin.c | ||
| arabjoin.h | ||
| ata_idle_notify.c | ||
| backlight-sw-fading.c | ||
| backlight.c | ||
| bidi.c | ||
| buflib.c | ||
| COPYING | ||
| core_alloc.c | ||
| debug.c | ||
| eeprom_settings.c | ||
| enc_base.c | ||
| events.c | ||
| firmware.make | ||
| font.c | ||
| font_cache.c | ||
| general.c | ||
| hangul.c | ||
| linuxboot.c | ||
| load_code.c | ||
| logf.c | ||
| lru.c | ||
| panic.c | ||
| pcm.c | ||
| pcm_mixer.c | ||
| pcm_sampr.c | ||
| pcm_sw_volume.c | ||
| powermgmt.c | ||
| profile.c | ||
| README | ||
| rolo.c | ||
| rom.lds | ||
| screendump.c | ||
| scroll_engine.c | ||
| sdmmc.c | ||
| sound.c | ||
| SOURCES | ||
| storage.c | ||
| system.c | ||
| timer.c | ||
| tuner.c | ||
| usb.c | ||
See docs/README