[Flac-dev] MinGW Patch

Erik de Castro Lopo mle+la at mega-nerd.com
Tue Aug 12 21:33:51 PDT 2008


will surgent wrote:

> Hello, I was trying to compile Flac on MinGW/Msys but got an error stating
> SIZE_T_MAX is undefined.
> To fix this error I edited the file "flac-1.2.1/include/share/alloc.h" and
> made the following change:

<snip>

> #ifndef SIZE_MAX
> # ifndef SIZE_T_MAX
> #  ifdef _MSC_VER
> #   define SIZE_T_MAX UINT_MAX
> #  elif defined(__MINGW_H)
> #   define SIZE_T_MAX UINT_MAX
> #  else
> #   error
> #  endif
> # endif
> # define SIZE_MAX SIZE_T_MAX
> #endif

Actually, there might be a better fix for this. How about:

-------8<-------8<-------8<-------8<-------8<-------8<-------8<-------
--- include/share/alloc.h	2008-06-29 21:43:05.000000000 +1000
+++ include/share/alloc.h	2008-08-13 14:38:33.000000000 +1000
@@ -28,7 +28,7 @@
  */
 
 #include <limits.h> /* for SIZE_MAX */
-#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__
+#if HAVE_STDINT_H
 #include <stdint.h> /* for SIZE_MAX in case limits.h didn't get it */
 #endif
 #include <stdlib.h> /* for size_t, malloc(), etc */
-------8<-------8<-------8<-------8<-------8<-------8<-------8<-------

Does that work for MinGW?

> Hope I found the right place to submit this :~)

Yes.

Erik
-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
`If you want a vision of the future, it is a wireless broadband
 network feeding requests for foreign money-laundering assistance
 into a human temporal lobe, forever. With banner ads.'
 -- John M. Ford


More information about the Flac-dev mailing list