summaryrefslogtreecommitdiff
path: root/src/input/input_http.c
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2002-12-01 00:36:00 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2002-12-01 00:36:00 +0000
commitd876b1ec4f633e62c26491543a4fd3372f78f9cf (patch)
treed30c120bebf453952f1d747526d018644de6c0c8 /src/input/input_http.c
parentc1021c7e260c81bcc1ec293f0d57b12aeed1edb3 (diff)
downloadxine-lib-d876b1ec4f633e62c26491543a4fd3372f78f9cf.tar.gz
xine-lib-d876b1ec4f633e62c26491543a4fd3372f78f9cf.tar.bz2
fix memleak in input_http, fix mms read function
CVS patchset: 3393 CVS date: 2002/12/01 00:36:00
Diffstat (limited to 'src/input/input_http.c')
-rw-r--r--src/input/input_http.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/input/input_http.c b/src/input/input_http.c
index f180bc292..bcdfde748 100644
--- a/src/input/input_http.c
+++ b/src/input/input_http.c
@@ -93,6 +93,11 @@ typedef struct {
int shoutcast_metaint;
off_t shoutcast_pos;
char *shoutcast_songtitle;
+
+ /* scratch buffer for forward seeking */
+
+ char seek_buf[BUFSIZE];
+
} http_input_plugin_t;
@@ -585,16 +590,17 @@ static off_t http_plugin_get_current_pos (input_plugin_t *this_gen){
static off_t http_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) {
http_input_plugin_t *this = (http_input_plugin_t *) this_gen;
+ /* only realtive forward-seeking is implemented */
+
if ((origin == SEEK_CUR) && (offset >= 0)) {
- char *tmp;
- assert((tmp = malloc(1024)) != NULL);
- for (;((int)offset) - 1024 > 0; offset -= 1024) {
- this->curpos += http_plugin_read(this_gen, tmp, 1024);
+
+ for (;((int)offset) - BUFSIZE > 0; offset -= BUFSIZE) {
+ this->curpos += http_plugin_read (this_gen, this->seek_buf, BUFSIZE);
}
- this->curpos += http_plugin_read(this_gen, tmp, offset);
+
+ this->curpos += http_plugin_read (this_gen, this->seek_buf, offset);
}
- /* dummy implementation: don't seek, just return current position */
return this->curpos;
}