Commit 5a4cd737 authored by Friedemann Kleint's avatar Friedemann Kleint Committed by hjk

CDB: Use maxStringLength parameter from settings.

Change-Id: I0969bbbc39863e0981b5af81feced10d0fbbecac
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 72421c18
......@@ -209,26 +209,30 @@ inline char toHexDigit(unsigned v)
}
// Strings from raw data.
std::wstring quotedWStringFromCharData(const unsigned char *data, size_t size)
std::wstring quotedWStringFromCharData(const unsigned char *data, size_t size, bool truncated)
{
std::wstring rc;
rc.reserve(size + 2);
rc.reserve(size + (truncated ? 5 : 2));
rc.push_back(L'"');
const unsigned char *end = data + size;
for ( ; data < end; data++)
rc.push_back(wchar_t(*data));
if (truncated)
rc.append(L"...");
rc.push_back(L'"');
return rc;
}
std::wstring quotedWStringFromWCharData(const unsigned char *dataIn, size_t sizeIn)
std::wstring quotedWStringFromWCharData(const unsigned char *dataIn, size_t sizeIn, bool truncated)
{
std::wstring rc;
const wchar_t *data = reinterpret_cast<const wchar_t *>(dataIn);
const size_t size = sizeIn / sizeof(wchar_t);
rc.reserve(size + 2);
rc.reserve(size + (truncated ? 5 : 2));
rc.push_back(L'"');
rc.append(data, data + size);
if (truncated)
rc.append(L"...");
rc.push_back(L'"');
return rc;
}
......
......@@ -176,8 +176,8 @@ std::string wStringToString(const std::wstring &w);
std::wstring stringToWString(const std::string &w);
// Strings from raw data.
std::wstring quotedWStringFromCharData(const unsigned char *data, size_t size);
std::wstring quotedWStringFromWCharData(const unsigned char *data, size_t size);
std::wstring quotedWStringFromCharData(const unsigned char *data, size_t size, bool truncated = false);
std::wstring quotedWStringFromWCharData(const unsigned char *data, size_t size, bool truncated = false);
// Helper for dumping memory
std::string dumpMemory(const unsigned char *data, size_t size, bool wantQuotes = true);
......
......@@ -1590,7 +1590,7 @@ static inline bool dumpQString(const SymbolGroupValue &v, std::wostream &str,
if (!typeArrayV)
return false;
if (!readQt5StringData(typeArrayV, qtInfo.version, true, position,
std::min(length, unsigned(10240)),
std::min(length, ExtensionContext::instance().parameters().maxStringLength),
&fullSize, &size, &memory))
return false;
if (size) {
......@@ -2302,9 +2302,12 @@ static bool dumpStd_W_String(const SymbolGroupValue &v, int type, std::wostream
// and MSVC2008 none
const SymbolGroupValue bx = SymbolGroupValue::findMember(v, "_Bx");
const int reserved = bx.parent()["_Myres"].intValue();
const int size = bx.parent()["_Mysize"].intValue();
int size = bx.parent()["_Mysize"].intValue();
if (!bx || reserved < 0 || size < 0)
return false;
const bool truncated = unsigned(size) > ExtensionContext::instance().parameters().maxStringLength;
if (truncated)
size = ExtensionContext::instance().parameters().maxStringLength;
// 'Buf' array for small strings, else pointer 'Ptr'.
const int bufSize = type == KT_StdString ? 16 : 8; // see basic_string.
const unsigned long memSize = type == KT_StdString ? size : 2 * size;
......@@ -2315,8 +2318,8 @@ static bool dumpStd_W_String(const SymbolGroupValue &v, int type, std::wostream
if (!memory)
return false;
str << (type == KT_StdString ?
quotedWStringFromCharData(memory, memSize) :
quotedWStringFromWCharData(memory, memSize));
quotedWStringFromCharData(memory, memSize, truncated) :
quotedWStringFromWCharData(memory, memSize, truncated));
if (memoryHandle)
*memoryHandle = new MemoryHandle(memory, memSize);
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment