projects
/
hvgrip.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Convert to automake gnits option
[hvgrip.git]
/
src
/
id3.c
diff --git
a/src/id3.c
b/src/id3.c
index
46c89bf
..
4b46b96
100644
(file)
--- a/
src/id3.c
+++ b/
src/id3.c
@@
-28,6
+28,9
@@
static void ID3Put(char *dest,char *src,int len,char *encoding);
static void ID3Put(char *dest,char *src,int len,char *encoding);
+#define GENRE_MAX_DIGITS 6
+#define TRACK_MAX_DIGITS 3
+
/* this array contains string representations of all known ID3 tags */
/* taken from mp3id3 in the mp3tools 0.7 package */
/* this array contains string representations of all known ID3 tags */
/* taken from mp3id3 in the mp3tools 0.7 package */
@@
-216,6
+219,11
@@
typedef struct _id3_tag {
#ifdef HAVE_ID3V2
#ifdef HAVE_ID3V2
+/*
+ * id3lib, in a very stupid way, has a public bool typedef.
+ * This creates a compilation error if we are including <stdbool.h>
+ */
+#undef bool
#include <id3.h>
/* Things you might want to mess with. Surprisingly, the code will probably
#include <id3.h>
/* Things you might want to mess with. Surprisingly, the code will probably
@@
-252,8
+260,8
@@
gboolean ID3v2TagFile(char *filename, char *title, char *artist, char *album,
if ( frames[ i ] ) {
char *c_data = NULL;
if ( frames[ i ] ) {
char *c_data = NULL;
- char gen[
5 ] = "( )";
- char trk[
4 ] = " ";
+ char gen[
GENRE_MAX_DIGITS ] = "( )"; /* max unsigned char: 255 */
+ char trk[
TRACK_MAX_DIGITS ] = " "; /* max CDDA tracks: 99 */
switch( frameids[ i ] ) {
case ID3FID_TITLE:
switch( frameids[ i ] ) {
case ID3FID_TITLE:
@@
-278,12
+286,12
@@
gboolean ID3v2TagFile(char *filename, char *title, char *artist, char *album,
case ID3FID_CONTENTTYPE:
c_data = gen;
case ID3FID_CONTENTTYPE:
c_data = gen;
- s
printf( gen, "(%d)", genre ); /* XXX */
+ s
nprintf( gen, GENRE_MAX_DIGITS, "(%d)", genre );
break;
case ID3FID_TRACKNUM:
c_data = trk;
break;
case ID3FID_TRACKNUM:
c_data = trk;
- s
printf( trk, "%d", tracknum ); /* XXX */
+ s
nprintf( trk, TRACK_MAX_DIGITS, "%d", tracknum );
break;
default:
break;
default: