diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-10-09 02:35:51 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-10-09 02:35:51 +0000 |
commit | c6f2d725d005f912830b523aa1d1a419f4e22ecd (patch) | |
tree | 1368757b759b80251b8a1afd343f3a5ecab0a36d | |
parent | c34125503493b2a71728c1cc5e913744f797704e (diff) | |
download | tor-c6f2d725d005f912830b523aa1d1a419f4e22ecd.tar.gz tor-c6f2d725d005f912830b523aa1d1a419f4e22ecd.zip |
r8957@totoro: nickm | 2006-10-08 22:35:17 -0400
The otherwise regrettable MIPSpro C compiler warns about values set but never used, and about mixing enums and ints; these are good warnings, and so should be fixed. This removes some dead code and some potential bugs. Thanks to pnx.
svn:r8664
-rw-r--r-- | src/common/crypto.c | 3 | ||||
-rw-r--r-- | src/common/torgzip.c | 6 | ||||
-rw-r--r-- | src/common/torgzip.h | 2 | ||||
-rw-r--r-- | src/or/config.c | 5 | ||||
-rw-r--r-- | src/or/connection_edge.c | 3 | ||||
-rw-r--r-- | src/or/directory.c | 2 | ||||
-rw-r--r-- | src/or/dirserv.c | 2 | ||||
-rw-r--r-- | src/or/rendcommon.c | 2 | ||||
-rw-r--r-- | src/or/router.c | 6 | ||||
-rw-r--r-- | src/or/routerparse.c | 5 | ||||
-rw-r--r-- | src/or/test.c | 1 |
11 files changed, 16 insertions, 21 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c index 932a0a0472..9aea7506ae 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -879,12 +879,11 @@ crypto_pk_private_hybrid_decrypt(crypto_pk_env_t *env, size_t fromlen, int padding, int warnOnFailure) { - int overhead, outlen, r; + int outlen, r; size_t pkeylen; crypto_cipher_env_t *cipher = NULL; char buf[PK_BYTES+1]; - overhead = crypto_get_rsa_padding_overhead(crypto_get_rsa_padding(padding)); pkeylen = crypto_pk_keysize(env); if (fromlen <= pkeylen) { diff --git a/src/common/torgzip.c b/src/common/torgzip.c index 4555ec16f9..83438462a2 100644 --- a/src/common/torgzip.c +++ b/src/common/torgzip.c @@ -274,9 +274,9 @@ tor_gzip_uncompress(char **out, size_t *out_len, /** Try to tell whether the <b>in_len</b>-byte string in <b>in</b> is likely * to be compressed or not. If it is, return the likeliest compression method. - * Otherwise, return 0. + * Otherwise, return UNKNOWN_METHOD. */ -int +compress_method_t detect_compression_method(const char *in, size_t in_len) { if (in_len > 2 && !memcmp(in, "\x1f\x8b", 2)) { @@ -285,7 +285,7 @@ detect_compression_method(const char *in, size_t in_len) (ntohs(get_uint16(in)) % 31) == 0) { return ZLIB_METHOD; } else { - return 0; + return UNKNOWN_METHOD; } } diff --git a/src/common/torgzip.h b/src/common/torgzip.h index 153ab4992d..ca3f493540 100644 --- a/src/common/torgzip.h +++ b/src/common/torgzip.h @@ -29,7 +29,7 @@ tor_gzip_uncompress(char **out, size_t *out_len, int is_gzip_supported(void); -int detect_compression_method(const char *in, size_t in_len); +compress_method_t detect_compression_method(const char *in, size_t in_len); typedef enum { TOR_ZLIB_OK, TOR_ZLIB_DONE, TOR_ZLIB_BUF_FULL, TOR_ZLIB_ERR diff --git a/src/or/config.c b/src/or/config.c index ac604bd35f..7ba1e22b01 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1555,13 +1555,11 @@ option_reset(config_format_t *fmt, or_options_t *options, config_var_t *var, int use_defaults) { config_line_t *c; - void *lvalue; char *msg = NULL; CHECK(fmt, options); option_clear(fmt, options, var); /* clear it first */ if (!use_defaults) return; /* all done */ - lvalue = STRUCT_VAR_P(options, var->var_offset); if (var->initvalue) { c = tor_malloc_zero(sizeof(config_line_t)); c->key = tor_strdup(var->name); @@ -3247,7 +3245,7 @@ static int parse_dir_server_line(const char *line, int validate_only) { smartlist_t *items = NULL; - int r, idx; + int r; char *addrport=NULL, *address=NULL, *nickname=NULL, *fingerprint=NULL; uint16_t port; char digest[DIGEST_LEN]; @@ -3262,7 +3260,6 @@ parse_dir_server_line(const char *line, int validate_only) goto err; } - idx = 0; if (is_legal_nickname(smartlist_get(items, 0))) { nickname = smartlist_get(items, 0); smartlist_del_keeporder(items, 0); diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 0ca76d5efd..969afa464a 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -2311,7 +2311,8 @@ parse_extended_hostname(char *address) char query[REND_SERVICE_ID_LEN+1]; s = strrchr(address,'.'); - if (!s) return 0; /* no dot, thus normal */ + if (!s) + return NORMAL_HOSTNAME; /* no dot, thus normal */ if (!strcmp(s+1,"exit")) { *s = 0; /* nul-terminate it */ return EXIT_HOSTNAME; /* .exit */ diff --git a/src/or/directory.c b/src/or/directory.c index afafd6f317..210d020584 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1008,7 +1008,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn) if (conn->_base.purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS) { smartlist_t *which = NULL; - int source; + networkstatus_source_t source; char *cp; log_info(LD_DIR,"Received networkstatus objects (size %d) from server " "'%s:%d'",(int) body_len, conn->_base.address, conn->_base.port); diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 4a5b1f7e08..16625d99c2 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -226,7 +226,7 @@ dirserv_router_get_status(const routerinfo_t *router, const char **msg) if (crypto_pk_get_fingerprint(router->identity_pkey, fingerprint, 0)) { log_warn(LD_BUG,"Error computing fingerprint"); - return -1; + return FP_REJECT; } return dirserv_get_status_impl(fingerprint, router->nickname, diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index ab38e9f3a6..7293f8fb06 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -471,5 +471,7 @@ rend_process_relay_cell(circuit_t *circ, int command, size_t length, default: tor_assert(0); } + + (void)r; } diff --git a/src/or/router.c b/src/or/router.c index a5d8895e7b..5f192cb53a 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -243,7 +243,6 @@ init_keys(void) char fingerprint[FINGERPRINT_LEN+1]; /*nickname<space>fp\n\0 */ char fingerprint_line[MAX_NICKNAME_LEN+FINGERPRINT_LEN+3]; - char *cp; const char *mydesc, *datadir; crypto_pk_env_t *prkey; char digest[20]; @@ -279,7 +278,6 @@ init_keys(void) if (check_private_dir(keydir, CPD_CREATE)) { return -1; } - cp = keydir + strlen(keydir); /* End of string. */ /* 1. Read identity key. Make it if none is found. */ tor_snprintf(keydir,sizeof(keydir),"%s/keys/identity.key",datadir); @@ -1093,7 +1091,7 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router, char *bandwidth_usage; char *family_line; #ifdef DEBUG_ROUTER_DUMP_ROUTER_TO_STRING - char *s_tmp, *s_dup; + char *s_dup; const char *cp; routerinfo_t *ri_tmp; #endif @@ -1263,7 +1261,7 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router, s[written+1] = 0; #ifdef DEBUG_ROUTER_DUMP_ROUTER_TO_STRING - cp = s_tmp = s_dup = tor_strdup(s); + cp = s_dup = tor_strdup(s); ri_tmp = router_parse_entry_from_string(cp, NULL, 1); if (!ri_tmp) { log_err(LD_BUG, diff --git a/src/or/routerparse.c b/src/or/routerparse.c index f76cfecafb..060f3b7839 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -110,7 +110,7 @@ typedef enum { /** Table mapping keywords to token value and to argument rules. */ static struct { - const char *t; int v; arg_syntax s; obj_syntax os; int ws; + const char *t; directory_keyword v; arg_syntax s; obj_syntax os; int ws; } token_table[] = { { "accept", K_ACCEPT, ARGS, NO_OBJ, RTR }, { "directory-signature", K_DIRECTORY_SIGNATURE, ARGS, NEED_OBJ, @@ -265,15 +265,12 @@ router_append_dirobj_signature(char *buf, size_t buf_len, const char *digest, version_status_t tor_version_is_obsolete(const char *myversion, const char *versionlist) { - const char *vl; tor_version_t mine, other; int found_newer = 0, found_older = 0, found_newer_in_series = 0, found_any_in_series = 0, r, same; version_status_t ret = VS_UNRECOMMENDED; smartlist_t *version_sl; - vl = versionlist; - log_debug(LD_CONFIG,"Checking whether version '%s' is in '%s'", myversion, versionlist); diff --git a/src/or/test.c b/src/or/test.c index 147c5c209a..c25bd189cd 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -1174,6 +1174,7 @@ test_control_formats(void) sz = read_escaped_data(inp, strlen(inp), 1, &out); test_streq(out, ".This is a test\nof the emergency \nbroadcast\n.system.\nZ.\n"); + test_eq(sz, strlen(out)); tor_free(out); } |