Fix a couple of Windows 2Gig file size issues.

Patch submitted by Janne Hyvärinen <cse@sci.fi>.
This commit is contained in:
Erik de Castro Lopo
2013-03-14 18:22:29 +11:00
parent 6497ce1977
commit f25b2602dc
25 changed files with 178 additions and 159 deletions

View File

@@ -61,11 +61,17 @@ void grabbag__file_copy_metadata(const char *srcpath, const char *destpath)
}
}
off_t grabbag__file_get_filesize(const char *srcpath)
FLAC__off_t grabbag__file_get_filesize(const char *srcpath)
{
#if defined _MSC_VER || defined __MINGW32__
struct _stat64 srcstat;
if(0 == _stat64(srcpath, &srcstat))
#else
struct stat srcstat;
if(0 == stat(srcpath, &srcstat))
#endif
return srcstat.st_size;
else
return -1;

View File

@@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "share/compat.h"
/* slightly different that strndup(): this always copies 'size' bytes starting from s into a NUL-terminated string. */
static char *local__strndup_(const char *s, size_t size)
@@ -356,7 +357,7 @@ FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, con
*error_message = error_messages[3];
}
else { /* regular picture file */
const off_t size = grabbag__file_get_filesize(spec);
const FLAC__off_t size = grabbag__file_get_filesize(spec);
if(size < 0)
*error_message = error_messages[5];
else {