From 20c87f1ab60b25a5e8bf475d379182bc62fd210f Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 20 Oct 2015 08:06:46 +0100 Subject: [PATCH] gcc warnings --- C/blobs.c | 7 +++++++ C/load_dl.c | 1 + C/save.c | 1 + C/scanner.c | 19 +------------------ include/YapErrors.h | 1 + 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/C/blobs.c b/C/blobs.c index 449a9e819..0a9f541ac 100644 --- a/C/blobs.c +++ b/C/blobs.c @@ -46,7 +46,14 @@ char * Yap_blob_to_string(AtomEntry *ref, const char *s0, size_t sz) fclose(f); // return the final result. return s; } else { +#if __APPLE__ size_t sz0 = strlcpy( s, (char *)RepAtom( AtomSWIStream )->StrOfAE, sz); +#else + size_t sz0; + char *f = (char *)memcpy(s, (char *)RepAtom( AtomSWIStream )->StrOfAE, sz); + f[0]='\0'; + sz0 = f-s; +#endif s = s+sz0; sz -= sz0; #if defined(__linux__) || defined(__APPLE__) diff --git a/C/load_dl.c b/C/load_dl.c index f533bef4c..7f5c1d711 100755 --- a/C/load_dl.c +++ b/C/load_dl.c @@ -26,6 +26,7 @@ char * findExecutable(const char *av0, char *buffer); #include +#include #include #include #include diff --git a/C/save.c b/C/save.c index 6ac07c972..94008aaed 100755 --- a/C/save.c +++ b/C/save.c @@ -32,6 +32,7 @@ static char SccsId[] = "@(#)save.c 1.3 3/15/90"; #include "dlmalloc.h" #endif #include "yapio.h" +#include "YapText.h" #include "sshift.h" #include "Foreign.h" #if HAVE_STRING_H diff --git a/C/scanner.c b/C/scanner.c index 4feef50a7..4812cea57 100755 --- a/C/scanner.c +++ b/C/scanner.c @@ -454,7 +454,7 @@ static void Yap_setCurrentSourceLocation(struct stream_desc *s) { } /* token table with some help from Richard O'Keefe's PD scanner */ -static char chtype0[NUMBER_OF_CHARS + 1] = { +char_kind_t Yap_chtype0[NUMBER_OF_CHARS + 1] = { EF, /* nul soh stx etx eot enq ack bel bs ht nl vt np cr so si */ @@ -547,23 +547,6 @@ typedef struct scanner_internals { size_t CommentsBuffLim; } scanner_internals; -char *Yap_chtype = chtype0 + 1; - -int Yap_wide_chtype(Int ch) { -#if HAVE_WCTYPE_H - if (iswalnum(ch)) { - if (iswlower(ch)) - return LC; - if (iswdigit(ch)) - return NU; - return UC; - } - if (iswpunct(ch)) - return SY; -#endif - return BS; -} - // standard get char, uses conversion table // and converts to wide #define getchr(inp) inp->stream_wgetc_for_read(inp - GLOBAL_Stream) diff --git a/include/YapErrors.h b/include/YapErrors.h index 9b480f0e8..51d12f06b 100644 --- a/include/YapErrors.h +++ b/include/YapErrors.h @@ -131,6 +131,7 @@ BEGIN_ERRORS() E(TYPE_ERROR_CALLABLE, TYPE_ERROR, "callable") E(TYPE_ERROR_CHAR, TYPE_ERROR, "char") E(TYPE_ERROR_CHARACTER, TYPE_ERROR, "character") + E(TYPE_ERROR_CHARACTER_CODE, TYPE_ERROR, "character_code") E(TYPE_ERROR_COMPOUND, TYPE_ERROR, "compound") E(TYPE_ERROR_DBREF, TYPE_ERROR, "dbref") E(TYPE_ERROR_DBTERM, TYPE_ERROR, "dbterm")