From 66019c8421a094ee409b2d499bff728ba86f39bc Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 3 Mar 2019 10:04:33 +0100 Subject: [PATCH] mescc: Mes C Library: Fix compile warnings. * include/libmes.h (dtoab, itoa, ltoa, ntoab, ultoa, utoa): Return char* (WAS: char const*). * lib/*/*c: Update, add missing includes. --- include/libmes.h | 20 ++++++++++++-------- include/stdarg.h | 4 ++-- include/stdlib.h | 3 ++- lib/mes/abtol.c | 2 +- lib/mes/itoa.c | 4 ++-- lib/mes/ltoa.c | 4 ++-- lib/mes/ltoab.c | 4 ++-- lib/mes/ntoab.c | 4 ++-- lib/mes/ultoa.c | 4 ++-- lib/mes/utoa.c | 4 ++-- lib/stdio/vprintf.c | 4 ++-- lib/stdio/vsprintf.c | 4 ++-- 12 files changed, 33 insertions(+), 28 deletions(-) diff --git a/include/libmes.h b/include/libmes.h index 579f4709..5377b1db 100644 --- a/include/libmes.h +++ b/include/libmes.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -24,13 +24,17 @@ #include int __mes_debug (); -long abtol (char const** p, int base); -char const* ntoab (long number, int base, int signed_p); -char const* itoa (int number); -char const* ltoa (long number); -char const* ultoa (unsigned long number); -char const* utoa (unsigned number); -char const* ltoab (long x, int base); +void __ungetc_init (); +void __ungetc_clear (int filedes); +void __ungetc_set (int filedes, int c); +int __ungetc_p (int filedes); +long abtol (char const **p, int base); +char *itoa (int number); +char *ltoa (long number); +char *ltoab (long x, int base); +char *ntoab (long number, int base, int signed_p); +char *ultoa (unsigned long number); +char *utoa (unsigned number); int atoi (char const *s); int eputc (int c); int fdgetc (int fd); diff --git a/include/stdarg.h b/include/stdarg.h index f56b0dd2..70912eb1 100644 --- a/include/stdarg.h +++ b/include/stdarg.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2017 Jan (janneke) Nieuwenhuizen + * Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -31,7 +31,7 @@ #define __FOO_VARARGS 1 #endif -typedef long va_list; +typedef char *va_list; #define va_start(ap, last) (void)((ap) = (char*)(&(last) + 1)) #define va_arg(ap, type) (type)(((long*)((ap) = ((ap) + sizeof (void*))))[-1]) #define va_end(ap) (void)((ap) = 0) diff --git a/include/stdlib.h b/include/stdlib.h index 5d8d62f3..ce0b1a94 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2017 Jan (janneke) Nieuwenhuizen + * Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -31,6 +31,7 @@ #include #include +double atof (char const *s); int atoi (char const *s); int atexit (void (*function) (void)); void * calloc (size_t nmemb, size_t size); diff --git a/lib/mes/abtol.c b/lib/mes/abtol.c index 69ec50a6..e0c30f42 100644 --- a/lib/mes/abtol.c +++ b/lib/mes/abtol.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * diff --git a/lib/mes/itoa.c b/lib/mes/itoa.c index cd330e88..95b6d034 100644 --- a/lib/mes/itoa.c +++ b/lib/mes/itoa.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -20,7 +20,7 @@ #include -char const* +char * itoa (int x) { return ntoab (x, 10, 1); diff --git a/lib/mes/ltoa.c b/lib/mes/ltoa.c index 82bed4d9..8b91566e 100644 --- a/lib/mes/ltoa.c +++ b/lib/mes/ltoa.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -20,7 +20,7 @@ #include -char const* +char * ltoa (long x) { return ntoab (x, 10, 1); diff --git a/lib/mes/ltoab.c b/lib/mes/ltoab.c index 090d3ca2..7aee68cc 100644 --- a/lib/mes/ltoab.c +++ b/lib/mes/ltoab.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -20,7 +20,7 @@ #include -char const* +char * ltoab (long x, int base) { return ntoab (x, base, 1); diff --git a/lib/mes/ntoab.c b/lib/mes/ntoab.c index 52990854..5fcfe5ac 100644 --- a/lib/mes/ntoab.c +++ b/lib/mes/ntoab.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -20,7 +20,7 @@ #include -char const* +char * ntoab (long x, int base, int signed_p) { static char itoa_buf[20]; diff --git a/lib/mes/ultoa.c b/lib/mes/ultoa.c index 40461f18..c3099d3e 100644 --- a/lib/mes/ultoa.c +++ b/lib/mes/ultoa.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -20,7 +20,7 @@ #include -char const* +char * ultoa (unsigned long x) { return ntoab (x, 10, 1); diff --git a/lib/mes/utoa.c b/lib/mes/utoa.c index c6e90e9b..742e04ce 100644 --- a/lib/mes/utoa.c +++ b/lib/mes/utoa.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -20,7 +20,7 @@ #include -char const* +char * utoa (unsigned x) { return ntoab (x, 10, 0); diff --git a/lib/stdio/vprintf.c b/lib/stdio/vprintf.c index 850a9556..909d1fab 100644 --- a/lib/stdio/vprintf.c +++ b/lib/stdio/vprintf.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -24,5 +24,5 @@ int vprintf (char const* format, va_list ap) { - return vfprintf (STDOUT, format, ap); + return vfprintf (stdout, format, ap); } diff --git a/lib/stdio/vsprintf.c b/lib/stdio/vsprintf.c index 9953c3af..8a65b0d6 100644 --- a/lib/stdio/vsprintf.c +++ b/lib/stdio/vsprintf.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -18,8 +18,8 @@ * along with GNU Mes. If not, see . */ +#include #include -#include int vsprintf (char *str, char const* format, va_list ap)