Login
1 branch 0 tags
Ben (Desktop/Arch) Topbar 7eca3af 1 month ago 37 Commits
moon / firmware / src / metadata / helper.c
#include <stdint.h>
#include <stddef.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';
    }
}