changeset 2948:b4046e5c478e

Please don't use GNU-only stuff without providing an alternative?
author Jonathan Schleifer <js-audacious@webkeks.org>
date Fri, 03 Oct 2008 00:23:27 +0200
parents c79e239a816f
children 0f0227b29f43
files configure.ac src/modplug/archive/arch_rar.cxx
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Thu Oct 02 23:53:27 2008 +0200
+++ b/configure.ac	Fri Oct 03 00:23:27 2008 +0200
@@ -99,6 +99,8 @@
 dnl Gettext -nenolod
 AM_GNU_GETTEXT([external])
 
+AC_CHECK_FUNC(strnlen, [AC_DEFINE(HAVE_STRNLEN, 1, [Whether we have strnlen])],)
+
 dnl Path settings
 
 AC_ARG_WITH(dev-dsp,
--- a/src/modplug/archive/arch_rar.cxx	Thu Oct 02 23:53:27 2008 +0200
+++ b/src/modplug/archive/arch_rar.cxx	Fri Oct 03 00:23:27 2008 +0200
@@ -16,6 +16,19 @@
 #include <vector>
 #include <cstdlib>
 #include <cstring>
+
+#ifndef HAVE_STRNLEN
+size_t
+strnlen(const char *s, size_t maxlen)
+{
+	size_t i = 0;
+
+	while (i < maxlen && (*s++))
+		i++;
+
+	return i;
+}
+#endif
 	
 arch_Rar::arch_Rar(const string& aFileName)
 {