Fix a couple of Windows 2Gig file size issues.
[platform/upstream/flac.git] / src / test_libFLAC++ / metadata_manip.cpp
index 1d75dca..ff02416 100644 (file)
 #include <stdlib.h> /* for malloc() */
 #include <string.h> /* for memcpy()/memset() */
 #include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */
+#ifdef _MSC_VER
+#include <sys/utime.h>
+#else
 #include <utime.h> /* for utime() */
+#endif
+#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__
 #include <unistd.h> /* for chown(), unlink() */
+#endif
 #include <sys/stat.h> /* for stat(), maybe chmod() */
 #include "FLAC/assert.h"
 #include "FLAC++/decoder.h"
 #include "FLAC++/metadata.h"
 #include "share/grabbag.h"
 #include "share/compat.h"
+#include "share/macros.h"
 extern "C" {
 #include "test_libs_common/file_utils_flac.h"
 }
@@ -270,8 +277,8 @@ void set_file_stats_(const char *filename, struct stat *stats)
        (void)chmod(filename, stats->st_mode);
        (void)utime(filename, &srctime);
 #if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__
-       (void)chown(filename, stats->st_uid, (gid_t)(-1));
-       (void)chown(filename, (uid_t)(-1), stats->st_gid);
+       FLAC_CHECK_RETURN(chown(filename, stats->st_uid, (gid_t)(-1)));
+       FLAC_CHECK_RETURN(chown(filename, (uid_t)(-1), stats->st_gid));
 #endif
 }
 
@@ -288,7 +295,7 @@ static size_t chain_write_cb_(const void *ptr, size_t size, size_t nmemb, ::FLAC
 
 static int chain_seek_cb_(::FLAC__IOHandle handle, FLAC__int64 offset, int whence)
 {
-       off_t o = (off_t)offset;
+       FLAC__off_t o = (FLAC__off_t)offset;
        FLAC__ASSERT(offset == o);
        return fseeko((FILE*)handle, o, whence);
 }