Use more the ND_TTEST_1() macro

This commit is contained in:
Francois-Xavier Le Bail 2017-12-15 19:39:00 +01:00
parent 09393e2faa
commit 1a04b92e36
6 changed files with 12 additions and 12 deletions

View File

@ -802,7 +802,7 @@ q933_print(netdissect_options *ndo,
ND_PRINT((ndo, "%s", ndo->ndo_eflag ? "" : "Q.933"));
if (length == 0 || !ND_TTEST(*p)) {
if (length == 0 || !ND_TTEST_1(p)) {
if (!ndo->ndo_eflag)
ND_PRINT((ndo, ", "));
ND_PRINT((ndo, "length %u", length));
@ -821,7 +821,7 @@ q933_print(netdissect_options *ndo,
* Get the call reference value.
*/
for (i = 0; i < call_ref_length; i++) {
if (length == 0 || !ND_TTEST(*p)) {
if (length == 0 || !ND_TTEST_1(p)) {
if (!ndo->ndo_eflag)
ND_PRINT((ndo, ", "));
ND_PRINT((ndo, "length %u", olen));
@ -835,7 +835,7 @@ q933_print(netdissect_options *ndo,
/*
* Get the message type.
*/
if (length == 0 || !ND_TTEST(*p)) {
if (length == 0 || !ND_TTEST_1(p)) {
if (!ndo->ndo_eflag)
ND_PRINT((ndo, ", "));
ND_PRINT((ndo, "length %u", olen));
@ -851,7 +851,7 @@ q933_print(netdissect_options *ndo,
non_locking_shift = 0;
unshift_codeset = codeset;
if (length != 0) {
if (!ND_TTEST(*p)) {
if (!ND_TTEST_1(p)) {
if (!ndo->ndo_eflag)
ND_PRINT((ndo, ", "));
ND_PRINT((ndo, "length %u", olen));
@ -952,7 +952,7 @@ q933_print(netdissect_options *ndo,
/*
* Get the first octet of the IE.
*/
if (!ND_TTEST(*p)) {
if (!ND_TTEST_1(p)) {
if (!ndo->ndo_vflag) {
ND_PRINT((ndo, ", length %u", olen));
}
@ -995,7 +995,7 @@ q933_print(netdissect_options *ndo,
/*
* No. Get the IE length.
*/
if (length == 0 || !ND_TTEST(*p)) {
if (length == 0 || !ND_TTEST_1(p)) {
if (!ndo->ndo_vflag) {
ND_PRINT((ndo, ", length %u", olen));
}

View File

@ -346,7 +346,7 @@ again:
switch (ipds->nh) {
case IPPROTO_AH:
if (!ND_TTEST(*ipds->cp)) {
if (!ND_TTEST_1(ipds->cp)) {
ND_PRINT((ndo, "[|AH]"));
break;
}

View File

@ -671,7 +671,7 @@ struct isis_tlv_lsp {
void
isoclns_print(netdissect_options *ndo, const uint8_t *p, u_int length)
{
if (!ND_TTEST(*p)) { /* enough bytes on the wire ? */
if (!ND_TTEST_1(p)) { /* enough bytes on the wire ? */
ND_PRINT((ndo, "|OSI"));
return;
}

View File

@ -259,7 +259,7 @@ pimv1_print(netdissect_options *ndo,
ND_PRINT((ndo, " %s", tok2str(pimv1_type_str, "[type %u]", type)));
switch (type) {
case PIMV1_TYPE_QUERY:
if (ND_TTEST(bp[8])) {
if (ND_TTEST_1(bp + 8)) {
switch (EXTRACT_U_1(bp + 8) >> 4) {
case 0:
ND_PRINT((ndo, " Dense-mode"));

View File

@ -1410,7 +1410,7 @@ ppp_hdlc(netdissect_options *ndo,
* Do this so that we dont overwrite the original packet
* contents.
*/
for (s = p, t = b, i = length; i != 0 && ND_TTEST(*s); i--) {
for (s = p, t = b, i = length; i != 0 && ND_TTEST_1(s); i--) {
c = EXTRACT_U_1(s);
s++;
if (c == 0x7d) {

View File

@ -691,7 +691,7 @@ fetch_token(netdissect_options *ndo, const u_char *pptr, u_int idx, u_int len,
size_t toklen = 0;
for (; idx < len; idx++) {
if (!ND_TTEST(*(pptr + idx))) {
if (!ND_TTEST_1(pptr + idx)) {
/* ran past end of captured data */
return (0);
}
@ -725,7 +725,7 @@ fetch_token(netdissect_options *ndo, const u_char *pptr, u_int idx, u_int len,
* an end-of-line (CR or LF).
*/
for (; idx < len; idx++) {
if (!ND_TTEST(*(pptr + idx))) {
if (!ND_TTEST_1(pptr + idx)) {
/* ran past end of captured data */
break;
}