This commit is contained in:
luoliangyi 2022-12-26 10:16:59 +08:00
parent cac3f6cabb
commit dcc86888b2
1 changed files with 4 additions and 16 deletions

View File

@ -1593,7 +1593,7 @@ HGResult HGPdtToolDbDeviceImpl::UploadEntryImage(HGUInt entryName, const HGChar*
{
HGChar uuid[256];
HGBase_GetUuid(uuid, 256);
remotePath = std::string("/upload/") + uuid + ".jpg";
remotePath = std::string("/upload/") + uuid;
}
res = UploadFile(ftpHost, ftpPort, fileName, remotePath.c_str());
@ -1777,19 +1777,7 @@ HGResult HGPdtToolDbDeviceImpl::GetEntryImageRemotePath(const HGChar* entryNameS
static size_t read_callback(char* ptr, size_t size, size_t nmemb, void* stream)
{
unsigned long nread;
/* in real-world cases, this would probably get this data differently
as this fread() stuff is exactly what the library already would do
by default internally */
size_t retcode = fread(ptr, size, nmemb, (FILE*)stream);
if (retcode > 0)
{
nread = (unsigned long)retcode;
//fprintf(stderr, "*** We read %lu bytes from file\n", nread);
}
return retcode;
return fread(ptr, size, nmemb, (FILE*)stream);
}
static int read_xferinfo(void* p, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
@ -1812,7 +1800,7 @@ HGResult HGPdtToolDbDeviceImpl::UploadFile(const HGChar* host, HGUShort port, co
HGResult ret = HGBASE_ERR_FAIL;
fseek(file, 0, SEEK_END);
long fsize = ftell(file);
long fSize = ftell(file);
fseek(file, 0, SEEK_SET);
/* get a curl handle */
@ -1837,7 +1825,7 @@ HGResult HGPdtToolDbDeviceImpl::UploadFile(const HGChar* host, HGUShort port, co
option you MUST make sure that the type of the passed-in argument is a
curl_off_t. If you use CURLOPT_INFILESIZE (without _LARGE) you must
make sure that to pass in a type 'long' argument. */
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)fsize);
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)fSize);
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, read_xferinfo);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);