diff options
author | Max Kellermann <max@duempel.org> | 2009-10-11 23:32:22 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-10-11 23:32:22 +0200 |
commit | 727c301fbcd285ff781f2d9b538973ca6a4ebcef (patch) | |
tree | f75711b0035fdfb1e3a4f3e529ef5ffd9ef81d45 /src/decoder/mad_plugin.c | |
parent | 71f881d5cb40fbb77a77a8b50b8d662acaa84310 (diff) | |
download | mpd-727c301fbcd285ff781f2d9b538973ca6a4ebcef.tar.gz mpd-727c301fbcd285ff781f2d9b538973ca6a4ebcef.tar.xz mpd-727c301fbcd285ff781f2d9b538973ca6a4ebcef.zip |
input_stream: use "goffset" instead of "off_t"
The "off_t" type may change when you enable or disable large file
support on 32 bit platforms. This caused severe ABI problems within
MPD when we enabled LFS for the first time: two sources included
config.h and sys/types.h in different order, and had different off_t
sizes - leading to memory corruption because of ABI incompatibility.
This patch attempts to get rid of all public "off_t" uses: it removes
"off_t" from the input_stream ABI/API, and switches to GLib's 64 bit
"goffset" type. This may hurt 32 bit embedded platforms a tiny bit,
but that's not even measurable.
Diffstat (limited to 'src/decoder/mad_plugin.c')
-rw-r--r-- | src/decoder/mad_plugin.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/decoder/mad_plugin.c b/src/decoder/mad_plugin.c index c5287564f..27ddf655d 100644 --- a/src/decoder/mad_plugin.c +++ b/src/decoder/mad_plugin.c @@ -779,10 +779,10 @@ mp3_frame_duration(const struct mad_frame *frame) MAD_UNITS_MILLISECONDS) / 1000.0; } -static off_t +static goffset mp3_this_frame_offset(const struct mp3_data *data) { - off_t offset = data->input_stream->offset; + goffset offset = data->input_stream->offset; if (data->stream.this_frame != NULL) offset -= data->stream.bufend - data->stream.this_frame; @@ -792,7 +792,7 @@ mp3_this_frame_offset(const struct mp3_data *data) return offset; } -static off_t +static goffset mp3_rest_including_this_frame(const struct mp3_data *data) { return data->input_stream->size - mp3_this_frame_offset(data); @@ -804,7 +804,7 @@ mp3_rest_including_this_frame(const struct mp3_data *data) static void mp3_filesize_to_song_length(struct mp3_data *data) { - off_t rest = mp3_rest_including_this_frame(data); + goffset rest = mp3_rest_including_this_frame(data); if (rest > 0) { float frame_duration = mp3_frame_duration(&data->frame); |