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.
This commit is contained in:
@@ -20,14 +20,12 @@
|
||||
#ifndef MPD_INPUT_STREAM_H
|
||||
#define MPD_INPUT_STREAM_H
|
||||
|
||||
#include "config.h"
|
||||
#include <glib.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
struct input_stream;
|
||||
|
||||
struct input_stream {
|
||||
/**
|
||||
* the plugin which implements this input stream
|
||||
@@ -58,12 +56,12 @@ struct input_stream {
|
||||
/**
|
||||
* the size of the resource, or -1 if unknown
|
||||
*/
|
||||
off_t size;
|
||||
goffset size;
|
||||
|
||||
/**
|
||||
* the current offset within the stream
|
||||
*/
|
||||
off_t offset;
|
||||
goffset offset;
|
||||
|
||||
/**
|
||||
* the MIME content type of the resource, or NULL if unknown
|
||||
@@ -108,7 +106,7 @@ input_stream_close(struct input_stream *is);
|
||||
* @param whence the base of the seek, one of SEEK_SET, SEEK_CUR, SEEK_END
|
||||
*/
|
||||
bool
|
||||
input_stream_seek(struct input_stream *is, off_t offset, int whence);
|
||||
input_stream_seek(struct input_stream *is, goffset offset, int whence);
|
||||
|
||||
/**
|
||||
* Returns true if the stream has reached end-of-file.
|
||||
|
||||
Reference in New Issue
Block a user