Patch to tcd



I've mada a small patch to tcd to allow it to use non-ASCII characters in
the song titles. It's attached.

--
Nuno Ferreira
nmrf@rnl.ist.utl.pt
Index: cddb.c
===================================================================
RCS file: /debian/home/gnomecvs/gnome-media/tcd/cddb.c,v
retrieving revision 1.4
diff -u -r1.4 cddb.c
--- cddb.c	1998/04/24 21:26:29	1.4
+++ cddb.c	1998/04/25 05:37:43
@@ -58,12 +58,19 @@
                         
 struct toc cdtoc[100];
                         
+static int num_digits( int num)
+{
+	int count = 1;
+	
+	while ((num/=10) != 0)
+		count++;
+	return(count);
+}
 
 int tcd_readcddb( cd_struct* cd, char* filename )
 {
 	FILE* fp;
 	char string[100];
-	char num[80];
 	int trk;	
 	
 	fp = fopen( filename, "r" );
@@ -94,8 +101,10 @@
 		}
 		if( strncmp( string, "TTITLE", 6 ) == 0 )
 		{
-                       	if(sscanf( string, "TTITLE%d=%[ -z]", &trk, num ) == 2)
-                        	strncpy( cd->trk[trk+1].name, num, TRK_NAME_LEN );
+                       	if(sscanf( string, "TTITLE%d=", &trk ) == 1)
+                        	strncpy( cd->trk[trk+1].name, 
+                        	         string + 7 + num_digits(trk),
+                        	         TRK_NAME_LEN );
                 	else
                 		cd->trk[trk+1].name[0] = 0;
 		}				


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]