summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfview.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-10-26 15:33:58 -0700
committerCommit bot <commit-bot@chromium.org>2016-10-26 15:33:58 -0700
commitf39074c0ae47a84c496782f8b75bcce1e1cfdf59 (patch)
tree077b7f12bff3c4aa4d53c6b74fa32e613cc73a27 /fpdfsdk/fpdfview.cpp
parente5cb0b191aed020da99757c117dae014ea65c6ba (diff)
downloadpdfium-f39074c0ae47a84c496782f8b75bcce1e1cfdf59.tar.xz
Fix some FX_BOOL / int noise in fxcrt.chromium/2902
Review-Url: https://codereview.chromium.org/2450183003
Diffstat (limited to 'fpdfsdk/fpdfview.cpp')
-rw-r--r--fpdfsdk/fpdfview.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index be56c531d2..03aedf6874 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -112,7 +112,7 @@ FX_FILESIZE CFPDF_FileStream::GetSize() {
return 0;
}
-FX_BOOL CFPDF_FileStream::IsEOF() {
+bool CFPDF_FileStream::IsEOF() {
return m_nCurPos >= GetSize();
}
@@ -120,18 +120,18 @@ FX_FILESIZE CFPDF_FileStream::GetPosition() {
return m_nCurPos;
}
-FX_BOOL CFPDF_FileStream::ReadBlock(void* buffer,
- FX_FILESIZE offset,
- size_t size) {
+bool CFPDF_FileStream::ReadBlock(void* buffer,
+ FX_FILESIZE offset,
+ size_t size) {
if (!buffer || !size || !m_pFS->ReadBlock)
- return FALSE;
+ return false;
if (m_pFS->ReadBlock(m_pFS->clientData, (FPDF_DWORD)offset, buffer,
(FPDF_DWORD)size) == 0) {
m_nCurPos = offset + size;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
size_t CFPDF_FileStream::ReadBlock(void* buffer, size_t size) {
@@ -153,23 +153,23 @@ size_t CFPDF_FileStream::ReadBlock(void* buffer, size_t size) {
return 0;
}
-FX_BOOL CFPDF_FileStream::WriteBlock(const void* buffer,
- FX_FILESIZE offset,
- size_t size) {
+bool CFPDF_FileStream::WriteBlock(const void* buffer,
+ FX_FILESIZE offset,
+ size_t size) {
if (!m_pFS || !m_pFS->WriteBlock)
- return FALSE;
+ return false;
if (m_pFS->WriteBlock(m_pFS->clientData, (FPDF_DWORD)offset, buffer,
(FPDF_DWORD)size) == 0) {
m_nCurPos = offset + size;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CFPDF_FileStream::Flush() {
+bool CFPDF_FileStream::Flush() {
if (!m_pFS || !m_pFS->Flush)
- return TRUE;
+ return true;
return m_pFS->Flush(m_pFS->clientData) == 0;
}
@@ -186,21 +186,21 @@ void CPDF_CustomAccess::Release() {
delete this;
}
-FX_BOOL CPDF_CustomAccess::ReadBlock(void* buffer,
- FX_FILESIZE offset,
- size_t size) {
- if (offset < 0) {
- return FALSE;
- }
+bool CPDF_CustomAccess::ReadBlock(void* buffer,
+ FX_FILESIZE offset,
+ size_t size) {
+ if (offset < 0)
+ return false;
+
FX_SAFE_FILESIZE newPos =
pdfium::base::checked_cast<FX_FILESIZE, size_t>(size);
newPos += offset;
if (!newPos.IsValid() ||
newPos.ValueOrDie() > static_cast<FX_FILESIZE>(m_FileAccess.m_FileLen)) {
- return FALSE;
+ return false;
}
- return m_FileAccess.m_GetBlock(m_FileAccess.m_Param, offset, (uint8_t*)buffer,
- size);
+ return !!m_FileAccess.m_GetBlock(m_FileAccess.m_Param, offset,
+ reinterpret_cast<uint8_t*>(buffer), size);
}
// 0 bit: FPDF_POLICY_MACHINETIME_ACCESS
@@ -388,18 +388,18 @@ class CMemFile final : public IFX_SeekableReadStream {
void Release() override { delete this; }
FX_FILESIZE GetSize() override { return m_size; }
- FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override {
+ bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override {
if (offset < 0) {
- return FALSE;
+ return false;
}
FX_SAFE_FILESIZE newPos =
pdfium::base::checked_cast<FX_FILESIZE, size_t>(size);
newPos += offset;
if (!newPos.IsValid() || newPos.ValueOrDie() > m_size) {
- return FALSE;
+ return false;
}
FXSYS_memcpy(buffer, m_pBuf + offset, size);
- return TRUE;
+ return true;
}
private: