MSVC 2005/2008 can't compile libFLAC

lvqcl <[email protected]>
Newsgroups gmane.comp.audio.compression.flac.devel
Message-ID <op.yt6f6cp5cba0by@userme-pc>
These versions of Visual Studio don't have stdint.h and
all [u]intNN_t types. But now these types are everywhere
in FLAC codebase.

An easy fix would be to move definitions of these types
 from share/compat.h into FLAC/ordinals.h (see attached
patch).
But it may break some 3rd party programs that include
(directly or indirectly) this file and also have their
own typedefs for these types.

(Also, currently FLAC/ordinals.h contains some nonsense
like "typedef uint32_t __int32 FLAC__uint32;", but that's
not a real problem)


So, what to do?

1) include share/compat.h where needed (but it's too big,
and even indirectly includes <windows.h>).

2) create a new file compat_stdint.h or compat_inttypes.h
that has only necessary definitions and include it.

3) apply the attached patch and hope that it has the most
compatible definitions for these types.

4) drop MSVC 2005/2008 support.

5) revert some changes of integer types to [u]intNN_t.

_______________________________________________
flac-dev mailing list
[email protected]
http://lists.xiph.org/mailman/listinfo/flac-dev
ordinals_fix.patch (application/octet-stream, 1.7 KB)
diff --git a/include/FLAC/ordinals.h b/include/FLAC/ordinals.h
index 8018afe..ebdc812 100644
--- a/include/FLAC/ordinals.h
+++ b/include/FLAC/ordinals.h
@@ -39,15 +39,14 @@
  * the 1999 ISO C Standard header file <stdint.h>.
  */
 
-typedef __int8 FLAC__int8;
-typedef uint32_t __int8 FLAC__uint8;
-
-typedef __int16 FLAC__int16;
-typedef __int32 FLAC__int32;
-typedef __int64 FLAC__int64;
-typedef uint32_t __int16 FLAC__uint16;
-typedef uint32_t __int32 FLAC__uint32;
-typedef uint32_t __int64 FLAC__uint64;
+typedef signed __int8  int8_t;
+typedef signed __int16 int16_t;
+typedef signed __int32 int32_t;
+typedef signed __int64 int64_t;
+typedef unsigned __int8 uint8_t;
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int64 uint64_t;
 
 #else
 
@@ -55,6 +54,8 @@ typedef uint32_t __int64 FLAC__uint64;
 
 #include <stdint.h>
 
+#endif
+
 typedef int8_t FLAC__int8;
 typedef uint8_t FLAC__uint8;
 
@@ -65,7 +66,6 @@ typedef uint16_t FLAC__uint16;
 typedef uint32_t FLAC__uint32;
 typedef uint64_t FLAC__uint64;
 
-#endif
 
 typedef int FLAC__bool;
 
diff --git a/include/share/compat.h b/include/share/compat.h
index 2083f3a..0db6dde 100644
--- a/include/share/compat.h
+++ b/include/share/compat.h
@@ -130,14 +130,7 @@
 #    ifndef UINT32_MAX
 #      define UINT32_MAX _UI32_MAX
 #    endif
-     typedef unsigned __int64 uint64_t;
-     typedef unsigned __int32 uint32_t;
-     typedef unsigned __int16 uint16_t;
-     typedef unsigned __int8 uint8_t;
-     typedef __int64 int64_t;
-     typedef __int32 int32_t;
-     typedef __int16 int16_t;
-     typedef __int8  int8_t;
+#    include "FLAC/ordinals.h"
 #    define PRIu64 "I64u"
 #    define PRId64 "I64d"
 #    define PRIx64 "I64x"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.