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:
Max Kellermann
2009-10-11 23:32:22 +02:00
parent 71f881d5cb
commit 727c301fbc
10 changed files with 25 additions and 25 deletions

View File

@@ -17,6 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h" /* must be first for large file support */
#include "input/file_input_plugin.h"
#include "input_plugin.h"
@@ -92,11 +93,11 @@ input_file_open(struct input_stream *is, const char *filename)
}
static bool
input_file_seek(struct input_stream *is, off_t offset, int whence)
input_file_seek(struct input_stream *is, goffset offset, int whence)
{
int fd = GPOINTER_TO_INT(is->data);
offset = lseek(fd, offset, whence);
offset = (goffset)lseek(fd, (off_t)offset, whence);
if (offset < 0) {
is->error = errno;
return false;