summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_parser/cpdf_parser.cpp9
-rw-r--r--core/src/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp3
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp11
-rw-r--r--core/src/fpdfdoc/doc_formfield.cpp6
-rw-r--r--core/src/fxcrt/fx_basic_buffer.cpp2
-rw-r--r--core/src/fxcrt/fx_basic_wstring.cpp2
-rw-r--r--core/src/fxge/agg/fx_agg_driver.cpp30
-rw-r--r--core/src/fxge/ge/fx_ge_fontmap.cpp11
10 files changed, 46 insertions, 38 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index 9a318eb824..f3797c2532 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -1953,11 +1953,13 @@ void CPDF_Creator::Clear() {
m_pIDArray = NULL;
}
}
-FX_BOOL CPDF_Creator::Create(IFX_StreamWrite* pFile, FX_DWORD flags) {
+
+bool CPDF_Creator::Create(IFX_StreamWrite* pFile, FX_DWORD flags) {
m_File.AttachFile(pFile);
return Create(flags);
}
-FX_BOOL CPDF_Creator::Create(FX_DWORD flags) {
+
+bool CPDF_Creator::Create(FX_DWORD flags) {
m_dwFlags = flags;
m_iStage = 0;
m_Offset = 0;
@@ -1966,7 +1968,7 @@ FX_BOOL CPDF_Creator::Create(FX_DWORD flags) {
m_NewObjNumArray.RemoveAll();
InitID();
if (flags & FPDFCREATE_PROGRESSIVE) {
- return TRUE;
+ return true;
}
return Continue(NULL) > -1;
}
diff --git a/core/src/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp b/core/src/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
index 6256f4c526..84464fcff2 100644
--- a/core/src/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
+++ b/core/src/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
@@ -267,7 +267,7 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream,
if (!CanReadFromBitStream(hStream, required_bits))
return FALSE;
- for (int i = 0; i < dwSharedObjTotal; ++i) {
+ for (FX_DWORD i = 0; i < dwSharedObjTotal; ++i) {
dwPrevObjLen = dwCurObjLen;
FX_SAFE_DWORD safeObjLen = hStream->GetBits(dwDeltaGroupLen);
safeObjLen += dwGroupLeastLen;
diff --git a/core/src/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/src/fpdfapi/fpdf_parser/cpdf_parser.cpp
index c9a2d8d496..e9332901c0 100644
--- a/core/src/fpdfapi/fpdf_parser/cpdf_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/cpdf_parser.cpp
@@ -55,6 +55,7 @@ CPDF_Parser::CPDF_Parser()
m_FileVersion(0),
m_pTrailer(nullptr),
m_pEncryptDict(nullptr),
+ m_bVersionUpdated(false),
m_pLinearized(nullptr),
m_dwFirstPageNo(0),
m_dwXrefStartObjNum(0) {
@@ -124,7 +125,7 @@ void CPDF_Parser::ShrinkObjectMap(FX_DWORD objnum) {
}
void CPDF_Parser::CloseParser() {
- m_bVersionUpdated = FALSE;
+ m_bVersionUpdated = false;
delete m_pDocument;
m_pDocument = nullptr;
@@ -466,7 +467,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos,
m_ObjectInfo[objnum].pos = offset;
int32_t version = FXSYS_atoi(pEntry + 11);
if (version >= 1)
- m_bVersionUpdated = TRUE;
+ m_bVersionUpdated = true;
m_ObjectInfo[objnum].gennum = version;
if (m_ObjectInfo[objnum].pos < m_pSyntax->m_FileLen)
@@ -541,7 +542,7 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos,
m_ObjectInfo[objnum].pos = offset;
int32_t version = FXSYS_atoi(pEntry + 11);
if (version >= 1)
- m_bVersionUpdated = TRUE;
+ m_bVersionUpdated = true;
m_ObjectInfo[objnum].gennum = version;
if (m_ObjectInfo[objnum].pos < m_pSyntax->m_FileLen)
@@ -775,7 +776,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
m_ObjectInfo[objnum].pos = obj_pos;
m_ObjectInfo[objnum].gennum = gennum;
if (oldgen != gennum)
- m_bVersionUpdated = TRUE;
+ m_bVersionUpdated = true;
}
} else {
m_ObjectInfo[objnum].pos = obj_pos;
diff --git a/core/src/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp b/core/src/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
index b414827f95..89ad5eec33 100644
--- a/core/src/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
@@ -772,7 +772,8 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
GetNextWordInternal(nullptr);
int numMarkers = ReadEOLMarkers(m_Pos);
- if (m_WordSize == kEndObjStr.GetLength() && numMarkers != 0 &&
+ if (m_WordSize == static_cast<unsigned int>(kEndObjStr.GetLength()) &&
+ numMarkers != 0 &&
FXSYS_memcmp(m_WordBuffer, kEndObjStr.GetPtr(), kEndObjStr.GetLength()) ==
0) {
m_Pos = streamStartPos;
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
index 6618a13709..93b867005c 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -628,13 +628,14 @@ int CPDF_DIBSource::CreateDecoder() {
pParams ? pParams->GetIntegerBy("ColorTransform", 1) : 1));
if (!m_pDecoder) {
FX_BOOL bTransform = FALSE;
- int comps, bpc;
+ int comps;
+ int bpc;
ICodec_JpegModule* pJpegModule = CPDF_ModuleMgr::Get()->GetJpegModule();
if (pJpegModule->LoadInfo(src_data, src_size, m_Width, m_Height, comps,
bpc, bTransform)) {
- if (m_nComponents != comps) {
+ if (m_nComponents != static_cast<FX_DWORD>(comps)) {
FX_Free(m_pCompData);
- m_nComponents = comps;
+ m_nComponents = static_cast<FX_DWORD>(comps);
if (m_Family == PDFCS_LAB && m_nComponents != 3) {
m_pCompData = nullptr;
return 0;
@@ -1440,7 +1441,9 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp,
FX_BOOL bFlipX,
int clip_left,
int clip_width) const {
- int last_src_x = -1;
+ // last_src_x used to store the last seen src_x position which should be
+ // in [0, src_width). Set the initial value to be an invalid src_x value.
+ FX_DWORD last_src_x = src_width;
FX_ARGB last_argb = FXARGB_MAKE(0xFF, 0xFF, 0xFF, 0xFF);
FX_FLOAT unit_To8Bpc = 255.0f / ((1 << m_bpc) - 1);
for (int i = 0; i < clip_width; i++) {
diff --git a/core/src/fpdfdoc/doc_formfield.cpp b/core/src/fpdfdoc/doc_formfield.cpp
index 09393bc30d..4bce85e831 100644
--- a/core/src/fpdfdoc/doc_formfield.cpp
+++ b/core/src/fpdfdoc/doc_formfield.cpp
@@ -110,15 +110,15 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
case CPDF_FormField::RadioButton: {
int iCount = CountControls();
if (iCount) {
+ // TODO(weili): Check whether anything special needs to be done for
+ // unison field. Otherwise, merge these branches.
if (PDF_FormField_IsUnison(this)) {
for (int i = 0; i < iCount; i++) {
CheckControl(i, GetControl(i)->IsDefaultChecked(), FALSE);
}
} else {
for (int i = 0; i < iCount; i++) {
- CPDF_FormControl* pControl = GetControl(i);
- FX_BOOL bChecked = pControl->IsDefaultChecked();
- CheckControl(i, bChecked, FALSE);
+ CheckControl(i, GetControl(i)->IsDefaultChecked(), FALSE);
}
}
}
diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp
index f623d995c7..a3039f4188 100644
--- a/core/src/fxcrt/fx_basic_buffer.cpp
+++ b/core/src/fxcrt/fx_basic_buffer.cpp
@@ -381,7 +381,7 @@ bool CFX_FileBufferArchive::Flush() {
return false;
if (!m_pBuffer || !nRemaining)
return true;
- return m_pFile->WriteBlock(m_pBuffer.get(), nRemaining);
+ return m_pFile->WriteBlock(m_pBuffer.get(), nRemaining) > 0;
}
int32_t CFX_FileBufferArchive::AppendBlock(const void* pBuf, size_t size) {
diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp
index 11a840a806..95b761bd09 100644
--- a/core/src/fxcrt/fx_basic_wstring.cpp
+++ b/core/src/fxcrt/fx_basic_wstring.cpp
@@ -205,7 +205,7 @@ bool CFX_WideString::Equal(const wchar_t* ptr) const {
if (!ptr) {
return m_pData->m_nDataLength == 0;
}
- return wcslen(ptr) == m_pData->m_nDataLength &&
+ return wcslen(ptr) == static_cast<size_t>(m_pData->m_nDataLength) &&
wmemcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0;
}
bool CFX_WideString::Equal(const CFX_WideStringC& str) const {
diff --git a/core/src/fxge/agg/fx_agg_driver.cpp b/core/src/fxge/agg/fx_agg_driver.cpp
index 16cf705585..2f376b2b19 100644
--- a/core/src/fxge/agg/fx_agg_driver.cpp
+++ b/core/src/fxge/agg/fx_agg_driver.cpp
@@ -1799,37 +1799,37 @@ CFX_FxgeDevice::CFX_FxgeDevice() {
m_bOwnedBitmap = FALSE;
}
-FX_BOOL CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap,
- int dither_bits,
- FX_BOOL bRgbByteOrder,
- CFX_DIBitmap* pOriDevice,
- FX_BOOL bGroupKnockout) {
+bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap,
+ int dither_bits,
+ bool bRgbByteOrder,
+ CFX_DIBitmap* pOriDevice,
+ bool bGroupKnockout) {
if (!pBitmap) {
- return FALSE;
+ return false;
}
SetBitmap(pBitmap);
IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(
pBitmap, dither_bits, bRgbByteOrder, pOriDevice, bGroupKnockout);
SetDeviceDriver(pDriver);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_FxgeDevice::Create(int width,
- int height,
- FXDIB_Format format,
- int dither_bits,
- CFX_DIBitmap* pOriDevice) {
- m_bOwnedBitmap = TRUE;
+bool CFX_FxgeDevice::Create(int width,
+ int height,
+ FXDIB_Format format,
+ int dither_bits,
+ CFX_DIBitmap* pOriDevice) {
+ m_bOwnedBitmap = true;
CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
if (!pBitmap->Create(width, height, format)) {
delete pBitmap;
- return FALSE;
+ return false;
}
SetBitmap(pBitmap);
IFX_RenderDeviceDriver* pDriver =
new CFX_AggDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE);
SetDeviceDriver(pDriver);
- return TRUE;
+ return true;
}
CFX_FxgeDevice::~CFX_FxgeDevice() {
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index cd46148b7f..2ad1e5c9de 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -387,19 +387,20 @@ int32_t GetSimilarValue(int weight,
int pitch_family,
FX_DWORD style) {
int32_t iSimilarValue = 0;
- if ((style & FXFONT_BOLD) == (weight > 400)) {
+ if (!!(style & FXFONT_BOLD) == (weight > 400)) {
iSimilarValue += 16;
}
- if ((style & FXFONT_ITALIC) == bItalic) {
+ if (!!(style & FXFONT_ITALIC) == bItalic) {
iSimilarValue += 16;
}
- if ((style & FXFONT_SERIF) == (pitch_family & FXFONT_FF_ROMAN)) {
+ if (!!(style & FXFONT_SERIF) == !!(pitch_family & FXFONT_FF_ROMAN)) {
iSimilarValue += 16;
}
- if ((style & FXFONT_SCRIPT) == (pitch_family & FXFONT_FF_SCRIPT)) {
+ if (!!(style & FXFONT_SCRIPT) == !!(pitch_family & FXFONT_FF_SCRIPT)) {
iSimilarValue += 8;
}
- if ((style & FXFONT_FIXED_PITCH) == (pitch_family & FXFONT_FF_FIXEDPITCH)) {
+ if (!!(style & FXFONT_FIXED_PITCH) ==
+ !!(pitch_family & FXFONT_FF_FIXEDPITCH)) {
iSimilarValue += 8;
}
return iSimilarValue;