? stats ? out ? diff ? auto.rc Index: client/attribute.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/attribute.c,v retrieving revision 1.7 diff -u -r1.7 attribute.c --- client/attribute.c 2002/02/24 11:50:32 1.7 +++ client/attribute.c 2002/03/01 19:50:50 @@ -73,8 +73,8 @@ * } body[entries]; */ int preamble_length, header_length, body_length, total_length, i, - current_body_offset, entries = hash_num_entries(hash), key_size = - sizeof(struct attr_key); + current_body_offset, entries = hash_num_entries(hash); + size_t key_size = sizeof(struct attr_key); char *result, *body; int *value_lengths, *header, *preamble; @@ -159,7 +159,7 @@ ... *****************************************************************************/ static void unserialize_hash(struct hash_table *hash, char *data, - int data_length) + size_t data_length) { int *preamble, *header; int entries, i, preamble_length, header_length; @@ -235,7 +235,7 @@ Low-level function to set an attribute. If data_length is zero the attribute is removed. *****************************************************************************/ -void attribute_set(int key, int id, int x, int y, int data_length, +void attribute_set(int key, int id, int x, int y, size_t data_length, const void *const data) { struct attr_key *pkey; @@ -274,7 +274,7 @@ to hold the attribute attribute_get aborts. Returns the actual size of the attribute. Can be zero if the attribute is unset. *****************************************************************************/ -int attribute_get(int key, int id, int x, int y, int max_data_length, +size_t attribute_get(int key, int id, int x, int y, size_t max_data_length, void *data) { @@ -325,7 +325,7 @@ /**************************************************************************** ... *****************************************************************************/ -void attr_unit_set(enum attr_unit what, int unit_id, int data_length, +void attr_unit_set(enum attr_unit what, int unit_id, size_t data_length, const void *const data) { attribute_set(what, unit_id, -1, -2, data_length, data); @@ -334,7 +334,7 @@ /**************************************************************************** ... *****************************************************************************/ -int attr_unit_get(enum attr_unit what, int unit_id, int max_data_length, +size_t attr_unit_get(enum attr_unit what, int unit_id, size_t max_data_length, void *data) { return attribute_get(what, unit_id, -1, -2, max_data_length, data); @@ -351,7 +351,7 @@ /**************************************************************************** ... *****************************************************************************/ -int attr_unit_get_int(enum attr_unit what, int unit_id, int *data) +size_t attr_unit_get_int(enum attr_unit what, int unit_id, int *data) { return attr_unit_get(what, unit_id, sizeof(int), data); } @@ -359,7 +359,7 @@ /**************************************************************************** ... *****************************************************************************/ -void attr_city_set(enum attr_city what, int city_id, int data_length, +void attr_city_set(enum attr_city what, int city_id, size_t data_length, const void *const data) { attribute_set(what, city_id, -1, -1, data_length, data); @@ -368,7 +368,7 @@ /**************************************************************************** ... *****************************************************************************/ -int attr_city_get(enum attr_city what, int city_id, int max_data_length, +size_t attr_city_get(enum attr_city what, int city_id, size_t max_data_length, void *data) { return attribute_get(what, city_id, -1, -1, max_data_length, data); @@ -385,7 +385,7 @@ /**************************************************************************** ... *****************************************************************************/ -int attr_city_get_int(enum attr_city what, int city_id, int *data) +size_t attr_city_get_int(enum attr_city what, int city_id, int *data) { return attr_city_get(what, city_id, sizeof(int), data); } @@ -393,7 +393,7 @@ /**************************************************************************** ... *****************************************************************************/ -void attr_player_set(enum attr_player what, int player_id, int data_length, +void attr_player_set(enum attr_player what, int player_id, size_t data_length, const void *const data) { attribute_set(what, player_id, -1, -1, data_length, data); @@ -402,8 +402,8 @@ /**************************************************************************** ... *****************************************************************************/ -int attr_player_get(enum attr_player what, int player_id, - int max_data_length, void *data) +size_t attr_player_get(enum attr_player what, int player_id, + size_t max_data_length, void *data) { return attribute_get(what, player_id, -1, -1, max_data_length, data); } @@ -411,7 +411,7 @@ /**************************************************************************** ... *****************************************************************************/ -void attr_tile_set(enum attr_tile what, int x, int y, int data_length, +void attr_tile_set(enum attr_tile what, int x, int y, size_t data_length, const void *const data) { attribute_set(what, -1, x, y, data_length, data); @@ -420,7 +420,7 @@ /**************************************************************************** ... *****************************************************************************/ -int attr_tile_get(enum attr_tile what, int x, int y, int max_data_length, +size_t attr_tile_get(enum attr_tile what, int x, int y, size_t max_data_length, void *data) { return attribute_get(what, -1, x, y, max_data_length, data); Index: client/attribute.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/attribute.h,v retrieving revision 1.3 diff -u -r1.3 attribute.h --- client/attribute.h 2002/02/02 09:21:30 1.3 +++ client/attribute.h 2002/03/01 19:50:50 @@ -47,45 +47,45 @@ void attribute_init(void); void attribute_flush(void); void attribute_restore(void); -void attribute_set(int key, int id, int x, int y, int data_length, +void attribute_set(int key, int id, int x, int y, size_t data_length, const void *const data); -int attribute_get(int key, int id, int x, int y, int max_data_length, +size_t attribute_get(int key, int id, int x, int y, size_t max_data_length, void *data); /* * Special methods for units. */ -void attr_unit_set(enum attr_unit what, int unit_id, int data_length, +void attr_unit_set(enum attr_unit what, int unit_id, size_t data_length, const void *const data); -int attr_unit_get(enum attr_unit what, int unit_id, int max_data_length, +size_t attr_unit_get(enum attr_unit what, int unit_id, size_t max_data_length, void *data); void attr_unit_set_int(enum attr_unit what, int unit_id, int data); -int attr_unit_get_int(enum attr_unit what, int unit_id, int *data); +size_t attr_unit_get_int(enum attr_unit what, int unit_id, int *data); /* * Special methods for cities. */ -void attr_city_set(enum attr_city what, int city_id, int data_length, +void attr_city_set(enum attr_city what, int city_id, size_t data_length, const void *const data); -int attr_city_get(enum attr_city what, int city_id, int max_data_length, +size_t attr_city_get(enum attr_city what, int city_id, size_t max_data_length, void *data); void attr_city_set_int(enum attr_city what, int city_id, int data); -int attr_city_get_int(enum attr_city what, int city_id, int *data); +size_t attr_city_get_int(enum attr_city what, int city_id, int *data); /* * Special methods for players. */ -void attr_player_set(enum attr_player what, int player_id, int data_length, +void attr_player_set(enum attr_player what, int player_id, size_t data_length, const void *const data); -int attr_player_get(enum attr_player what, int player_id, - int max_data_length, void *data); +size_t attr_player_get(enum attr_player what, int player_id, + size_t max_data_length, void *data); /* * Special methods for tiles. */ -void attr_tile_set(enum attr_tile what, int x, int y, int data_length, +void attr_tile_set(enum attr_tile what, int x, int y, size_t data_length, const void *const data); -int attr_tile_get(enum attr_tile what, int x, int y, int max_data_length, +size_t attr_tile_get(enum attr_tile what, int x, int y, size_t max_data_length, void *data); #endif Index: client/agents/cma_core.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/agents/cma_core.c,v retrieving revision 1.16 diff -u -r1.16 cma_core.c --- client/agents/cma_core.c 2002/02/26 19:57:10 1.16 +++ client/agents/cma_core.c 2002/03/01 19:50:56 @@ -1551,7 +1551,7 @@ { struct cma_parameter parameter; struct cma_result result; - int len; + size_t len; bool handled; int i; @@ -1784,10 +1784,8 @@ struct cma_parameter *parameter) { struct cma_parameter my_parameter; - int len; - - len = attr_city_get(ATTR_CITY_CMA_PARAMETER, pcity->id, - sizeof(struct cma_parameter), &my_parameter); + size_t len = attr_city_get(ATTR_CITY_CMA_PARAMETER, pcity->id, + sizeof(struct cma_parameter), &my_parameter); if (len == 0) { return FALSE; Index: client/agents/cma_fec.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/agents/cma_fec.c,v retrieving revision 1.6 diff -u -r1.6 cma_fec.c --- client/agents/cma_fec.c 2002/02/26 19:57:10 1.6 +++ client/agents/cma_fec.c 2002/03/01 19:50:56 @@ -101,7 +101,7 @@ *****************************************************************/ void cmafec_get_fe_parameter(struct city *pcity, struct cma_parameter *dest) { - int len; + size_t len; struct cma_parameter parameter; /* our fe_parameter could be stale. our agents parameter is uptodate */ Index: common/astring.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/astring.c,v retrieving revision 1.6 diff -u -r1.6 astring.c --- common/astring.c 2002/02/16 17:05:04 1.6 +++ common/astring.c 2002/03/01 19:50:57 @@ -61,12 +61,11 @@ The actual amount allocated may be larger than n, and is stored in astr->n_alloc. ***********************************************************************/ -void astr_minsize(struct astring *astr, int n) +void astr_minsize(struct astring *astr, size_t n) { int n1; assert(astr != NULL); - assert(astr->n_alloc>=0); astr->n = n; if (n <= astr->n_alloc) { @@ -88,7 +87,6 @@ struct astring zero_astr = ASTRING_INIT; assert(astr != NULL); - assert(astr->n_alloc>=0); if (astr->n_alloc > 0) { assert(astr->str != NULL); @@ -102,7 +100,7 @@ Initialize the struct; size is the size of one "object", or use 1 if you just want "bytes". ***********************************************************************/ -void ath_init(struct athing *ath, int size) +void ath_init(struct athing *ath, size_t size) { assert(ath != NULL); ath->ptr = NULL; @@ -117,12 +115,11 @@ The actual amount allocated may be larger than n, and is stored in ath->n_alloc. ***********************************************************************/ -void ath_minnum(struct athing *ath, int n) +void ath_minnum(struct athing *ath, size_t n) { int n1; assert(ath != NULL); - assert(ath->n_alloc>=0); assert(ath->size>0); ath->n = n; @@ -142,10 +139,9 @@ ***********************************************************************/ void ath_free(struct athing *ath) { - int size; + size_t size; assert(ath != NULL); - assert(ath->n_alloc>=0); size = ath->size; if (ath->n_alloc > 0) { Index: common/astring.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/astring.h,v retrieving revision 1.4 diff -u -r1.4 astring.h --- common/astring.h 2002/02/07 17:23:38 1.4 +++ common/astring.h 2002/03/01 19:50:57 @@ -21,15 +21,15 @@ struct astring { char *str; /* the string */ - int n; /* size most recently requested */ - int n_alloc; /* total allocated */ + size_t n; /* size most recently requested */ + size_t n_alloc; /* total allocated */ }; struct athing { void *ptr; /* the data */ - int size; /* size of one object */ - int n; /* number most recently requested */ - int n_alloc; /* total number allocated */ + size_t size; /* size of one object */ + size_t n; /* number most recently requested */ + size_t n_alloc; /* total number allocated */ }; /* Can assign this in variable declaration to initialize: @@ -39,11 +39,11 @@ #define ASTRING_INIT { NULL, 0, 0 } void astr_init(struct astring *astr); -void astr_minsize(struct astring *astr, int n); +void astr_minsize(struct astring *astr, size_t n); void astr_free(struct astring *astr); -void ath_init(struct athing *ath, int size); -void ath_minnum(struct athing *ath, int n); +void ath_init(struct athing *ath, size_t size); +void ath_minnum(struct athing *ath, size_t n); void ath_free(struct athing *ath); /* Returns a pointer to the nth (0-based) element in the given athing. Does Index: common/capability.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/capability.c,v retrieving revision 1.8 diff -u -r1.8 capability.c --- common/capability.c 2002/02/16 17:05:05 1.8 +++ common/capability.c 2002/03/01 19:50:57 @@ -45,7 +45,7 @@ if (*capstr == '+') { capstr++; } - if ((next-capstr == cap_len) && strncmp(cap, capstr, cap_len)==0) { + if ((next - capstr == (int) cap_len) && strncmp(cap, capstr, cap_len) == 0) { return TRUE; } if (*next == '\0') { Index: common/connection.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/connection.c,v retrieving revision 1.25 diff -u -r1.25 connection.c --- common/connection.c 2002/02/26 16:58:12 1.25 +++ common/connection.c 2002/03/01 19:50:57 @@ -91,7 +91,7 @@ enum cmdlevel_id cmdlevel_named(const char *token) { enum cmdlevel_id i; - int len = strlen(token); + size_t len = strlen(token); for (i = 0; i < ALLOW_NUM; ++i) { if (strncmp(levelnames[i], token, len) == 0) { Index: common/inputfile.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/inputfile.c,v retrieving revision 1.22 diff -u -r1.22 inputfile.c --- common/inputfile.c 2002/02/26 16:58:12 1.22 +++ common/inputfile.c 2002/03/01 19:50:59 @@ -317,7 +317,7 @@ static bool check_include(struct inputfile *inf) { const char *include_prefix = "*include"; - static int len = 0; + static size_t len = 0; char *bare_name, *full_name, *c; struct inputfile *new_inf, temp; Index: common/packets.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/packets.c,v retrieving revision 1.192 diff -u -r1.192 packets.c --- common/packets.c 2002/02/26 20:19:10 1.192 +++ common/packets.c 2002/03/01 19:51:02 @@ -108,9 +108,9 @@ static void iget_uint8_vec8(struct pack_iter *piter, int **val, int stop); static void iget_uint16_vec8(struct pack_iter *piter, int **val, int stop); -static void iget_string(struct pack_iter *piter, char *mystring, int navail); -static void iget_bit_string(struct pack_iter *piter, char *str, int navail); -static void iget_city_map(struct pack_iter *piter, char *str, int navail); +static void iget_string(struct pack_iter *piter, char *mystring, size_t navail); +static void iget_bit_string(struct pack_iter *piter, char *str, size_t navail); +static void iget_city_map(struct pack_iter *piter, char *str, size_t navail); static void iget_tech_list(struct pack_iter *piter, int *techs); /* Use the above iget versions instead of the get versions below, @@ -1154,7 +1154,7 @@ mystring can be NULL, in which case just advance piter, and ignore navail. If mystring is non-NULL, navail must be greater than 0. **************************************************************************/ -static void iget_string(struct pack_iter *piter, char *mystring, int navail) +static void iget_string(struct pack_iter *piter, char *mystring, size_t navail) { unsigned char *c; int ps_len; /* length in packet, not including null */ @@ -1220,7 +1220,7 @@ memory available in str. That is, reverse the encoding of put_city_map(). str can be NULL, meaning to just read past city_map. **************************************************************************/ -static void iget_city_map(struct pack_iter *piter, char *str, int navail) +static void iget_city_map(struct pack_iter *piter, char *str, size_t navail) { static const int index[20]= {1,2,3, 5,6,7,8,9, 10,11, 13,14, 15,16,17,18,19, 21,22,23 }; @@ -1267,11 +1267,12 @@ **************************************************************************/ static unsigned char *put_bit_string(unsigned char *buffer, char *str) { - int i,b,n; - int data; + int b, data; + size_t i, n = strlen(str); - n=strlen(str); - *buffer++=n; + assert(n < UCHAR_MAX); + + *buffer++ = (unsigned char) n; for(i=0;iptr), but I couldn't be bothered trying to get everything (including short_packet) correct. --dwp **************************************************************************/ -static void iget_bit_string(struct pack_iter *piter, char *str, int navail) +static void iget_bit_string(struct pack_iter *piter, char *str, size_t navail) { int npack; /* number claimed in packet */ int i; /* iterate the bytes */ Index: common/sbuffer.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/sbuffer.c,v retrieving revision 1.6 diff -u -r1.6 sbuffer.c --- common/sbuffer.c 2002/02/16 17:05:08 1.6 +++ common/sbuffer.c 2002/03/01 19:51:03 @@ -110,7 +110,7 @@ /************************************************************************** Get a new initialized sbuffer, specifying buffer size: **************************************************************************/ -struct sbuffer *sbuf_new_size(int size) +struct sbuffer *sbuf_new_size(size_t size) { struct sbuffer *sb; @@ -129,7 +129,7 @@ /************************************************************************** malloc: size here must be less than sb->size. **************************************************************************/ -void *sbuf_malloc(struct sbuffer *sb, int size) +void *sbuf_malloc(struct sbuffer *sb, size_t size) { char *ret; Index: common/sbuffer.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/sbuffer.h,v retrieving revision 1.2 diff -u -r1.2 sbuffer.h --- common/sbuffer.h 2001/12/11 16:16:39 1.2 +++ common/sbuffer.h 2002/03/01 19:51:03 @@ -19,10 +19,10 @@ struct sbuffer *sbuf_new(void); /* as sbuf_new, specifying buffer size: */ -struct sbuffer *sbuf_new_size(int size); +struct sbuffer *sbuf_new_size(size_t size); /* malloc and strdup: */ -void *sbuf_malloc(struct sbuffer *sb, int size); +void *sbuf_malloc(struct sbuffer *sb, size_t size); char *sbuf_strdup(struct sbuffer *sb, const char *str); /* free all memory associated with sb; after this sb itself points Index: common/specvec.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/specvec.h,v retrieving revision 1.1 diff -u -r1.1 specvec.h --- common/specvec.h 2002/01/09 21:49:06 1.1 +++ common/specvec.h 2002/03/01 19:51:04 @@ -65,7 +65,7 @@ void SPECVEC_FOO(_vector_init) (SPECVEC_VECTOR *tthis); void SPECVEC_FOO(_vector_reserve) (SPECVEC_VECTOR *tthis, int n); -int SPECVEC_FOO(_vector_size) (SPECVEC_VECTOR *tthis); +size_t SPECVEC_FOO(_vector_size) (SPECVEC_VECTOR *tthis); SPECVEC_TYPE *SPECVEC_FOO(_vector_get) (SPECVEC_VECTOR *tthis, int index); void SPECVEC_FOO(_vector_free) (SPECVEC_VECTOR *tthis); Index: common/specvec_c.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/specvec_c.h,v retrieving revision 1.2 diff -u -r1.2 specvec_c.h --- common/specvec_c.h 2002/01/19 03:25:46 1.2 +++ common/specvec_c.h 2002/03/01 19:51:04 @@ -49,7 +49,7 @@ ath_minnum(&tthis->vector, n); } -int SPECVEC_FOO(_vector_size) (SPECVEC_VECTOR *tthis) +size_t SPECVEC_FOO(_vector_size) (SPECVEC_VECTOR *tthis) { return tthis->vector.n; } Index: server/handchat.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/handchat.c,v retrieving revision 1.18 diff -u -r1.18 handchat.c --- server/handchat.c 2002/02/27 11:12:51 1.18 +++ server/handchat.c 2002/03/01 19:51:09 @@ -39,7 +39,7 @@ name, assume connection name is a "modified" player name and don't use both (eg "(1-Shaka)" instead of "Shaka (1-Shaka)"). **************************************************************************/ -static void form_chat_name(struct connection *pconn, char *buffer, int len) +static void form_chat_name(struct connection *pconn, char *buffer, size_t len) { struct player *pplayer = pconn->player; Index: server/ruleset.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v retrieving revision 1.98 diff -u -r1.98 ruleset.c --- server/ruleset.c 2002/02/27 11:12:52 1.98 +++ server/ruleset.c 2002/03/01 19:51:13 @@ -2061,7 +2061,7 @@ * Read terrain-specific city names. */ for (type = T_FIRST; type < T_COUNT; type++) { - int k; + size_t k; char namebuf[MAX_LEN_NAME]; /* Index: server/savegame.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v retrieving revision 1.66 diff -u -r1.66 savegame.c --- server/savegame.c 2002/02/27 11:46:21 1.66 +++ server/savegame.c 2002/03/01 19:51:15 @@ -210,7 +210,8 @@ static char *quote_block(const void *const data, int length) { char *buffer = fc_malloc(length * 3 + 10); - int offset, i; + size_t offset; + int i; sprintf(buffer, "%d:", length); offset = strlen(buffer); @@ -1572,7 +1573,8 @@ char *quoted = quote_block(plr->attribute_block.data, plr->attribute_block.length); char part[PART_SIZE + 1]; - int current_part_nr, parts, bytes_left; + int current_part_nr, parts; + size_t bytes_left; secfile_insert_int(file, plr->attribute_block.length, "player%d.attribute_block_length", plrno); @@ -1586,7 +1588,7 @@ "player%d.attribute_block_parts", plrno); for (current_part_nr = 0; current_part_nr < parts; current_part_nr++) { - int size_of_current_part = MIN(bytes_left, PART_SIZE); + size_t size_of_current_part = MIN(bytes_left, PART_SIZE); assert(bytes_left); Index: server/sernet.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/sernet.c,v retrieving revision 1.86 diff -u -r1.86 sernet.c --- server/sernet.c 2002/02/27 11:12:53 1.86 +++ server/sernet.c 2002/03/01 19:51:15 @@ -517,7 +517,7 @@ } continue; #else /* !HAVE_LIBREADLINE */ - int didget; + ssize_t didget; char buf[BUF_SIZE+1]; if((didget=read(0, buf, BUF_SIZE))==-1) { Index: server/stdinhand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v retrieving revision 1.211 diff -u -r1.211 stdinhand.c --- server/stdinhand.c 2002/02/27 11:12:54 1.211 +++ server/stdinhand.c 2002/03/01 19:51:20 @@ -956,7 +956,7 @@ **************************************************************************/ static PlayerNameStatus test_player_name(char* name) { - int len = strlen(name); + size_t len = strlen(name); if (len == 0) { return PNameEmpty; @@ -2554,7 +2554,7 @@ char buf[MAX_LEN_CONSOLE_LINE]; char command[MAX_LEN_CONSOLE_LINE], *cptr_s, *cptr_d; int cmd,i,len1; - int clen = 0; + size_t clen = 0; for (cptr_s = str; *cptr_s != '\0' && !isalnum(*cptr_s); cptr_s++); for (cptr_d = command; *cptr_s != '\0' && isalnum(*cptr_s); cptr_s++, cptr_d++) @@ -3105,7 +3105,7 @@ if (cmd->synopsis) { /* line up the synopsis lines: */ const char *syn = _("Synopsis: "); - int synlen = strlen(syn); + size_t synlen = strlen(syn); char prefix[40]; my_snprintf(prefix, sizeof(prefix), "%*s", synlen, " ");