diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2006-09-10 01:46:45 +0000 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2006-09-10 01:46:45 +0000 |
commit | abd545bbb37d5bf4b2a2d686a2e622fd6b8a6db3 (patch) | |
tree | 3bd1b2d0959a8066c7b50046d05f0161fc645bae /src | |
parent | 98f6c6b16be9f7ab9818d4de5d8e74de2b5b4bd5 (diff) | |
download | xine-lib-abd545bbb37d5bf4b2a2d686a2e622fd6b8a6db3.tar.gz xine-lib-abd545bbb37d5bf4b2a2d686a2e622fd6b8a6db3.tar.bz2 |
Fix seeking, remove blocksize support for now, and check if mmap fails.
CVS patchset: 8215
CVS date: 2006/09/10 01:46:45
Diffstat (limited to 'src')
-rw-r--r-- | src/input/input_file.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/input/input_file.c b/src/input/input_file.c index 8c7ed040e..09914dcf8 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_file.c,v 1.112 2006/09/10 00:59:37 dgp85 Exp $ + * $Id: input_file.c,v 1.113 2006/09/10 01:46:45 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -190,9 +190,9 @@ static off_t file_plugin_seek (input_plugin_t *this_gen, off_t offset, int origi if ( this->mmap_on ) { void *new_point = this->mmap_curr; switch(origin) { - case SEEK_SET: new_point = this->mmap_base + offset; - case SEEK_CUR: new_point = this->mmap_curr + offset; - case SEEK_END: new_point = this->mmap_base + this->mmap_len + offset; + case SEEK_SET: new_point = this->mmap_base + offset; break; + case SEEK_CUR: new_point = this->mmap_curr + offset; break; + case SEEK_END: new_point = this->mmap_base + this->mmap_len + offset; break; default: errno = EINVAL; return (off_t)-1; @@ -246,7 +246,7 @@ static off_t file_plugin_get_length (input_plugin_t *this_gen) { static uint32_t file_plugin_get_blocksize (input_plugin_t *this_gen) { file_input_plugin_t *this = (file_input_plugin_t *) this_gen; -#ifdef HAVE_MMAP +#if 0 && defined(HAVE_MMAP) if ( this->mmap_on ) return this->mmap_len; #endif @@ -388,10 +388,11 @@ static int file_plugin_open (input_plugin_t *this_gen ) { } #ifdef HAVE_MMAP - this->mmap_on = 1; - this->mmap_base = mmap(NULL, sbuf.st_size, PROT_READ, MAP_SHARED, this->fh, 0); - this->mmap_curr = this->mmap_base; - this->mmap_len = sbuf.st_size; + if ( (this->mmap_base = mmap(NULL, sbuf.st_size, PROT_READ, MAP_SHARED, this->fh, 0)) != -1 ) { + this->mmap_on = 1; + this->mmap_curr = this->mmap_base; + this->mmap_len = sbuf.st_size; + } #endif if (file_plugin_get_length (this_gen) == 0) { |