Skip to content

Commit

Permalink
Fix warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
dchapyshev committed Oct 29, 2023
1 parent 59f2ef4 commit ba21379
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion source/base/audio/audio_output_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void AudioOutputWin::threadRun()
{
// Wait for a close-down event, stream-switch event or a new render event.
DWORD wait_result = WaitForMultipleObjects(
std::size(wait_array), wait_array, false, INFINITE);
static_cast<DWORD>(std::size(wait_array)), wait_array, false, INFINITE);
switch (wait_result)
{
case WAIT_OBJECT_0 + 0:
Expand Down
2 changes: 1 addition & 1 deletion source/base/audio/win/audio_util_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ bool isMMCSSSupported()
static const wchar_t* const kAvrtDLL = L"%WINDIR%\\system32\\Avrt.dll";
wchar_t path[MAX_PATH] = { 0 };

ExpandEnvironmentStringsW(kAvrtDLL, path, std::size(path));
ExpandEnvironmentStringsW(kAvrtDLL, path, static_cast<DWORD>(std::size(path)));
return (LoadLibraryExW(path, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH) != nullptr);
}

Expand Down
2 changes: 1 addition & 1 deletion source/base/codec/multi_channel_resampler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ MultiChannelResampler::MultiChannelResampler(int channels,
}

// Setup the wrapped AudioBus for channel data.
wrapped_resampler_audio_bus_->set_frames(request_size);
wrapped_resampler_audio_bus_->set_frames(static_cast<int>(request_size));

// Allocate storage for all channels except the first, which will use the
// |destination| provided to ProvideInput() directly.
Expand Down
2 changes: 1 addition & 1 deletion source/base/codec/zstd_compress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const uint32_t kMaxDataSize = 64 * 1024 * 1024; // 64 MB
template <class T>
T compressT(const T& source, int compress_level)
{
uint32_t source_data_size = source.size();
uint32_t source_data_size = static_cast<uint32_t>(source.size());
if (!source_data_size || source_data_size > kMaxDataSize)
{
LOG(LS_ERROR) << "Invalid source data size: " << source_data_size;
Expand Down
4 changes: 2 additions & 2 deletions source/base/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ std::filesystem::path execFilePath()

#if defined(OS_WIN)
wchar_t buffer[MAX_PATH] = { 0 };
GetModuleFileNameExW(GetCurrentProcess(), nullptr, buffer, std::size(buffer));
GetModuleFileNameExW(GetCurrentProcess(), nullptr, buffer, static_cast<DWORD>(std::size(buffer)));
exec_file_path = buffer;
#elif defined(OS_LINUX)
char buffer[PATH_MAX] = { 0 };
Expand Down Expand Up @@ -472,7 +472,7 @@ LogMessage::~LogMessage()
{
std::scoped_lock lock(g_log_file_lock);

if (g_log_file.tellp() >= g_max_log_file_size)
if (static_cast<size_t>(g_log_file.tellp()) >= g_max_log_file_size)
{
// The maximum size of the log file has been exceeded. Close the current log file and
// create a new one.
Expand Down
4 changes: 2 additions & 2 deletions source/base/system_error.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ std::string SystemError::toString(Code code)
constexpr int kErrorMessageBufferSize = 256;
wchar_t msgbuf[kErrorMessageBufferSize];

DWORD len = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr, code, 0, msgbuf, std::size(msgbuf), nullptr);
DWORD len = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr,
code, 0, msgbuf, static_cast<DWORD>(std::size(msgbuf)), nullptr);
if (len)
{
std::wstring msg = collapseWhitespace(msgbuf, true) + stringPrintf(L" (0x%lX)", code);
Expand Down
3 changes: 2 additions & 1 deletion source/base/win/registry_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ TEST_F(RegistryTest, TruncatedCharTest)
// kData size is not a multiple of sizeof(wchar_t).
const uint8_t kData[] = { 1, 2, 3, 4, 5 };
EXPECT_EQ(5u, std::size(kData));
ASSERT_EQ(ERROR_SUCCESS, key.writeValue(kName, kData, std::size(kData), REG_BINARY));
ASSERT_EQ(ERROR_SUCCESS,
key.writeValue(kName, kData, static_cast<DWORD>(std::size(kData)), REG_BINARY));

RegistryValueIterator iterator(HKEY_CURRENT_USER, foo_key.c_str());
ASSERT_TRUE(iterator.valid());
Expand Down

0 comments on commit ba21379

Please sign in to comment.