libFLAC with Android NDK: use of undeclared identifier 'SIZE_MAX'

Steve <[email protected]>
Newsgroups gmane.comp.audio.compression.flac.devel
Message-ID <CAMvrk33K5k5cxEUM2WQF_RcUns+-cu9Gre_f8SmsEHVq-qZtTw@mail.gmail.com>
Hi flac-dev,

When we try to build libFLAC v1.3.1 using the Android NDK, we currently are
getting an error in a couple files:

../../third_party/flac/src/libFLAC/md5.c:498:25: error: use of undeclared
> identifier 'SIZE_MAX'
> if ((size_t)channels > SIZE_MAX / (size_t)bytes_per_sample)
>

I filed a bug for it on the sourceforge bug tracker:
https://sourceforge.net/p/flac/bugs/457/

This is fixed (in all NDK versions) by including limits.h.  I've attached a
simple patch that fixes the Android NDK build.

Please let me know if theres any other process involved in getting this
patch upstreamed.

Thanks,
~Steve

_______________________________________________
flac-dev mailing list
[email protected]
http://lists.xiph.org/mailman/listinfo/flac-dev
flac_android.diff (application/octet-stream, 605 B)
diff --git a/src/libFLAC/md5.c b/src/libFLAC/md5.c
index e5adc3e..91d0aeb 100644
--- a/src/libFLAC/md5.c
+++ b/src/libFLAC/md5.c
@@ -2,6 +2,10 @@
 #  include <config.h>
 #endif
 
+#ifdef ANDROID
+#  include <limits.h>
+#endif
+
 #include <stdlib.h>		/* for malloc() */
 #include <string.h>		/* for memcpy() */
 
diff --git a/src/libFLAC/memory.c b/src/libFLAC/memory.c
index d22df70..8621e6d 100644
--- a/src/libFLAC/memory.c
+++ b/src/libFLAC/memory.c
@@ -34,6 +34,10 @@
 #  include <config.h>
 #endif
 
+#ifdef ANDROID
+#  include <limits.h>
+#endif
+
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
 #endif
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.