|
|
@@ -5165,23 +5165,24 @@ void ResourceWatcherFSM::GetSystemProccess()
|
|
|
CSimpleStringA endStr = ",";
|
|
|
CSimpleStringA totalProcStr = "{";
|
|
|
|
|
|
- int uploadTime = 0;
|
|
|
- auto last_it = std::prev(processName.end());
|
|
|
+ int uploadTime = 0, procNo = 0;
|
|
|
+ int size = processName.size();
|
|
|
unordered_map<int, CSimpleStringA>::iterator it;
|
|
|
for (it = processName.begin(); it != processName.end(); ++it)
|
|
|
{
|
|
|
+ procNo++;
|
|
|
//"pid1":"name1"
|
|
|
curProcStr = CSimpleStringA("\"") + to_string(it->first).c_str() + "\":\"" + it->second + "\"";
|
|
|
len = totalProcStr.GetLength() + curProcStr.GetLength();
|
|
|
- if (len > 1000 || it == last_it)
|
|
|
+ if (len > 1000 || procNo == size)
|
|
|
{
|
|
|
endStr = "}";
|
|
|
uploadTime++;
|
|
|
- if (it == last_it)
|
|
|
+ if (procNo == size)
|
|
|
{
|
|
|
totalProcStr = totalProcStr + curProcStr + endStr;
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetSystemProccess")(totalProcStr.GetData());
|
|
|
- totalProcStr = "{";
|
|
|
+ break;
|
|
|
}
|
|
|
else
|
|
|
{
|