mpd: fix for string.h vs strings.h changes

This commit is contained in:
François Revol
2014-08-15 22:44:39 +02:00
parent 908c82cd1a
commit e751fa468b

View File

@@ -1270,3 +1270,76 @@ index fe933cc..0f111c6 100644
--
1.8.3.4
From af2b547614d4813d2e24e4b70bfd30ea00e0800c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Fri, 15 Aug 2014 21:12:50 +0200
Subject: [PATCH 1/2] util: Fix header for strcasecmp
According to POSIX and both OSX and Linux manpages,
strcasecmp comes from strings.h, not string.h.
Most OSes also have them available in string.h,
but we just fixed the headers on Haiku and it now
only provides them in strings.h.
We might want to fall back to string.h for other
OSes though...
cf.
http://pubs.opengroup.org/onlinepubs/009695399/functions/strcasecmp.html
http://linux.die.net/man/3/strcasecmp
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/strcasecmp.3.html
---
src/util/ASCII.hxx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/util/ASCII.hxx b/src/util/ASCII.hxx
index adea6dc..4a65254 100644
--- a/src/util/ASCII.hxx
+++ b/src/util/ASCII.hxx
@@ -30,10 +30,13 @@
#ifndef MPD_ASCII_HXX
#define MPD_ASCII_HXX
+#include "config.h"
#include "Compiler.h"
#include <assert.h>
-#include <string.h>
+#if HAVE_STRINGS_H
+#include <strings.h>
+#endif
/**
* Determine whether two strings are equal, ignoring case for ASCII
--
2.1.0.rc1
From c761b00e3a1f2b92b15b54a9a9626b123164e174 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Fri, 15 Aug 2014 22:17:45 +0200
Subject: [PATCH 2/2] icu: include strings.h for strcasecmp
Again, POSIX says strcasecmp is not in string.h.
---
src/lib/icu/Collate.cxx | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/lib/icu/Collate.cxx b/src/lib/icu/Collate.cxx
index f6621eb..7542c0e 100644
--- a/src/lib/icu/Collate.cxx
+++ b/src/lib/icu/Collate.cxx
@@ -38,6 +38,9 @@
#include <assert.h>
#include <string.h>
+#if HAVE_STRINGS_H
+#include <strings.h>
+#endif
#ifdef HAVE_ICU
static UCollator *collator;
--
2.1.0.rc1