summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-10-09 02:35:51 +0000
committerNick Mathewson <nickm@torproject.org>2006-10-09 02:35:51 +0000
commitc6f2d725d005f912830b523aa1d1a419f4e22ecd (patch)
tree1368757b759b80251b8a1afd343f3a5ecab0a36d /src/common
parentc34125503493b2a71728c1cc5e913744f797704e (diff)
downloadtor-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
Diffstat (limited to 'src/common')
-rw-r--r--src/common/crypto.c3
-rw-r--r--src/common/torgzip.c6
-rw-r--r--src/common/torgzip.h2
3 files changed, 5 insertions, 6 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