include/share/compat.h : Simplify.
[platform/upstream/flac.git] / include / share / compat.h
index 950a182..64139a2 100644 (file)
 
 #if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
 #include <sys/types.h> /* for off_t */
-#if !defined __MINGW32__ /* @@@ [2G limit] */
-#ifndef fseeko
-#define fseeko fseek
-#endif
-#ifndef ftello
-#define ftello ftell
+#define FLAC__off_t __int64 /* use this instead of off_t to fix the 2 GB limit */
+#if !defined __MINGW32__
+#define fseeko _fseeki64
+#define ftello _ftelli64
+#else /* MinGW */
+#if !defined(HAVE_FSEEKO)
+#define fseeko fseeko64
+#define ftello ftello64
 #endif
 #endif
+#else
+#define FLAC__off_t off_t
 #endif
 
 #if HAVE_INTTYPES_H
 #endif
 
 #if defined _MSC_VER || defined __MINGW32__
-#include <io.h> /* for _setmode() */
+#include <io.h> /* for _setmode(), chmod() */
 #include <fcntl.h> /* for _O_BINARY */
 #endif
 #if defined __CYGWIN__ || defined __EMX__
-#include <io.h> /* for setmode(), O_BINARY */
+#include <io.h> /* for setmode(), chmod() */
 #include <fcntl.h> /* for _O_BINARY */
+#else
+#include <unistd.h> /* for chown(), unlink() */
 #endif
 
-
 #if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
 #if defined __BORLANDC__
 #include <utime.h> /* for utime() */
 #else
 #include <sys/utime.h> /* for utime() */
 #endif
-#include <io.h> /* for chmod() */
-#include <sys/types.h> /* for off_t */
 #else
 #include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */
 #include <utime.h> /* for utime() */
-#include <unistd.h> /* for chown(), unlink() */
 #endif
 
 #if defined _MSC_VER
 #  endif
 #endif /* defined _MSC_VER */
 
+
+/* FLAC needs to compile and work correctly on systems with a norrmal ISO C99
+ * snprintf as well as Microsoft Visual Studio which has an non-standards
+ * conformant snprint_s function.
+ *
+ * This function wraps the MS version to behave more like the the ISO version.
+ */
+
+int flac_snprintf(char *str, size_t size, const char *fmt, ...);
+
 #endif /* FLAC__SHARE__COMPAT_H */