+ if (vl->type == ASN_OCTET_STR)
+ {
+ char *string;
+ char *endptr;
+
+ string = (char *) vl->val.string;
+ endptr = NULL;
+
+ if (string != NULL)
+ {
+ if (type == DS_TYPE_COUNTER)
+ ret.counter = (counter_t) strtoll (string, &endptr, /* base = */ 0);
+ else if (type == DS_TYPE_GAUGE)
+ ret.gauge = (gauge_t) strtod (string, &endptr);
+ }
+
+ /* Check if an error occurred */
+ if ((string == NULL) || (endptr == string))
+ {
+ if (type == DS_TYPE_COUNTER)
+ ret.counter = 0;
+ else if (type == DS_TYPE_GAUGE)
+ ret.gauge = NAN;
+ }
+ }
+ else if (type == DS_TYPE_COUNTER)