diff --git a/client/crash_report_database_win.cc b/client/crash_report_database_win.cc index 95358b47..5eabdee0 100644 --- a/client/crash_report_database_win.cc +++ b/client/crash_report_database_win.cc @@ -159,7 +159,7 @@ ReportDisk::ReportDisk(const MetadataFileReportRecord& record, base::UTF8ToUTF16(&string_table[record.file_path_index])); id = &string_table[record.id_index]; creation_time = record.creation_time; - uploaded = record.uploaded; + uploaded = record.uploaded != 0; last_upload_attempt_time = record.last_upload_attempt_time; upload_attempts = record.upload_attempts; state = static_cast(record.state); diff --git a/client/crashpad_client_win.cc b/client/crashpad_client_win.cc index 3b3eaa6a..92529ae1 100644 --- a/client/crashpad_client_win.cc +++ b/client/crashpad_client_win.cc @@ -229,7 +229,7 @@ void CrashpadClient::DumpWithoutCrash(const CONTEXT& context) { g_non_crash_exception_information.exception_pointers = reinterpret_cast(&exception_pointers); - bool set_event_result = SetEvent(g_signal_non_crash_dump); + bool set_event_result = !!SetEvent(g_signal_non_crash_dump); PLOG_IF(ERROR, !set_event_result) << "SetEvent"; DWORD wfso_result = WaitForSingleObject(g_non_crash_dump_done, INFINITE); diff --git a/client/settings.cc b/client/settings.cc index 7f126ad7..6d464077 100644 --- a/client/settings.cc +++ b/client/settings.cc @@ -250,10 +250,12 @@ bool Settings::ReadSettings(FileHandle handle, return false; bool read_result; - if (log_read_error) + if (log_read_error) { read_result = LoggingReadFile(handle, out_data, sizeof(*out_data)); - else - read_result = ReadFile(handle, out_data, sizeof(*out_data)); + } else { + read_result = + ReadFile(handle, out_data, sizeof(*out_data)) == sizeof(*out_data); + } if (!read_result) return false; diff --git a/minidump/minidump_file_writer.cc b/minidump/minidump_file_writer.cc index ff353191..2b13433a 100644 --- a/minidump/minidump_file_writer.cc +++ b/minidump/minidump_file_writer.cc @@ -173,7 +173,7 @@ bool MinidumpFileWriter::WriteEverything(FileWriterInterface* file_writer) { // Seek back to the end of the file, in case some non-minidump content will be // written to the file after the minidump content. - return file_writer->Seek(end_offset, SEEK_SET); + return file_writer->Seek(end_offset, SEEK_SET) >= 0; } bool MinidumpFileWriter::Freeze() { diff --git a/minidump/minidump_module_writer_test.cc b/minidump/minidump_module_writer_test.cc index d5cc02b0..fdd5b0ca 100644 --- a/minidump/minidump_module_writer_test.cc +++ b/minidump/minidump_module_writer_test.cc @@ -158,8 +158,7 @@ void ExpectMiscellaneousDebugRecord( *misc_record); ASSERT_TRUE(misc_debug_record); EXPECT_EQ(expected_debug_type, misc_debug_record->DataType); - EXPECT_EQ(expected_debug_utf16, - static_cast(misc_debug_record->Unicode)); + EXPECT_EQ(expected_debug_utf16, misc_debug_record->Unicode != 0); EXPECT_EQ(0u, misc_debug_record->Reserved[0]); EXPECT_EQ(0u, misc_debug_record->Reserved[1]); EXPECT_EQ(0u, misc_debug_record->Reserved[2]); diff --git a/snapshot/cpu_context.cc b/snapshot/cpu_context.cc index 82839db8..1ff2b459 100644 --- a/snapshot/cpu_context.cc +++ b/snapshot/cpu_context.cc @@ -40,7 +40,7 @@ uint16_t CPUContextX86::FxsaveToFsaveTagWord( uint16_t fsave_tag = 0; for (int physical_index = 0; physical_index < 8; ++physical_index) { - bool fxsave_bit = fxsave_tag & (1 << physical_index); + bool fxsave_bit = (fxsave_tag & (1 << physical_index)) != 0; uint8_t fsave_bits; if (fxsave_bit) { @@ -55,7 +55,7 @@ uint16_t CPUContextX86::FxsaveToFsaveTagWord( fsave_bits = kX87TagSpecial; } else { // The integer bit the “J bit”. - bool integer_bit = st[7] & 0x80; + bool integer_bit = (st[7] & 0x80) != 0; if (exponent == 0) { uint64_t fraction = ((implicit_cast(st[7]) & 0x7f) << 56) | (implicit_cast(st[6]) << 48) | diff --git a/snapshot/win/system_snapshot_win.cc b/snapshot/win/system_snapshot_win.cc index a7523f48..88827a5d 100644 --- a/snapshot/win/system_snapshot_win.cc +++ b/snapshot/win/system_snapshot_win.cc @@ -274,7 +274,7 @@ bool SystemSnapshotWin::CPUX86SupportsDAZ() const { uint32_t mxcsr_mask = extended_registers[7]; // Test the DAZ bit. - return mxcsr_mask & (1 << 6); + return (mxcsr_mask & (1 << 6)) != 0; } SystemSnapshot::OperatingSystem SystemSnapshotWin::GetOperatingSystem() const { @@ -311,7 +311,7 @@ std::string SystemSnapshotWin::MachineDescription() const { bool SystemSnapshotWin::NXEnabled() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); - return IsProcessorFeaturePresent(PF_NX_ENABLED); + return !!IsProcessorFeaturePresent(PF_NX_ENABLED); } void SystemSnapshotWin::TimeZone(DaylightSavingTimeStatus* dst_status, diff --git a/util/file/file_io_win.cc b/util/file/file_io_win.cc index 10805439..def2a5a2 100644 --- a/util/file/file_io_win.cc +++ b/util/file/file_io_win.cc @@ -233,7 +233,7 @@ bool LoggingTruncateFile(FileHandle file) { bool LoggingCloseFile(FileHandle file) { BOOL rv = CloseHandle(file); PLOG_IF(ERROR, !rv) << "CloseHandle"; - return rv; + return !!rv; } } // namespace crashpad diff --git a/util/win/critical_section_with_debug_info.cc b/util/win/critical_section_with_debug_info.cc index dc1a2dba..1613a512 100644 --- a/util/win/critical_section_with_debug_info.cc +++ b/util/win/critical_section_with_debug_info.cc @@ -21,13 +21,13 @@ namespace crashpad { namespace { -BOOL CrashpadInitializeCriticalSectionEx( +bool CrashpadInitializeCriticalSectionEx( CRITICAL_SECTION* critical_section, DWORD spin_count, DWORD flags) { static const auto initialize_critical_section_ex = GET_FUNCTION_REQUIRED(L"kernel32.dll", ::InitializeCriticalSectionEx); - bool ret = + BOOL ret = initialize_critical_section_ex(critical_section, spin_count, flags); if (!ret) { PLOG(ERROR) << "InitializeCriticalSectionEx"; diff --git a/util/win/exception_handler_server.cc b/util/win/exception_handler_server.cc index 304319b7..aba3ffa0 100644 --- a/util/win/exception_handler_server.cc +++ b/util/win/exception_handler_server.cc @@ -450,7 +450,7 @@ DWORD __stdcall ExceptionHandlerServer::PipeServiceProc(void* ctx) { DCHECK(service_context); for (;;) { - bool ret = ConnectNamedPipe(service_context->pipe(), nullptr); + bool ret = !!ConnectNamedPipe(service_context->pipe(), nullptr); if (!ret && GetLastError() != ERROR_PIPE_CONNECTED) { PLOG(ERROR) << "ConnectNamedPipe"; } else if (ServiceClientConnection(*service_context)) { @@ -491,7 +491,7 @@ void __stdcall ExceptionHandlerServer::OnNonCrashDumpEvent(void* ctx, BOOLEAN) { client->non_crash_exception_information_address(), client->debug_critical_section_address()); - bool result = SetEvent(client->non_crash_dump_completed_event()); + bool result = !!SetEvent(client->non_crash_dump_completed_event()); PLOG_IF(ERROR, !result) << "SetEvent"; } diff --git a/util/win/process_info.cc b/util/win/process_info.cc index 1478d044..cdc27b1e 100644 --- a/util/win/process_info.cc +++ b/util/win/process_info.cc @@ -59,7 +59,7 @@ bool IsProcessWow64(HANDLE process_handle) { PLOG(ERROR) << "IsWow64Process"; return false; } - return is_wow64; + return !!is_wow64; } template diff --git a/util/win/process_info_test.cc b/util/win/process_info_test.cc index 81e5613e..c997d499 100644 --- a/util/win/process_info_test.cc +++ b/util/win/process_info_test.cc @@ -50,7 +50,7 @@ bool IsProcessWow64(HANDLE process_handle) { PLOG(ERROR) << "IsWow64Process"; return false; } - return is_wow64; + return !!is_wow64; } void VerifyAddressInInCodePage(const ProcessInfo& process_info,