Change ProcessMemoryRange to use VMSize
Follow up to https://crrev.com/c/1387756 replace size_t with VMSize.
Bug: crashpad:270
Change-Id: I22ac9e3503ef3e9707b2ad0758ae133c5a746f27
Reviewed-on: https://chromium-review.googlesource.com/c/1389235
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
diff --git a/util/process/process_memory_range.cc b/util/process/process_memory_range.cc
index aee8c80..caa4315 100644
--- a/util/process/process_memory_range.cc
+++ b/util/process/process_memory_range.cc
@@ -67,7 +67,7 @@
}
bool ProcessMemoryRange::Read(VMAddress address,
- size_t size,
+ VMSize size,
void* buffer) const {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
CheckedVMAddressRange read_range(range_.Is64Bit(), address, size);
@@ -79,14 +79,14 @@
}
bool ProcessMemoryRange::ReadCStringSizeLimited(VMAddress address,
- size_t size,
+ VMSize size,
std::string* string) const {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
if (!range_.ContainsValue(address)) {
LOG(ERROR) << "read out of range";
return false;
}
- size = std::min(size, base::checked_cast<size_t>(range_.End() - address));
+ size = std::min(size, range_.End() - address);
return memory_->ReadCStringSizeLimited(address, size, string);
}
diff --git a/util/process/process_memory_range.h b/util/process/process_memory_range.h
index 2b654ba..aabee49 100644
--- a/util/process/process_memory_range.h
+++ b/util/process/process_memory_range.h
@@ -97,7 +97,7 @@
//!
//! \return `true` on success, with \a buffer filled appropriately. `false` on
//! failure, with a message logged.
- bool Read(VMAddress address, size_t size, void* buffer) const;
+ bool Read(VMAddress address, VMSize size, void* buffer) const;
//! \brief Reads a `NUL`-terminated C string from the target process into a
//! string in the current process.
@@ -113,7 +113,7 @@
//! a `NUL` terminator is not found within \a size bytes, or when
//! encountering unmapped or unreadable pages.
bool ReadCStringSizeLimited(VMAddress address,
- size_t size,
+ VMSize size,
std::string* string) const;
private: