diff options
author | Max Kellermann <max@duempel.org> | 2008-10-28 20:39:09 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-28 20:39:09 +0100 |
commit | 0a61877702965dc375b3ad2b2d1cf0315703c22e (patch) | |
tree | 9c4ed9b5ae32a1b00eab1b84b08f0100be4e3aa1 /src/input_curl.c | |
parent | 016d996131d560db6d72476ae29c74df84746fff (diff) | |
download | mpd-0a61877702965dc375b3ad2b2d1cf0315703c22e.tar.gz mpd-0a61877702965dc375b3ad2b2d1cf0315703c22e.tar.xz mpd-0a61877702965dc375b3ad2b2d1cf0315703c22e.zip |
input_stream: convert offset and size to the off_t data type
size_t and long aren't 64 bit safe (i.e. files larger than 2 GB on a
32 bit OS). Use off_t instead, which is a 64 bit integer if compiled
with large file support.
Diffstat (limited to '')
-rw-r--r-- | src/input_curl.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/input_curl.c b/src/input_curl.c index 9ac529a63..11473eab0 100644 --- a/src/input_curl.c +++ b/src/input_curl.c @@ -414,8 +414,7 @@ input_curl_send_request(struct input_curl *c) } static bool -input_curl_seek(struct input_stream *is, mpd_unused long offset, - mpd_unused int whence) +input_curl_seek(struct input_stream *is, off_t offset, int whence) { struct input_curl *c = is->data; bool ret; @@ -427,15 +426,15 @@ input_curl_seek(struct input_stream *is, mpd_unused long offset, switch (whence) { case SEEK_SET: - is->offset = (off_t)offset; + is->offset = offset; break; case SEEK_CUR: - is->offset += (off_t)offset; + is->offset += offset; break; case SEEK_END: - is->offset = (off_t)is->size + (off_t)offset; + is->offset = is->size + offset; break; default: @@ -456,7 +455,7 @@ input_curl_seek(struct input_stream *is, mpd_unused long offset, /* send the "Range" header */ if (is->offset > 0) { - c->range = g_strdup_printf("%ld-", is->offset); /* XXX 64 bit safety */ + c->range = g_strdup_printf("%lld-", (long long)is->offset); curl_easy_setopt(c->easy, CURLOPT_RANGE, c->range); } |