Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -490,10 +490,13 @@ AC_MSG_RESULT(no) AC_DEFINE(SSIZE_MAX, [((ssize_t)(SIZE_MAX / 2))], [Maximum value for ssize_t]) ]) +AC_CHECK_HEADER(sys/types.h, + [AC_DEFINE(OF_HAVE_SYS_TYPES_H, 1, [Whether we have ])]) + AC_CHECK_TYPE(max_align_t, [AC_DEFINE(OF_HAVE_MAX_ALIGN_T, 1, [Whether we have max_align_t])]) AC_CHECK_HEADER(stdnoreturn.h, [AC_DEFINE(OF_HAVE_STDNORETURN_H, 1, [Whether we have stdnoreturn.h])]) @@ -1060,11 +1063,11 @@ esac AC_MSG_CHECKING(for getaddrinfo) AC_TRY_COMPILE([ #include - #ifndef _WIN32 + #ifdef OF_HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #endif @@ -1113,11 +1116,11 @@ esac AS_IF([test x"$have_threadsafe_getaddrinfo" = \ x"unknown"], [ AC_EGREP_CPP(yes, [ - #ifndef _WIN32 + #ifdef OF_HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #endif Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -18,12 +18,10 @@ #include #include #include -#include - #import "OFString.h" #import "OFMutableString_UTF8.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" Index: src/OFNumber.h ================================================================== --- src/OFNumber.h +++ src/OFNumber.h @@ -19,11 +19,15 @@ #endif #ifndef __STDC_CONSTANT_MACROS # define __STDC_CONSTANT_MACROS #endif -#include +#include "objfw-defs.h" + +#ifdef OF_HAVE_SYS_TYPES_H +# include +#endif #import "OFObject.h" #import "OFSerialization.h" #import "OFJSONRepresentation.h" #import "OFMessagePackRepresentation.h" Index: src/OFProcess.h ================================================================== --- src/OFProcess.h +++ src/OFProcess.h @@ -19,11 +19,15 @@ #endif #ifndef __STDC_CONSTANT_MACROS # define __STDC_CONSTANT_MACROS #endif -#include +#include "objfw-defs.h" + +#ifdef OF_HAVE_SYS_TYPES_H +# include +#endif #import "OFStream.h" #import "OFString.h" #ifdef OF_WINDOWS Index: src/OFSeekableStream.h ================================================================== --- src/OFSeekableStream.h +++ src/OFSeekableStream.h @@ -19,11 +19,15 @@ #endif #ifndef __STDC_CONSTANT_MACROS # define __STDC_CONSTANT_MACROS #endif -#include +#include "objfw-defs.h" + +#ifdef OF_HAVE_SYS_TYPES_H +# include +#endif #import "OFStream.h" OF_ASSUME_NONNULL_BEGIN Index: src/OFString_UTF8.m ================================================================== --- src/OFString_UTF8.m +++ src/OFString_UTF8.m @@ -18,11 +18,13 @@ #include #include #include -#include +#ifdef OF_HAVE_SYS_TYPES_H +# include +#endif #import "OFString_UTF8.h" #import "OFString_UTF8+Private.h" #import "OFMutableString_UTF8.h" #import "OFArray.h" Index: src/OFXMLParser.m ================================================================== --- src/OFXMLParser.m +++ src/OFXMLParser.m @@ -16,12 +16,10 @@ #include "config.h" #include -#include - #import "OFXMLParser.h" #import "OFString.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFBigDataArray.h" @@ -105,17 +103,14 @@ size_t count = [namespaces count]; if (prefix == nil) prefix = @""; - if (count - 1 > SSIZE_MAX) - @throw [OFOutOfRangeException exception]; - - for (ssize_t i = count - 1; i >= 0; i--) { + while (count > 0) { OFString *tmp; - if ((tmp = [objects[i] objectForKey: prefix]) != nil) + if ((tmp = [objects[--count] objectForKey: prefix]) != nil) return tmp; } return nil; } Index: src/objfw-defs.h.in ================================================================== --- src/objfw-defs.h.in +++ src/objfw-defs.h.in @@ -28,13 +28,14 @@ #undef OF_HAVE_SOCKETS #undef OF_HAVE_STDNORETURN #undef OF_HAVE_SYMLINK #undef OF_HAVE_SYNC_BUILTINS #undef OF_HAVE_SYS_SOCKET_H +#undef OF_HAVE_SYS_TYPES_H #undef OF_HAVE_THREADS #undef OF_HAVE_UNICODE_TABLES #undef OF_HAVE__THREAD_LOCAL #undef OF_HAVE___THREAD #undef OF_NINTENDO_DS #undef OF_OBJFW_RUNTIME #undef OF_UNIVERSAL #undef SIZE_MAX Index: src/of_asprintf.m ================================================================== --- src/of_asprintf.m +++ src/of_asprintf.m @@ -31,11 +31,13 @@ #endif #ifdef HAVE_XLOCALE_H # include #endif -#include +#ifdef OF_HAVE_SYS_TYPES_H +# include +#endif #import "OFString.h" #import "OFLocalization.h" #import "OFInitializationFailedException.h"