summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-06-07 10:46:22 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-07 10:46:23 -0700
commit4997b22f84307521a62838f874928bf56cd3423c (patch)
treead11d99ac0a491ee222e9d0a42ec3b6ad3354e2a /fpdfsdk
parent0687e76dc259c678b3f29a6608331f07ffd8f1e2 (diff)
downloadpdfium-4997b22f84307521a62838f874928bf56cd3423c.tar.xz
Get rid of NULLs in core/
Review-Url: https://codereview.chromium.org/2032613003
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdfdoc_embeddertest.cpp14
-rw-r--r--fpdfsdk/fpdftext_embeddertest.cpp30
-rw-r--r--fpdfsdk/fxedit/fxet_edit.cpp1
3 files changed, 22 insertions, 23 deletions
diff --git a/fpdfsdk/fpdfdoc_embeddertest.cpp b/fpdfsdk/fpdfdoc_embeddertest.cpp
index 2450b6aea6..e0880deca5 100644
--- a/fpdfsdk/fpdfdoc_embeddertest.cpp
+++ b/fpdfsdk/fpdfdoc_embeddertest.cpp
@@ -23,22 +23,22 @@ TEST_F(FPDFDocEmbeddertest, DestGetPageIndex) {
// Page number directly in item from Dests NameTree.
FPDF_DEST dest = FPDF_GetNamedDestByName(document(), "First");
- EXPECT_NE(nullptr, dest);
+ EXPECT_TRUE(dest);
EXPECT_EQ(1U, FPDFDest_GetPageIndex(document(), dest));
// Page number via object reference in item from Dests NameTree.
dest = FPDF_GetNamedDestByName(document(), "Next");
- EXPECT_NE(nullptr, dest);
+ EXPECT_TRUE(dest);
EXPECT_EQ(1U, FPDFDest_GetPageIndex(document(), dest));
// Page number directly in item from Dests dictionary.
dest = FPDF_GetNamedDestByName(document(), "FirstAlternate");
- EXPECT_NE(nullptr, dest);
+ EXPECT_TRUE(dest);
EXPECT_EQ(11U, FPDFDest_GetPageIndex(document(), dest));
// Invalid object reference in item from Dests NameTree.
dest = FPDF_GetNamedDestByName(document(), "LastAlternate");
- EXPECT_NE(nullptr, dest);
+ EXPECT_TRUE(dest);
EXPECT_EQ(0U, FPDFDest_GetPageIndex(document(), dest));
}
@@ -88,7 +88,7 @@ TEST_F(FPDFDocEmbeddertest, Bookmarks) {
EXPECT_EQ(0u, FPDFBookmark_GetTitle(nullptr, buf, sizeof(buf)));
FPDF_BOOKMARK child = FPDFBookmark_GetFirstChild(document(), nullptr);
- EXPECT_NE(nullptr, child);
+ EXPECT_TRUE(child);
EXPECT_EQ(34u, FPDFBookmark_GetTitle(child, buf, sizeof(buf)));
EXPECT_EQ(CFX_WideString(L"A Good Beginning"),
CFX_WideString::FromUTF16LE(buf, 16));
@@ -96,7 +96,7 @@ TEST_F(FPDFDocEmbeddertest, Bookmarks) {
EXPECT_EQ(nullptr, FPDFBookmark_GetFirstChild(document(), child));
FPDF_BOOKMARK sibling = FPDFBookmark_GetNextSibling(document(), child);
- EXPECT_NE(nullptr, sibling);
+ EXPECT_TRUE(sibling);
EXPECT_EQ(28u, FPDFBookmark_GetTitle(sibling, buf, sizeof(buf)));
EXPECT_EQ(CFX_WideString(L"A Good Ending"),
CFX_WideString::FromUTF16LE(buf, 13));
@@ -112,7 +112,7 @@ TEST_F(FPDFDocEmbeddertest, FindBookmarks) {
std::unique_ptr<unsigned short, pdfium::FreeDeleter> title =
GetFPDFWideString(L"A Good Beginning");
FPDF_BOOKMARK child = FPDFBookmark_Find(document(), title.get());
- EXPECT_NE(nullptr, child);
+ EXPECT_TRUE(child);
// Check that the string matches.
unsigned short buf[128];
diff --git a/fpdfsdk/fpdftext_embeddertest.cpp b/fpdfsdk/fpdftext_embeddertest.cpp
index a5215c20cc..3070c30771 100644
--- a/fpdfsdk/fpdftext_embeddertest.cpp
+++ b/fpdfsdk/fpdftext_embeddertest.cpp
@@ -32,10 +32,10 @@ class FPDFTextEmbeddertest : public EmbedderTest {};
TEST_F(FPDFTextEmbeddertest, Text) {
EXPECT_TRUE(OpenDocument("hello_world.pdf"));
FPDF_PAGE page = LoadPage(0);
- EXPECT_NE(nullptr, page);
+ EXPECT_TRUE(page);
FPDF_TEXTPAGE textpage = FPDFText_LoadPage(page);
- EXPECT_NE(nullptr, textpage);
+ EXPECT_TRUE(textpage);
static const char expected[] = "Hello, world!\r\nGoodbye, world!";
unsigned short fixed_buffer[128];
@@ -141,10 +141,10 @@ TEST_F(FPDFTextEmbeddertest, Text) {
TEST_F(FPDFTextEmbeddertest, TextSearch) {
EXPECT_TRUE(OpenDocument("hello_world.pdf"));
FPDF_PAGE page = LoadPage(0);
- EXPECT_NE(nullptr, page);
+ EXPECT_TRUE(page);
FPDF_TEXTPAGE textpage = FPDFText_LoadPage(page);
- EXPECT_NE(nullptr, textpage);
+ EXPECT_TRUE(textpage);
std::unique_ptr<unsigned short, pdfium::FreeDeleter> nope =
GetFPDFWideString(L"nope");
@@ -157,7 +157,7 @@ TEST_F(FPDFTextEmbeddertest, TextSearch) {
// No occurences of "nope" in test page.
FPDF_SCHHANDLE search = FPDFText_FindStart(textpage, nope.get(), 0, 0);
- EXPECT_NE(nullptr, search);
+ EXPECT_TRUE(search);
EXPECT_EQ(0, FPDFText_GetSchResultIndex(search));
EXPECT_EQ(0, FPDFText_GetSchCount(search));
@@ -174,7 +174,7 @@ TEST_F(FPDFTextEmbeddertest, TextSearch) {
// Two occurences of "world" in test page.
search = FPDFText_FindStart(textpage, world.get(), 0, 2);
- EXPECT_NE(nullptr, search);
+ EXPECT_TRUE(search);
// Remains not found until advanced.
EXPECT_EQ(0, FPDFText_GetSchResultIndex(search));
@@ -209,7 +209,7 @@ TEST_F(FPDFTextEmbeddertest, TextSearch) {
// Exact search unaffected by case sensitiity and whole word flags.
search = FPDFText_FindStart(textpage, world.get(),
FPDF_MATCHCASE | FPDF_MATCHWHOLEWORD, 0);
- EXPECT_NE(nullptr, search);
+ EXPECT_TRUE(search);
EXPECT_TRUE(FPDFText_FindNext(search));
EXPECT_EQ(7, FPDFText_GetSchResultIndex(search));
EXPECT_EQ(5, FPDFText_GetSchCount(search));
@@ -217,7 +217,7 @@ TEST_F(FPDFTextEmbeddertest, TextSearch) {
// Default is case-insensitive, so matching agaist caps works.
search = FPDFText_FindStart(textpage, world_caps.get(), 0, 0);
- EXPECT_NE(nullptr, search);
+ EXPECT_TRUE(search);
EXPECT_TRUE(FPDFText_FindNext(search));
EXPECT_EQ(7, FPDFText_GetSchResultIndex(search));
EXPECT_EQ(5, FPDFText_GetSchCount(search));
@@ -252,10 +252,10 @@ TEST_F(FPDFTextEmbeddertest, TextSearch) {
TEST_F(FPDFTextEmbeddertest, StreamLengthPastEndOfFile) {
EXPECT_TRUE(OpenDocument("bug_57.pdf"));
FPDF_PAGE page = LoadPage(0);
- EXPECT_NE(nullptr, page);
+ EXPECT_TRUE(page);
FPDF_TEXTPAGE textpage = FPDFText_LoadPage(page);
- EXPECT_NE(nullptr, textpage);
+ EXPECT_TRUE(textpage);
EXPECT_EQ(13, FPDFText_CountChars(textpage));
FPDFText_ClosePage(textpage);
@@ -265,13 +265,13 @@ TEST_F(FPDFTextEmbeddertest, StreamLengthPastEndOfFile) {
TEST_F(FPDFTextEmbeddertest, WebLinks) {
EXPECT_TRUE(OpenDocument("weblinks.pdf"));
FPDF_PAGE page = LoadPage(0);
- EXPECT_NE(nullptr, page);
+ EXPECT_TRUE(page);
FPDF_TEXTPAGE textpage = FPDFText_LoadPage(page);
- EXPECT_NE(nullptr, textpage);
+ EXPECT_TRUE(textpage);
FPDF_PAGELINK pagelink = FPDFLink_LoadWebLinks(textpage);
- EXPECT_NE(nullptr, pagelink);
+ EXPECT_TRUE(pagelink);
// Page contains two HTTP-style URLs.
EXPECT_EQ(2, FPDFLink_CountWebLinks(pagelink));
@@ -371,10 +371,10 @@ TEST_F(FPDFTextEmbeddertest, WebLinks) {
TEST_F(FPDFTextEmbeddertest, GetFontSize) {
EXPECT_TRUE(OpenDocument("hello_world.pdf"));
FPDF_PAGE page = LoadPage(0);
- EXPECT_NE(nullptr, page);
+ EXPECT_TRUE(page);
FPDF_TEXTPAGE textpage = FPDFText_LoadPage(page);
- EXPECT_NE(nullptr, textpage);
+ EXPECT_TRUE(textpage);
const double kExpectedFontsSizes[] = {12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 1, 1, 16, 16, 16, 16, 16,
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp
index d2abb176eb..0124913c5f 100644
--- a/fpdfsdk/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/fxedit/fxet_edit.cpp
@@ -756,7 +756,6 @@ CFX_Edit::CFX_Edit(CPDF_VariableText* pVT)
m_ptScrollPos(0, 0),
m_ptRefreshScrollPos(0, 0),
m_bEnableScroll(FALSE),
- m_pIterator(nullptr),
m_ptCaret(0.0f, 0.0f),
m_Undo(kEditUndoMaxItems),
m_nAlignment(0),