mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge pull request #17352 from egorpugin:patch-2
* Fix integer overflow in parseOption(). Previous code does not work for values like 100000MB. * Fix warning during 32-bit build on inactive code path. * fix build without C++11
This commit is contained in:
@@ -1961,7 +1961,11 @@ inline size_t parseOption(const std::string &value)
|
||||
}
|
||||
cv::String valueStr = value.substr(0, pos);
|
||||
cv::String suffixStr = value.substr(pos, value.length() - pos);
|
||||
int v = atoi(valueStr.c_str());
|
||||
#ifdef CV_CXX11
|
||||
size_t v = (size_t)std::stoull(valueStr);
|
||||
#else
|
||||
size_t v = (size_t)atol(valueStr.c_str());
|
||||
#endif
|
||||
if (suffixStr.length() == 0)
|
||||
return v;
|
||||
else if (suffixStr == "MB" || suffixStr == "Mb" || suffixStr == "mb")
|
||||
|
||||
Reference in New Issue
Block a user