更新 src/tencent_cos.cpp
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
#include "cos_api.h"
|
#include "cos_api.h"
|
||||||
#include "cos_http_io.h"
|
#include "cos_http_io.h"
|
||||||
#include "cos_log.h"
|
#include "cos_log.h"
|
||||||
|
static int inited = 0;
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DLL_EXPORT
|
DLL_EXPORT
|
||||||
@@ -17,14 +18,18 @@ extern "C" {
|
|||||||
|
|
||||||
module::tencent_cos::tencent_cos()
|
module::tencent_cos::tencent_cos()
|
||||||
{
|
{
|
||||||
if (cos_http_io_initialize(NULL, 0) != COSE_OK) {
|
if(inited == 0){
|
||||||
printf("COS HTTP INIT FAILED");
|
if (cos_http_io_initialize(NULL, 0) != COSE_OK) {
|
||||||
|
printf("COS HTTP INIT FAILED");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
inited = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module::tencent_cos::~tencent_cos()
|
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)
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user