diff --git a/src/modules/Image/colortable.c b/src/modules/Image/colortable.c index bd97e5eb4e99300f5e4d90ce31bd87f4729e1bec..694bcaebb9919cdf8d5549a621283305c671a41a 100644 --- a/src/modules/Image/colortable.c +++ b/src/modules/Image/colortable.c @@ -1,11 +1,11 @@ #include "global.h" -/* $Id: colortable.c,v 1.93 2000/08/15 12:43:02 grubba Exp $ */ +/* $Id: colortable.c,v 1.94 2000/08/16 19:48:40 grubba Exp $ */ /* **! module Image **! note -**! $Id: colortable.c,v 1.93 2000/08/15 12:43:02 grubba Exp $ +**! $Id: colortable.c,v 1.94 2000/08/16 19:48:40 grubba Exp $ **! class Colortable **! **! This object keeps colortable information, @@ -20,7 +20,7 @@ #undef COLORTABLE_DEBUG #undef COLORTABLE_REDUCE_DEBUG -RCSID("$Id: colortable.c,v 1.93 2000/08/15 12:43:02 grubba Exp $"); +RCSID("$Id: colortable.c,v 1.94 2000/08/16 19:48:40 grubba Exp $"); #include <math.h> /* fabs() */ @@ -3663,7 +3663,8 @@ void image_colortable_index_32bit(INT32 args) SIMPLE_BAD_ARG_ERROR("Colortable.index",1,"non-empty image object"); if (sizeof(unsigned INT32)!=4) - fatal("INT32 isn't 32 bits (sizeof is %d)\n",sizeof(unsigned INT32)); + fatal("INT32 isn't 32 bits (sizeof is %ld)\n", + (long)TO_UINT32(sizeof(unsigned INT32))); ps=begin_wide_shared_string(src->xsize*src->ysize,2); diff --git a/src/modules/Image/encodings/avs.c b/src/modules/Image/encodings/avs.c index 11c2d81455a3b7a3dfacebe18abef9d6bdc6689e..e8f6b52b4224151811046a845117f20f9438b8c7 100644 --- a/src/modules/Image/encodings/avs.c +++ b/src/modules/Image/encodings/avs.c @@ -8,7 +8,7 @@ #endif #include "stralloc.h" -RCSID("$Id: avs.c,v 1.10 2000/08/03 21:25:31 grubba Exp $"); +RCSID("$Id: avs.c,v 1.11 2000/08/16 19:55:39 grubba Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -65,7 +65,9 @@ void image_avs_f__decode(INT32 args) error("This is not an AVS file (w=%d; h=%d)\n", w, h); if((size_t)w*h*4+8 > (size_t)s->len) - error("This is not an AVS file (w=%d; h=%d; s=%d)\n",w,h,s->len); + error("This is not an AVS file (w=%d; h=%d; s=%ld)\n", + w, h, + DO_NOT_WARN((long)s->len)); push_int( w ); push_int( h ); diff --git a/src/modules/Image/encodings/bmp.c b/src/modules/Image/encodings/bmp.c index e30f4e3ef97d1bd06cbea5ae1622646e4d386345..086104c15331c096be3a5b24a578e0afd2fdd5a4 100644 --- a/src/modules/Image/encodings/bmp.c +++ b/src/modules/Image/encodings/bmp.c @@ -1,9 +1,9 @@ -/* $Id: bmp.c,v 1.26 2000/08/08 10:52:38 grubba Exp $ */ +/* $Id: bmp.c,v 1.27 2000/08/16 19:53:24 grubba Exp $ */ /* **! module Image **! note -**! $Id: bmp.c,v 1.26 2000/08/08 10:52:38 grubba Exp $ +**! $Id: bmp.c,v 1.27 2000/08/16 19:53:24 grubba Exp $ **! submodule BMP **! **! This submodule keeps the BMP (Windows Bitmap) @@ -22,7 +22,7 @@ #include <ctype.h> #include "stralloc.h" -RCSID("$Id: bmp.c,v 1.26 2000/08/08 10:52:38 grubba Exp $"); +RCSID("$Id: bmp.c,v 1.27 2000/08/16 19:53:24 grubba Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -220,7 +220,12 @@ void img_bmp_encode(INT32 args) get_storage(oc,image_colortable_program); } else if (image_colortable_size(nct)>(1<<bpp)) - bad_arg_error("Image.BMP.encode",sp-args,args,2,"mapping",sp+2-1-args,"colortable must have at most %d colors (has %d colors)\n",1<<bpp,image_colortable_size(nct)); + bad_arg_error("Image.BMP.encode", sp-args, args, 2, "mapping", + sp+2-1-args, + "colortable must have at most %d colors " + "(has %ld colors)\n", + 1<<bpp, + DO_NOT_WARN((long)image_colortable_size(nct))); case 24: break; default: @@ -536,7 +541,7 @@ void i_img_bmp__decode(INT32 args,int header_only) if (len<54) error("Image.BMP.decode: unexpected EOF in header (at byte %d)\n", - len); + DO_NOT_WARN((long)len)); push_text("xsize"); push_int(xsize=int_from_32bit(s+14+4*1)); @@ -590,8 +595,8 @@ void i_img_bmp__decode(INT32 args,int header_only) case 12: /* dos (?) mode */ if (len<54) - error("Image.BMP.decode: unexpected EOF in header (at byte %d)\n", - len); + error("Image.BMP.decode: unexpected EOF in header (at byte %ld)\n", + DO_NOT_WARN((long)len)); push_text("xsize"); push_int(xsize=int_from_16bit(s+14+4)); diff --git a/src/modules/Image/encodings/gif.c b/src/modules/Image/encodings/gif.c index d3b7cdb9c57a70e2d0a6ee27cf10b66103b69b45..78c9a2368f38efbf8e42fd6e03d70dcf7a2310b8 100644 --- a/src/modules/Image/encodings/gif.c +++ b/src/modules/Image/encodings/gif.c @@ -1,9 +1,9 @@ -/* $Id: gif.c,v 1.58 2000/08/15 12:48:54 grubba Exp $ */ +/* $Id: gif.c,v 1.59 2000/08/16 19:50:13 grubba Exp $ */ /* **! module Image **! note -**! $Id: gif.c,v 1.58 2000/08/15 12:48:54 grubba Exp $ +**! $Id: gif.c,v 1.59 2000/08/16 19:50:13 grubba Exp $ **! submodule GIF **! **! This submodule keep the GIF encode/decode capabilities @@ -31,7 +31,7 @@ #include <ctype.h> #include "stralloc.h" -RCSID("$Id: gif.c,v 1.58 2000/08/15 12:48:54 grubba Exp $"); +RCSID("$Id: gif.c,v 1.59 2000/08/16 19:50:13 grubba Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -221,7 +221,9 @@ void image_gif_header_block(INT32 args) } if (numcolors+alphaentry>256) - error("Image.GIF.header_block(): too many colors (%d%s)\n",numcolors+alphaentry,alphaentry?" including alpha channel color":""); + error("Image.GIF.header_block(): too many colors (%ld%s)\n", + DO_NOT_WARN((long)(numcolors + alphaentry)), + alphaentry?" including alpha channel color":""); while ((1<<bpp)<numcolors+alphaentry) bpp++; @@ -716,7 +718,9 @@ CHRONO("gif render_block begin"); if (numcolors==0) error("Image.GIF.render_block(): no colors in colortable\n"); else if (numcolors>256) - error("Image.GIF.render_block(): too many colors in given colortable: %d (256 is max)\n",numcolors); + error("Image.GIF.render_block(): too many colors in given colortable: " + "%ld (256 is max)\n", + DO_NOT_WARN((long)numcolors)); if (args>=5) { diff --git a/src/modules/Image/encodings/tga.c b/src/modules/Image/encodings/tga.c index 452f592bb5ce58981ccc3cc64a2a5df84ff7af21..8e7113463b80d4690aabf09618d30222718aea88 100644 --- a/src/modules/Image/encodings/tga.c +++ b/src/modules/Image/encodings/tga.c @@ -1,6 +1,6 @@ /* - * $Id: tga.c,v 1.22 2000/08/13 14:43:15 grubba Exp $ + * $Id: tga.c,v 1.23 2000/08/16 19:54:05 grubba Exp $ * * Targa codec for pike. Based on the tga plugin for gimp. * @@ -81,7 +81,7 @@ #include "module_magic.h" -RCSID("$Id: tga.c,v 1.22 2000/08/13 14:43:15 grubba Exp $"); +RCSID("$Id: tga.c,v 1.23 2000/08/16 19:54:05 grubba Exp $"); #ifndef MIN # define MIN(X,Y) ((X)<(Y)?(X):(Y)) @@ -186,7 +186,8 @@ static struct image_alpha load_image(struct pike_string *str) buffer.len = str->len; if(buffer.len < ((sizeof(struct tga_footer)+sizeof(struct tga_header)))) - error("Data (%d bytes) is too short\n", buffer.len); + error("Data (%ld bytes) is too short\n", + DO_NOT_WARN((long)buffer.len)); /* MEMCPY(&footer, (buffer.str+(buffer.len-sizeof(struct tga_footer))), */ diff --git a/src/modules/Image/encodings/x.c b/src/modules/Image/encodings/x.c index 15fd9139a8bb009f4e006af705be91073cded6c3..132615ed188d8dcd84986d9702b2b20548eaf0ed 100644 --- a/src/modules/Image/encodings/x.c +++ b/src/modules/Image/encodings/x.c @@ -1,9 +1,9 @@ -/* $Id: x.c,v 1.32 2000/08/15 12:52:31 grubba Exp $ */ +/* $Id: x.c,v 1.33 2000/08/16 19:51:15 grubba Exp $ */ /* **! module Image **! note -**! $Id: x.c,v 1.32 2000/08/15 12:52:31 grubba Exp $ +**! $Id: x.c,v 1.33 2000/08/16 19:51:15 grubba Exp $ **! submodule X **! **! This submodule handles encoding and decoding of @@ -29,7 +29,7 @@ #include <winsock.h> #endif -RCSID("$Id: x.c,v 1.32 2000/08/15 12:52:31 grubba Exp $"); +RCSID("$Id: x.c,v 1.33 2000/08/16 19:51:15 grubba Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -749,7 +749,10 @@ void image_x_encode_pseudocolor(INT32 args) if (sp[5-args].type!=T_STRING) error("Image.X.encode_pseudocolor: illegal argument 6 (expected string)\n"); else if (sp[5-args].u.string->len!=((vbpp>8)?2:1)<<vbpp) - error("Image.X.encode_pseudocolor: illegal argument 6 (expected translate string of length %d, not %d)\n",((vbpp>8)?2:1)<<vbpp,sp[5-args].u.string->len); + error("Image.X.encode_pseudocolor: illegal argument 6 " + "(expected translate string of length %d, not %ld)\n", + ((vbpp>8)?2:1)<<vbpp, + DO_NOT_WARN((long)sp[5-args].u.string->len)); else translate=sp[5-args].u.string->str; } diff --git a/src/modules/Image/encodings/xcf.c b/src/modules/Image/encodings/xcf.c index 1c4390924710ba9a5e2cdf7bededa64ca614ec3f..e12caf542b1a3acfb73a56bffbff7f8c42e5f4f3 100644 --- a/src/modules/Image/encodings/xcf.c +++ b/src/modules/Image/encodings/xcf.c @@ -1,5 +1,5 @@ #include "global.h" -RCSID("$Id: xcf.c,v 1.20 2000/08/12 23:06:54 grubba Exp $"); +RCSID("$Id: xcf.c,v 1.21 2000/08/16 19:54:51 grubba Exp $"); #include "image_machine.h" @@ -1164,8 +1164,9 @@ void image_xcf_f__decode_tiles( INT32 args ) } if( (size_t)(tile->len) < (size_t)(eheight * ewidth * bpp )) - error("Too small tile, was %d bytes, I really need %d\n", - tile->len, eheight*ewidth * bpp); + error("Too small tile, was %ld bytes, I really need %d\n", + DO_NOT_WARN((long)tile->len), + eheight*ewidth * bpp); s = (unsigned char *)tile->str; diff --git a/src/modules/Image/image.c b/src/modules/Image/image.c index 814694cb43a36acf3ffcdd9df2cf844480666a6f..9f0d24b257a23df66220cb2fcca0fe4a71a1c93b 100644 --- a/src/modules/Image/image.c +++ b/src/modules/Image/image.c @@ -1,9 +1,9 @@ -/* $Id: image.c,v 1.175 2000/08/15 12:39:58 grubba Exp $ */ +/* $Id: image.c,v 1.176 2000/08/16 19:46:54 grubba Exp $ */ /* **! module Image **! note -**! $Id: image.c,v 1.175 2000/08/15 12:39:58 grubba Exp $ +**! $Id: image.c,v 1.176 2000/08/16 19:46:54 grubba Exp $ **! class Image **! **! The main object of the <ref>Image</ref> module, this object @@ -98,7 +98,7 @@ #include "stralloc.h" #include "global.h" -RCSID("$Id: image.c,v 1.175 2000/08/15 12:39:58 grubba Exp $"); +RCSID("$Id: image.c,v 1.176 2000/08/16 19:46:54 grubba Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -589,9 +589,10 @@ void img_read_get_channel(int arg,char *name,INT32 args, "wide strings are not supported (yet)\n",arg+1,name); if (sp[arg-args-1].u.string->len!=THIS->xsize*THIS->ysize) error("create_method: argument %d (%s channel): " - "string is %d characters, expected %d\n", - arg+1,name,sp[arg-args-1].u.string->len, - THIS->xsize*THIS->ysize); + "string is %ld characters, expected %ld\n", + arg+1, name, + DO_NOT_WARN((long)sp[arg-args-1].u.string->len), + DO_NOT_WARN((long)(THIS->xsize*THIS->ysize))); *s=(unsigned char *)sp[arg-args-1].u.string->str; *m=1; break; @@ -2589,7 +2590,7 @@ exit_loop: THREADS_DISALLOW(); if (err) { - error(err); + error("%s\n", err); } pop_n_elems(args); diff --git a/src/modules/Image/image_module.c b/src/modules/Image/image_module.c index b11265f8e3e690c6a857ceb4dd3ef4b5b0158952..e4190dee88e7347466c8a2fa47700c2659a74e1e 100644 --- a/src/modules/Image/image_module.c +++ b/src/modules/Image/image_module.c @@ -1,7 +1,7 @@ #include "global.h" #include "stralloc.h" #include "global.h" -RCSID("$Id: image_module.c,v 1.7 2000/07/28 07:12:44 hubbe Exp $"); +RCSID("$Id: image_module.c,v 1.8 2000/08/16 19:44:20 grubba Exp $"); #include "pike_macros.h" #include "interpret.h" #include "program.h" @@ -79,8 +79,23 @@ static struct #include "initstuff.h" }; +/* 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 IMAGE_CHECK_STACK(X) do { if (save_sp != sp) { fatal("%s:%d: %d droppings on stack! previous init: %s\n", __FILE__, __LINE__, sp - save_sp,X); } } while(0) +#define IMAGE_CHECK_STACK(X) do { \ + if (save_sp != sp) { \ + fatal("%s:%d: %ld droppings on stack! previous init: %s\n", \ + __FILE__, __LINE__, TO_LONG(sp - save_sp), X); \ + } \ + } while(0) #else #define IMAGE_CHECK_STACK(X) #endif /* PIKE_DEBUG */ diff --git a/src/modules/Math/math_matrix.c b/src/modules/Math/math_matrix.c index d82b5513e39a8987b1923113aa6e9b2c0b8e41f3..3c2477eeec6f1c509e93258785263ed0da938e09 100644 --- a/src/modules/Math/math_matrix.c +++ b/src/modules/Math/math_matrix.c @@ -1,4 +1,4 @@ -/* $Id: math_matrix.c,v 1.16 2000/08/10 09:51:54 per Exp $ */ +/* $Id: math_matrix.c,v 1.17 2000/08/16 19:58:59 grubba Exp $ */ #include "global.h" #include "config.h" @@ -189,7 +189,7 @@ static void matrix_create(INT32 args) SIMPLE_OUT_OF_MEMORY_ERROR("matrix", sizeof(FTYPE)*xs*ys); - if (args>2) + if (args>2) { if (sp[2-args].type==T_INT) z=(FTYPE)sp[2-args].u.integer; else if (sp[2-args].type==T_FLOAT) @@ -214,6 +214,7 @@ static void matrix_create(INT32 args) } else SIMPLE_BAD_ARG_ERROR("matrix",3,"int|float|string"); + } xs*=ys; while (xs--) *(m++)=z; @@ -335,7 +336,7 @@ void matrix_cast(INT32 args) int i,j; int xs=THIS->xsize,ys=THIS->ysize; FTYPE *m=THIS->m; - check_stack(xs+ys); + check_stack(DO_NOT_WARN((long)(xs+ys))); pop_n_elems(args); for (i=0; i<ys; i++) { @@ -365,7 +366,7 @@ void matrix_vect(INT32 args) int i,j; int xs=THIS->xsize,ys=THIS->ysize; FTYPE *m=THIS->m; - check_stack(xs+ys); + check_stack(DO_NOT_WARN((long)(xs+ys))); pop_n_elems(args); for (i=0; i<ys; i++) for (j=0; j<xs; j++) diff --git a/src/modules/Parser/html.c b/src/modules/Parser/html.c index c6c13c64960c7d6f33bb82e1688e0e3c0a9cfe52..020acc395ab04dd0c67ce3661be15e3f6664124e 100644 --- a/src/modules/Parser/html.c +++ b/src/modules/Parser/html.c @@ -287,6 +287,16 @@ static int quote_tag_lookup (struct parser_html_storage *this, /****** debug helper ********************************/ +/* 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 DEBUG void debug_mark_spot(char *desc,struct piece *feed,int c) { @@ -2873,9 +2883,11 @@ static newstate do_try_feed(struct parser_html_storage *this, #ifdef DEBUG if (*feed && feed[0]->s->len < st->c) - fatal("len (%d) < st->c (%d)\n",feed[0]->s->len,st->c); + fatal("len (%ld) < st->c (%ld)\n", + TO_LONG(feed[0]->s->len), TO_LONG(st->c)); if (*feed && cmp_feed_pos (*feed, st->c, dst, cdst) > 0) - fatal ("Going backwards from %p:%d to %p:%d.\n", *feed, st->c, dst, cdst); + fatal ("Going backwards from %p:%ld to %p:%ld.\n", + *feed, TO_LONG(st->c), dst, TO_LONG(cdst)); #endif /* do we need to check data? */ @@ -2978,8 +2990,8 @@ static newstate do_try_feed(struct parser_html_storage *this, #ifdef DEBUG if (*feed != dst || st->c != cdst) - fatal ("Internal position confusion: feed: %p:%d, dst: %p:%d.\n", - *feed, st->c, dst, cdst); + fatal ("Internal position confusion: feed: %p:%ld, dst: %p:%ld.\n", + *feed, TO_LONG(st->c), dst, TO_LONG(cdst)); #endif ch=index_shared_string(dst->s,cdst); @@ -3464,8 +3476,8 @@ static newstate do_try_feed(struct parser_html_storage *this, #ifdef DEBUG if (!scan_entity) fatal ("Shouldn't parse entities now.\n"); if (*feed != dst || st->c != cdst) - fatal ("Internal position confusion: feed: %p:%d, dst: %p:%d\n", - *feed, st->c, dst, cdst); + fatal ("Internal position confusion: feed: %p:%ld, dst: %p:%ld\n", + *feed, TO_LONG(st->c), dst, TO_LONG(cdst)); #endif /* just search for end of entity */ diff --git a/src/modules/Parser/parser.c b/src/modules/Parser/parser.c index 0b3fc1209205f8b8bda6c6846ba01bad10b262cf..a628f6846f5674d6343e350bf96ce42b307a8925 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.8 2000/07/28 07:14:14 hubbe Exp $"); +RCSID("$Id: parser.c,v 1.9 2000/08/16 20:02:02 grubba Exp $"); #include "pike_macros.h" #include "interpret.h" #include "program.h" @@ -80,8 +80,24 @@ 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", __FILE__, __LINE__, sp - save_sp,X); } } while(0) +#define PARSER_CHECK_STACK(X) do { \ + if (save_sp != sp) { \ + fatal("%s:%d: %d droppings on stack! previous init: %s\n", \ + __FILE__, __LINE__, \ + TO_LONG(sp - save_sp), X); \ + } \ + } while(0) #else #define PARSER_CHECK_STACK(X) #endif /* PIKE_DEBUG */ diff --git a/src/modules/_Crypto/cbc.c b/src/modules/_Crypto/cbc.c index c0067f77d0a9b442bc1d045871e9cf45a5676d17..ffc65c0a3927dac666871066cda47ad16537dde3 100644 --- a/src/modules/_Crypto/cbc.c +++ b/src/modules/_Crypto/cbc.c @@ -1,5 +1,5 @@ /* - * $Id: cbc.c,v 1.16 2000/07/28 07:15:16 hubbe Exp $ + * $Id: cbc.c,v 1.17 2000/08/16 20:09:23 grubba Exp $ * * CBC (Cipher Block Chaining Mode) crypto module for Pike. * @@ -85,8 +85,8 @@ INLINE static void cbc_encrypt_step(const unsigned INT8 *source, error("cbc->encrypt(): Expected string from crypt_block()\n"); } if (sp[-1].u.string->len != block_size) { - error("cbc->encrypt(): Bad string length %d returned from crypt_block()\n", - sp[-1].u.string->len); + error("cbc->encrypt(): Bad string length %ld returned from crypt_block()\n", + DO_NOT_WARN((long)sp[-1].u.string->len)); } MEMCPY(THIS->iv, sp[-1].u.string->str, block_size); MEMCPY(dest, sp[-1].u.string->str, block_size); @@ -106,8 +106,8 @@ INLINE static void cbc_decrypt_step(const unsigned INT8 *source, error("cbc->decrypt(): Expected string from crypt_block()\n"); } if (sp[-1].u.string->len != block_size) { - error("cbc->decrypt(): Bad string length %d returned from crypt_block()\n", - sp[-1].u.string->len); + error("cbc->decrypt(): Bad string length %ld returned from crypt_block()\n", + DO_NOT_WARN((long)sp[-1].u.string->len)); } for (i=0; i < block_size; i++) { diff --git a/src/modules/_Crypto/crypto.c b/src/modules/_Crypto/crypto.c index f20c97ddcbaab295e88b5cdc983a791c500d70a7..d7ea2e158fa3b71139fcebf5bd9472289ebf4441 100644 --- a/src/modules/_Crypto/crypto.c +++ b/src/modules/_Crypto/crypto.c @@ -1,5 +1,5 @@ /* - * $Id: crypto.c,v 1.37 2000/08/16 16:09:55 grubba Exp $ + * $Id: crypto.c,v 1.38 2000/08/16 20:08:19 grubba Exp $ * * A pike module for getting access to some common cryptos. * @@ -259,7 +259,8 @@ static void f_create(INT32 args) if ((!THIS->block_size) || (THIS->block_size > 4096)) { - error("crypto->create(): Bad block size %d\n", THIS->block_size); + error("crypto->create(): Bad block size %ld\n", + DO_NOT_WARN((long)THIS->block_size)); } THIS->backlog = (unsigned char *)xalloc(THIS->block_size); @@ -340,8 +341,8 @@ static void f_crypto_crypt(INT32 args) error("crypto->crypt(): crypt_block() did not return string\n"); } if (sp[-1].u.string->len != THIS->block_size) { - error("crypto->crypt(): Unexpected string length %d\n", - sp[-1].u.string->len); + error("crypto->crypt(): Unexpected string length %ld\n", + DO_NOT_WARN((long)sp[-1].u.string->len)); } MEMCPY(result, sp[-1].u.string->str, THIS->block_size); @@ -371,8 +372,8 @@ static void f_crypto_crypt(INT32 args) error("crypto->crypt(): crypt_block() did not return string\n"); } if (sp[-1].u.string->len != len) { - error("crypto->crypt(): Unexpected string length %d\n", - sp[-1].u.string->len); + error("crypto->crypt(): Unexpected string length %ld\n", + DO_NOT_WARN((long)sp[-1].u.string->len)); } MEMCPY(result + roffset, sp[-1].u.string->str, len); diff --git a/src/modules/files/file.c b/src/modules/files/file.c index 01afb059d519651bf4068cab86643ee443b3e9df..060f6b174a7e42516655c7b95b3216b000b62eb0 100644 --- a/src/modules/files/file.c +++ b/src/modules/files/file.c @@ -6,7 +6,7 @@ /**/ #define NO_PIKE_SHORTHAND #include "global.h" -RCSID("$Id: file.c,v 1.187 2000/08/16 16:06:27 grubba Exp $"); +RCSID("$Id: file.c,v 1.188 2000/08/16 20:12:50 grubba Exp $"); #include "fdlib.h" #include "interpret.h" #include "svalue.h" @@ -890,12 +890,12 @@ static void file_write(INT32 args) while(i--) { if (a->item[i].type != PIKE_T_STRING) { error("Bad argument 1 to file->write().\n" - "Element %d is not a string.\n", - i); + "Element %ld is not a string.\n", + DO_NOT_WARN((long)i)); } else if (a->item[i].u.string->size_shift) { error("Bad argument 1 to file->write().\n" - "Element %d is a wide string.\n", - i); + "Element %ld is a wide string.\n", + DO_NOT_WARN((long)i)); } } @@ -2648,6 +2648,16 @@ void PIKE_CONCAT(Y,_ref) (INT32 args) { \ #include "file_functions.h" +/* 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 void check_static_file_data(struct callback *a, void *b, void *c) { @@ -2655,7 +2665,8 @@ void check_static_file_data(struct callback *a, void *b, void *c) { #define FILE_FUNC(X,Y,Z) \ if(PIKE_CONCAT(Y,_function_number)<0 || PIKE_CONCAT(Y,_function_number)>file_program->num_identifier_references) \ - fatal(#Y "_function_number is incorrect: %d\n",PIKE_CONCAT(Y,_function_number)); + fatal(#Y "_function_number is incorrect: %ld\n", \ + TO_LONG(PIKE_CONCAT(Y,_function_number))); #include "file_functions.h" } }