Remove strange integral constants for "true", "false", "%PDF".

Compilers have good inline memcmp nowadays, so we don't
have to resort to old tricks.

Remove FXDWORD_FROM_LSBFIRST and FXDWORD_FROM_MSBFIRST
while we're at it. MSBFIRST was technically wrong due
to promotion to int.

R=dsinclair@chromium.org

Review URL: https://codereview.chromium.org/1834553002 .
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index 0421104..9995038 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -248,9 +248,7 @@
 
 #define MAX_WORD_BUFFER 256
 #define MAX_STRING_LENGTH 32767
-#define FXDWORD_TRUE FXDWORD_FROM_LSBFIRST(0x65757274)
-#define FXDWORD_NULL FXDWORD_FROM_LSBFIRST(0x6c6c756e)
-#define FXDWORD_FALS FXDWORD_FROM_LSBFIRST(0x736c6166)
+
 CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement() {
   if (m_pLastObj) {
     m_pLastObj->Release();
@@ -311,20 +309,21 @@
   m_WordBuffer[m_WordSize] = 0;
   if (bIsNumber)
     return Number;
+
   if (m_WordBuffer[0] == '/')
     return Name;
 
   if (m_WordSize == 4) {
-    if (*(FX_DWORD*)m_WordBuffer == FXDWORD_TRUE) {
+    if (memcmp(m_WordBuffer, "true", 4) == 0) {
       m_pLastObj = new CPDF_Boolean(TRUE);
       return Others;
     }
-    if (*(FX_DWORD*)m_WordBuffer == FXDWORD_NULL) {
+    if (memcmp(m_WordBuffer, "null", 4) == 0) {
       m_pLastObj = new CPDF_Null;
       return Others;
     }
   } else if (m_WordSize == 5) {
-    if (*(FX_DWORD*)m_WordBuffer == FXDWORD_FALS && m_WordBuffer[4] == 'e') {
+    if (memcmp(m_WordBuffer, "false", 5) == 0) {
       m_pLastObj = new CPDF_Boolean(FALSE);
       return Others;
     }
@@ -453,14 +452,14 @@
     return pArray;
   }
   if (m_WordSize == 4) {
-    if (*(FX_DWORD*)m_WordBuffer == FXDWORD_TRUE) {
+    if (memcmp(m_WordBuffer, "true", 4) == 0) {
       return new CPDF_Boolean(TRUE);
     }
-    if (*(FX_DWORD*)m_WordBuffer == FXDWORD_NULL) {
+    if (memcmp(m_WordBuffer, "null", 4) == 0) {
       return new CPDF_Null;
     }
   } else if (m_WordSize == 5) {
-    if (*(FX_DWORD*)m_WordBuffer == FXDWORD_FALS && m_WordBuffer[4] == 'e') {
+    if (memcmp(m_WordBuffer, "false", 5) == 0) {
       return new CPDF_Boolean(FALSE);
     }
   }
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
index a4cc85a..caffb68 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
@@ -69,20 +69,14 @@
     'R', 'R', 'R', 'R', 'R', 'R', 'R', 'W'};
 
 int32_t GetHeaderOffset(IFX_FileRead* pFile) {
-  // TODO(dsinclair): This is a complicated way of saying %PDF, simplify?
-  const FX_DWORD tag = FXDWORD_FROM_LSBFIRST(0x46445025);
-
   const size_t kBufSize = 4;
   uint8_t buf[kBufSize];
-  int32_t offset = 0;
-  while (offset <= 1024) {
+  for (int32_t offset = 0; offset <= 1024; ++offset) {
     if (!pFile->ReadBlock(buf, offset, kBufSize))
       return -1;
 
-    if (*(FX_DWORD*)buf == tag)
+    if (memcmp(buf, "%PDF", 4) == 0)
       return offset;
-
-    ++offset;
   }
   return -1;
 }
diff --git a/core/fxcrt/include/fx_system.h b/core/fxcrt/include/fx_system.h
index eb863c6..1d51aec 100644
--- a/core/fxcrt/include/fx_system.h
+++ b/core/fxcrt/include/fx_system.h
@@ -253,10 +253,6 @@
 #define FXSYS_log10(a) (FX_FLOAT) log10(a)
 #define FXSYS_fmod(a, b) (FX_FLOAT) fmod(a, b)
 #define FXSYS_abs abs
-#define FXDWORD_FROM_LSBFIRST(i) (i)
-#define FXDWORD_FROM_MSBFIRST(i)                        \
-  (((uint8_t)(i) << 24) | ((uint8_t)((i) >> 8) << 16) | \
-   ((uint8_t)((i) >> 16) << 8) | (uint8_t)((i) >> 24))
 #define FXDWORD_GET_LSBFIRST(p)                                                \
   ((static_cast<FX_DWORD>(p[3]) << 24) | (static_cast<FX_DWORD>(p[2]) << 16) | \
    (static_cast<FX_DWORD>(p[1]) << 8) | (static_cast<FX_DWORD>(p[0])))
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index c7afab3..9b43fae 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -411,7 +411,7 @@
                                         uint8_t* buffer,
                                         FX_DWORD size) {
   HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont);
-  table = FXDWORD_FROM_MSBFIRST(table);
+  table = FXDWORD_GET_MSBFIRST(reinterpret_cast<uint8_t*>(&table));
   size = ::GetFontData(m_hDC, table, 0, buffer, size);
   ::SelectObject(m_hDC, hOldFont);
   if (size == GDI_ERROR) {