mirror of
https://github.com/jhuebert/MeshCore.git
synced 2026-12-03 10:54:13 +00:00
fix(filter): drop the text= branch the merged sender/text param left behind
Folding sender= and text= into one branch kept the original text= arm as unreachable code, and put the IvUnit enum between parseIvNum()'s comment and parseIvNum(). Both are caught by reading the diff rather than by a test.
This commit is contained in:
1 parent
b989434ca7
commit
ee9a8e0be5
1 file changed
+2
-6
@@ -623,13 +623,13 @@ void FilterRules::save(FILESYSTEM* fs) {
|
||||
|
||||
// ---------------------------------------------------------------- CLI
|
||||
|
||||
// interval value: hops/len = unsigned decimal; snr = signed dB (snapped to the
|
||||
// quarter-dB grid, stored as quarter-dB int)
|
||||
// Which scale an Interval's endpoints are written in (FilterRule::snr stores
|
||||
// quarter-dB steps in the same int16 pair hops/len use as plain counts).
|
||||
enum IvUnit { IV_UNSIGNED, // hops, len: plain decimal
|
||||
IV_SNR_DB }; // snr: signed dB, snapped to the quarter-dB grid
|
||||
|
||||
// interval value: hops/len = unsigned decimal; snr = signed dB (snapped to the
|
||||
// quarter-dB grid, stored as quarter-dB int)
|
||||
static bool parseIvNum(const char* s, IvUnit unit, uint16_t* out) {
|
||||
if (unit == IV_SNR_DB) {
|
||||
char* end;
|
||||
@@ -896,10 +896,6 @@ static bool addRuleParam(FilterRules& filter, FilterRule* r, RegionMap* regions,
|
||||
is_sender ? FILTER_SENDER_PATTERN_LEN : FILTER_TEXT_PATTERN_LEN,
|
||||
val, key, reply);
|
||||
}
|
||||
if (strcmp(key, "text") == 0) {
|
||||
if (val[0] == 0) { strcpy(reply, "Err - empty regex"); return false; } // matches everything
|
||||
return setPattern(r->text, FILTER_TEXT_PATTERN_LEN, val, "text", reply);
|
||||
}
|
||||
if (strcmp(key, "action") == 0) {
|
||||
if (strcmp(val, "drop") == 0) r->action = FILTER_ACT_DROP;
|
||||
else if (strcmp(val, "forward") == 0) r->action = FILTER_ACT_FORWARD;
|
||||
|
||||
Reference in new issue
Block a user