summaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-10-19 12:11:49 -0700
committerLei Zhang <thestig@chromium.org>2015-10-19 12:11:49 -0700
commitb0748bb1b207559deaec7a5f49c00c492a5f6082 (patch)
treeb4eb849c5d68388f74ca0e1006895e415f004a43 /core/include
parent29cd8b9631408c0360c744e23a2733d24c9224ec (diff)
downloadpdfium-b0748bb1b207559deaec7a5f49c00c492a5f6082.tar.xz
Merge to XFA: Sanity check the values of TRUE and FALSE.
Get rid of cond ? TRUE : FALSE. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1405723003 . (cherry picked from commit aff4635dad81bc319266d9d84b81552580cd2b65) Review URL: https://codereview.chromium.org/1412793003 .
Diffstat (limited to 'core/include')
-rw-r--r--core/include/fxcrt/fx_system.h5
-rw-r--r--core/include/fxge/fx_dib.h7
2 files changed, 10 insertions, 2 deletions
diff --git a/core/include/fxcrt/fx_system.h b/core/include/fxcrt/fx_system.h
index f0d403501c..0ca04307a9 100644
--- a/core/include/fxcrt/fx_system.h
+++ b/core/include/fxcrt/fx_system.h
@@ -92,6 +92,11 @@ typedef int FX_STRSIZE;
#define FALSE 0
#endif
+#ifdef __cplusplus
+static_assert(TRUE == true, "true_needs_to_be_true");
+static_assert(FALSE == false, "false_needs_to_be_false");
+#endif
+
#ifndef NULL
#define NULL 0
#endif
diff --git a/core/include/fxge/fx_dib.h b/core/include/fxge/fx_dib.h
index 818aaac520..e22ab58065 100644
--- a/core/include/fxge/fx_dib.h
+++ b/core/include/fxge/fx_dib.h
@@ -196,13 +196,16 @@ class CFX_DIBSource {
int GetBPP() const { return m_bpp; }
+ // TODO(thestig): Investigate this. Given the possible values of FXDIB_Format,
+ // it feels as though this should be implemented as !!(m_AlphaFlag & 1) and
+ // IsOpaqueImage() below should never be able to return TRUE.
FX_BOOL IsAlphaMask() const { return m_AlphaFlag == 1; }
- FX_BOOL HasAlpha() const { return m_AlphaFlag & 2 ? TRUE : FALSE; }
+ FX_BOOL HasAlpha() const { return !!(m_AlphaFlag & 2); }
FX_BOOL IsOpaqueImage() const { return !(m_AlphaFlag & 3); }
- FX_BOOL IsCmykImage() const { return m_AlphaFlag & 4 ? TRUE : FALSE; }
+ FX_BOOL IsCmykImage() const { return !!(m_AlphaFlag & 4); }
int GetPaletteSize() const {
return IsAlphaMask() ? 0 : (m_bpp == 1 ? 2 : (m_bpp == 8 ? 256 : 0));