fix compile problem of some gcc compiler:dynamic array can't be initialized where defined

This commit is contained in:
huiyongchen 2019-05-16 11:18:33 +08:00
parent a0afa4ca1a
commit 7154194106

View File

@ -645,7 +645,8 @@ void ServantHandle::processTracking(const TarsCurrentPtr &current)
{ {
TLOGINFO("[TARS] servant got a tracking request, tracking key:" << trackinfoIter->second << endl); TLOGINFO("[TARS] servant got a tracking request, tracking key:" << trackinfoIter->second << endl);
string context = trackinfoIter->second; string context = trackinfoIter->second;
char szBuffer[context.size() + 1] = {0}; char szBuffer[context.size() + 1];
memset(szBuffer, 0x00, context.size() + 1);
memcpy(szBuffer, context.c_str(), context.size()); memcpy(szBuffer, context.c_str(), context.size());
std::unordered_map<std::string, std::string> text_map; std::unordered_map<std::string, std::string> text_map;