Convert (void) to static_cast<void> in C++ code

Converting instances of old C-style void casts to suppress return
values to use C++ style static cases. There are a few examples of
(void) that remain, since they are in C code, and the third_party/
instances are not touched at all.

Change-Id: I72b3fc0e1d713db669b76135e03d1cf87873a2fe
Reviewed-on: https://pdfium-review.googlesource.com/33790
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
diff --git a/core/fpdfapi/font/cfx_cttgsubtable.cpp b/core/fpdfapi/font/cfx_cttgsubtable.cpp
index ae868ca..6c93363 100644
--- a/core/fpdfapi/font/cfx_cttgsubtable.cpp
+++ b/core/fpdfapi/font/cfx_cttgsubtable.cpp
@@ -256,7 +256,7 @@
 void CFX_CTTGSUBTable::ParseCoverageFormat1(FT_Bytes raw,
                                             TCoverageFormat1* rec) {
   FT_Bytes sp = raw;
-  (void)GetUInt16(sp);
+  static_cast<void>(GetUInt16(sp));
   rec->GlyphArray = std::vector<uint16_t>(GetUInt16(sp));
   for (auto& glyph : rec->GlyphArray)
     glyph = GetUInt16(sp);
@@ -265,7 +265,7 @@
 void CFX_CTTGSUBTable::ParseCoverageFormat2(FT_Bytes raw,
                                             TCoverageFormat2* rec) {
   FT_Bytes sp = raw;
-  (void)GetUInt16(sp);
+  static_cast<void>(GetUInt16(sp));
   rec->RangeRecords = std::vector<TRangeRecord>(GetUInt16(sp));
   for (auto& rangeRec : rec->RangeRecords) {
     rangeRec.Start = GetUInt16(sp);
@@ -300,7 +300,7 @@
 
 void CFX_CTTGSUBTable::ParseSingleSubstFormat2(FT_Bytes raw, TSubTable2* rec) {
   FT_Bytes sp = raw;
-  (void)GetUInt16(sp);
+  static_cast<void>(GetUInt16(sp));
   uint16_t offset = GetUInt16(sp);
   rec->Coverage = ParseCoverage(&raw[offset]);
   rec->Substitutes = std::vector<uint16_t>(GetUInt16(sp));
diff --git a/core/fpdfapi/parser/cpdf_parser_embeddertest.cpp b/core/fpdfapi/parser/cpdf_parser_embeddertest.cpp
index 3b8f550..ef9d438 100644
--- a/core/fpdfapi/parser/cpdf_parser_embeddertest.cpp
+++ b/core/fpdfapi/parser/cpdf_parser_embeddertest.cpp
@@ -28,7 +28,7 @@
   // Shouldn't crash. We don't check the return value here because we get the
   // the count from the "/Count 1" in the testcase (at the time of writing)
   // rather than the actual count (0).
-  (void)GetPageCount();
+  static_cast<void>(GetPageCount());
 }
 
 TEST_F(CPDFParserEmbeddertest, Bug_325a) {
diff --git a/core/fxcrt/fx_memory_unittest.cpp b/core/fxcrt/fx_memory_unittest.cpp
index 2856bb9..d062885 100644
--- a/core/fxcrt/fx_memory_unittest.cpp
+++ b/core/fxcrt/fx_memory_unittest.cpp
@@ -21,11 +21,12 @@
 // TODO(tsepez): re-enable OOM tests if we can find a way to
 // prevent it from hosing the bots.
 TEST(fxcrt, DISABLED_FX_AllocOOM) {
-  EXPECT_DEATH_IF_SUPPORTED((void)FX_Alloc(int, kMaxIntAlloc), "");
+  EXPECT_DEATH_IF_SUPPORTED(static_cast<void>(FX_Alloc(int, kMaxIntAlloc)), "");
 
   int* ptr = FX_Alloc(int, 1);
   EXPECT_TRUE(ptr);
-  EXPECT_DEATH_IF_SUPPORTED((void)FX_Realloc(int, ptr, kMaxIntAlloc), "");
+  EXPECT_DEATH_IF_SUPPORTED(
+      static_cast<void>(FX_Realloc(int, ptr, kMaxIntAlloc)), "");
   FX_Free(ptr);
 }
 
@@ -37,7 +38,8 @@
 
   ptr = FX_Alloc(int, 1);
   EXPECT_TRUE(ptr);
-  EXPECT_DEATH_IF_SUPPORTED((void)FX_Realloc(int, ptr, kOverflowIntAlloc), "");
+  EXPECT_DEATH_IF_SUPPORTED(
+      static_cast<void>(FX_Realloc(int, ptr, kOverflowIntAlloc)), "");
   FX_Free(ptr);
 }
 
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp
index 62d2c00..8ebf7fa 100644
--- a/fpdfsdk/fpdf_formfill.cpp
+++ b/fpdfsdk/fpdf_formfill.cpp
@@ -272,9 +272,9 @@
     return -1;
   CPDF_InterForm interform(pPage->GetDocument());
   int z_order = -1;
-  (void)interform.GetControlAtPoint(
+  static_cast<void>(interform.GetControlAtPoint(
       pPage, CFX_PointF(static_cast<float>(page_x), static_cast<float>(page_y)),
-      &z_order);
+      &z_order));
   return z_order;
 }
 
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index f9f5981..595c4a9 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -644,7 +644,7 @@
   if (!it)
     return true;
 
-  (void)it->MoveToNext();
+  static_cast<void>(it->MoveToNext());
   CXFA_Node* pNode = it->MoveToNext();
 
   while (pNode) {
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index d2e8487..0491840 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -682,7 +682,7 @@
     return;
   }
 
-  (void)FPDF_GetDocPermissions(doc.get());
+  static_cast<void>(FPDF_GetDocPermissions(doc.get()));
 
   if (options.show_metadata)
     DumpMetaData(doc.get());
diff --git a/samples/pdfium_test_write_helper.cc b/samples/pdfium_test_write_helper.cc
index c436c97..758f5ef 100644
--- a/samples/pdfium_test_write_helper.cc
+++ b/samples/pdfium_test_write_helper.cc
@@ -211,7 +211,7 @@
   uint32_t bom = 0x0000FEFF;
   if (fwrite(&bom, sizeof(bom), 1, fp) != 1) {
     fprintf(stderr, "Failed to write to %s\n", filename);
-    (void)fclose(fp);
+    static_cast<void>(fclose(fp));
     return;
   }
 
@@ -223,7 +223,7 @@
       break;
     }
   }
-  (void)fclose(fp);
+  static_cast<void>(fclose(fp));
 }
 
 void WriteAnnot(FPDF_PAGE page, const char* pdf_name, int num) {
@@ -343,7 +343,7 @@
     }
   }
 
-  (void)fclose(fp);
+  static_cast<void>(fclose(fp));
 }
 
 std::string WritePng(const char* pdf_name,
@@ -383,7 +383,7 @@
   if (bytes_written != png_encoding.size())
     fprintf(stderr, "Failed to write to %s\n", filename);
 
-  (void)fclose(fp);
+  static_cast<void>(fclose(fp));
   return std::string(filename);
 }
 
@@ -649,6 +649,6 @@
     else
       fprintf(stderr, "Successfully wrote embedded image %s.\n", filename);
 
-    (void)fclose(fp);
+    static_cast<void>(fclose(fp));
   }
 }
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index 03eebe3..aaea965 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -220,7 +220,7 @@
     FPDF_LoadXFA(*document);
 #endif  // PDF_ENABLE_XFA
 
-  (void)FPDF_GetDocPermissions(*document);
+  static_cast<void>(FPDF_GetDocPermissions(*document));
   return true;
 }
 
@@ -262,16 +262,16 @@
 
 int EmbedderTest::GetFirstPageNum() {
   int first_page = FPDFAvail_GetFirstPageNum(document_);
-  (void)FPDFAvail_IsPageAvail(avail_, first_page,
-                              fake_file_access_->GetDownloadHints());
+  static_cast<void>(FPDFAvail_IsPageAvail(
+      avail_, first_page, fake_file_access_->GetDownloadHints()));
   return first_page;
 }
 
 int EmbedderTest::GetPageCount() {
   int page_count = FPDF_GetPageCount(document_);
   for (int i = 0; i < page_count; ++i)
-    (void)FPDFAvail_IsPageAvail(avail_, i,
-                                fake_file_access_->GetDownloadHints());
+    static_cast<void>(FPDFAvail_IsPageAvail(
+        avail_, i, fake_file_access_->GetDownloadHints()));
   return page_count;
 }
 
diff --git a/testing/test_support.cpp b/testing/test_support.cpp
index 2b6f436..16ae5b2 100644
--- a/testing/test_support.cpp
+++ b/testing/test_support.cpp
@@ -84,19 +84,19 @@
     fprintf(stderr, "Failed to open: %s\n", filename);
     return nullptr;
   }
-  (void)fseek(file, 0, SEEK_END);
+  static_cast<void>(fseek(file, 0, SEEK_END));
   size_t file_length = ftell(file);
   if (!file_length) {
     return nullptr;
   }
-  (void)fseek(file, 0, SEEK_SET);
+  static_cast<void>(fseek(file, 0, SEEK_SET));
   std::unique_ptr<char, pdfium::FreeDeleter> buffer(
       static_cast<char*>(malloc(file_length)));
   if (!buffer) {
     return nullptr;
   }
   size_t bytes_read = fread(buffer.get(), 1, file_length, file);
-  (void)fclose(file);
+  static_cast<void>(fclose(file));
   if (bytes_read != file_length) {
     fprintf(stderr, "Failed to read: %s\n", filename);
     return nullptr;