Fix some compiler warnings

svn:r5124
This commit is contained in:
Nick Mathewson 2005-09-23 17:11:20 +00:00
parent faa4f420de
commit 9050480339
3 changed files with 20 additions and 17 deletions

View File

@ -364,10 +364,10 @@ int
authdir_wants_to_reject_router(routerinfo_t *ri,
const char **msg)
{
tor_assert(msg);
/* Okay. Now check whether the fingerprint is recognized. */
router_status_t status = dirserv_router_get_status(ri, msg);
time_t now;
tor_assert(msg);
if (status == FP_REJECT)
return -1; /* msg is already set. */

View File

@ -2553,3 +2553,4 @@ router_reset_descriptor_download_failures(void)
rs->next_attempt_at = 0;
});
}

View File

@ -1367,34 +1367,36 @@ test_dir_format(void)
test_eq(IS_NOT_CVS, ver1.cvs);
test_streq("", ver1.status_tag);
#define test_eq_vs(vs1, vs2) test_eq_type(version_status_t, "%d", (vs1), (vs2))
/* make sure tor_version_is_obsolete() works */
test_eq(VS_OLD, tor_version_is_obsolete("0.0.1", "Tor 0.0.2"));
test_eq(VS_OLD, tor_version_is_obsolete("0.0.1", "0.0.2, Tor 0.0.3"));
test_eq(VS_OLD, tor_version_is_obsolete("0.0.1", "0.0.2,Tor 0.0.3"));
test_eq(VS_OLD, tor_version_is_obsolete("0.0.1", "0.0.3,BetterTor 0.0.1"));
test_eq(VS_RECOMMENDED,tor_version_is_obsolete("0.0.2", "Tor 0.0.2,Tor 0.0.3"));
test_eq(VS_NEW_IN_SERIES,
test_eq_vs(VS_OLD, tor_version_is_obsolete("0.0.1", "Tor 0.0.2"));
test_eq_vs(VS_OLD, tor_version_is_obsolete("0.0.1", "0.0.2, Tor 0.0.3"));
test_eq_vs(VS_OLD, tor_version_is_obsolete("0.0.1", "0.0.2,Tor 0.0.3"));
test_eq_vs(VS_OLD, tor_version_is_obsolete("0.0.1", "0.0.3,BetterTor 0.0.1"));
test_eq_vs(VS_RECOMMENDED,tor_version_is_obsolete("0.0.2", "Tor 0.0.2,Tor 0.0.3"));
test_eq_vs(VS_NEW_IN_SERIES,
tor_version_is_obsolete("0.0.2", "Tor 0.0.2pre1,Tor 0.0.3"));
test_eq(VS_OLD, tor_version_is_obsolete("0.0.2", "Tor 0.0.2.1,Tor 0.0.3"));
test_eq(VS_NEW, tor_version_is_obsolete("0.1.0", "Tor 0.0.2,Tor 0.0.3"));
test_eq(VS_RECOMMENDED,
test_eq_vs(VS_OLD, tor_version_is_obsolete("0.0.2", "Tor 0.0.2.1,Tor 0.0.3"));
test_eq_vs(VS_NEW, tor_version_is_obsolete("0.1.0", "Tor 0.0.2,Tor 0.0.3"));
test_eq_vs(VS_RECOMMENDED,
tor_version_is_obsolete("0.0.7rc2", "0.0.7,Tor 0.0.7rc2,Tor 0.0.8"));
test_eq(VS_OLD, tor_version_is_obsolete("0.0.5.0", "0.0.5.1-cvs"));
test_eq(VS_NEW_IN_SERIES, tor_version_is_obsolete("0.0.5.1-cvs", "0.0.5"));
test_eq_vs(VS_OLD, tor_version_is_obsolete("0.0.5.0", "0.0.5.1-cvs"));
test_eq_vs(VS_NEW_IN_SERIES, tor_version_is_obsolete("0.0.5.1-cvs", "0.0.5"));
/* Not on list, but newer than any in same series. */
test_eq(VS_NEW_IN_SERIES,
test_eq_vs(VS_NEW_IN_SERIES,
tor_version_is_obsolete("0.1.0.3", "Tor 0.1.0.2,Tor 0.0.9.5,Tor 0.1.1.0"));
/* Series newer than any on list. */
test_eq(VS_NEW,
test_eq_vs(VS_NEW,
tor_version_is_obsolete("0.1.2.3", "Tor 0.1.0.2,Tor 0.0.9.5,Tor 0.1.1.0"));
/* Series older than any on list. */
test_eq(VS_OLD,
test_eq_vs(VS_OLD,
tor_version_is_obsolete("0.0.1.3", "Tor 0.1.0.2,Tor 0.0.9.5,Tor 0.1.1.0"));
/* Not on list, not newer than any on same series. */
test_eq(VS_UNRECOMMENDED,
test_eq_vs(VS_UNRECOMMENDED,
tor_version_is_obsolete("0.1.0.1", "Tor 0.1.0.2,Tor 0.0.9.5,Tor 0.1.1.0"));
/* On list, not newer than any on same series. */
test_eq(VS_UNRECOMMENDED,
test_eq_vs(VS_UNRECOMMENDED,
tor_version_is_obsolete("0.1.0.1", "Tor 0.1.0.2,Tor 0.0.9.5,Tor 0.1.1.0"));
test_eq(0, tor_version_as_new_as("Tor 0.0.5", "0.0.9pre1-cvs"));