Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Unified Diff: fpdfsdk/fpdfview.cpp

Issue 2450183003: Fix some FX_BOOL / int noise in fxcrt. (Closed)
Patch Set: moar Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/fpdfsave.cpp ('k') | fpdfsdk/fsdk_define.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfview.cpp
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 92ca34effac0f33ea5e6d940d9df5720b5482176..6f27e4f1b92331674c1b40f4cae0ceab53646787 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:
« no previous file with comments | « fpdfsdk/fpdfsave.cpp ('k') | fpdfsdk/fsdk_define.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698