changeset 22362:e244d570ba44

cleaned stream_seek() : simplified the alignment to STREAM_BUFFER_SIZE or s->sector_size
author nicodvb
date Wed, 28 Feb 2007 23:40:39 +0000
parents eec955510da7
children 03ba33feaae9
files stream/stream.c
diffstat 1 files changed, 4 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream.c	Wed Feb 28 14:55:34 2007 +0000
+++ b/stream/stream.c	Wed Feb 28 23:40:39 2007 +0000
@@ -299,26 +299,10 @@
     return 1;
   }
 
-  switch(s->type){
-  case STREAMTYPE_STREAM:
-#ifdef _LARGEFILE_SOURCE
-    newpos=pos&(~((long long)STREAM_BUFFER_SIZE-1));break;
-#else
-    newpos=pos&(~(STREAM_BUFFER_SIZE-1));break;
-#endif
-  default:
-    // Round on sector size
-    if(s->sector_size)
-      newpos=(pos/s->sector_size)*s->sector_size;
-    else { // Otherwise on the buffer size
-#ifdef _LARGEFILE_SOURCE
-      newpos=pos&(~((long long)STREAM_BUFFER_SIZE-1));break;
-#else
-      newpos=pos&(~(STREAM_BUFFER_SIZE-1));break;
-#endif
-    }
-    break;
-  }
+  if(s->sector_size)
+      newpos = (pos/s->sector_size)*s->sector_size;
+  else
+      newpos = pos&(~((off_t)STREAM_BUFFER_SIZE-1));
 
 if( mp_msg_test(MSGT_STREAM,MSGL_DBG3) ){
   mp_msg(MSGT_STREAM,MSGL_DBG3, "s->pos=%"PRIX64"  newpos=%"PRIX64"  new_bufpos=%"PRIX64"  buflen=%X  \n",