[PATCH] Title key cache and minor fixes

H}kan Hjort d95hjort at dtek.chalmers.se
Mon Jul 1 11:41:11 CEST 2002


Wed Jun 26 2002, Adam Jones wrote:
> Hi all.
> 
> I've now split the title key cache patch into two - a bugfix patch and a
> patch containing only the cache functionality (which must be applied on
> top of the first).  The bugfix patch is attached, since it's pretty
> trivial and should be non-controversial.
> 
(Removed the typos as obvious).


diff -u --recursive libdvdcss-1.2.1/src/libdvdcss.c libdvdcss-1.2.1-fixed/src/libdvdcss.c
--- libdvdcss-1.2.1/src/libdvdcss.c	Sun Jun  2 16:54:10 2002
+++ libdvdcss-1.2.1-fixed/src/libdvdcss.c	Wed Jun 26 20:51:38 2002
@@ -300,6 +300,7 @@
 {
     dvd_title_t *p_title;
     dvd_title_t *p_newtitle;
+    dvd_title_t *p_firsttitle;
     dvd_key_t    p_title_key;
     int          i_ret;
 
@@ -342,8 +343,9 @@
     }
 
     /* Find our spot in the list */
     p_newtitle = NULL;
     p_title = dvdcss->p_titles;
+    p_firsttitle = p_title;
     while( ( p_title != NULL ) && ( p_title->i_startlb < i_block ) )
     {
         p_newtitle = p_title;
@@ -357,10 +359,16 @@
     memcpy( p_newtitle->p_key, p_title_key, KEY_SIZE );
 
     /* Link the new title, either at the beginning or inside the list */
-    if( p_title == NULL )
+    if( p_firsttitle == NULL )
     {
         dvdcss->p_titles = p_newtitle;
         p_newtitle->p_next = NULL;
+    }
+    else if (p_title == NULL)
+    {
+       p_newtitle->p_next = p_firsttitle;
+       p_firsttitle->p_next = NULL;
+       dvdcss->p_titles = p_newtitle;
     }
     else
     {

What are you trying to fix here?  A small description of how it fails 
whould have made it much simpler to know if this was the right fix.
Is this for the case of insering a key first in a non empty list?

-- 
Håkan Hjort

-- 
This is the libdvdcss-devel mailing-list, see http://www.videolan.org/libdvdcss/
To unsubscribe, please read http://www.videolan.org/lists.html
If you are in trouble, please contact <postmaster at videolan.org>



More information about the libdvdcss-devel mailing list