Make GCC v4 happy with heavy warnings enabled.

svn:r4922
This commit is contained in:
Nick Mathewson 2005-09-08 06:37:50 +00:00
parent f50ddfd4dd
commit 8f37357193
4 changed files with 12 additions and 11 deletions

View File

@ -86,16 +86,16 @@ typedef struct config_var_t {
* or_options_t.<b>member</b>" * or_options_t.<b>member</b>"
*/ */
#define VAR(name,conftype,member,initvalue) \ #define VAR(name,conftype,member,initvalue) \
{ name, CONFIG_TYPE_ ## conftype, STRUCT_OFFSET(or_options_t, member), initvalue } { name, CONFIG_TYPE_ ## conftype, STRUCT_OFFSET(or_options_t, member), initvalue, NULL }
/** An entry for config_vars: "The option <b>name</b> is obsolete." */ /** An entry for config_vars: "The option <b>name</b> is obsolete." */
#define OBSOLETE(name) { name, CONFIG_TYPE_OBSOLETE, 0, NULL } #define OBSOLETE(name) { name, CONFIG_TYPE_OBSOLETE, 0, NULL, NULL }
/** Array of configuration options. Until we disallow nonstandard /** Array of configuration options. Until we disallow nonstandard
* abbreviations, order is significant, since the first matching option will * abbreviations, order is significant, since the first matching option will
* be chosen first. * be chosen first.
*/ */
static config_var_t _option_vars[] = { static config_var_t _option_vars[] = {
VAR("AccountingMax", MEMUNIT, AccountingMax, "0 bytes"), VAR("AccountingMax", MEMUNIT, AccountingMax, "0 bytes"),
VAR("AccountingMaxKB", UINT, _AccountingMaxKB, "0"), VAR("AccountingMaxKB", UINT, _AccountingMaxKB, "0"),
VAR("AccountingStart", STRING, AccountingStart, NULL), VAR("AccountingStart", STRING, AccountingStart, NULL),
VAR("Address", STRING, Address, NULL), VAR("Address", STRING, Address, NULL),
@ -189,12 +189,12 @@ static config_var_t _option_vars[] = {
VAR("UseHelperNodes", BOOL, UseHelperNodes, "0"), VAR("UseHelperNodes", BOOL, UseHelperNodes, "0"),
VAR("User", STRING, User, NULL), VAR("User", STRING, User, NULL),
VAR("__LeaveStreamsUnattached", BOOL,LeaveStreamsUnattached, "0"), VAR("__LeaveStreamsUnattached", BOOL,LeaveStreamsUnattached, "0"),
{ NULL, CONFIG_TYPE_OBSOLETE, 0, NULL } { NULL, CONFIG_TYPE_OBSOLETE, 0, NULL, NULL }
}; };
#undef VAR #undef VAR
#define VAR(name,conftype,member,initvalue) \ #define VAR(name,conftype,member,initvalue) \
{ name, CONFIG_TYPE_ ## conftype, STRUCT_OFFSET(or_state_t, member), initvalue } { name, CONFIG_TYPE_ ## conftype, STRUCT_OFFSET(or_state_t, member), initvalue, NULL }
static config_var_t _state_vars[] = { static config_var_t _state_vars[] = {
VAR("AccountingBytesReadInterval", MEMUNIT, AccountingBytesReadInInterval,NULL), VAR("AccountingBytesReadInterval", MEMUNIT, AccountingBytesReadInInterval,NULL),
VAR("AccountingBytesWrittenInInterval", MEMUNIT, VAR("AccountingBytesWrittenInInterval", MEMUNIT,
@ -208,7 +208,7 @@ static config_var_t _state_vars[] = {
VAR("HelperNodes", LINELIST_V, HelperNodes, NULL), VAR("HelperNodes", LINELIST_V, HelperNodes, NULL),
VAR("LastWritten", ISOTIME, LastWritten, NULL), VAR("LastWritten", ISOTIME, LastWritten, NULL),
{ NULL, CONFIG_TYPE_OBSOLETE, 0, NULL } { NULL, CONFIG_TYPE_OBSOLETE, 0, NULL, NULL }
}; };
#undef VAR #undef VAR

View File

@ -409,7 +409,7 @@ get_escaped_string(const char *start, size_t in_len_max,
*outp++ = *cp++; *outp++ = *cp++;
} }
*outp = '\0'; *outp = '\0';
tor_assert((outp - *out) == *out_len); tor_assert((outp - *out) == (int)*out_len);
return end+1; return end+1;
} }
@ -1965,7 +1965,8 @@ connection_control_process_inbuf_v1(connection_t *conn)
* recognize it. * recognize it.
*/ */
cmd_len = 0; cmd_len = 0;
while (cmd_len < data_len && !TOR_ISSPACE(conn->incoming_cmd[cmd_len])) while ((size_t)cmd_len < data_len
&& !TOR_ISSPACE(conn->incoming_cmd[cmd_len]))
++cmd_len; ++cmd_len;
/* /*

View File

@ -422,8 +422,8 @@ dirserver_getinfo_unregistered(const char *question)
for (i = 0; i < smartlist_len(descriptor_list); ++i) { for (i = 0; i < smartlist_len(descriptor_list); ++i) {
ent = smartlist_get(descriptor_list, i); ent = smartlist_get(descriptor_list, i);
r = dirserv_router_fingerprint_is_known(ent); r = dirserv_router_fingerprint_is_known(ent);
if (ent->bandwidthcapacity >= min_bw && if (ent->bandwidthcapacity >= (size_t)min_bw &&
ent->bandwidthrate >= min_bw && ent->bandwidthrate >= (size_t)min_bw &&
r == 0) { r == 0) {
/* then log this one */ /* then log this one */
tor_snprintf(buf, sizeof(buf), tor_snprintf(buf, sizeof(buf),

View File

@ -469,7 +469,7 @@ rend_service_introduce(circuit_t *circuit, const char *request, size_t request_l
extend_info->identity_digest, DIGEST_LEN); extend_info->identity_digest, DIGEST_LEN);
klen = ntohs(get_uint16(buf+7+DIGEST_LEN)); klen = ntohs(get_uint16(buf+7+DIGEST_LEN));
if (len != 7+DIGEST_LEN+2+klen+20+128) { if ((int)len != 7+DIGEST_LEN+2+klen+20+128) {
log_fn(LOG_WARN, "Bad length %u for version 2 INTRODUCE2 cell.", (int)len); log_fn(LOG_WARN, "Bad length %u for version 2 INTRODUCE2 cell.", (int)len);
goto err; goto err;
} }