diff options
Diffstat (limited to 'src/xine-engine/input_cache.c')
-rw-r--r-- | src/xine-engine/input_cache.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/xine-engine/input_cache.c b/src/xine-engine/input_cache.c index a566e1f84..2989d8718 100644 --- a/src/xine-engine/input_cache.c +++ b/src/xine-engine/input_cache.c @@ -15,14 +15,12 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * Buffered Input Plugin (request optimizer). * * The goal of this input plugin is to reduce * the number of calls to the real input plugin. - * - * $Id: input_cache.c,v 1.14 2007/02/20 00:34:57 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -35,7 +33,8 @@ #define LOG */ -#include "xine_internal.h" +#include <xine/xine_internal.h> +#include <assert.h> #define DEFAULT_BUFFER_SIZE 1024 @@ -62,8 +61,9 @@ typedef struct { /* * read data from input plugin and write it into file */ -static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { +static off_t cache_plugin_read(input_plugin_t *this_gen, void *buf_gen, off_t len) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; + char *buf = (char *)buf_gen; off_t read_len = 0; off_t main_read; @@ -74,7 +74,11 @@ static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { if (len <= (this->buf_len - this->buf_pos)) { /* all bytes are in the buffer */ switch (len) { -#if !(defined(sparc) || defined(__sparc__) || defined __ia64__) +#if defined(__i386__) || defined(__x86_64__) + /* These are restricted to x86 and amd64. Some other architectures don't + * handle unaligned accesses in the same way, quite possibly requiring + * extra code over and above simple byte copies. + */ case 8: *((uint64_t *)buf) = *(uint64_t *)(&(this->buf[this->buf_pos])); break; @@ -188,6 +192,7 @@ static buf_element_t *cache_plugin_read_block(input_plugin_t *this_gen, fifo_buf if (buf) { buf->type = BUF_DEMUX_BLOCK; + assert(todo <= buf->max_size); read_len = cache_plugin_read (this_gen, buf->content, todo); buf->size = read_len; } |