napatech: fix warnings with ByteExtractStringUint8

The WARN_UNUSED attribute has been added to ByteExtractStringUint8
in commit 6988168114.  The return
value is now handled and appropriate errors printed.
pull/9441/head
Ralph Eastwood 2 years ago committed by Victor Julien
parent 23e5386513
commit d7aa7a063f

@ -1454,8 +1454,16 @@ uint32_t NapatechSetupTraffic(uint32_t first_stream, uint32_t last_stream)
if (strchr(port->val, '-')) { if (strchr(port->val, '-')) {
stream_spec = CONFIG_SPECIFIER_RANGE; stream_spec = CONFIG_SPECIFIER_RANGE;
ByteExtractStringUint8(&ports_spec.first[iteration], 10, 0, port->val); if (ByteExtractStringUint8(&ports_spec.first[iteration], 10, 0, port->val) == -1) {
ByteExtractStringUint8(&ports_spec.second[iteration], 10, 0, strchr(port->val, '-')+1); FatalError("Invalid value '%s' in napatech.ports specification in conf file.",
port->val);
}
if (ByteExtractStringUint8(&ports_spec.second[iteration], 10, 0,
strchr(port->val, '-') + 1) == -1) {
FatalError("Invalid value '%s' in napatech.ports specification in conf file.",
port->val);
}
if (ports_spec.first[iteration] == ports_spec.second[iteration]) { if (ports_spec.first[iteration] == ports_spec.second[iteration]) {
if (is_inline) { if (is_inline) {
@ -1533,8 +1541,17 @@ uint32_t NapatechSetupTraffic(uint32_t first_stream, uint32_t last_stream)
} }
stream_spec = CONFIG_SPECIFIER_RANGE; stream_spec = CONFIG_SPECIFIER_RANGE;
ByteExtractStringUint8(&ports_spec.first[iteration], 10, 0, port->val); if (ByteExtractStringUint8(&ports_spec.first[iteration], 10, 0, port->val) == -1) {
ByteExtractStringUint8(&ports_spec.second[iteration], 10, 0, strchr(port->val, '-') + 1); FatalError("Invalid value '%s' in napatech.ports specification in conf file.",
port->val);
}
if (ByteExtractStringUint8(&ports_spec.second[iteration], 10, 0,
strchr(port->val, '-') + 1) == -1) {
FatalError("Invalid value '%s' in napatech.ports specification in conf file.",
port->val);
}
snprintf(ports_spec.str, sizeof (ports_spec.str), "(%d..%d)", ports_spec.first[iteration], ports_spec.second[iteration]); snprintf(ports_spec.str, sizeof (ports_spec.str), "(%d..%d)", ports_spec.first[iteration], ports_spec.second[iteration]);
} else { } else {
/* check that the sting in the config file is correctly specified */ /* check that the sting in the config file is correctly specified */
@ -1544,7 +1561,10 @@ uint32_t NapatechSetupTraffic(uint32_t first_stream, uint32_t last_stream)
} }
stream_spec = CONFIG_SPECIFIER_INDIVIDUAL; stream_spec = CONFIG_SPECIFIER_INDIVIDUAL;
ByteExtractStringUint8(&ports_spec.first[iteration], 10, 0, port->val); if (ByteExtractStringUint8(&ports_spec.first[iteration], 10, 0, port->val) == -1) {
FatalError("Invalid value '%s' in napatech.ports specification in conf file.",
port->val);
}
/* Determine the ports to use on the NTPL assign statement*/ /* Determine the ports to use on the NTPL assign statement*/
if (iteration == 0) { if (iteration == 0) {

Loading…
Cancel
Save