return NULL;
}
- /* means we have a non empty string
- * which does not contain a delimiter */
- if (split[1] == NULL) {
- g_strfreev(split);
- return NULL;
- }
-
rng = (range_pair_t *)g_malloc(sizeof(range_pair_t));
- /* string == "X-?" */
- if (*(split[0]) != '\0') {
+ if (split[1] == NULL) {
+ /* means we have a non empty string with no delimiter
+ * so it must be a single number */
rng->floor = (gint)strtol(split[0],NULL,10);
- } else
- /* string == "-?" */
- rng->floor = G_MININT;
-
- /* string != "?-" */
- if (*(split[1]) != '\0') {
- rng->ceil = (gint)strtol(split[1],NULL,10);
- } else
- /* string == "?-" */
- rng->ceil = G_MAXINT;
-
+ rng->ceil = rng->floor;
+ } else {
+ /* string == "X-?" */
+ if (*(split[0]) != '\0') {
+ rng->floor = (gint)strtol(split[0],NULL,10);
+ } else
+ /* string == "-?" */
+ rng->floor = G_MININT;
+
+ /* string != "?-" */
+ if (*(split[1]) != '\0') {
+ rng->ceil = (gint)strtol(split[1],NULL,10);
+ } else
+ /* string == "?-" */
+ rng->ceil = G_MAXINT;
+ }
g_strfreev(split);
return rng;
return n;
}
+static void
+uat_plen_record_update_cb(void *r, const char **err)
+{
+ uat_plen_record_t *rec = (uat_plen_record_t*)r;
+ if (rec->packet_range->nranges < 1) {
+ *err = ep_strdup_printf("Invalid range string");
+ return;
+ }
+
+ *err = NULL;
+}
+
static void uat_plen_record_free_cb(void*r) {
uat_plen_record_t* record = (uat_plen_record_t*)r;
0, /* not a dissector, so affects neither dissection nor fields */
NULL, /* help */
uat_plen_record_copy_cb, /* copy callback */
- NULL, /* update callback */
+ uat_plen_record_update_cb, /* update callback */
uat_plen_record_free_cb, /* free callback */
uat_plen_record_post_update_cb, /* post update callback */
plen_uat_flds); /* UAT field definitions */