#include <stddef.h>
#include <stdint.h>
#include <string.h>
// Helper to read big-endian uint32
uint32_t read_be32(const uint8_t* buf) {
return ((uint32_t)buf[0] << 24) | ((uint32_t)buf[1] << 16) |
((uint32_t)buf[2] << 8) | buf[3];
}
// Trim trailing whitespace (ID3v1 uses space padding)
void trim_trailing(char* str) {
size_t len = strlen(str);
while (len > 0 && (str[len - 1] == ' ' || str[len - 1] == '\0')) {
str[--len] = '\0';
}
}