1. 修复SDK缓冲区问题

This commit is contained in:
coffee 2024-08-09 11:33:05 +08:00
parent 2e585032fe
commit 51f769587b

View File

@ -547,7 +547,7 @@ bool HDSDKPrivate::ParseReadData(const std::string &data)
return false; return false;
} }
std::string buff = detail::Mid(data, 0, len); std::string buff = detail::Mid(readBuff_, 0, len);
detail::Remove(readBuff_, 0, len); detail::Remove(readBuff_, 0, len);
bool result = true; bool result = true;
@ -636,8 +636,8 @@ bool HDSDKPrivate::ParseSDKCmdAnswer(std::string &&data)
sdkBuff_.append(data); sdkBuff_.append(data);
if (total <= sdkBuff_.size()) { if (total <= sdkBuff_.size()) {
std::string buff(std::move(sdkBuff_)); std::string buff(sdkBuff_.substr(0, total));
sdkBuff_.clear(); sdkBuff_ = sdkBuff_.substr(total);
ReadXml(buff, 0); ReadXml(buff, 0);
} }