continue fixing compilation (gcc/clang)

This commit is contained in:
Enno Rehling 2017-01-10 18:05:48 +01:00 committed by Enno Rehling
parent d94cde67a4
commit 5ddd511aa8
11 changed files with 29 additions and 11 deletions

View File

@ -34,6 +34,7 @@ without prior permission by the authors of Eressea.
#include <tolua.h> #include <tolua.h>
#include <string.h> #include <string.h>
#include <stdbool.h>
typedef struct helpmode { typedef struct helpmode {
const char *name; const char *name;

View File

@ -18,6 +18,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef H_KRNL_ALLIANCE #ifndef H_KRNL_ALLIANCE
#define H_KRNL_ALLIANCE #define H_KRNL_ALLIANCE
#include <stdbool.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -15,6 +15,7 @@
#include "keyword.h" #include "keyword.h"
#include <stddef.h> #include <stddef.h>
#include <stdbool.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -2,6 +2,8 @@
#define H_KEYWORD_H #define H_KEYWORD_H
#include "kernel/types.h" #include "kernel/types.h"
#include <stdbool.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {

View File

@ -3,6 +3,8 @@
#ifndef UNILIB_H #ifndef UNILIB_H
#define UNILIB_H #define UNILIB_H
#define _POSIX_C_SOURCE 200809L
#ifndef MAX_PATH #ifndef MAX_PATH
# define MAX_PATH 4096 # define MAX_PATH 4096
#endif #endif
@ -12,4 +14,5 @@
#define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) > (b)) ? (a) : (b)) #define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define TOLUA_CAST (char*)
#endif #endif

View File

@ -4,6 +4,7 @@
#include <util/log.h> #include <util/log.h>
#include <util/unicode.h> #include <util/unicode.h>
#include <stdbool.h>
#include <ctype.h> #include <ctype.h>
#include <wctype.h> #include <wctype.h>
@ -30,7 +31,7 @@ static int eatwhite(const char *ptr, size_t * total_size)
ret = unicode_utf8_to_ucs4(&ucs, ptr, &size); ret = unicode_utf8_to_ucs4(&ucs, ptr, &size);
if (ret != 0) if (ret != 0)
break; break;
if (!iswxspace((wint_t)ucs)) if (!iswspace((wint_t)ucs))
break; break;
*total_size += size; *total_size += size;
ptr += size; ptr += size;
@ -52,7 +53,7 @@ static const char *getbuf_latin1(FILE * F)
if (bp == NULL) if (bp == NULL)
return NULL; return NULL;
while (*bp && isxspace(*(unsigned char *)bp)) while (*bp && isspace(*(unsigned char *)bp))
++bp; /* eatwhite */ ++bp; /* eatwhite */
comment = (bool)(comment && cont); comment = (bool)(comment && cont);
@ -113,15 +114,15 @@ static const char *getbuf_latin1(FILE * F)
if (iscntrl(c)) { if (iscntrl(c)) {
if (!comment && cp < fbuf + MAXLINE) { if (!comment && cp < fbuf + MAXLINE) {
*cp++ = isxspace(c) ? ' ' : '?'; *cp++ = isspace(c) ? ' ' : '?';
} }
++bp; ++bp;
continue; continue;
} }
else if (isxspace(c)) { else if (isspace(c)) {
if (!quote) { if (!quote) {
++bp; ++bp;
while (*bp && isxspace(*(unsigned char *)bp)) while (*bp && isspace(*(unsigned char *)bp))
++bp; /* eatwhite */ ++bp; /* eatwhite */
if (!comment && *bp && *bp != COMMENT_CHAR && cp < fbuf + MAXLINE) if (!comment && *bp && *bp != COMMENT_CHAR && cp < fbuf + MAXLINE)
*(cp++) = ' '; *(cp++) = ' ';
@ -136,7 +137,7 @@ static const char *getbuf_latin1(FILE * F)
} }
else if (c == CONTINUE_CHAR) { else if (c == CONTINUE_CHAR) {
const char *end = ++bp; const char *end = ++bp;
while (*end && isxspace(*(unsigned char *)end)) while (*end && isspace(*(unsigned char *)end))
++end; /* eatwhite */ ++end; /* eatwhite */
if (*end == '\0') { if (*end == '\0') {
bp = end; bp = end;
@ -269,7 +270,7 @@ static const char *getbuf_utf8(FILE * F)
break; break;
} }
if (iswxspace((wint_t)ucs)) { if (iswspace((wint_t)ucs)) {
if (!quote) { if (!quote) {
bp += size; bp += size;
ret = eatwhite(bp, &size); ret = eatwhite(bp, &size);

View File

@ -32,7 +32,7 @@ static int eatwhitespace_c(const char **str_p)
for (;;) { for (;;) {
unsigned char utf8_character = (unsigned char)*str; unsigned char utf8_character = (unsigned char)*str;
if (~utf8_character & 0x80) { if (~utf8_character & 0x80) {
if (!iswxspace(utf8_character)) if (!iswspace(utf8_character))
break; break;
++str; ++str;
} }
@ -42,7 +42,7 @@ static int eatwhitespace_c(const char **str_p)
log_warning("illegal character sequence in UTF8 string: %s\n", str); log_warning("illegal character sequence in UTF8 string: %s\n", str);
break; break;
} }
if (!iswxspace((wint_t)ucs)) if (!iswspace((wint_t)ucs))
break; break;
str += len; str += len;
} }
@ -106,7 +106,7 @@ void skip_token(void)
log_warning("illegal character sequence in UTF8 string: %s\n", states->current_token); 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; return;
} }
else { else {
@ -163,7 +163,7 @@ char *parse_token(const char **str, char *lbuf, size_t buflen)
copy = true; copy = true;
escape = false; escape = false;
} }
else if (iswxspace((wint_t)ucs)) { else if (iswspace((wint_t)ucs)) {
if (quotechar == 0) if (quotechar == 0)
break; break;
copy = true; copy = true;

View File

@ -12,6 +12,7 @@
#define UTIL_PARSER_H #define UTIL_PARSER_H
#include <stddef.h> #include <stddef.h>
#include <stdbool.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <stdbool.h>
#define PASSWORD_PLAINTEXT 0 #define PASSWORD_PLAINTEXT 0
#define PASSWORD_DEFAULT PASSWORD_PLAINTEXT #define PASSWORD_DEFAULT PASSWORD_PLAINTEXT

View File

@ -1,3 +1,4 @@
#pragma once
/* /*
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de> Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de Katja Zedel <katze@felidae.kn-bremen.de
@ -18,6 +19,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef RAND_H #ifndef RAND_H
#define RAND_H #define RAND_H
#include <stdbool.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -21,6 +21,7 @@
/* libc includes */ /* libc includes */
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>