[147056] trunk/dports/multimedia/libmms

devans at macports.org devans at macports.org
Thu Mar 24 09:29:38 PDT 2016


Revision: 147056
          https://trac.macports.org/changeset/147056
Author:   devans at macports.org
Date:     2016-03-24 09:29:38 -0700 (Thu, 24 Mar 2016)
Log Message:
-----------
libmms: address missing strndup() on 10.6 and earlier.

Modified Paths:
--------------
    trunk/dports/multimedia/libmms/Portfile

Added Paths:
-----------
    trunk/dports/multimedia/libmms/files/
    trunk/dports/multimedia/libmms/files/strndup.patch

Modified: trunk/dports/multimedia/libmms/Portfile
===================================================================
--- trunk/dports/multimedia/libmms/Portfile	2016-03-24 15:58:47 UTC (rev 147055)
+++ trunk/dports/multimedia/libmms/Portfile	2016-03-24 16:29:38 UTC (rev 147056)
@@ -26,3 +26,5 @@
 depends_lib         path:lib/pkgconfig/glib-2.0.pc:glib2 \
                     port:libiconv \
                     port:gettext
+
+patchfiles          strndup.patch

Added: trunk/dports/multimedia/libmms/files/strndup.patch
===================================================================
--- trunk/dports/multimedia/libmms/files/strndup.patch	                        (rev 0)
+++ trunk/dports/multimedia/libmms/files/strndup.patch	2016-03-24 16:29:38 UTC (rev 147056)
@@ -0,0 +1,37 @@
+--- src/uri.c.orig	2016-03-24 09:04:32.000000000 -0700
++++ src/uri.c	2016-03-24 09:11:25.000000000 -0700
+@@ -26,6 +26,34 @@
+ #define TRUE 1
+ #endif
+ 
++#ifdef __APPLE__
++#include <Availability.h>
++#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060
++static char * strndup (char const *s, size_t n);
++static size_t strnlen (const char *string, size_t maxlen);
++
++static size_t
++strnlen (const char *string, size_t maxlen)
++{
++  const char *end = memchr (string, '\0', maxlen);
++  return end ? (size_t) (end - string) : maxlen;
++}
++
++static char *
++strndup (char const *s, size_t n)
++{
++  size_t len = strnlen (s, n);
++  char *new = malloc (len + 1);
++
++  if (new == NULL)
++    return NULL;
++
++  new[len] = '\0';
++  return memcpy (new, s, len);
++}
++#endif
++#endif
++
+ #define g_strdup strdup
+ #define g_strndup strndup
+ #define g_malloc malloc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160324/02ad927d/attachment.html>


More information about the macports-changes mailing list