Merge "Resupport long compare"
diff --git a/cmds/statsd/src/matchers/matcher_util.cpp b/cmds/statsd/src/matchers/matcher_util.cpp
index 944764b..4612009 100644
--- a/cmds/statsd/src/matchers/matcher_util.cpp
+++ b/cmds/statsd/src/matchers/matcher_util.cpp
@@ -233,6 +233,11 @@
(matcher.eq_int() == values[i].mValue.int_value)) {
return true;
}
+ // eq_int covers both int and long.
+ if (values[i].mValue.getType() == LONG &&
+ (matcher.eq_int() == values[i].mValue.long_value)) {
+ return true;
+ }
}
return false;
case FieldValueMatcher::ValueMatcherCase::kLtInt:
@@ -241,6 +246,11 @@
(values[i].mValue.int_value < matcher.lt_int())) {
return true;
}
+ // lt_int covers both int and long.
+ if (values[i].mValue.getType() == LONG &&
+ (values[i].mValue.long_value < matcher.lt_int())) {
+ return true;
+ }
}
return false;
case FieldValueMatcher::ValueMatcherCase::kGtInt:
@@ -249,6 +259,11 @@
(values[i].mValue.int_value > matcher.gt_int())) {
return true;
}
+ // gt_int covers both int and long.
+ if (values[i].mValue.getType() == LONG &&
+ (values[i].mValue.long_value > matcher.gt_int())) {
+ return true;
+ }
}
return false;
case FieldValueMatcher::ValueMatcherCase::kLtFloat:
@@ -273,6 +288,11 @@
(values[i].mValue.int_value <= matcher.lte_int())) {
return true;
}
+ // lte_int covers both int and long.
+ if (values[i].mValue.getType() == LONG &&
+ (values[i].mValue.long_value <= matcher.lte_int())) {
+ return true;
+ }
}
return false;
case FieldValueMatcher::ValueMatcherCase::kGteInt:
@@ -281,6 +301,11 @@
(values[i].mValue.int_value >= matcher.gte_int())) {
return true;
}
+ // gte_int covers both int and long.
+ if (values[i].mValue.getType() == LONG &&
+ (values[i].mValue.long_value >= matcher.gte_int())) {
+ return true;
+ }
}
return false;
default: