From ddd074f393f3203feb1d3fc236f6af610c6d02d9 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 10 Jan 2017 18:05:48 +0100 Subject: [PATCH] continue fixing compilation (gcc/clang) --- src/bind_faction.c | 1 + src/kernel/alliance.h | 3 +++ src/kernel/order.h | 1 + src/keyword.h | 2 ++ src/platform.h | 3 +++ src/util/filereader.c | 15 ++++++++------- src/util/parser.c | 8 ++++---- src/util/parser.h | 1 + src/util/password.h | 1 + src/util/rand.h | 4 ++++ src/util/translation.c | 1 + 11 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/bind_faction.c b/src/bind_faction.c index 36da798c1..2ace2ae52 100644 --- a/src/bind_faction.c +++ b/src/bind_faction.c @@ -36,6 +36,7 @@ without prior permission by the authors of Eressea. #include #include +#include typedef struct helpmode { const char *name; diff --git a/src/kernel/alliance.h b/src/kernel/alliance.h index 907fc65f7..4be05b871 100644 --- a/src/kernel/alliance.h +++ b/src/kernel/alliance.h @@ -18,6 +18,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef H_KRNL_ALLIANCE #define H_KRNL_ALLIANCE + +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/src/kernel/order.h b/src/kernel/order.h index 69cf1ea33..7f4b00a5e 100644 --- a/src/kernel/order.h +++ b/src/kernel/order.h @@ -15,6 +15,7 @@ #include "keyword.h" #include +#include #ifdef __cplusplus extern "C" { diff --git a/src/keyword.h b/src/keyword.h index e60d0731f..1d8f04bb2 100644 --- a/src/keyword.h +++ b/src/keyword.h @@ -2,6 +2,8 @@ #define H_KEYWORD_H #include "kernel/types.h" +#include + #ifdef __cplusplus extern "C" { diff --git a/src/platform.h b/src/platform.h index 2f114cec5..7f82f46a8 100644 --- a/src/platform.h +++ b/src/platform.h @@ -3,6 +3,8 @@ #ifndef UNILIB_H #define UNILIB_H +#define _POSIX_C_SOURCE 200809L + #ifndef MAX_PATH # define MAX_PATH 4096 #endif @@ -12,4 +14,5 @@ #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#define TOLUA_CAST (char*) #endif diff --git a/src/util/filereader.c b/src/util/filereader.c index 3223ca2ab..d36d3ca71 100644 --- a/src/util/filereader.c +++ b/src/util/filereader.c @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -30,7 +31,7 @@ static int eatwhite(const char *ptr, size_t * total_size) ret = unicode_utf8_to_ucs4(&ucs, ptr, &size); if (ret != 0) break; - if (!iswxspace((wint_t)ucs)) + if (!iswspace((wint_t)ucs)) break; *total_size += size; ptr += size; @@ -52,7 +53,7 @@ static const char *getbuf_latin1(FILE * F) if (bp == NULL) return NULL; - while (*bp && isxspace(*(unsigned char *)bp)) + while (*bp && isspace(*(unsigned char *)bp)) ++bp; /* eatwhite */ comment = (bool)(comment && cont); @@ -113,15 +114,15 @@ static const char *getbuf_latin1(FILE * F) if (iscntrl(c)) { if (!comment && cp < fbuf + MAXLINE) { - *cp++ = isxspace(c) ? ' ' : '?'; + *cp++ = isspace(c) ? ' ' : '?'; } ++bp; continue; } - else if (isxspace(c)) { + else if (isspace(c)) { if (!quote) { ++bp; - while (*bp && isxspace(*(unsigned char *)bp)) + while (*bp && isspace(*(unsigned char *)bp)) ++bp; /* eatwhite */ if (!comment && *bp && *bp != COMMENT_CHAR && cp < fbuf + MAXLINE) *(cp++) = ' '; @@ -136,7 +137,7 @@ static const char *getbuf_latin1(FILE * F) } else if (c == CONTINUE_CHAR) { const char *end = ++bp; - while (*end && isxspace(*(unsigned char *)end)) + while (*end && isspace(*(unsigned char *)end)) ++end; /* eatwhite */ if (*end == '\0') { bp = end; @@ -269,7 +270,7 @@ static const char *getbuf_utf8(FILE * F) break; } - if (iswxspace((wint_t)ucs)) { + if (iswspace((wint_t)ucs)) { if (!quote) { bp += size; ret = eatwhite(bp, &size); diff --git a/src/util/parser.c b/src/util/parser.c index 0fbde6769..bbdb5ac7e 100644 --- a/src/util/parser.c +++ b/src/util/parser.c @@ -32,7 +32,7 @@ static int eatwhitespace_c(const char **str_p) for (;;) { unsigned char utf8_character = (unsigned char)*str; if (~utf8_character & 0x80) { - if (!iswxspace(utf8_character)) + if (!iswspace(utf8_character)) break; ++str; } @@ -42,7 +42,7 @@ static int eatwhitespace_c(const char **str_p) log_warning("illegal character sequence in UTF8 string: %s\n", str); break; } - if (!iswxspace((wint_t)ucs)) + if (!iswspace((wint_t)ucs)) break; str += len; } @@ -106,7 +106,7 @@ void skip_token(void) log_warning("illegal character sequence in UTF8 string: %s\n", states->current_token); } } - if (iswxspace((wint_t)ucs) && quotechar == 0) { + if (iswspace((wint_t)ucs) && quotechar == 0) { return; } else { @@ -163,7 +163,7 @@ char *parse_token(const char **str, char *lbuf, size_t buflen) copy = true; escape = false; } - else if (iswxspace((wint_t)ucs)) { + else if (iswspace((wint_t)ucs)) { if (quotechar == 0) break; copy = true; diff --git a/src/util/parser.h b/src/util/parser.h index 802fc56cb..0c8306931 100644 --- a/src/util/parser.h +++ b/src/util/parser.h @@ -12,6 +12,7 @@ #define UTIL_PARSER_H #include +#include #ifdef __cplusplus extern "C" { diff --git a/src/util/password.h b/src/util/password.h index e1d49fb6d..b83d544a6 100644 --- a/src/util/password.h +++ b/src/util/password.h @@ -1,5 +1,6 @@ #pragma once +#include #define PASSWORD_PLAINTEXT 0 #define PASSWORD_DEFAULT PASSWORD_PLAINTEXT diff --git a/src/util/rand.h b/src/util/rand.h index 9fb3f2f69..e9d9062b7 100644 --- a/src/util/rand.h +++ b/src/util/rand.h @@ -1,3 +1,4 @@ +#pragma once /* Copyright (c) 1998-2015, Enno Rehling Katja Zedel + #ifdef __cplusplus extern "C" { #endif diff --git a/src/util/translation.c b/src/util/translation.c index b0933d322..c733cc272 100644 --- a/src/util/translation.c +++ b/src/util/translation.c @@ -21,6 +21,7 @@ /* libc includes */ #include #include +#include #include #include