+// Conversion from text to uint32_t, including a range check.
+// This is sigrok specific, _not_ part of any C++ standard library.
+static uint32_t stou32(const std::string &str)
+{
+ unsigned long ret;
+ errno = 0;
+ ret = stoul(str);
+ if (errno == ERANGE)
+ throw std::out_of_range("stou32");
+ if (ret > std::numeric_limits<uint32_t>::max())
+ throw std::out_of_range("stou32");
+ return ret;
+}
+