You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @brief Converts a string view to an integral value of type T.
63
+
*
64
+
* This function attempts to parse a string representation of a number into an integer of the specified integral type T.
65
+
* It performs validation to ensure the string is a valid representation of a number within the range of the target type and checks for overflow or invalid input.
66
+
*
67
+
* @tparam T The integral type to which the string should be converted.
68
+
* @param[in] str The input string view representing the number.
69
+
* @param[out] out The reference where the converted value will be stored, if successful.
70
+
* @return true if the conversion was successful and `out` contains the parsed value.
71
+
* @return false if the conversion failed due to invalid input, overflow, or out-of-range value.
72
+
*
73
+
* @note The function handles both signed and unsigned types, for signed types, it processes negative numbers correctly.
74
+
* @note It also validates the input for edge cases like empty strings, leading zeros, or excessive length.
75
+
*
76
+
* @warning Ensure the input string is sanitized if sourced from untrusted input, as this function does not strip whitespace or handle non-numeric characters beyond validation.
OS_LOGD(TAG, "Update requested for version %s", version.toString().c_str()); // TODO: This is abusing the SemVer::toString() method causing alot of string copies, fix this
OS_LOGD(TAG, "Remote version: %s", version.toString().c_str()); // TODO: This is abusing the SemVer::toString() method causing alot of string copies, fix this
335
331
}
336
332
337
-
if (version.toString() == OPENSHOCK_FW_VERSION) { // TODO: This is abusing the SemVer::toString() method causing alot of string copies, fix this
333
+
std::string versionStr = version.toString(); // TODO: This is abusing the SemVer::toString() method causing alot of string copies, fix this
334
+
335
+
if (versionStr == OPENSHOCK_FW_VERSION ""sv) {
338
336
OS_LOGI(TAG, "Requested version is already installed");
339
337
continue;
340
338
}
341
339
340
+
OS_LOGD(TAG, "Updating to version: %.*s", versionStr.length(), versionStr.data());
OS_LOGD(TAG, " Version: %s", version.toString().c_str());// TODO: This is abusing the SemVer::toString() method causing alot of string copies, fix this
0 commit comments