diff --git a/src/backend.c b/src/backend.c index b2eb79bf554721c1824c3b6ef17822c0710990e6..d0c80c1fc58535781b631a7fa36de2c655be3651 100644 --- a/src/backend.c +++ b/src/backend.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: backend.c,v 1.54 2000/08/15 16:16:14 grubba Exp $"); +RCSID("$Id: backend.c,v 1.55 2000/08/17 18:48:27 grubba Exp $"); #include "fdlib.h" #include "backend.h" #include <errno.h> @@ -648,10 +648,10 @@ void do_debug(void) switch(errno) { case EBADF: - fatal("Backend filedescriptor %d is bad.\n",poll_fds[e].fd); + fatal("Backend filedescriptor %ld is bad.\n", (long)poll_fds[e].fd); break; case ENOENT: - fatal("Backend filedescriptor %d is not.\n",poll_fds[e].fd); + fatal("Backend filedescriptor %ld is not.\n", (long)poll_fds[e].fd); break; } } @@ -866,9 +866,10 @@ void backend(void) #ifdef PIKE_DEBUG num_active -= handled; if (!handled && active_poll_fds[i].revents) { - fprintf(stderr, "BACKEND: fd %d has revents 0x%08x, " - "but hasn't been handled.\n", active_poll_fds[i].fd, - active_poll_fds[i].revents); + fprintf(stderr, "BACKEND: fd %ld has revents 0x%08lx, " + "but hasn't been handled.\n", + (long)active_poll_fds[i].fd, + (long)active_poll_fds[i].revents); } #endif /* PIKE_DEBUG */ } @@ -877,9 +878,10 @@ void backend(void) fprintf(stderr, "BACKEND: %d more active fds than were handled.\n", num_active); for(i=0; i<active_num_in_poll; i++) { - fprintf(stderr, "BACKEND: fd %d, events 0x%08x, revents 0x%08x\n", - active_poll_fds[i].fd, active_poll_fds[i].events, - active_poll_fds[i].revents); + fprintf(stderr, "BACKEND: fd %ld, events 0x%08lx, revents 0x%08lx\n", + (long)active_poll_fds[i].fd, + (long)active_poll_fds[i].events, + (long)active_poll_fds[i].revents); } } #endif /* PIKE_DEBUG */ diff --git a/src/compilation.h b/src/compilation.h index ee7d7c04a19c9087a914cf3957d3c11fb43d92dd..38667b7756b8fba9f905eed5cac61d17c00b5987 100644 --- a/src/compilation.h +++ b/src/compilation.h @@ -1,5 +1,5 @@ /* - * $Id: compilation.h,v 1.18 2000/07/10 18:21:33 grubba Exp $ + * $Id: compilation.h,v 1.19 2000/08/17 19:10:05 grubba Exp $ * * Compilator state push / pop operator construction file * @@ -94,7 +94,8 @@ #define STACKMEMBER(X,Y,Z) DO_DEBUG_CODE( \ if(Pike_compiler->Y < oLd->Y) \ - fatal("Stack " #Y " shrunk %d steps compilation, currently: %p.\n",oLd->Y - Pike_compiler->Y,Pike_compiler->Y); ) + fatal("Stack " #Y " shrunk %ld steps compilation, currently: %p.\n", \ + PTRDIFF_T_TO_LONG(oLd->Y - Pike_compiler->Y), Pike_compiler->Y); ) #define SNAME(X,Y) { \ struct X *oLd=Pike_compiler->previous; diff --git a/src/dynamic_load.c b/src/dynamic_load.c index 6ca7dee7544490b5903c8a42f0065db37b3b852b..69a4196962ba9548acc698e68d4ae36f6fe712b4 100644 --- a/src/dynamic_load.c +++ b/src/dynamic_load.c @@ -8,7 +8,7 @@ # include "pike_macros.h" # include "main.h" -RCSID("$Id: dynamic_load.c,v 1.42 2000/08/10 09:04:42 grubba Exp $"); +RCSID("$Id: dynamic_load.c,v 1.43 2000/08/17 18:51:09 grubba Exp $"); #endif /* !TESTING */ @@ -313,9 +313,9 @@ void f_load_module(INT32 args) (*(modfun)init)(); #ifdef PIKE_DEBUG if(sp != save_sp) - fatal("load_module(%s) left %d droppings on stack!\n", + fatal("load_module(%s) left %ld droppings on stack!\n", module_name, - sp-save_sp); + PTRDIFF_T_TO_LONG(sp - save_sp)); } #endif diff --git a/src/encode.c b/src/encode.c index bc2bffed7af15d239e7fdd4884215f210d4f3ffa..fec0df4e6d19d3aa65e2d67c65cd062eee64fe68 100644 --- a/src/encode.c +++ b/src/encode.c @@ -25,7 +25,7 @@ #include "version.h" #include "bignum.h" -RCSID("$Id: encode.c,v 1.67 2000/08/16 10:50:42 grubba Exp $"); +RCSID("$Id: encode.c,v 1.68 2000/08/17 18:50:32 grubba Exp $"); /* #define ENCODE_DEBUG */ @@ -1700,7 +1700,8 @@ static void rec_restore_value(char **v, ptrdiff_t *l) return; default: - error("Format error. Unknown type tag %d:%d\n", i, t); + error("Format error. Unknown type tag %ld:%ld\n", + PTRDIFF_T_TO_LONG(i), PTRDIFF_T_TO_LONG(t)); } } diff --git a/src/gc.c b/src/gc.c index ad52524af456bb093bc98ef3fa8640a6c7aaf706..c43790ceac9bf7e96aa30c0a3b505499efc71396 100644 --- a/src/gc.c +++ b/src/gc.c @@ -30,7 +30,7 @@ struct callback *gc_evaluator_callback=0; #include "block_alloc.h" -RCSID("$Id: gc.c,v 1.123 2000/08/16 22:03:40 mast Exp $"); +RCSID("$Id: gc.c,v 1.124 2000/08/17 18:57:37 grubba Exp $"); /* Run garbage collect approximately every time * 20 percent of all arrays, objects and programs is @@ -2141,8 +2141,8 @@ int do_gc(void) if (gc_extra_refs) fatal("Lost track of %d extra refs to things in gc.\n", gc_extra_refs); if (gc_ext_weak_refs) - fatal("Still got %u external weak references to internal things in gc.\n", - gc_ext_weak_refs); + fatal("Still got %lu external weak references to internal things in gc.\n", + (unsigned long)PTRDIFF_T_TO_LONG(gc_ext_weak_refs)); #endif Pike_in_gc=0; diff --git a/src/interpret.c b/src/interpret.c index b745c0fa6c378563ba723e86b49df0b44c0db32a..e4f1e29e1e7a72b34b01c8777c5a51e7e11f86ae 100644 --- a/src/interpret.c +++ b/src/interpret.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: interpret.c,v 1.164 2000/08/16 16:00:52 grubba Exp $"); +RCSID("$Id: interpret.c,v 1.165 2000/08/17 18:45:04 grubba Exp $"); #include "interpret.h" #include "object.h" #include "program.h" @@ -1410,8 +1410,9 @@ void slow_check_stack(void) if(Pike_sp > &(Pike_interpreter.evaluator_stack[stack_size])) fatal("Svalue stack overflow. " - "(%d entries on stack, stack_size is %d entries)\n", - Pike_sp-Pike_interpreter.evaluator_stack,stack_size); + "(%ld entries on stack, stack_size is %ld entries)\n", + PTRDIFF_T_TO_LONG(Pike_sp - Pike_interpreter.evaluator_stack), + PTRDIFF_T_TO_LONG(stack_size)); if(Pike_mark_sp > &(Pike_interpreter.mark_stack[stack_size])) fatal("Mark stack overflow.\n"); diff --git a/src/interpret.h b/src/interpret.h index 48c50a58d692d58620f40ea857bc6003119aac75..7c0dd794e010259ff5a6f6a398c7d48d497c19e8 100644 --- a/src/interpret.h +++ b/src/interpret.h @@ -5,7 +5,7 @@ \*/ /* - * $Id: interpret.h,v 1.63 2000/08/09 12:49:27 grubba Exp $ + * $Id: interpret.h,v 1.64 2000/08/17 18:20:44 grubba Exp $ */ #ifndef INTERPRET_H #define INTERPRET_H @@ -72,11 +72,13 @@ struct pike_frame #define debug_check_stack() #endif -#define check_stack(X) do { \ - if(Pike_sp - Pike_interpreter.evaluator_stack + (X) >= Pike_stack_size) \ +#define check_stack(X) do { \ + if(Pike_sp - Pike_interpreter.evaluator_stack + (X) >= Pike_stack_size) \ error("Svalue stack overflow. " \ - "(%d of %d entries on stack, needed %d more entries)\n", \ - Pike_sp-Pike_interpreter.evaluator_stack,Pike_stack_size,(X)); \ + "(%ld of %ld entries on stack, needed %ld more entries)\n", \ + PTRDIFF_T_TO_LONG(Pike_sp - Pike_interpreter.evaluator_stack), \ + PTRDIFF_T_TO_LONG(Pike_stack_size), \ + PTRDIFF_T_TO_LONG(X)); \ }while(0) #define check_mark_stack(X) do { \ diff --git a/src/module_support.c b/src/module_support.c index 1c3e159dc27f425ea49d99a35ccacef1445a60dd..b1b2d849289ae2c50ae2f53af27b5a3cb6a66ea6 100644 --- a/src/module_support.c +++ b/src/module_support.c @@ -6,7 +6,7 @@ #include "pike_types.h" #include "error.h" -RCSID("$Id: module_support.c,v 1.36 2000/08/16 10:27:34 grubba Exp $"); +RCSID("$Id: module_support.c,v 1.37 2000/08/17 19:03:15 grubba Exp $"); /* Checks that args_to_check arguments are OK. * Returns 1 if everything worked ok, zero otherwise. @@ -357,9 +357,9 @@ PMOD_EXPORT void get_all_args(char *fname, INT32 args, char *format, ... ) ret+1, expected_type, 0, - "Too few arguments to %s(). Expected %d arguments, got %d.\n" - "The type of the next argument is expected to be %s\n", - fname, strlen(format)/2, args, expected_type); + "Too few arguments to %s(). Expected %ld arguments, got %d.\n" + "The type of the next argument is expected to be %s\n", + fname, PTRDIFF_T_TO_LONG(strlen(format)/2), args, expected_type); } } } diff --git a/src/modules/Parser/parser.c b/src/modules/Parser/parser.c index a628f6846f5674d6343e350bf96ce42b307a8925..17ad108b069b9757a4f743c7ac2c5c66ef5f57b6 100644 --- a/src/modules/Parser/parser.c +++ b/src/modules/Parser/parser.c @@ -1,7 +1,7 @@ #include "global.h" #include "stralloc.h" #include "global.h" -RCSID("$Id: parser.c,v 1.9 2000/08/16 20:02:02 grubba Exp $"); +RCSID("$Id: parser.c,v 1.10 2000/08/17 18:21:59 grubba Exp $"); #include "pike_macros.h" #include "interpret.h" #include "program.h" @@ -80,22 +80,12 @@ static struct { 0,0,0,0,0 } }; -/* Avoid loss of precision warnings. */ -#ifdef __ECL -static inline long TO_LONG(ptrdiff_t x) -{ - return DO_NOT_WARN((long)x); -} -#else /* !__ECL */ -#define TO_LONG(x) ((long)(x)) -#endif /* __ECL */ - #ifdef PIKE_DEBUG #define PARSER_CHECK_STACK(X) do { \ if (save_sp != sp) { \ - fatal("%s:%d: %d droppings on stack! previous init: %s\n", \ + fatal("%s:%d: %ld droppings on stack! previous init: %s\n", \ __FILE__, __LINE__, \ - TO_LONG(sp - save_sp), X); \ + PTRDIFF_T_TO_LONG(sp - save_sp), X); \ } \ } while(0) #else diff --git a/src/modules/call_out/call_out.c b/src/modules/call_out/call_out.c index 401cf0884294a836b6a9df3846affb314cb7ab6c..5b2fa922694ad00526c60fcd2d60782085b93f4a 100644 --- a/src/modules/call_out/call_out.c +++ b/src/modules/call_out/call_out.c @@ -6,7 +6,7 @@ /**/ #include "global.h" #include "config.h" -RCSID("$Id: call_out.c,v 1.38 2000/08/16 16:08:06 grubba Exp $"); +RCSID("$Id: call_out.c,v 1.39 2000/08/17 18:32:46 grubba Exp $"); #include "array.h" #include "dynamic_buffer.h" #include "object.h" @@ -23,6 +23,7 @@ RCSID("$Id: call_out.c,v 1.38 2000/08/16 16:08:06 grubba Exp $"); #include "gc.h" #include "threads.h" #include "stuff.h" +#include "bignum.h" #include "callback.h" diff --git a/src/modules/spider/xml.c b/src/modules/spider/xml.c index c7525ad56590fd811cd60059e031b325e77ece6d..bde27059e71a26d6df0ee725cafa443630bb10c5 100644 --- a/src/modules/spider/xml.c +++ b/src/modules/spider/xml.c @@ -664,8 +664,11 @@ ISWRAP(isHexChar) #define IF_XMLDEBUG(X) #endif -#define PEEK(X) \ -( IF_XMLDEBUG(((X) > data->input.len)?(fatal("PEEK out of bounds (%d/%d)\n",(X),data->input.len),0):) \ +#define PEEK(X) \ +( IF_XMLDEBUG(((X) > data->input.len)? \ + (fatal("PEEK out of bounds (%ld/%ld)\n", \ + PTRDIFF_T_TO_LONG(X), \ + PTRDIFF_T_TO_LONG(data->input.len)), 0):) \ INDEX_PCHARP(data->input.datap,X) ) #define SAFE_PEEK(X) ((X)>=data->input.len ? 0 : PEEK(X)) @@ -690,7 +693,9 @@ ISWRAP(isHexChar) if(data->input.to_free) free_string(data->input.to_free); \ data->input=*i; \ really_free_xmlinput(i); \ - IF_XMLDEBUG(fprintf(stderr,"ptr=%p len=%d pos=%d to_free=%p\n",data->input.datap.ptr,data->input.len,data->input.pos,data->input.to_free)); \ + IF_XMLDEBUG(fprintf(stderr,"ptr=%p len=%d pos=%d to_free=%p\n", \ + data->input.datap.ptr, data->input.len, \ + data->input.pos, data->input.to_free)); \ } while(0) static inline int xmlread(int z,struct xmldata *data, int line) @@ -1112,7 +1117,9 @@ static int read_smeg_pereference(struct xmldata *data) XMLERROR("XML->__entities value is not a string!"); }else{ struct pike_string *s=sp[-1].u.string; - IF_XMLDEBUG(fprintf(stderr,"ptr=%p len=%d pos=%d to_free=%p\n",data->input.datap.ptr,data->input.len,data->input.pos,data->input.to_free)); + IF_XMLDEBUG(fprintf(stderr, "ptr=%p len=%d pos=%d to_free=%p\n", + data->input.datap.ptr, data->input.len, + data->input.pos, data->input.to_free)); PUSH(s); READ(0); /* autopop empty strings */ pop_stack(); @@ -1361,7 +1368,8 @@ static void simple_read_attributes(struct xmldata *data, SIMPLE_READ_ATTVALUE(iscd); #ifdef VERBOSE_XMLDEBUG - fprintf(stderr,"Attribute %s = %s (iscd = %d)\n",sp[-2].u.string->str, sp[-1].u.string->str,iscd); + fprintf(stderr,"Attribute %s = %s (iscd = %d)\n", + sp[-2].u.string->str, sp[-1].u.string->str,iscd); #endif assign_lvalue(sp-3, sp-1); @@ -1922,7 +1930,8 @@ static int really_low_parse_dtd(struct xmldata *data) comefrom_fixed: #ifdef VERBOSE_XMLDEBUG - fprintf(stderr,"READING ATTVALUE (is_cdata = %d)\n",is_cdata); + fprintf(stderr,"READING ATTVALUE (is_cdata = %d)\n", + is_cdata); #endif SIMPLE_READ_ATTVALUE(is_cdata); if(THIS->attributes && !already_seen) diff --git a/src/modules/sprintf/sprintf.c b/src/modules/sprintf/sprintf.c index bdd35cfe4356c56467ec79c1a7a7f66e08a5bb35..b470e131a3de1fc8bb1a0e8a578b676220841b35 100644 --- a/src/modules/sprintf/sprintf.c +++ b/src/modules/sprintf/sprintf.c @@ -103,7 +103,7 @@ */ #include "global.h" -RCSID("$Id: sprintf.c,v 1.72 2000/08/10 19:30:00 grubba Exp $"); +RCSID("$Id: sprintf.c,v 1.73 2000/08/17 18:41:20 grubba Exp $"); #include "error.h" #include "array.h" #include "svalue.h" @@ -1250,7 +1250,8 @@ static void low_pike_sprintf(struct format_stack *fs, l=4; if(fs->fsp->width > 0) l=fs->fsp->width; if(l != 4 && l != 8) - sprintf_error(fs, "Invalid IEEE width %d.\n", l); + sprintf_error(fs, "Invalid IEEE width %ld.\n", + PTRDIFF_T_TO_LONG(l)); x=(char *)alloca(l); fs->fsp->b=MKPCHARP(x,0); fs->fsp->len=l; diff --git a/src/opcodes.c b/src/opcodes.c index 90066608b527dd2d969a945189d9d45825d2f628..80e76206e3e6186d79649293105499082f89e090 100644 --- a/src/opcodes.c +++ b/src/opcodes.c @@ -26,7 +26,7 @@ #include "bignum.h" #include "operators.h" -RCSID("$Id: opcodes.c,v 1.89 2000/08/15 14:15:20 grubba Exp $"); +RCSID("$Id: opcodes.c,v 1.90 2000/08/17 19:06:30 grubba Exp $"); void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind) { @@ -88,8 +88,8 @@ void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind) if(what->u.string->len == 0) error("Attempt to index the empty string with %d.\n", i); else - error("Index %d is out of string range 0 - %d.\n", - i, what->u.string->len-1); + error("Index %d is out of string range 0 - %ld.\n", + i, PTRDIFF_T_TO_LONG(what->u.string->len - 1)); } else i=index_shared_string(what->u.string,i); to->type=T_INT; @@ -1284,8 +1284,8 @@ CHAROPT2( \ case 'F': \ if(field_length == -1) field_length = 4; \ if(field_length != 4 && field_length != 8) \ - error("Invalid IEEE width %d in sscanf format string.\n", \ - field_length); \ + error("Invalid IEEE width %ld in sscanf format string.\n", \ + PTRDIFF_T_TO_LONG(field_length)); \ if(eye+field_length > input_len) \ { \ chars_matched[0]=eye; \ diff --git a/src/operators.c b/src/operators.c index 19884bc352dfe870493ce00cb1699cb382202937..afdedfcf7e82f3281fda00e3eda07e59624c0bac 100644 --- a/src/operators.c +++ b/src/operators.c @@ -6,7 +6,7 @@ /**/ #include "global.h" #include <math.h> -RCSID("$Id: operators.c,v 1.99 2000/08/15 11:18:46 grubba Exp $"); +RCSID("$Id: operators.c,v 1.100 2000/08/17 19:07:13 grubba Exp $"); #include "interpret.h" #include "svalue.h" #include "multiset.h" @@ -2489,7 +2489,8 @@ static void f_string_assignment_index(INT32 args) if(i<0) i+=THIS->s->len; if(i<0 || i>=THIS->s->len) - error("Index %d is out of range 0 - %d.\n", i, THIS->s->len-1); + error("Index %d is out of range 0 - %ld.\n", + i, PTRDIFF_T_TO_LONG(THIS->s->len - 1)); else i=index_shared_string(THIS->s,i); pop_n_elems(args); diff --git a/src/pike_types.c b/src/pike_types.c index ae124f1a53abd48b76a12388a8c8f044eccd9081..18435a06b497e4be4c449fed75b36ecb5b41bbe0 100644 --- a/src/pike_types.c +++ b/src/pike_types.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: pike_types.c,v 1.135 2000/08/16 10:30:46 grubba Exp $"); +RCSID("$Id: pike_types.c,v 1.136 2000/08/17 19:00:25 grubba Exp $"); #include <ctype.h> #include "svalue.h" #include "pike_types.h" @@ -114,7 +114,9 @@ void check_type_string(struct pike_string *s) if(type_length(s->str) != s->len) { stupid_describe_type(s->str,s->len); - fatal("Length of type is wrong. (should be %d, is %d)\n",type_length(s->str),s->len); + fatal("Length of type is wrong. (should be %ld, is %ld)\n", + PTRDIFF_T_TO_LONG(type_length(s->str)), + PTRDIFF_T_TO_LONG(s->len)); } } #endif diff --git a/src/program.c b/src/program.c index 67108cdd5a58081b56c1543332b78f75db2ea532..a7f9f6024bf0efd50bc9312e2f49fba78d64a43c 100644 --- a/src/program.c +++ b/src/program.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: program.c,v 1.262 2000/08/16 10:25:52 grubba Exp $"); +RCSID("$Id: program.c,v 1.263 2000/08/17 19:08:11 grubba Exp $"); #include "program.h" #include "object.h" #include "dynamic_buffer.h" @@ -1200,7 +1200,9 @@ void check_program(struct program *p) if( (p->identifiers[e].func.offset /* + OFFSETOF(object,storage)*/ ) & (alignof_variable(p->identifiers[e].run_time_type)-1)) { - fatal("Variable %s offset is not properly aligned (%d).\n",p->identifiers[e].name->str,p->identifiers[e].func.offset); + fatal("Variable %s offset is not properly aligned (%ld).\n", + p->identifiers[e].name->str, + PTRDIFF_T_TO_LONG(p->identifiers[e].func.offset)); } } }