cc -Wall -I./include -DHAS_JIT -o encodings/singlebyte.o -c encodings/singlebyte.c
encodings/singlebyte.c:63: warning: initialization from incompatible pointer type
encodings/singlebyte.c:65: warning: initialization from incompatible pointer type
I'm not sure why there is only const on one of these
typedef struct {
const char *name;
INTVAL max_bytes;
INTVAL (*characters)(const void *ptr, INTVAL bytes);
INTVAL (*decode)(const void *ptr);
void *(*encode)(void *ptr, INTVAL c);
void *(*skip_forward)(void *ptr, INTVAL n);
void *(*skip_backward)(void *ptr, INTVAL n);
} ENCODING;
given that the ANSI C library seems happy to put const on prototypes for
functions that return a non-const pointer into the string (eg strchr())
but that is a more fundamental change than removing the warning by changing
just 1 file (as appended).
Nicholas Clark
--- encodings/singlebyte.c~ Sun Dec 30 12:05:21 2001
+++ encodings/singlebyte.c Tue Jan 1 17:59:55 2002
@@ -41,14 +41,14 @@
}
static void *
-singlebyte_skip_forward (const void *ptr, INTVAL n) {
+singlebyte_skip_forward (void *ptr, INTVAL n) {
byte_t *bptr = (byte_t*)ptr;
return bptr + n;
}
static void *
-singlebyte_skip_backward (const void *ptr, INTVAL n) {
+singlebyte_skip_backward (void *ptr, INTVAL n) {
byte_t *bptr = (byte_t*)ptr;
return bptr - n;