更新 src/tencent_cos.cpp

This commit is contained in:
2025-12-30 12:04:04 +08:00
parent 66343055b3
commit 6e72d68166

View File

@@ -3,6 +3,7 @@
#include "cos_api.h"
#include "cos_http_io.h"
#include "cos_log.h"
static int inited = 0;
extern "C" {
#ifdef _WIN32
DLL_EXPORT
@@ -17,14 +18,18 @@ extern "C" {
module::tencent_cos::tencent_cos()
{
if (cos_http_io_initialize(NULL, 0) != COSE_OK) {
printf("COS HTTP INIT FAILED");
if(inited == 0){
if (cos_http_io_initialize(NULL, 0) != COSE_OK) {
printf("COS HTTP INIT FAILED");
return;
}
inited = 1;
}
}
module::tencent_cos::~tencent_cos()
{
cos_http_io_deinitialize();
// cos_http_io_deinitialize();
}
std::string module::tencent_cos::upfile(const std::string& appid,const std::string& endpoint,const std::string& access_key_id,const std::string& access_key_secret,const std::string& bucket_name,const std::string& object_name,const std::string& filepath)