HGGitLab

Commit 80071439 authored by luoliangyi's avatar luoliangyi

webservice:解决拆分图像返回不正确的问题

parent 901b96d2
......@@ -589,7 +589,8 @@ bool HttpUser::SendResponse(const char* httpVersion, HGUInt errCode, const char*
HGBase_EnterLock(m_cs);
send(m_sockConn, response, (int)strlen(response), 0);
send(m_sockConn, head, (int)strlen(head), 0);
send(m_sockConn, (const char *)data, (int)size, 0);
if (NULL != data && 0 != size)
send(m_sockConn, (const char *)data, (int)size, 0);
HGBase_LeaveLock(m_cs);
return true;
}
......@@ -192,6 +192,7 @@ bool Manager::GetImageByDevId(const std::string& devId, std::vector<std::string>
}
}
SaveFileNameList(devId, imgNameList);
return true;
}
......@@ -396,7 +397,11 @@ bool Manager::ExportZipFile(HGByte** data, HGUInt* size)
HGImage img = NULL;
std::string fileName = filePath + fileNameList[i];
#if defined(HG_CMP_MSC)
zip_source_t* s = zip_source_file(z, AnsiToUtf8(fileName.c_str()).c_str(), 0, 0);
#else
zip_source_t* s = zip_source_file(z, fileName.c_str(), 0, 0);
#endif
if (NULL != s)
{
if (zip_file_add(z, fileNameList[i].c_str(), s, ZIP_FL_OVERWRITE) >= 0)
......@@ -583,7 +588,7 @@ bool Manager::MergeImage(const std::string& devId, bool isHorizontal, const std:
static bool LowerSort(const std::string &str1, const std::string& str2)
{
return str1 < str2;
return atoi(str1.c_str()) < atoi(str2.c_str());
}
bool Manager::BookSort(const std::string& devId, std::vector<std::string>& imgNameList,
......@@ -591,8 +596,8 @@ bool Manager::BookSort(const std::string& devId, std::vector<std::string>& imgNa
{
std::vector<std::string> fileNameList = GetFileNameList(devId);
std::sort(fileNameList.begin(), fileNameList.end(), LowerSort);
SaveFileNameList(devId, fileNameList);
return GetImageByDevId(devId, imgNameList, imgBase64List);
}
......@@ -626,7 +631,7 @@ bool Manager::ResetPatchIndex()
}
bool Manager::SplitImage(const std::string& devId, const std::string& imgName, bool isHorizontal, int x1, int y1, int x2, int y2,
std::string imgName1, std::string imgBase64_1, std::string imgName2, std::string imgBase64_2)
std::string& imgName1, std::string& imgBase64_1, std::string& imgName2, std::string& imgBase64_2)
{
imgName1.clear();
imgBase64_1.clear();
......
......@@ -78,7 +78,7 @@ public:
bool ResetPatchIndex();
// 拆分图像
bool SplitImage(const std::string& devId, const std::string& imgName, bool isHorizontal, int x1, int y1, int x2, int y2,
std::string imgName1, std::string imgBase64_1, std::string imgName2, std::string imgBase64_2);
std::string& imgName1, std::string& imgBase64_1, std::string& imgName2, std::string& imgBase64_2);
// 获取设备序列号
bool GetDevSerialNo(const std::string& devId, std::string& serialNo);
// 获取图像Base64
......
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