From 626200e579860b1b833869b758155c84d325c7c0 Mon Sep 17 00:00:00 2001 From: raster Date: Mon, 5 Dec 2011 10:17:57 +0000 Subject: [PATCH] From: Joerg Sonnenberger Subject: [E-devel] eina 1.1.0beta patches for/from pkgsrc Several patches to fix warnings and potential on netbsd/solaris. minor so i think i'll skip changelog for this. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@65898 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- configure.ac | 20 +++++++++++++++++++- src/lib/eina_cpu.c | 4 ++-- src/lib/eina_magic.c | 4 ++-- src/lib/eina_simple_xml_parser.c | 14 +++++++------- src/lib/eina_strbuf.c | 6 +++--- 5 files changed, 33 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 68c1c50..31e2996 100644 --- a/configure.ac +++ b/configure.ac @@ -469,7 +469,25 @@ EFL_LINKER_FLAG([-fno-strict-aliasing]) ### Checks for library functions AC_ISC_POSIX AC_FUNC_ALLOCA -AC_CHECK_FUNCS([strlcpy dirfd openat fstatat fpathconf execvp]) +AC_CHECK_FUNCS([strlcpy openat fstatat fpathconf execvp]) + +AC_MSG_CHECKING([dirfd]) +AC_LINK_IFELSE([ + +#include + +DIR *dirp; + +int +main(void) +{ + return dirfd(dirp); +} +], [ AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_DIRFD], 1, [ Define to 1 if you have the `dirfd' function or macro. ]) + ], + [ AC_MSG_RESULT([no])] +) # dlopen and dladdr dlopen_libs="" diff --git a/src/lib/eina_cpu.c b/src/lib/eina_cpu.c index 8af550d..5b190e4 100644 --- a/src/lib/eina_cpu.c +++ b/src/lib/eina_cpu.c @@ -24,7 +24,7 @@ # ifdef _WIN32 # define WIN32_LEAN_AND_MEAN # include -# elif defined (__SUNPRO_C) || defined(__GNU__) +# elif defined (__sun) || defined(__GNU__) # include # elif defined (__FreeBSD__) || defined (__OpenBSD__) || \ defined (__NetBSD__) || defined (__DragonFly__) || defined (__MacOSX__) || \ @@ -140,7 +140,7 @@ EAPI int eina_cpu_count(void) GetSystemInfo(&sysinfo); return sysinfo.dwNumberOfProcessors; -# elif defined (__SUNPRO_C) || defined(__GNU__) +# elif defined (__sun) || defined(__GNU__) /* * _SC_NPROCESSORS_ONLN: number of processors that are online, that is available when sysconf is called. The number diff --git a/src/lib/eina_magic.c b/src/lib/eina_magic.c index 1adde92..08e9964 100644 --- a/src/lib/eina_magic.c +++ b/src/lib/eina_magic.c @@ -79,7 +79,7 @@ _eina_magic_strings_sort_cmp(const void *p1, const void *p2) static int _eina_magic_strings_find_cmp(const void *p1, const void *p2) { - Eina_Magic a = (Eina_Magic)p1; + Eina_Magic a = (Eina_Magic)(size_t)p1; const Eina_Magic_String *b = p2; return a - b->magic; } @@ -206,7 +206,7 @@ eina_magic_string_get(Eina_Magic magic) _eina_magic_strings_dirty = 0; } - ems = bsearch((void *)magic, _eina_magic_strings, + ems = bsearch((void *)(size_t)magic, _eina_magic_strings, _eina_magic_strings_count, sizeof(Eina_Magic_String), _eina_magic_strings_find_cmp); if (ems) diff --git a/src/lib/eina_simple_xml_parser.c b/src/lib/eina_simple_xml_parser.c index 08a8259..91f6e87 100644 --- a/src/lib/eina_simple_xml_parser.c +++ b/src/lib/eina_simple_xml_parser.c @@ -121,7 +121,7 @@ static inline const char * _eina_simple_xml_whitespace_find(const char *itr, const char *itr_end) { for (; itr < itr_end; itr++) - if (isspace(*itr)) break; + if (isspace((unsigned char)*itr)) break; return itr; } @@ -129,7 +129,7 @@ static inline const char * _eina_simple_xml_whitespace_skip(const char *itr, const char *itr_end) { for (; itr < itr_end; itr++) - if (!isspace(*itr)) break; + if (!isspace((unsigned char)*itr)) break; return itr; } @@ -137,7 +137,7 @@ static inline const char * _eina_simple_xml_whitespace_unskip(const char *itr, const char *itr_start) { for (itr--; itr > itr_start; itr--) - if (!isspace(*itr)) break; + if (!isspace((unsigned char)*itr)) break; return itr + 1; } @@ -309,7 +309,7 @@ eina_simple_xml_parse(const char *buf, unsigned buflen, Eina_Bool strip, Eina_Si (!memcmp(itr + 2, "DOCTYPE", sizeof("DOCTYPE") - 1)) && ((itr[2 + sizeof("DOCTYPE") - 1] == '>') || - (isspace(itr[2 + sizeof("DOCTYPE") - 1])))) + (isspace((unsigned char)itr[2 + sizeof("DOCTYPE") - 1])))) { type = EINA_SIMPLE_XML_DOCTYPE; toff = sizeof("!DOCTYPE") - 1; @@ -455,7 +455,7 @@ eina_simple_xml_tag_attributes_find(const char *buf, unsigned buflen) for (; itr < itr_end; itr++) { - if (!isspace(*itr)) + if (!isspace((unsigned char)*itr)) { /* user skip tagname and already gave it the attributes */ if (*itr == '=') @@ -492,7 +492,7 @@ eina_simple_xml_attributes_parse(const char *buf, unsigned buflen, Eina_Simple_X key = p; for (key_end = key; key_end < itr_end; key_end++) - if ((*key_end == '=') || (isspace(*key_end))) break; + if ((*key_end == '=') || (isspace((unsigned char)*key_end))) break; if (key_end == itr_end) return EINA_FALSE; if (key_end == key) continue; @@ -504,7 +504,7 @@ eina_simple_xml_attributes_parse(const char *buf, unsigned buflen, Eina_Simple_X value++; } for (; value < itr_end; value++) - if (!isspace(*value)) break; + if (!isspace((unsigned char)*value)) break; if (value == itr_end) return EINA_FALSE; if ((*value == '"') || (*value == '\'')) diff --git a/src/lib/eina_strbuf.c b/src/lib/eina_strbuf.c index 74b1eb9..828d842 100644 --- a/src/lib/eina_strbuf.c +++ b/src/lib/eina_strbuf.c @@ -162,9 +162,9 @@ eina_strbuf_insert_vprintf(Eina_Strbuf *buf, EAPI void eina_strbuf_trim(Eina_Strbuf *buf) { - char *c = buf->buf; + unsigned char *c = buf->buf; - while (buf->len > 0 && isspace(((unsigned char*)(buf->buf))[buf->len - 1])) + while (buf->len > 0 && isspace(c[buf->len - 1])) buf->len--; while (buf->len > 0 && isspace(*c)) { @@ -178,7 +178,7 @@ eina_strbuf_trim(Eina_Strbuf *buf) EAPI void eina_strbuf_ltrim(Eina_Strbuf *buf) { - char *c = buf->buf; + unsigned char *c = buf->buf; while (buf->len > 0 && isspace(*c)) { -- 2.7.4