forked from qt-creator/qt-creator
Debugger: Fix array type element count extraction
Task-number: QTCREATORBUG-20639 Task-number: QTCREATORBUG-21677 Change-Id: I518ba2a8afde099535becd3af9bed4ded1b54644 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -105,9 +105,11 @@ static bool isArrayType(const std::string &typeName)
|
||||
static ULONG extractArraySize(const std::string &typeName, size_t openArrayPos = 0)
|
||||
{
|
||||
if (openArrayPos == 0)
|
||||
openArrayPos = typeName.find_last_of('[');
|
||||
const auto closeArrayPos = typeName.find_last_of(']');
|
||||
if (openArrayPos == std::string::npos || closeArrayPos == std::string::npos)
|
||||
openArrayPos = typeName.find_first_of('[');
|
||||
if (openArrayPos == std::string::npos)
|
||||
return 0;
|
||||
const auto closeArrayPos = typeName.find_first_of(']', openArrayPos);
|
||||
if (closeArrayPos == std::string::npos)
|
||||
return 0;
|
||||
const std::string arraySizeString = typeName.substr(openArrayPos + 1,
|
||||
closeArrayPos - openArrayPos - 1);
|
||||
|
Reference in New Issue
Block a user