12 #define ID3_MAJOR_VERSION 3 32 if(data == NULL || datalen == 0)
40 size_t newsize = datalen + 10 + 1;
50 unsigned char *tmp = NULL;
53 for(n = 1; n <= 4; n++)
56 (tag->
frames)[tag->
size + 4 + (4 - n)] = tmp[len - n];
87 unsigned char *tag = malloc(10 + t->
size + 1);
95 unsigned char *tmp = NULL;
98 for(n = 1; n <= 4; n++)
101 tag[6 + (4 - n)] = tmp[len - n];
103 tag[6 + (4 - n)] = 0;
108 for(n = 0; n < t->
size; n++)
109 tag[10 + n] = t->
frames[n];
111 tag[10 + t->
size] =
'\0';
114 fwrite(tag, 1, 10 + t->
size, fp);
131 FILE *fp = fopen(filename,
"w");
int ID3_tag_add_data(ID3_tag *tag, uint8_t t1, uint8_t t2, uint8_t t3, uint8_t t4, char *data)
int ID3_tag_fwrite(ID3_tag *t, FILE *fp)
#define str_len(s)
Shorthand for counting '\0' terminating strings. See _len for more info.
int ID3_tag_write(ID3_tag *tag, char *filename)
size_t ustrncpy(unsigned char *dest, const char *src, size_t n)
int ID3_tag_init(ID3_tag *t)
#define ID3_MAJOR_VERSION
size_t int_to_bit1(unsigned long long i, unsigned char **s, unsigned int base)