From e3bc5b64c6d079433af4c08aa808b077c512b8a5 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Fri, 17 Oct 2008 17:40:48 +0000 Subject: [PATCH] Warning cleanup: Remove no-op bv_len < 0 and bv_len >= 0 tests --- servers/slapd/overlays/accesslog.c | 12 ++++++------ servers/slapd/overlays/pcache.c | 2 +- servers/slapd/overlays/syncprov.c | 6 +++--- servers/slapd/overlays/translucent.c | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/servers/slapd/overlays/accesslog.c b/servers/slapd/overlays/accesslog.c index 0be32e9bfa..a6b261377b 100644 --- a/servers/slapd/overlays/accesslog.c +++ b/servers/slapd/overlays/accesslog.c @@ -1400,7 +1400,7 @@ static int accesslog_response(Operation *op, SlapReply *rs) { attr_merge_one( e, ad_reqMessage, &bv, NULL ); } bv.bv_len = snprintf( timebuf, sizeof( timebuf ), "%d", rs->sr_err ); - if ( bv.bv_len >= 0 && bv.bv_len < sizeof( timebuf ) ) { + if ( bv.bv_len < sizeof( timebuf ) ) { bv.bv_val = timebuf; attr_merge_one( e, ad_reqResult, &bv, NULL ); } @@ -1617,17 +1617,17 @@ static int accesslog_response(Operation *op, SlapReply *rs) { } bv.bv_val = timebuf; bv.bv_len = snprintf( bv.bv_val, sizeof( timebuf ), "%d", rs->sr_nentries ); - if ( bv.bv_len >= 0 && bv.bv_len < sizeof( timebuf ) ) { + if ( bv.bv_len < sizeof( timebuf ) ) { attr_merge_one( e, ad_reqEntries, &bv, NULL ); } /* else? */ bv.bv_len = snprintf( bv.bv_val, sizeof( timebuf ), "%d", op->ors_tlimit ); - if ( bv.bv_len >= 0 && bv.bv_len < sizeof( timebuf ) ) { + if ( bv.bv_len < sizeof( timebuf ) ) { attr_merge_one( e, ad_reqTimeLimit, &bv, NULL ); } /* else? */ bv.bv_len = snprintf( bv.bv_val, sizeof( timebuf ), "%d", op->ors_slimit ); - if ( bv.bv_len >= 0 && bv.bv_len < sizeof( timebuf ) ) { + if ( bv.bv_len < sizeof( timebuf ) ) { attr_merge_one( e, ad_reqSizeLimit, &bv, NULL ); } /* else? */ break; @@ -1635,7 +1635,7 @@ static int accesslog_response(Operation *op, SlapReply *rs) { case LOG_EN_BIND: bv.bv_val = timebuf; bv.bv_len = snprintf( bv.bv_val, sizeof( timebuf ), "%d", op->o_protocol ); - if ( bv.bv_len >= 0 && bv.bv_len < sizeof( timebuf ) ) { + if ( bv.bv_len < sizeof( timebuf ) ) { attr_merge_one( e, ad_reqVersion, &bv, NULL ); } /* else? */ if ( op->orb_method == LDAP_AUTH_SIMPLE ) { @@ -1838,7 +1838,7 @@ accesslog_abandon( Operation *op, SlapReply *rs ) e = accesslog_entry( op, rs, LOG_EN_ABANDON, &op2 ); bv.bv_val = buf; bv.bv_len = snprintf( buf, sizeof( buf ), "%d", op->orn_msgid ); - if ( bv.bv_len >= 0 && bv.bv_len < sizeof( buf ) ) { + if ( bv.bv_len < sizeof( buf ) ) { attr_merge_one( e, ad_reqId, &bv, NULL ); } /* else? */ diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c index ea01254d18..5ecfc3fb5e 100644 --- a/servers/slapd/overlays/pcache.c +++ b/servers/slapd/overlays/pcache.c @@ -2712,7 +2712,7 @@ pc_cfadd( Operation *op, SlapReply *rs, Entry *p, ConfigArgs *ca ) /* FIXME: should not hardcode "olcDatabase" here */ bv.bv_len = snprintf( ca->cr_msg, sizeof( ca->cr_msg ), "olcDatabase=%s", cm->db.bd_info->bi_type ); - if ( bv.bv_len < 0 || bv.bv_len >= sizeof( ca->cr_msg ) ) { + if ( bv.bv_len >= sizeof( ca->cr_msg ) ) { return -1; } bv.bv_val = ca->cr_msg; diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index e05ee7fe47..db113f042b 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -627,7 +627,7 @@ again: cf.f_av_value = si->si_ctxcsn[maxid]; fop.ors_filterstr.bv_len = snprintf( buf, sizeof( buf ), "(entryCSN>=%s)", cf.f_av_value.bv_val ); - if ( fop.ors_filterstr.bv_len < 0 || fop.ors_filterstr.bv_len >= sizeof( buf ) ) { + if ( fop.ors_filterstr.bv_len >= sizeof( buf ) ) { return LDAP_OTHER; } fop.ors_attrsonly = 0; @@ -664,7 +664,7 @@ again: fop.ors_filterstr.bv_len = snprintf( buf, sizeof( buf ), "(entryCSN<=%s)", cf.f_av_value.bv_val ); } - if ( fop.ors_filterstr.bv_len < 0 || fop.ors_filterstr.bv_len >= sizeof( buf ) ) { + if ( fop.ors_filterstr.bv_len >= sizeof( buf ) ) { return LDAP_OTHER; } fop.ors_attrsonly = 1; @@ -2532,7 +2532,7 @@ sp_cf_gen(ConfigArgs *c) struct berval bv; bv.bv_len = snprintf( c->cr_msg, sizeof( c->cr_msg ), "%d %d", si->si_chkops, si->si_chktime ); - if ( bv.bv_len < 0 || bv.bv_len >= sizeof( c->cr_msg ) ) { + if ( bv.bv_len >= sizeof( c->cr_msg ) ) { rc = 1; } else { bv.bv_val = c->cr_msg; diff --git a/servers/slapd/overlays/translucent.c b/servers/slapd/overlays/translucent.c index 70d763f11e..e87cbe4632 100644 --- a/servers/slapd/overlays/translucent.c +++ b/servers/slapd/overlays/translucent.c @@ -159,7 +159,7 @@ translucent_cfadd( Operation *op, SlapReply *rs, Entry *e, ConfigArgs *ca ) /* FIXME: should not hardcode "olcDatabase" here */ bv.bv_len = snprintf( ca->cr_msg, sizeof( ca->cr_msg ), "olcDatabase=%s", ov->db.bd_info->bi_type ); - if ( bv.bv_len < 0 || bv.bv_len >= sizeof( ca->cr_msg ) ) { + if ( bv.bv_len >= sizeof( ca->cr_msg ) ) { return -1; } bv.bv_val = ca->cr_msg; -- 2.39.5