changeset 8841:ddf6a9f4cc6a

do not create bogus filenames
author arpi
date Wed, 08 Jan 2003 16:10:39 +0000
parents cecb561fcb21
children cb660331be34
files libmpdvdkit2/libdvdcss.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdvdkit2/libdvdcss.c	Wed Jan 08 14:55:56 2003 +0000
+++ b/libmpdvdkit2/libdvdcss.c	Wed Jan 08 16:10:39 2003 +0000
@@ -273,14 +273,15 @@
 	char sector[DVDCSS_BLOCK_SIZE];
 	// 32768+40  -> disc title (32 uppercase chars)
 	// 32768+813 -> disc manufacturing date + serial no (16 digit number)
-	dvdcss->pf_seek( dvdcss, 32768/DVDCSS_BLOCK_SIZE);
+	int ret=dvdcss->pf_seek( dvdcss, 32768/DVDCSS_BLOCK_SIZE);
+	//printf("disc_id seek: %d -> %d,  i_fd=%d  i_read_fd=%d\n",32768/DVDCSS_BLOCK_SIZE,ret,dvdcss->i_fd,dvdcss->i_read_fd);
 	if(dvdcss->pf_read( dvdcss, sector, 1) == 1){
 	    // check disc title first:
 	    char* title_name=&sector[40];
-	    int i=31;
-	    while(i>=0 && title_name[i]<=32) i--;
-	    title_name[i+1]=0;
-	    if(strlen(title_name)>5){
+	    int i=0;
+	    while(i<32 && title_name[i]>='0' && title_name[i]<='z') i++;
+	    title_name[i]=0;
+	    if(i>5){
 		disc_id=strdup(title_name);
 	    } else {
 		// use disc date+serial: