Skip to content

Commit

Permalink
Use brace initializer instead of empty C string to return empty C++ s…
Browse files Browse the repository at this point in the history
…tring (#763)
  • Loading branch information
AZero13 authored Oct 26, 2022
1 parent 2b84243 commit b89f945
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/vcpkg/base/system.mac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace vcpkg

std::string mac_bytes_to_string(const Span<char>& bytes)
{
if (bytes.size() != MAC_BYTES_LENGTH) return "";
if (bytes.size() != MAC_BYTES_LENGTH) return {};

static constexpr char hexits[] = "0123456789abcdef";
char mac_address[MAC_STRING_LENGTH];
Expand Down
2 changes: 1 addition & 1 deletion src/vcpkg/commands.dependinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ namespace vcpkg::Commands::DependInfo
{
return create_dgml_as_string(depend_info);
}
return "";
return {};
}

void assign_depth_to_dependencies(const std::string& package,
Expand Down
8 changes: 4 additions & 4 deletions src/vcpkg/metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ namespace vcpkg
return ptime->to_string();
}

return "";
return {};
}

static const std::string& get_session_id()
Expand All @@ -120,16 +120,16 @@ namespace vcpkg
path += L"\\kernel32.dll";

const auto versz = GetFileVersionInfoSizeW(path.c_str(), nullptr);
if (versz == 0) return "";
if (versz == 0) return {};

std::vector<char> verbuf;
verbuf.resize(versz);

if (!GetFileVersionInfoW(path.c_str(), 0, static_cast<DWORD>(verbuf.size()), &verbuf[0])) return "";
if (!GetFileVersionInfoW(path.c_str(), 0, static_cast<DWORD>(verbuf.size()), &verbuf[0])) return {};

void* rootblock;
UINT rootblocksize;
if (!VerQueryValueW(&verbuf[0], L"\\", &rootblock, &rootblocksize)) return "";
if (!VerQueryValueW(&verbuf[0], L"\\", &rootblock, &rootblocksize)) return {};

auto rootblock_ffi = static_cast<VS_FIXEDFILEINFO*>(rootblock);

Expand Down
2 changes: 1 addition & 1 deletion src/vcpkg/sourceparagraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ namespace vcpkg
if (cur() == Unicode::end_of_file)
{
add_error(msg::format(msgEmptyLicenseExpression));
return "";
return {};
}

Expecting expecting = Expecting::License;
Expand Down

0 comments on commit b89f945

Please sign in to comment.