changeset 304:0110b591bf9c src

make dvdnav_sector_search() work correctly for blocks in the last vobu; patch by ggurov+abv-bg
author nicodvb
date Sat, 14 Jul 2007 11:25:44 +0000
parents 52cda7471a24
children 8615160a0521
files searching.c
diffstat 1 files changed, 2 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/searching.c	Thu Jul 12 20:09:45 2007 +0000
+++ b/searching.c	Sat Jul 14 11:25:44 2007 +0000
@@ -78,32 +78,26 @@
   if(admap) {
     uint32_t address = 0;
     uint32_t vobu_start, next_vobu;
-    int32_t found = 0;
     int admap_entries = (admap->last_byte + 1 - VOBU_ADMAP_SIZE)/VOBU_ADMAP_SIZE;
 
     /* Search through ADMAP for best sector */
     vobu_start = SRI_END_OF_CELL;
     /* FIXME: Implement a faster search algorithm */
-    while((!found) && (address < admap_entries)) {
+    while(address < admap_entries) {
       next_vobu = admap->vobu_start_sectors[address];
 
       /* fprintf(MSG_OUT, "libdvdnav: Found block %u\n", next_vobu); */
 
       if(vobu_start <= seekto_block &&
           next_vobu > seekto_block) {
-        found = 1;
+        break;
       } else {
         vobu_start = next_vobu;
       }
       address ++;
     }
-    if(found) {
       *vobu = vobu_start;
       return DVDNAV_STATUS_OK;
-    } else {
-      fprintf(MSG_OUT, "libdvdnav: Could not locate block\n");
-      return DVDNAV_STATUS_ERR;
-    }
   }
   fprintf(MSG_OUT, "libdvdnav: admap not located\n");
   return DVDNAV_STATUS_ERR;