summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-06-05 14:06:10 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-05 14:06:10 +0000
commit6cec70acf4ed6839c4a865c41381a6ac37de97e8 (patch)
tree03e758c713203fef08d0407c322b5337c67010f1
parentfbcc5d9afb4506eea1003d024a5fac5d601cc196 (diff)
downloadpdfium-6cec70acf4ed6839c4a865c41381a6ac37de97e8.tar.xz
Revert "Convert (void) to static_cast<void> in C++ code"
This reverts commit 80c6ab7b99bcbd7b940f78dc0cac52c30249f59c. Reason for revert: (void) idiom is prevalent through out C++ code. Original change's description: > 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> TBR=thestig@chromium.org,tsepez@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org,rharrison@chromium.org Change-Id: Ib6cc021c97cb1ea7c71b90346fa9b500659f565d No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/33890 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--core/fpdfapi/font/cfx_cttgsubtable.cpp6
-rw-r--r--core/fpdfapi/parser/cpdf_parser_embeddertest.cpp2
-rw-r--r--core/fxcrt/fx_memory_unittest.cpp8
-rw-r--r--fpdfsdk/fpdf_formfill.cpp4
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp2
-rw-r--r--samples/pdfium_test.cc2
-rw-r--r--samples/pdfium_test_write_helper.cc10
-rw-r--r--testing/embedder_test.cpp10
-rw-r--r--testing/test_support.cpp6
9 files changed, 24 insertions, 26 deletions
diff --git a/core/fpdfapi/font/cfx_cttgsubtable.cpp b/core/fpdfapi/font/cfx_cttgsubtable.cpp
index 6c93363857..ae868ca5ab 100644
--- a/core/fpdfapi/font/cfx_cttgsubtable.cpp
+++ b/core/fpdfapi/font/cfx_cttgsubtable.cpp
@@ -256,7 +256,7 @@ CFX_CTTGSUBTable::ParseCoverage(FT_Bytes raw) {
void CFX_CTTGSUBTable::ParseCoverageFormat1(FT_Bytes raw,
TCoverageFormat1* rec) {
FT_Bytes sp = raw;
- static_cast<void>(GetUInt16(sp));
+ (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::ParseCoverageFormat1(FT_Bytes raw,
void CFX_CTTGSUBTable::ParseCoverageFormat2(FT_Bytes raw,
TCoverageFormat2* rec) {
FT_Bytes sp = raw;
- static_cast<void>(GetUInt16(sp));
+ (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::ParseSingleSubstFormat1(FT_Bytes raw, TSubTable1* rec) {
void CFX_CTTGSUBTable::ParseSingleSubstFormat2(FT_Bytes raw, TSubTable2* rec) {
FT_Bytes sp = raw;
- static_cast<void>(GetUInt16(sp));
+ (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 ef9d43828e..3b8f550253 100644
--- a/core/fpdfapi/parser/cpdf_parser_embeddertest.cpp
+++ b/core/fpdfapi/parser/cpdf_parser_embeddertest.cpp
@@ -28,7 +28,7 @@ TEST_F(CPDFParserEmbeddertest, Bug_544880) {
// 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).
- static_cast<void>(GetPageCount());
+ (void)GetPageCount();
}
TEST_F(CPDFParserEmbeddertest, Bug_325a) {
diff --git a/core/fxcrt/fx_memory_unittest.cpp b/core/fxcrt/fx_memory_unittest.cpp
index d062885f85..2856bb9592 100644
--- a/core/fxcrt/fx_memory_unittest.cpp
+++ b/core/fxcrt/fx_memory_unittest.cpp
@@ -21,12 +21,11 @@ const size_t kOverflowIntAlloc2D = kMaxIntAlloc / kWidth + 10;
// 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(static_cast<void>(FX_Alloc(int, kMaxIntAlloc)), "");
+ EXPECT_DEATH_IF_SUPPORTED((void)FX_Alloc(int, kMaxIntAlloc), "");
int* ptr = FX_Alloc(int, 1);
EXPECT_TRUE(ptr);
- EXPECT_DEATH_IF_SUPPORTED(
- static_cast<void>(FX_Realloc(int, ptr, kMaxIntAlloc)), "");
+ EXPECT_DEATH_IF_SUPPORTED((void)FX_Realloc(int, ptr, kMaxIntAlloc), "");
FX_Free(ptr);
}
@@ -38,8 +37,7 @@ TEST(fxcrt, FX_AllocOverflow) {
ptr = FX_Alloc(int, 1);
EXPECT_TRUE(ptr);
- EXPECT_DEATH_IF_SUPPORTED(
- static_cast<void>(FX_Realloc(int, ptr, kOverflowIntAlloc)), "");
+ EXPECT_DEATH_IF_SUPPORTED((void)FX_Realloc(int, ptr, kOverflowIntAlloc), "");
FX_Free(ptr);
}
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp
index 8ebf7faaff..62d2c00d55 100644
--- a/fpdfsdk/fpdf_formfill.cpp
+++ b/fpdfsdk/fpdf_formfill.cpp
@@ -272,9 +272,9 @@ FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle,
return -1;
CPDF_InterForm interform(pPage->GetDocument());
int z_order = -1;
- static_cast<void>(interform.GetControlAtPoint(
+ (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 595c4a919f..f9f5981efb 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -644,7 +644,7 @@ bool CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
if (!it)
return true;
- static_cast<void>(it->MoveToNext());
+ (void)it->MoveToNext();
CXFA_Node* pNode = it->MoveToNext();
while (pNode) {
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 0491840b34..d2e84872d6 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -682,7 +682,7 @@ void RenderPdf(const std::string& name,
return;
}
- static_cast<void>(FPDF_GetDocPermissions(doc.get()));
+ (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 758f5efe72..c436c97fbe 100644
--- a/samples/pdfium_test_write_helper.cc
+++ b/samples/pdfium_test_write_helper.cc
@@ -211,7 +211,7 @@ void WriteText(FPDF_PAGE page, const char* pdf_name, int num) {
uint32_t bom = 0x0000FEFF;
if (fwrite(&bom, sizeof(bom), 1, fp) != 1) {
fprintf(stderr, "Failed to write to %s\n", filename);
- static_cast<void>(fclose(fp));
+ (void)fclose(fp);
return;
}
@@ -223,7 +223,7 @@ void WriteText(FPDF_PAGE page, const char* pdf_name, int num) {
break;
}
}
- static_cast<void>(fclose(fp));
+ (void)fclose(fp);
}
void WriteAnnot(FPDF_PAGE page, const char* pdf_name, int num) {
@@ -343,7 +343,7 @@ void WriteAnnot(FPDF_PAGE page, const char* pdf_name, int num) {
}
}
- static_cast<void>(fclose(fp));
+ (void)fclose(fp);
}
std::string WritePng(const char* pdf_name,
@@ -383,7 +383,7 @@ std::string WritePng(const char* pdf_name,
if (bytes_written != png_encoding.size())
fprintf(stderr, "Failed to write to %s\n", filename);
- static_cast<void>(fclose(fp));
+ (void)fclose(fp);
return std::string(filename);
}
@@ -649,6 +649,6 @@ void WriteImages(FPDF_PAGE page, const char* pdf_name, int page_num) {
else
fprintf(stderr, "Successfully wrote embedded image %s.\n", filename);
- static_cast<void>(fclose(fp));
+ (void)fclose(fp);
}
}
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index aaea965cf0..03eebe3abc 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -220,7 +220,7 @@ bool EmbedderTest::OpenDocumentHelper(const char* password,
FPDF_LoadXFA(*document);
#endif // PDF_ENABLE_XFA
- static_cast<void>(FPDF_GetDocPermissions(*document));
+ (void)FPDF_GetDocPermissions(*document);
return true;
}
@@ -262,16 +262,16 @@ void EmbedderTest::DoOpenActions() {
int EmbedderTest::GetFirstPageNum() {
int first_page = FPDFAvail_GetFirstPageNum(document_);
- static_cast<void>(FPDFAvail_IsPageAvail(
- avail_, first_page, fake_file_access_->GetDownloadHints()));
+ (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)
- static_cast<void>(FPDFAvail_IsPageAvail(
- avail_, i, fake_file_access_->GetDownloadHints()));
+ (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 16ae5b28b9..2b6f436c32 100644
--- a/testing/test_support.cpp
+++ b/testing/test_support.cpp
@@ -84,19 +84,19 @@ std::unique_ptr<char, pdfium::FreeDeleter> GetFileContents(const char* filename,
fprintf(stderr, "Failed to open: %s\n", filename);
return nullptr;
}
- static_cast<void>(fseek(file, 0, SEEK_END));
+ (void)fseek(file, 0, SEEK_END);
size_t file_length = ftell(file);
if (!file_length) {
return nullptr;
}
- static_cast<void>(fseek(file, 0, SEEK_SET));
+ (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);
- static_cast<void>(fclose(file));
+ (void)fclose(file);
if (bytes_read != file_length) {
fprintf(stderr, "Failed to read: %s\n", filename);
return nullptr;