* random.c, spgrid.[ch]: Fix warnings with hope that I didn't broke

anything. These floats to longs and vice versa casts are starnge
	  indeed.
	* isis_pdu.c: As we don't use %z for size_t for now because we support
	  older compilers, cast them to unsigned long.

	Also fix previous changelog entry. Isisd compiles cleanly now again.
This commit is contained in:
hasso 2005-09-01 18:18:47 +00:00
parent aac372f4f5
commit 29e50b2353
5 changed files with 42 additions and 25 deletions

View File

@ -1,3 +1,11 @@
2005-09-01 Hasso Tepper <hasso at quagga.net>
* random.c, spgrid.[ch]: Fix warnings with hope that I didn't broke
anything. These floats to longs and vice versa casts are starnge
indeed.
* isis_pdu.c: As we don't use %z for size_t for now because we support
older compilers, cast them to unsigned long.
2005-09-01 Hasso Tepper <hasso at quagga.net> 2005-09-01 Hasso Tepper <hasso at quagga.net>
* isis_adjacency.c, isis_lsp.c, isisd.c: Replace XMALLOC && memset * isis_adjacency.c, isis_lsp.c, isisd.c: Replace XMALLOC && memset
@ -5,7 +13,7 @@
* isis_lsp.c (lsp_build_pseudo): Fix adding ES neighbour. * isis_lsp.c (lsp_build_pseudo): Fix adding ES neighbour.
* isis_tlv.c: More compact free_tlvs() function. * isis_tlv.c: More compact free_tlvs() function.
* isis_lsp.c (lsp_build_nonpseudo) : Try to fix one more regression * isis_lsp.c (lsp_build_nonpseudo) : Try to fix one more regression
introduced by stream cleanup. Seek enp to the right place before introduced by stream cleanup. Seek endp to the right place before
starting to fill stream with TLVs. starting to fill stream with TLVs.
2005-08-16 Hasso Tepper <hasso at quagga.net> 2005-08-16 Hasso Tepper <hasso at quagga.net>

View File

@ -905,7 +905,9 @@ out:
circuit->area->area_tag, circuit->area->area_tag,
level, snpa_print (ssnpa), circuit->interface->name, level, snpa_print (ssnpa), circuit->interface->name,
circuit_t2string (circuit->circuit_is_type), circuit_t2string (circuit->circuit_is_type),
circuit->circuit_id, stream_get_endp (circuit->rcv_stream)); circuit->circuit_id,
/* FIXME: use %z when we stop supporting old compilers. */
(unsigned long) stream_get_endp (circuit->rcv_stream));
} }
free_tlvs (&tlvs); free_tlvs (&tlvs);
@ -949,7 +951,8 @@ process_lsp (int level, struct isis_circuit *circuit, u_char * ssnpa)
ntohl (hdr->seq_num), ntohl (hdr->seq_num),
ntohs (hdr->checksum), ntohs (hdr->checksum),
ntohs (hdr->rem_lifetime), ntohs (hdr->rem_lifetime),
stream_get_endp (circuit->rcv_stream), /* FIXME: use %z when we stop supporting old compilers. */
(unsigned long) stream_get_endp (circuit->rcv_stream),
circuit->interface->name); circuit->interface->name);
} }
@ -2031,13 +2034,15 @@ send_hello (struct isis_circuit *circuit, int level)
{ {
zlog_debug ("ISIS-Adj (%s): Sent L%d LAN IIH on %s, length %ld", zlog_debug ("ISIS-Adj (%s): Sent L%d LAN IIH on %s, length %ld",
circuit->area->area_tag, level, circuit->interface->name, circuit->area->area_tag, level, circuit->interface->name,
STREAM_SIZE (circuit->snd_stream)); /* FIXME: use %z when we stop supporting old compilers. */
(unsigned long) STREAM_SIZE (circuit->snd_stream));
} }
else else
{ {
zlog_debug ("ISIS-Adj (%s): Sent P2P IIH on %s, length %ld", zlog_debug ("ISIS-Adj (%s): Sent P2P IIH on %s, length %ld",
circuit->area->area_tag, circuit->interface->name, circuit->area->area_tag, circuit->interface->name,
STREAM_SIZE (circuit->snd_stream)); /* FIXME: use %z when we stop supporting old compilers. */
(unsigned long) STREAM_SIZE (circuit->snd_stream));
} }
} }
@ -2205,7 +2210,8 @@ send_csnp (struct isis_circuit *circuit, int level)
{ {
zlog_debug ("ISIS-Snp (%s): Sent L%d CSNP on %s, length %ld", zlog_debug ("ISIS-Snp (%s): Sent L%d CSNP on %s, length %ld",
circuit->area->area_tag, level, circuit->interface->name, circuit->area->area_tag, level, circuit->interface->name,
STREAM_SIZE (circuit->snd_stream)); /* FIXME: use %z when we stop supporting old compilers. */
(unsigned long) STREAM_SIZE (circuit->snd_stream));
for (ALL_LIST_ELEMENTS (list, node, nnode, lsp)) for (ALL_LIST_ELEMENTS (list, node, nnode, lsp))
{ {
zlog_debug ("ISIS-Snp (%s): CSNP entry %s, seq 0x%08x," zlog_debug ("ISIS-Snp (%s): CSNP entry %s, seq 0x%08x,"
@ -2372,7 +2378,9 @@ send_psnp (int level, struct isis_circuit *circuit)
zlog_debug ("ISIS-Snp (%s): Sent L%d PSNP on %s, length %ld", zlog_debug ("ISIS-Snp (%s): Sent L%d PSNP on %s, length %ld",
circuit->area->area_tag, level, circuit->area->area_tag, level,
circuit->interface->name, circuit->interface->name,
STREAM_SIZE (circuit->snd_stream)); /* FIXME: use %z when we stop supporting old
* compilers. */
(unsigned long) STREAM_SIZE (circuit->snd_stream));
retval = build_psnp (level, circuit, list); retval = build_psnp (level, circuit, list);
if (retval == ISIS_OK) if (retval == ISIS_OK)

View File

@ -10,11 +10,11 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/times.h> #include <sys/times.h>
float timer() unsigned long timer()
{ struct tms hold; { struct tms hold;
times(&hold); times(&hold);
return (float)(hold.tms_utime) / 60.0; return (unsigned long) ((float) (hold.tms_utime) / 60.0);
} }
@ -84,6 +84,7 @@ static long irand ()
return (long) internal_seed ; return (long) internal_seed ;
} }
#if 0 /* Not used. */
/*********************************************************************/ /*********************************************************************/
/* */ /* */
/* computer independent variant of irand */ /* computer independent variant of irand */
@ -106,14 +107,14 @@ static long xrand()
internal_seed = ( (((is2 * A1) + (is1 * A2))% T16 )* T15 + (is2 * A2) ) & B; internal_seed = ( (((is2 * A1) + (is1 * A2))% T16 )* T15 + (is2 * A2) ) & B;
return (long) ( internal_seed ) ; return (long) ( internal_seed ) ;
} }
#endif
/*********************************************************************/ /*********************************************************************/
double rand01() double rand01()
{ return (double) irand() / BF ; { return (double) (irand() / BF) ;
} }
/*********************************************************************/ /*********************************************************************/

View File

@ -26,7 +26,7 @@
#define NODE( x, y ) (x*Y + y + 1) #define NODE( x, y ) (x*Y + y + 1)
char *graph_type[] = { const char *graph_type[] = {
"double cycle", "double cycle",
"cycle", "cycle",
"path" "path"
@ -227,7 +227,7 @@ usage (struct vty *vty) {
/* parsing parameters */ /* parsing parameters */
/* checks the validity of incoming parameters */ /* checks the validity of incoming parameters */
int int
spgrid_check_params ( struct vty *vty, int argc, char **argv) spgrid_check_params ( struct vty *vty, int argc, const char **argv)
{ {
/* initialized by default values */ /* initialized by default values */
ext=0; ext=0;
@ -341,11 +341,11 @@ spgrid_check_params ( struct vty *vty, int argc, char **argv)
switch ( args[2] ) { switch ( args[2] ) {
case 'l': /* upper bound of the interval */ case 'l': /* upper bound of the interval */
cl_f = 1; cl_f = 1;
cl = (long) atof ( &args[3] ); cl = atol ( &args[3] );
break; break;
case 'm': /* lower bound */ case 'm': /* lower bound */
cm_f = 1; cm_f = 1;
cm = (long ) atof ( &args[3] ); cm = atol ( &args[3] );
break; break;
case 'c': /* type - cycle */ case 'c': /* type - cycle */
cw_f = 1; cw_f = 1;
@ -372,15 +372,15 @@ spgrid_check_params ( struct vty *vty, int argc, char **argv)
{ {
case 'l': /* upper bound of the interval */ case 'l': /* upper bound of the interval */
al_f = 1; al_f = 1;
al = (long) atof ( &args[3] ); al = atol ( &args[3] );
break; break;
case 'm': /* lower bound */ case 'm': /* lower bound */
am_f = 1; am_f = 1;
am = (long ) atof ( &args[3] ); am = atol ( &args[3] );
break; break;
case 'x': /* number of additional arcs */ case 'x': /* number of additional arcs */
ax_f = 1; ax_f = 1;
ax = (long ) atof ( &args[3] ); ax = atol ( &args[3] );
if ( ax < 0 ) if ( ax < 0 )
{ {
usage (vty); usage (vty);
@ -404,11 +404,11 @@ spgrid_check_params ( struct vty *vty, int argc, char **argv)
{ {
case 'l': /* upper bound */ case 'l': /* upper bound */
il_f = 1; il_f = 1;
il = (long) atof ( &args[3] ); il = atol ( &args[3] );
break; break;
case 'm': /* lower bound */ case 'm': /* lower bound */
im_f = 1; im_f = 1;
im = (long ) atof ( &args[3] ); im = atol ( &args[3] );
break; break;
case 'n': /* additional length: l *= in*|i1-i2| */ case 'n': /* additional length: l *= in*|i1-i2| */
in_f = 1; in_f = 1;
@ -452,11 +452,11 @@ spgrid_check_params ( struct vty *vty, int argc, char **argv)
{ {
case 'l': /* upper bound of art. arc */ case 'l': /* upper bound of art. arc */
sl_f = 1; sl_f = 1;
sl = (long) atof ( &args[3] ); sl = atol ( &args[3] );
break; break;
case 'm': /* lower bound of art. arc */ case 'm': /* lower bound of art. arc */
sm_f = 1; sm_f = 1;
sm = (long) atof ( &args[3] ); sm = atol ( &args[3] );
break; break;
default: /* unknown switch value */ default: /* unknown switch value */
usage (vty); usage (vty);
@ -473,11 +473,11 @@ spgrid_check_params ( struct vty *vty, int argc, char **argv)
{ {
case 'l': /* upper bound */ case 'l': /* upper bound */
pl_f = 1; pl_f = 1;
pl = (long) atof ( &args[3] ); pl = atol ( &args[3] );
break; break;
case 'm': /* lower bound */ case 'm': /* lower bound */
pm_f = 1; pm_f = 1;
pm = (long ) atof ( &args[3] ); pm = atol ( &args[3] );
break; break;
case 'n': /* additional: p *= pn*(x+1) */ case 'n': /* additional: p *= pn*(x+1) */
pn_f = 1; pn_f = 1;

View File

@ -33,7 +33,7 @@ struct arc {
}; };
int gen_spgrid_topology (struct vty *vty, struct list *topology); int gen_spgrid_topology (struct vty *vty, struct list *topology);
int spgrid_check_params (struct vty *vty, int argc, char **argv); int spgrid_check_params (struct vty *vty, int argc, const char **argv);
#endif /* _ZEBRA_ISIS_TOPOLOGY_SPGRID_H */ #endif /* _ZEBRA_ISIS_TOPOLOGY_SPGRID_H */