Skip to content

Commit 678ff91

Browse files
committed
Avoid Coverity Scan warnings
1 parent c854879 commit 678ff91

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

port/cpl_azure.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,16 @@ static struct curl_slist *GetAzureBlobHeaders(
106106
{
107107
osDate = IVSIS3LikeHandleHelper::GetRFC822DateTime();
108108
}
109-
const std::string osMsVersion(X_MS_VERSION);
110109

111-
const auto AddHeaders = [&osDate, &osMsVersion,
112-
bIncludeMSVersion](struct curl_slist *l_psHeaders)
110+
const auto AddHeaders =
111+
[&osDate, bIncludeMSVersion](struct curl_slist *l_psHeaders)
113112
{
114113
l_psHeaders = curl_slist_append(
115114
l_psHeaders, CPLSPrintf("x-ms-date: %s", osDate.c_str()));
116115
if (bIncludeMSVersion)
117116
{
118-
l_psHeaders =
119-
curl_slist_append(l_psHeaders, CPLSPrintf("x-ms-version: %s",
120-
osMsVersion.c_str()));
117+
l_psHeaders = curl_slist_append(
118+
l_psHeaders, CPLSPrintf("x-ms-version: %s", X_MS_VERSION));
121119
}
122120
return l_psHeaders;
123121
};
@@ -130,7 +128,7 @@ static struct curl_slist *GetAzureBlobHeaders(
130128

131129
std::map<std::string, std::string> oSortedMapMSHeaders;
132130
if (bIncludeMSVersion)
133-
oSortedMapMSHeaders["x-ms-version"] = osMsVersion;
131+
oSortedMapMSHeaders["x-ms-version"] = X_MS_VERSION;
134132
oSortedMapMSHeaders["x-ms-date"] = osDate;
135133
std::string osCanonicalizedHeaders(
136134
IVSIS3LikeHandleHelper::BuildCanonicalizedHeaders(oSortedMapMSHeaders,

port/cpl_vsil_abstract_archive.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ char **VSIArchiveFilesystemHandler::ReadDirEx(const char *pszDirname,
799799
if (archiveFilename == nullptr)
800800
return nullptr;
801801

802-
const int lenInArchiveSubDir = static_cast<int>(osInArchiveSubDir.size());
802+
const size_t lenInArchiveSubDir = osInArchiveSubDir.size();
803803

804804
CPLStringList oDir;
805805

@@ -814,9 +814,9 @@ char **VSIArchiveFilesystemHandler::ReadDirEx(const char *pszDirname,
814814
CPLDebug("VSIArchive", "Read dir %s", pszDirname);
815815
#endif
816816

817-
std::string searchDir = lenInArchiveSubDir > 0
818-
? std::string(osInArchiveSubDir)
819-
: std::string("");
817+
std::string searchDir;
818+
if (lenInArchiveSubDir != 0)
819+
searchDir = std::move(osInArchiveSubDir);
820820

821821
// Use directory index to find the list of children for this directory
822822
auto dirIter = content->dirIndex.find(searchDir);

0 commit comments

Comments
 (0)