mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-06-13 14:22:23 +00:00
Fixed errors reported by cppcheck 2.8 (#1949)
This commit is contained in:
parent
d75c6d6538
commit
92fd5bc3e1
|
@ -63,7 +63,7 @@ bool BodyData::Resize(size_t addbytes)
|
|||
}
|
||||
// realloc
|
||||
char* newtext;
|
||||
if(NULL == (newtext = (char*)realloc(text, (bufsize + need_size)))){
|
||||
if(NULL == (newtext = reinterpret_cast<char*>(realloc(text, (bufsize + need_size))))){
|
||||
S3FS_PRN_CRIT("not enough memory (realloc returned NULL)");
|
||||
free(text);
|
||||
text = NULL;
|
||||
|
|
43
src/curl.cpp
43
src/curl.cpp
|
@ -399,11 +399,11 @@ bool S3fsCurl::InitMimeType(const std::string& strFile)
|
|||
}
|
||||
S3FS_PRN_DBG("Try to load mime types from %s file.", MimeFile.c_str());
|
||||
|
||||
std::string line;
|
||||
std::ifstream MT(MimeFile.c_str());
|
||||
if(MT.good()){
|
||||
S3FS_PRN_DBG("The old mime types are cleared to load new mime types.");
|
||||
S3fsCurl::mimeTypes.clear();
|
||||
std::string line;
|
||||
|
||||
while(getline(MT, line)){
|
||||
if(line.empty()){
|
||||
|
@ -645,7 +645,7 @@ size_t S3fsCurl::UploadReadCallback(void* ptr, size_t size, size_t nmemb, void*
|
|||
ssize_t totalread;
|
||||
// read and set
|
||||
for(totalread = 0, readbytes = 0; totalread < copysize; totalread += readbytes){
|
||||
readbytes = pread(pCurl->partdata.fd, &((char*)ptr)[totalread], (copysize - totalread), pCurl->partdata.startpos + totalread);
|
||||
readbytes = pread(pCurl->partdata.fd, &(static_cast<char*>(ptr))[totalread], (copysize - totalread), pCurl->partdata.startpos + totalread);
|
||||
if(0 == readbytes){
|
||||
// eof
|
||||
break;
|
||||
|
@ -684,7 +684,7 @@ size_t S3fsCurl::DownloadWriteCallback(void* ptr, size_t size, size_t nmemb, voi
|
|||
|
||||
// write
|
||||
for(totalwrite = 0, writebytes = 0; totalwrite < copysize; totalwrite += writebytes){
|
||||
writebytes = pwrite(pCurl->partdata.fd, &((char*)ptr)[totalwrite], (copysize - totalwrite), pCurl->partdata.startpos + totalwrite);
|
||||
writebytes = pwrite(pCurl->partdata.fd, &(static_cast<char*>(ptr))[totalwrite], (copysize - totalwrite), pCurl->partdata.startpos + totalwrite);
|
||||
if(0 == writebytes){
|
||||
// eof?
|
||||
break;
|
||||
|
@ -792,7 +792,7 @@ bool S3fsCurl::PushbackSseKeys(const std::string& input)
|
|||
char* p_key;
|
||||
size_t keylength;
|
||||
|
||||
if(NULL != (p_key = (char *)s3fs_decode64(onekey.c_str(), onekey.size(), &keylength))) {
|
||||
if(NULL != (p_key = reinterpret_cast<char*>(s3fs_decode64(onekey.c_str(), onekey.size(), &keylength)))) {
|
||||
raw_key = std::string(p_key, keylength);
|
||||
base64_key = onekey;
|
||||
delete[] p_key;
|
||||
|
@ -803,7 +803,7 @@ bool S3fsCurl::PushbackSseKeys(const std::string& input)
|
|||
} else {
|
||||
char* pbase64_key;
|
||||
|
||||
if(NULL != (pbase64_key = s3fs_base64((unsigned char*)onekey.c_str(), onekey.length()))) {
|
||||
if(NULL != (pbase64_key = s3fs_base64(reinterpret_cast<unsigned char*>(const_cast<char*>(onekey.c_str())), onekey.length()))) {
|
||||
raw_key = onekey;
|
||||
base64_key = pbase64_key;
|
||||
delete[] pbase64_key;
|
||||
|
@ -929,6 +929,9 @@ bool S3fsCurl::LoadEnvSseCKeys()
|
|||
while(getline(fullkeys, onekey, ':')){
|
||||
S3fsCurl::PushbackSseKeys(onekey);
|
||||
}
|
||||
|
||||
// cppcheck-suppress unmatchedSuppression
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if(S3fsCurl::sseckeys.empty()){
|
||||
S3FS_PRN_ERR("There is no SSE Key in environment(AWSSSECKEYS=%s).", envkeys);
|
||||
return false;
|
||||
|
@ -1538,7 +1541,7 @@ bool S3fsCurl::UploadMultipartPostSetCurlOpts(S3fsCurl* s3fscurl)
|
|||
if(CURLE_OK != curl_easy_setopt(s3fscurl->hCurl, CURLOPT_READFUNCTION, UploadReadCallback)){
|
||||
return false;
|
||||
}
|
||||
if(CURLE_OK != curl_easy_setopt(s3fscurl->hCurl, CURLOPT_READDATA, (void*)s3fscurl)){
|
||||
if(CURLE_OK != curl_easy_setopt(s3fscurl->hCurl, CURLOPT_READDATA, reinterpret_cast<void*>(s3fscurl))){
|
||||
return false;
|
||||
}
|
||||
if(!S3fsCurl::AddUserAgent(s3fscurl->hCurl)){ // put User-Agent
|
||||
|
@ -1600,7 +1603,7 @@ bool S3fsCurl::PreGetObjectRequestSetCurlOpts(S3fsCurl* s3fscurl)
|
|||
if(CURLE_OK != curl_easy_setopt(s3fscurl->hCurl, CURLOPT_WRITEFUNCTION, DownloadWriteCallback)){
|
||||
return false;
|
||||
}
|
||||
if(CURLE_OK != curl_easy_setopt(s3fscurl->hCurl, CURLOPT_WRITEDATA, (void*)s3fscurl)){
|
||||
if(CURLE_OK != curl_easy_setopt(s3fscurl->hCurl, CURLOPT_WRITEDATA, reinterpret_cast<void*>(s3fscurl))){
|
||||
return false;
|
||||
}
|
||||
if(!S3fsCurl::AddUserAgent(s3fscurl->hCurl)){ // put User-Agent
|
||||
|
@ -1707,10 +1710,10 @@ int S3fsCurl::RawCurlDebugFunc(const CURL* hcurl, curl_infotype type, char* data
|
|||
remaining = size;
|
||||
p = data;
|
||||
do {
|
||||
char* eol = (char*)memchr(p, '\n', remaining);
|
||||
char* eol = reinterpret_cast<char*>(memchr(p, '\n', remaining));
|
||||
int newline = 0;
|
||||
if (eol == NULL) {
|
||||
eol = (char*)memchr(p, '\r', remaining);
|
||||
eol = reinterpret_cast<char*>(memchr(p, '\r', remaining));
|
||||
} else {
|
||||
if (eol > p && *(eol - 1) == '\r') {
|
||||
newline++;
|
||||
|
@ -2083,7 +2086,7 @@ bool S3fsCurl::RemakeHandle()
|
|||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, S3fsCurl::DownloadWriteCallback)){
|
||||
return false;
|
||||
}
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, (void*)this)){
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, reinterpret_cast<void*>(this))){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
@ -2146,7 +2149,7 @@ bool S3fsCurl::RemakeHandle()
|
|||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_POSTFIELDSIZE, static_cast<curl_off_t>(postdata_remaining))){
|
||||
return false;
|
||||
}
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_READDATA, (void*)this)){
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_READDATA, reinterpret_cast<void*>(this))){
|
||||
return false;
|
||||
}
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_READFUNCTION, S3fsCurl::ReadCallback)){
|
||||
|
@ -2179,7 +2182,7 @@ bool S3fsCurl::RemakeHandle()
|
|||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_READFUNCTION, S3fsCurl::UploadReadCallback)){
|
||||
return false;
|
||||
}
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_READDATA, (void*)this)){
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_READDATA, reinterpret_cast<void*>(this))){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
@ -2237,7 +2240,7 @@ bool S3fsCurl::RemakeHandle()
|
|||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_POSTFIELDSIZE, static_cast<curl_off_t>(postdata_remaining))){
|
||||
return false;
|
||||
}
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_READDATA, (void*)this)){
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_READDATA, reinterpret_cast<void*>(this))){
|
||||
return false;
|
||||
}
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_READFUNCTION, S3fsCurl::ReadCallback)){
|
||||
|
@ -2904,7 +2907,7 @@ bool S3fsCurl::GetIAMCredentials(const char* cred_url, const char* iam_v2_token,
|
|||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_POSTFIELDSIZE, static_cast<curl_off_t>(postdata_remaining))){
|
||||
return false;
|
||||
}
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_READDATA, (void*)this)){
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_READDATA, reinterpret_cast<void*>(this))){
|
||||
return false;
|
||||
}
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_READFUNCTION, S3fsCurl::ReadCallback)){
|
||||
|
@ -3291,8 +3294,8 @@ int S3fsCurl::PutRequest(const char* tpath, headers_t& meta, int fd)
|
|||
bodydata.Clear();
|
||||
|
||||
// Make request headers
|
||||
std::string strMD5;
|
||||
if(S3fsCurl::is_content_md5){
|
||||
std::string strMD5;
|
||||
if(-1 != fd){
|
||||
strMD5 = s3fs_get_content_md5(fd);
|
||||
if(0 == strMD5.length()){
|
||||
|
@ -3331,9 +3334,9 @@ int S3fsCurl::PutRequest(const char* tpath, headers_t& meta, int fd)
|
|||
requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-storage-class", GetStorageClass().c_str());
|
||||
}
|
||||
// SSE
|
||||
std::string ssevalue;
|
||||
// do not add SSE for create bucket
|
||||
if(0 != strcmp(tpath, "/")){
|
||||
std::string ssevalue;
|
||||
if(!AddSseRequestHead(S3fsCurl::GetSseType(), ssevalue, false, false)){
|
||||
S3FS_PRN_WARN("Failed to set SSE header, but continue...");
|
||||
}
|
||||
|
@ -3445,13 +3448,13 @@ int S3fsCurl::GetObjectRequest(const char* tpath, int fd, off_t start, off_t siz
|
|||
if(!tpath){
|
||||
return -EINVAL;
|
||||
}
|
||||
sse_type_t ssetype = sse_type_t::SSE_DISABLE;
|
||||
sse_type_t local_ssetype = sse_type_t::SSE_DISABLE;
|
||||
std::string ssevalue;
|
||||
if(!get_object_sse_type(tpath, ssetype, ssevalue)){
|
||||
if(!get_object_sse_type(tpath, local_ssetype, ssevalue)){
|
||||
S3FS_PRN_WARN("Failed to get SSE type for file(%s).", SAFESTRPTR(tpath));
|
||||
}
|
||||
|
||||
if(0 != (result = PreGetObjectRequest(tpath, fd, start, size, ssetype, ssevalue))){
|
||||
if(0 != (result = PreGetObjectRequest(tpath, fd, start, size, local_ssetype, ssevalue))){
|
||||
return result;
|
||||
}
|
||||
if(!fpLazySetup || !fpLazySetup(this)){
|
||||
|
@ -3759,7 +3762,7 @@ int S3fsCurl::CompleteMultipartPostRequest(const char* tpath, const std::string&
|
|||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_POSTFIELDSIZE, static_cast<curl_off_t>(postdata_remaining))){
|
||||
return -EIO;
|
||||
}
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_READDATA, (void*)this)){
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_READDATA, reinterpret_cast<void*>(this))){
|
||||
return -EIO;
|
||||
}
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_READFUNCTION, S3fsCurl::ReadCallback)){
|
||||
|
|
|
@ -337,17 +337,17 @@ void* S3fsMultiCurl::RequestPerformWrapper(void* arg)
|
|||
S3fsCurl* s3fscurl= static_cast<S3fsCurl*>(arg);
|
||||
void* result = NULL;
|
||||
if(!s3fscurl){
|
||||
return (void*)(intptr_t)(-EIO);
|
||||
return reinterpret_cast<void*>(static_cast<intptr_t>(-EIO));
|
||||
}
|
||||
if(s3fscurl->fpLazySetup){
|
||||
if(!s3fscurl->fpLazySetup(s3fscurl)){
|
||||
S3FS_PRN_ERR("Failed to lazy setup, then respond EIO.");
|
||||
result = (void*)(intptr_t)(-EIO);
|
||||
result = reinterpret_cast<void*>(static_cast<intptr_t>(-EIO));
|
||||
}
|
||||
}
|
||||
|
||||
if(!result){
|
||||
result = (void*)(intptr_t)(s3fscurl->RequestPerform());
|
||||
result = reinterpret_cast<void*>(static_cast<intptr_t>(s3fscurl->RequestPerform()));
|
||||
s3fscurl->DestroyCurlHandle(true, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ static bool is_special_name_folder_object(const char* path)
|
|||
//
|
||||
static int chk_dir_object_type(const char* path, std::string& newpath, std::string& nowpath, std::string& nowcache, headers_t* pmeta, dirtype* pDirType)
|
||||
{
|
||||
dirtype TypeTmp;
|
||||
dirtype TypeTmp = DIRTYPE_UNKNOWN;
|
||||
int result = -1;
|
||||
bool isforce = false;
|
||||
dirtype* pType = pDirType ? pDirType : &TypeTmp;
|
||||
|
@ -2767,10 +2767,10 @@ static int list_bucket(const char* path, S3ObjList& head, const char* delimiter,
|
|||
if(true == (truncated = is_truncated(doc))){
|
||||
xmlChar* tmpch;
|
||||
if(NULL != (tmpch = get_next_continuation_token(doc))){
|
||||
next_continuation_token = (char*)tmpch;
|
||||
next_continuation_token = reinterpret_cast<char*>(tmpch);
|
||||
xmlFree(tmpch);
|
||||
}else if(NULL != (tmpch = get_next_marker(doc))){
|
||||
next_marker = (char*)tmpch;
|
||||
next_marker = reinterpret_cast<char*>(tmpch);
|
||||
xmlFree(tmpch);
|
||||
}
|
||||
|
||||
|
@ -3650,7 +3650,7 @@ static bool set_mountpoint_attribute(struct stat& mpst)
|
|||
//
|
||||
static int set_bucket(const char* arg)
|
||||
{
|
||||
char *bucket_name = (char*)arg;
|
||||
char *bucket_name = const_cast<char*>(arg);
|
||||
if(strstr(arg, ":")){
|
||||
if(strstr(arg, "://")){
|
||||
S3FS_PRN_EXIT("bucket name and path(\"%s\") is wrong, it must be \"bucket[:/path]\".", arg);
|
||||
|
|
|
@ -172,7 +172,7 @@ int is_uid_include_group(uid_t uid, gid_t gid)
|
|||
//-------------------------------------------------------------------
|
||||
std::string mydirname(const std::string& path)
|
||||
{
|
||||
return std::string(dirname((char*)path.c_str()));
|
||||
return std::string(dirname(const_cast<char*>(path.c_str())));
|
||||
}
|
||||
|
||||
// safe variant of dirname
|
||||
|
@ -187,7 +187,7 @@ std::string mydirname(const char* path)
|
|||
|
||||
std::string mybasename(const std::string& path)
|
||||
{
|
||||
return std::string(basename((char*)path.c_str()));
|
||||
return std::string(basename(const_cast<char*>(path.c_str())));
|
||||
}
|
||||
|
||||
// safe variant of basename
|
||||
|
|
|
@ -66,7 +66,7 @@ static bool GetXmlNsUrl(xmlDocPtr doc, std::string& nsurl)
|
|||
if(nslist[0] && nslist[0]->href){
|
||||
int len = xmlStrlen(nslist[0]->href);
|
||||
if(0 < len){
|
||||
strNs = std::string((const char*)(nslist[0]->href), len);
|
||||
strNs = std::string(reinterpret_cast<const char*>(nslist[0]->href), len);
|
||||
}
|
||||
}
|
||||
S3FS_XMLFREE(nslist);
|
||||
|
@ -94,7 +94,7 @@ static xmlChar* get_base_exp(xmlDocPtr doc, const char* exp)
|
|||
xmlXPathContextPtr ctx = xmlXPathNewContext(doc);
|
||||
|
||||
if(!noxmlns && GetXmlNsUrl(doc, xmlnsurl)){
|
||||
xmlXPathRegisterNs(ctx, (xmlChar*)"s3", (xmlChar*)xmlnsurl.c_str());
|
||||
xmlXPathRegisterNs(ctx, reinterpret_cast<xmlChar*>(const_cast<char*>("s3")), reinterpret_cast<xmlChar*>(const_cast<char*>(xmlnsurl.c_str())));
|
||||
exp_string = "/s3:ListBucketResult/s3:";
|
||||
} else {
|
||||
exp_string = "/ListBucketResult/";
|
||||
|
@ -102,7 +102,7 @@ static xmlChar* get_base_exp(xmlDocPtr doc, const char* exp)
|
|||
|
||||
exp_string += exp;
|
||||
|
||||
if(NULL == (marker_xp = xmlXPathEvalExpression((xmlChar *)exp_string.c_str(), ctx))){
|
||||
if(NULL == (marker_xp = xmlXPathEvalExpression(reinterpret_cast<xmlChar*>(const_cast<char*>(exp_string.c_str())), ctx))){
|
||||
xmlXPathFreeContext(ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -148,14 +148,14 @@ static char* get_object_name(xmlDocPtr doc, xmlNodePtr node, const char* path)
|
|||
return NULL;
|
||||
}
|
||||
// basepath(path) is as same as fullpath.
|
||||
if(0 == strcmp((char*)fullpath, path)){
|
||||
if(0 == strcmp(reinterpret_cast<char*>(fullpath), path)){
|
||||
xmlFree(fullpath);
|
||||
return (char*)c_strErrorObjectName;
|
||||
}
|
||||
|
||||
// Make dir path and filename
|
||||
std::string strdirpath = mydirname(std::string((char*)fullpath));
|
||||
std::string strmybpath = mybasename(std::string((char*)fullpath));
|
||||
std::string strdirpath = mydirname(std::string(reinterpret_cast<char*>(fullpath)));
|
||||
std::string strmybpath = mybasename(std::string(reinterpret_cast<char*>(fullpath)));
|
||||
const char* dirpath = strdirpath.c_str();
|
||||
const char* mybname = strmybpath.c_str();
|
||||
const char* basepath= (path && '/' == path[0]) ? &path[1] : path;
|
||||
|
@ -217,7 +217,7 @@ static xmlChar* get_exp_value_xml(xmlDocPtr doc, xmlXPathContextPtr ctx, const c
|
|||
xmlChar* exp_value;
|
||||
|
||||
// search exp_key tag
|
||||
if(NULL == (exp = xmlXPathEvalExpression((xmlChar*)exp_key, ctx))){
|
||||
if(NULL == (exp = xmlXPathEvalExpression(reinterpret_cast<xmlChar*>(const_cast<char*>(exp_key)), ctx))){
|
||||
S3FS_PRN_ERR("Could not find key(%s).", exp_key);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ bool get_incomp_mpu_list(xmlDocPtr doc, incomp_mpu_list_t& list)
|
|||
std::string ex_date;
|
||||
|
||||
if(!noxmlns && GetXmlNsUrl(doc, xmlnsurl)){
|
||||
xmlXPathRegisterNs(ctx, (xmlChar*)"s3", (xmlChar*)xmlnsurl.c_str());
|
||||
xmlXPathRegisterNs(ctx, reinterpret_cast<xmlChar*>(const_cast<char*>("s3")), reinterpret_cast<xmlChar*>(const_cast<char*>(xmlnsurl.c_str())));
|
||||
ex_upload += "s3:";
|
||||
ex_key += "s3:";
|
||||
ex_id += "s3:";
|
||||
|
@ -266,7 +266,7 @@ bool get_incomp_mpu_list(xmlDocPtr doc, incomp_mpu_list_t& list)
|
|||
|
||||
// get "Upload" Tags
|
||||
xmlXPathObjectPtr upload_xp;
|
||||
if(NULL == (upload_xp = xmlXPathEvalExpression((xmlChar*)ex_upload.c_str(), ctx))){
|
||||
if(NULL == (upload_xp = xmlXPathEvalExpression(reinterpret_cast<xmlChar*>(const_cast<char*>(ex_upload.c_str())), ctx))){
|
||||
S3FS_PRN_ERR("xmlXPathEvalExpression returns null.");
|
||||
return false;
|
||||
}
|
||||
|
@ -291,26 +291,26 @@ bool get_incomp_mpu_list(xmlDocPtr doc, incomp_mpu_list_t& list)
|
|||
if(NULL == (ex_value = get_exp_value_xml(doc, ctx, ex_key.c_str()))){
|
||||
continue;
|
||||
}
|
||||
if('/' != *((char*)ex_value)){
|
||||
if('/' != *(reinterpret_cast<char*>(ex_value))){
|
||||
part.key = "/";
|
||||
}else{
|
||||
part.key = "";
|
||||
}
|
||||
part.key += (char*)ex_value;
|
||||
part.key += reinterpret_cast<char*>(ex_value);
|
||||
S3FS_XMLFREE(ex_value);
|
||||
|
||||
// search "UploadId" tag
|
||||
if(NULL == (ex_value = get_exp_value_xml(doc, ctx, ex_id.c_str()))){
|
||||
continue;
|
||||
}
|
||||
part.id = (char*)ex_value;
|
||||
part.id = reinterpret_cast<char*>(ex_value);
|
||||
S3FS_XMLFREE(ex_value);
|
||||
|
||||
// search "Initiated" tag
|
||||
if(NULL == (ex_value = get_exp_value_xml(doc, ctx, ex_date.c_str()))){
|
||||
continue;
|
||||
}
|
||||
part.date = (char*)ex_value;
|
||||
part.date = reinterpret_cast<char*>(ex_value);
|
||||
S3FS_XMLFREE(ex_value);
|
||||
|
||||
list.push_back(part);
|
||||
|
@ -330,7 +330,7 @@ bool is_truncated(xmlDocPtr doc)
|
|||
if(!strTruncate){
|
||||
return false;
|
||||
}
|
||||
if(0 == strcasecmp((const char*)strTruncate, "true")){
|
||||
if(0 == strcasecmp(reinterpret_cast<const char*>(strTruncate), "true")){
|
||||
result = true;
|
||||
}
|
||||
xmlFree(strTruncate);
|
||||
|
@ -342,7 +342,7 @@ int append_objects_from_xml_ex(const char* path, xmlDocPtr doc, xmlXPathContextP
|
|||
xmlXPathObjectPtr contents_xp;
|
||||
xmlNodeSetPtr content_nodes;
|
||||
|
||||
if(NULL == (contents_xp = xmlXPathEvalExpression((xmlChar*)ex_contents, ctx))){
|
||||
if(NULL == (contents_xp = xmlXPathEvalExpression(reinterpret_cast<xmlChar*>(const_cast<char*>(ex_contents)), ctx))){
|
||||
S3FS_PRN_ERR("xmlXPathEvalExpression returns null.");
|
||||
return -1;
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ int append_objects_from_xml_ex(const char* path, xmlDocPtr doc, xmlXPathContextP
|
|||
|
||||
// object name
|
||||
xmlXPathObjectPtr key;
|
||||
if(NULL == (key = xmlXPathEvalExpression((xmlChar*)ex_key, ctx))){
|
||||
if(NULL == (key = xmlXPathEvalExpression(reinterpret_cast<xmlChar*>(const_cast<char*>(ex_key)), ctx))){
|
||||
S3FS_PRN_WARN("key is null. but continue.");
|
||||
continue;
|
||||
}
|
||||
|
@ -376,21 +376,21 @@ int append_objects_from_xml_ex(const char* path, xmlDocPtr doc, xmlXPathContextP
|
|||
if(!name){
|
||||
S3FS_PRN_WARN("name is something wrong. but continue.");
|
||||
|
||||
}else if((const char*)name != c_strErrorObjectName){
|
||||
}else if(reinterpret_cast<const char*>(name) != c_strErrorObjectName){
|
||||
is_dir = isCPrefix ? true : false;
|
||||
stretag = "";
|
||||
|
||||
if(!isCPrefix && ex_etag){
|
||||
// Get ETag
|
||||
xmlXPathObjectPtr ETag;
|
||||
if(NULL != (ETag = xmlXPathEvalExpression((xmlChar*)ex_etag, ctx))){
|
||||
if(NULL != (ETag = xmlXPathEvalExpression(reinterpret_cast<xmlChar*>(const_cast<char*>(ex_etag)), ctx))){
|
||||
if(xmlXPathNodeSetIsEmpty(ETag->nodesetval)){
|
||||
S3FS_PRN_INFO("ETag->nodesetval is empty.");
|
||||
}else{
|
||||
xmlNodeSetPtr etag_nodes = ETag->nodesetval;
|
||||
xmlChar* petag = xmlNodeListGetString(doc, etag_nodes->nodeTab[0]->xmlChildrenNode, 1);
|
||||
if(petag){
|
||||
stretag = (char*)petag;
|
||||
stretag = reinterpret_cast<char*>(petag);
|
||||
xmlFree(petag);
|
||||
}
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ int append_objects_from_xml(const char* path, xmlDocPtr doc, S3ObjList& head)
|
|||
|
||||
// If there is not <Prefix>, use path instead of it.
|
||||
xmlChar* pprefix = get_prefix(doc);
|
||||
std::string prefix = (pprefix ? (char*)pprefix : path ? path : "");
|
||||
std::string prefix = (pprefix ? reinterpret_cast<char*>(pprefix) : path ? path : "");
|
||||
if(pprefix){
|
||||
xmlFree(pprefix);
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ int append_objects_from_xml(const char* path, xmlDocPtr doc, S3ObjList& head)
|
|||
xmlXPathContextPtr ctx = xmlXPathNewContext(doc);
|
||||
|
||||
if(!noxmlns && GetXmlNsUrl(doc, xmlnsurl)){
|
||||
xmlXPathRegisterNs(ctx, (xmlChar*)"s3", (xmlChar*)xmlnsurl.c_str());
|
||||
xmlXPathRegisterNs(ctx, reinterpret_cast<xmlChar*>(const_cast<char*>("s3")), reinterpret_cast<xmlChar*>(const_cast<char*>(xmlnsurl.c_str())));
|
||||
ex_contents+= "s3:";
|
||||
ex_key += "s3:";
|
||||
ex_cprefix += "s3:";
|
||||
|
|
|
@ -103,6 +103,9 @@ void* S3fsSignals::CheckCacheWorker(void* arg)
|
|||
while(S3fsSignals::enableUsr1){
|
||||
// wait
|
||||
pSem->wait();
|
||||
|
||||
// cppcheck-suppress unmatchedSuppression
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if(!S3fsSignals::enableUsr1){
|
||||
break; // assap
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user