pdfium.git
3 years agoConvert a bunch of raw pointers in fsdk_mgr to unique_ptrs.
Oliver Chang [Fri, 30 Oct 2015 22:28:47 +0000]
Convert a bunch of raw pointers in fsdk_mgr to unique_ptrs.

R=tsepez@chromium.org, thestig@chromium.org

Review URL: https://codereview.chromium.org/1425233002 .

3 years agoRemove two more unused variables that compilers now complain about.
Nico Weber [Fri, 30 Oct 2015 22:16:17 +0000]
Remove two more unused variables that compilers now complain about.

TBR=thestig@chromium.org

Review URL: https://codereview.chromium.org/1414073005 .

3 years agoRemove external jpeg provider interface.
Tom Sepez [Fri, 30 Oct 2015 20:33:35 +0000]
Remove external jpeg provider interface.

It is unused in PDFium.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1407903005 .

3 years agoMerge to master: Restore early return in FORM_DoPageAAction()
Tom Sepez [Fri, 30 Oct 2015 20:13:18 +0000]
Merge to master: Restore early return in FORM_DoPageAAction()

The early return is present in master, but take the other code
cleanup changes from XFA.

(cherry picked from commit de4791d291b4252045d7922fb838c64d9b711fdf)
Original Review URL: https://codereview.chromium.org/1425223002 .

BUG=pdfium:259
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1415743008 .

3 years agochromium_code: Surrender in the gyp build for now.
Nico Weber [Fri, 30 Oct 2015 20:07:20 +0000]
chromium_code: Surrender in the gyp build for now.

This is too hard debug with only roll try runs. I'll try again when I have
access to linux and windows boxen (monday).

BUG=pdfium:29
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1415483003 .

3 years agoMore chromium_code whack-a-mole.
Nico Weber [Fri, 30 Oct 2015 20:07:00 +0000]
More chromium_code whack-a-mole.

BUG=pdfium:29
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1419943006 .

3 years agoCPDFDoc_Environment::GetAnnotHandlerMgr() never returns nullptr.
Lei Zhang [Fri, 30 Oct 2015 20:06:11 +0000]
CPDFDoc_Environment::GetAnnotHandlerMgr() never returns nullptr.

Remove checks for its return value.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1424233003 .

3 years agoRip out the KillFocusAnnot call from CPDFSDK_PageView's destructor
Oliver Chang [Fri, 30 Oct 2015 19:48:49 +0000]
Rip out the KillFocusAnnot call from CPDFSDK_PageView's destructor

Previously, blur event actions could potentially touch deleted PageViews
as CPDFSDK_Document deletes the PageViews one by one.

This also fixes a related issue: CPDFSDK_Document::SetFocusAnnot no
longer does anything if the document is being destroyed. Otherwise, it
eventually tries to use m_pEnv->GetSDKDocument() at which point has
already been set to NULL by FPDFDOC_ExitFormFillEnvironment.

R=tsepez@chromium.org, thestig@chromium.org
BUG=512445

Review URL: https://codereview.chromium.org/1414353007 .

3 years agochromium_code tweaks for Windows and Linux/gyp.
Nico Weber [Fri, 30 Oct 2015 19:03:50 +0000]
chromium_code tweaks for Windows and Linux/gyp.

BUG=pdfium:29
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1431563002 .

3 years agoFix incorrect CPDFSDK_PageView::CountAnnots(). (try 2)
Lei Zhang [Fri, 30 Oct 2015 18:18:29 +0000]
Fix incorrect CPDFSDK_PageView::CountAnnots(). (try 2)

The original XFA version was correct, and the master version here is
wrong. The two versions are now in sync, but incorrect.
So we need to fix this here and then merge to XFA again.

Also fix what are now incorrect uses of CountAnnots() and do some
cleanups.

BUG=543049
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1413973011 .

3 years agoTurn on chromium_code (except -Wsign-compare, for now) for pdfium
Nico Weber [Fri, 30 Oct 2015 18:11:26 +0000]
Turn on chromium_code (except -Wsign-compare, for now) for pdfium

BUG=pdfium:29
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1411583005 .

3 years agolinux: Remove unneeded -L flags from static library targets.
Nico Weber [Fri, 30 Oct 2015 17:37:20 +0000]
linux: Remove unneeded -L flags from static library targets.

-L isn't used for creating static libraries.  This flag isn't present on
non-Linux or in the gn file either.

BUG=none
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1425213003 .

3 years agoAdd standard "Must be after no_chromium_code" comment in GN files.
Lei Zhang [Fri, 30 Oct 2015 17:31:03 +0000]
Add standard "Must be after no_chromium_code" comment in GN files.

R=thakis@chromium.org

Review URL: https://codereview.chromium.org/1411563004 .

3 years agoRevert "Fix incorrect CPDFSDK_PageView::CountAnnots()."
Lei Zhang [Fri, 30 Oct 2015 08:53:50 +0000]
Revert "Fix incorrect CPDFSDK_PageView::CountAnnots()."

This reverts commit 9dd9439d23d44d105db0950e33af0cc913a6cece.

BUG=536967
TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1421583005 .

3 years agoFix incorrect CPDFSDK_PageView::CountAnnots().
Lei Zhang [Fri, 30 Oct 2015 08:31:39 +0000]
Fix incorrect CPDFSDK_PageView::CountAnnots().

The original XFA version was correct, and the master version here is
wrong. The two versions are now in sync, but incorrect. So we need to
fix this here and then merge to XFA again.

BUG=536967
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1406183007 .

3 years agoRevert "Cleanup some numeric code."
dan sinclair [Thu, 29 Oct 2015 19:08:50 +0000]
Revert "Cleanup some numeric code."

This reverts commit 589f7e0a57675efce9810c15a3e9b7c49bf0bc90.

Broke the build on Mac, unable to find std::isdigit.

TBR=thestig@chromium.org

Review URL: https://codereview.chromium.org/1428853002 .

3 years agoCleanup some numeric code.
Dan Sinclair [Thu, 29 Oct 2015 18:56:26 +0000]
Cleanup some numeric code.

This changes the various comparisons of char >= '0' && char <= '9' and
char < '0' || char > '9' to use std::isdigit checks. It also cleans up
a handful of hex to digit conversions to call one common method.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1415933005 .

3 years agoCosmetic change to make fpdf_page_image.cpp identical to xfa.
Tom Sepez [Thu, 29 Oct 2015 17:05:20 +0000]
Cosmetic change to make fpdf_page_image.cpp identical to xfa.

Also stray newline in fpdf_parser_document.cpp in master.

R=dsinclair@chromium.org

Review URL: https://codereview.chromium.org/1424213004 .

3 years agoRemove linearized path print statements
Dan Sinclair [Thu, 29 Oct 2015 13:18:03 +0000]
Remove linearized path print statements

This CL makes the pdfium_test app a little less chatty by removing the print
statements around linearized paths.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1415333007 .

3 years agoAdd PDFCharIsLineEnding helper
Dan Sinclair [Wed, 28 Oct 2015 21:14:42 +0000]
Add PDFCharIsLineEnding helper

This CL adds a helper to check if a given character is a \n or \r.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1418073006 .

3 years agoAllow running individual tests.
Dan Sinclair [Wed, 28 Oct 2015 21:06:04 +0000]
Allow running individual tests.

This CL adds the ability to run a given test from the corpus, javascript and
pixel test runners. The filename to provide is relative to the testing
directory in question.

Because the directories for javascript and pixel are flat you just provide the filename (it will rewrite the .pdf to .in if .pdf is provided). For corpus tests you have to provide the path from the corpus directory.

Development/pdfium/pdfium % ./testing/tools/run_javascript_tests.py apply.pdf
Rendering PDF file /Development/pdfium/pdfium/out/Debug/gen/pdfium/testing/javascript/apply.pdf.
Non-linearized path...
Rendered 1 pages.
Skipped 0 bad pages.

Development/pdfium/pdfium % ./testing/tools/run_pixel_tests.py bug_524043_1.pdf
Rendering PDF file /Development/pdfium/pdfium/out/Debug/gen/pdfium/testing/pixel/bug_524043_1.pdf.
Linearized path...
Rendered 1 pages.
Skipped 0 bad pages.
Checking /Development/pdfium/pdfium/out/Debug/gen/pdfium/testing/pixel/bug_524043_1.pdf.0.png
diff: 0.00% passed

Development/pdfium/pdfium % ./testing/tools/run_corpus_tests.py third_party/tcpdf/example_065.pdf
Rendering PDF file /Development/pdfium/pdfium/out/Debug/gen/pdfium/testing/corpus/example_065.pdf.
Non-linearized path...
Rendered 1 pages.
Skipped 0 bad pages.
Checking /Development/pdfium/pdfium/out/Debug/gen/pdfium/testing/corpus/example_065.pdf.0.png
diff: 0.14% failed
FAILURE: example_065.pdf; Command '['/Development/pdfium/pdfium/out/Debug/pdfium_diff', '/Development/pdfium/pdfium/testing/corpus/third_party/tcpdf/example_065_expected.pdf.0.png', '/Development/pdfium/pdfium/out/Debug/gen/pdfium/testing/corpus/example_065.pdf.0.png']' returned non-zero exit status 1

Summary of Failures:
/Development/pdfium/pdfium/testing/corpus/third_party/tcpdf/example_065.pdf

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1407913005 .

3 years agoAdd a NULL check in pdf_page_colors.cpp
Oliver Chang [Wed, 28 Oct 2015 18:49:02 +0000]
Add a NULL check in pdf_page_colors.cpp

R=thestig@chromium.org
BUG=548714

Review URL: https://codereview.chromium.org/1430653002 .

3 years agoAdd constants for the path operators.
Dan Sinclair [Wed, 28 Oct 2015 18:18:26 +0000]
Add constants for the path operators.

This CL adds constants for some of the path operators to make it more obvious
what is being checked.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1413783009 .

3 years agoCheck if document was opened during testing.
Dan Sinclair [Wed, 28 Oct 2015 17:32:35 +0000]
Check if document was opened during testing.

When we call OpenDocument we fail to check if the document was actually opened.
Currently we return true in all cases (assuming we read the file). This CL
updates the code to check if the document was opened and return false if not.

I've updated several tests to check for FALSE instead of TRUE. I verified the
documents in fact don't open with my local (non-PDFium) PDF reader.

BUG=pdfium:223
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1417893007 .

3 years agoAdd PositionIsInBounds to CPDF_StreamParser
Dan Sinclair [Wed, 28 Oct 2015 16:57:00 +0000]
Add PositionIsInBounds to CPDF_StreamParser

This Cl moves all of the m_Size <= m_Pos and m_Pos >= m_Size checks to an
PositionIsInBounds() helper.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1412793008 .

3 years agoAdd helpers to check the PDF_CharType.
Dan Sinclair [Wed, 28 Oct 2015 14:14:08 +0000]
Add helpers to check the PDF_CharType.

This CL adds helpers to provide more descriptive access to
PDF_CharType.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1407913004 .

3 years agoUse static_cast for various CPDF_Object conversions.
Dan Sinclair [Tue, 27 Oct 2015 19:32:01 +0000]
Use static_cast for various CPDF_Object conversions.

This Cl converts a bunch of c-style casts to static_cast<CPDF_Object*>().

BUG=pdfium:201
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1428583003 .

3 years agoGive names to the shading types
Dan Sinclair [Tue, 27 Oct 2015 17:18:28 +0000]
Give names to the shading types

Currently the shading types are referenced by number. This Cl creates and enum
and updates the code to use the enum names instead of magic numbers.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1418623011 .

3 years agoAdd context to file load failures in pdfium_test.
Dan Sinclair [Tue, 27 Oct 2015 17:02:59 +0000]
Add context to file load failures in pdfium_test.

Currently if pdfium_test fails to load the document it just says it failed. This
CL adds some extra context by looking at the error set by the load and reporting
it to the user.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1413923006 .

3 years agoFix memory leak in FXJS_ReleaseRuntime.
Oliver Chang [Tue, 27 Oct 2015 16:21:32 +0000]
Fix memory leak in FXJS_ReleaseRuntime.

Should fix a bunch of JS related memory leaks reported by LSan/DrMemory.

R=jochen@chromium.org, thestig@chromium.org, tsepez@chromium.org
BUG=pdfium:242

Review URL: https://codereview.chromium.org/1417973009 .

3 years agoType check the m_pShadingObj before assuming it's a stream.
Dan Sinclair [Tue, 27 Oct 2015 16:08:20 +0000]
Type check the m_pShadingObj before assuming it's a stream.

The m_pShadingObj can be a stream or a dictionary depending on how it's used.
This CL adds some simple type checking to make sure that the type of the
object matches what we expect.

BUG=chromium:547706
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1421973004 .

3 years agoDelete unused fpdfsdkdll.rc and resource.h.
Lei Zhang [Tue, 27 Oct 2015 01:27:41 +0000]
Delete unused fpdfsdkdll.rc and resource.h.

BUG=pdfium:241
R=brucedawson@chromium.org

Review URL: https://codereview.chromium.org/1422193002 .

3 years agoRemove usage of std::vector::data
Oliver Chang [Tue, 27 Oct 2015 01:05:20 +0000]
Remove usage of std::vector::data

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1412823005 .

3 years agoPartial revert of commit c6d8683 to fix a GN + Win/Clang build warning.
Lei Zhang [Tue, 27 Oct 2015 00:00:46 +0000]
Partial revert of commit c6d8683 to fix a GN + Win/Clang build warning.

BUG=547906
TBR=thakis@chromium.org

Review URL: https://codereview.chromium.org/1420503012 .

3 years agoRemove default argument from CPDF_Dictionary::SetAt().
Lei Zhang [Mon, 26 Oct 2015 22:36:17 +0000]
Remove default argument from CPDF_Dictionary::SetAt().

Also fix a potential object leak.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1414963005 .

3 years agoTake FOXIT_FACE_COUNT and MM_FACE_COUNT constants from xfa
Tom Sepez [Mon, 26 Oct 2015 22:26:34 +0000]
Take FOXIT_FACE_COUNT and MM_FACE_COUNT constants from xfa

Make master closer to XFA and eliminate some magic numbers.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1410823005 .

3 years agoWhitespace changes in fx_system_unittest.cpp to match XFA
Tom Sepez [Mon, 26 Oct 2015 21:03:13 +0000]
Whitespace changes in fx_system_unittest.cpp to match XFA

TBR=thestig@chromium.org

Review URL: https://codereview.chromium.org/1418263003 .

3 years agoFix a leak in CPDF_SyntaxParser::GetObject().
Lei Zhang [Mon, 26 Oct 2015 20:54:28 +0000]
Fix a leak in CPDF_SyntaxParser::GetObject().

As seen in FPDFViewEmbeddertest.Crasher_451830.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1385803002 .

3 years agoRevert "Make m_pShadingObj a CPDF_Stream instead of CPDF_Object."
Dan Sinclair [Mon, 26 Oct 2015 20:25:38 +0000]
Revert "Make m_pShadingObj a CPDF_Stream instead of CPDF_Object."

There appear to be a bunch of corpus tests which fail with this change such
as FAILURE: shading1.pdf

This reverts commit 85361b227ad6786d2aeef8409b79a8d077a26ee9.

Make m_pShadingObj a CPDF_Stream instead of CPDF_Object.

This object is required to be a stream and was being converted as such. With
the new type checking this caused us to pass a nullptr where previously we'd
have, incorrectly, cast a CPDF_Dictionary to a CPDF_Stream.

This CL changes the m_pShadingObj to always be a CPDF_Stream. Then, we never
go down the bad code path because we check if m_pShadingObj is nullptr earlier
and bail out.

BUG=chromium:547706
TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1414283003 .

3 years agoMake m_pShadingObj a CPDF_Stream instead of CPDF_Object.
Dan Sinclair [Mon, 26 Oct 2015 20:14:23 +0000]
Make m_pShadingObj a CPDF_Stream instead of CPDF_Object.

This object is required to be a stream and was being converted as such. With
the new type checking this caused us to pass a nullptr where previously we'd
have, incorrectly, cast a CPDF_Dictionary to a CPDF_Stream.

This CL changes the m_pShadingObj to always be a CPDF_Stream. Then, we never
go down the bad code path because we check if m_pShadingObj is nullptr earlier
and bail out.

BUG=chromium:547706
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1426713002 .

3 years agoRevert "Revert "Add type cast definitions for CPDF_Reference.""
Dan Sinclair [Mon, 26 Oct 2015 19:58:42 +0000]
Revert "Revert "Add type cast definitions for CPDF_Reference.""

This reverts commit 7e155865c90cc1115cc7193b7646a341d8f9093e.

Add type cast definitions for CPDF_Reference.

This Cl adds ToReference, CPDF_Object::AsReference and CPDF_Object::IsReference
and updates the src to use them as needed.

BUG=pdfium:201
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1418923005 .

3 years agoRevert "Add type cast definitions for CPDF_Reference."
Dan Sinclair [Mon, 26 Oct 2015 17:02:07 +0000]
Revert "Add type cast definitions for CPDF_Reference."

This is causing pixel test failures on the bots.
  FAILURE: bug_543018_2.in
  FAILURE: bug_543018_1.in
  FAILURE: bug_524043_1.in

This reverts commit 9024e026dae1af064b8467bb0f62278417fb82d1.

Add type cast definitions for CPDF_Reference.

This Cl adds ToReference, CPDF_Object::AsReference and CPDF_Object::IsReference
and updates the src to use them as needed.

BUG=pdfium:201
TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1420973002 .

Review URL: https://codereview.chromium.org/1414393006 .

3 years agoAdd type cast definitions for CPDF_Reference.
Dan Sinclair [Mon, 26 Oct 2015 16:51:50 +0000]
Add type cast definitions for CPDF_Reference.

This Cl adds ToReference, CPDF_Object::AsReference and CPDF_Object::IsReference
and updates the src to use them as needed.

BUG=pdfium:201
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1420973002 .

3 years agoCleanup parts of CPDFSDK_AnnotIterator and CPDFSDK_PageView.
Lei Zhang [Sat, 24 Oct 2015 01:06:17 +0000]
Cleanup parts of CPDFSDK_AnnotIterator and CPDFSDK_PageView.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1411203007 .

3 years agoConvert some pointers in fpdf_parser_parser to unique_ptr and std::vector.
Oliver Chang [Sat, 24 Oct 2015 00:56:38 +0000]
Convert some pointers in fpdf_parser_parser to unique_ptr and std::vector.

R=thestig@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1411043003 .

3 years agoOne line whitespace change for fpdf_render.cpp (clang format)
Tom Sepez [Fri, 23 Oct 2015 23:07:31 +0000]
One line whitespace change for fpdf_render.cpp (clang format)

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1420873003 .

3 years agoSet a recursion limit on CPDF_DataAvail::CheckPageNode
Oliver Chang [Thu, 22 Oct 2015 23:32:14 +0000]
Set a recursion limit on CPDF_DataAvail::CheckPageNode

This limit mirrors FX_MAX_PAGE_LEVEL in fpdf_parser_document.cpp

R=thestig@chromium.org, tsepez@chromium.org

BUG=544880

Review URL: https://codereview.chromium.org/1421743003 .

3 years agoMake parallelized run_corpus_tests.py handle ctrl-c.
Lei Zhang [Thu, 22 Oct 2015 22:16:57 +0000]
Make parallelized run_corpus_tests.py handle ctrl-c.

Thanks Stack Overflow!

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1421623002 .

3 years agoAdd type cast definitions for CPDF_Stream.
Dan Sinclair [Thu, 22 Oct 2015 19:34:16 +0000]
Add type cast definitions for CPDF_Stream.

This Cl adds ToStream, CPDF_Object::AsStream and CPDF_Object::IsStream and
updates the src to use them as needed.

BUG=pdfium:201
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1402413004 .

3 years agoSync build settings to XFA.
Dan Sinclair [Thu, 22 Oct 2015 19:01:15 +0000]
Sync build settings to XFA.

This matches some whitespace/ordering changes made to BUILD.gn on XFA branch.

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1410773007 .

3 years agoRemove unused error variable from CFX_Font::AdjustMMParams
Oliver Chang [Thu, 22 Oct 2015 18:03:40 +0000]
Remove unused error variable from CFX_Font::AdjustMMParams

Also fixes a potential memory leak.

R=tsepez@chromium.org, thestig@chromium.org
BUG=pdfium:156

Review URL: https://codereview.chromium.org/1409973003 .

3 years agoRemove unused CPDFSDK_InterForm::DoFDFBuffer.
Dan Sinclair [Thu, 22 Oct 2015 15:08:42 +0000]
Remove unused CPDFSDK_InterForm::DoFDFBuffer.

This method isn't used anywhere and the implementation doesn't really do
anything.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1405163003 .

3 years agoAdd type cast definitions for CPDF_Array.
Dan Sinclair [Thu, 22 Oct 2015 13:31:44 +0000]
Add type cast definitions for CPDF_Array.

This Cl adds ToArray, CPDF_Object::AsArray and CPDF_Object::IsArray and
updates the src to use them as needed.

BUG=pdfium:201
R=thestig@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1417893003 .

3 years agoMore master side changes for convergence with XFA.
Tom Sepez [Wed, 21 Oct 2015 22:55:42 +0000]
More master side changes for convergence with XFA.

- Add new CPDFSDK_Document::GetPDFDocument()
- FPDFDocumentFromCPDFDocument() to match XFA
- rename some JS variables to be consistent with XFA
- remove unused param from CJS_GlobalData().
- kill dead code used XFA only.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1413883005 .

3 years ago(Reland) Switch builds to clang by default for Linux and OS X.
Oliver Chang [Wed, 21 Oct 2015 20:19:28 +0000]
(Reland) Switch builds to clang by default for Linux and OS X.

Also adds support for ASan and sanitizer coverage.

BUG=pdfium:1,pdfium:171
R=thakis@chromium.org, thestig@chromium.org

Committed: https://pdfium.googlesource.com/pdfium/+/5478df43a8970257e9644ae6f57a6fe7513029c6

Review URL: https://codereview.chromium.org/1406843002 .

3 years agoChange DEPS hooks paths to include 'pdfium/'.
Oliver Chang [Wed, 21 Oct 2015 19:05:57 +0000]
Change DEPS hooks paths to include 'pdfium/'.

This will break existing checkouts based on the instructions provided.

Instead of having a single pdfium directory, checkouts will now compromise of:
("repo" can be named anything)

repo/.gclient
repo/pdfium/.git
repo/pdfium/others...

To convert an existing checkout, do something like:

mkdir repo
mv pdfium repo
rm repo/pdfium/.gclient_entries # will be regenerated, with a warning
mv repo/pdfium/.gclient repo
edit repo/.gclient and change "name: '.'" to "name: 'pdfium'"

Instructions for getting a new checkout are in README.md in this CL.

R=thestig@chromium.org, tsepez@chromium.org, thakis@chromium.org

Review URL: https://codereview.chromium.org/1406383003 .

3 years agoRemove FFL_Utils as it is unused.
Dan Sinclair [Wed, 21 Oct 2015 18:16:29 +0000]
Remove FFL_Utils as it is unused.

None of the methods in this file are used and it is not included anywhere. Removing.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1417783004 .

3 years agoAdd type cast definitions for CPDF_Name.
Dan Sinclair [Wed, 21 Oct 2015 17:55:38 +0000]
Add type cast definitions for CPDF_Name.

This Cl adds ToName, CPDF_Object::AsName and CPDF_Object::IsName and
updates the src to use them as needed.

BUG=pdfium:201
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1417823005 .

3 years agoAdd type cast definitions for CPDF_String.
Dan Sinclair [Wed, 21 Oct 2015 17:08:24 +0000]
Add type cast definitions for CPDF_String.

This Cl adds ToString, CPDF_Object::AsString and CPDF_Object::IsString and
updates the src to use them as needed.

BUG=pdfium:201
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1417933002 .

3 years agoAdd type cast definitions for CPDF_Number.
Dan Sinclair [Wed, 21 Oct 2015 15:01:01 +0000]
Add type cast definitions for CPDF_Number.

This Cl adds ToNumber, CPDF_Object::AsNumber and CPDF_Object::IsNumber and
updates the src to use them as needed.

BUG=pdfium:201
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1410673005 .

3 years agoRemove void* ctor from CPDF_Number.
Dan Sinclair [Wed, 21 Oct 2015 12:57:40 +0000]
Remove void* ctor from CPDF_Number.

This Removes the ctor that took a pointer to the data to store and copied it
into the union memory. Instead, the call sites look at the type and pass the
correct value.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1422473002 .

3 years agoMake CFX_FontMgr member variables private. (try 2)
Lei Zhang [Tue, 20 Oct 2015 23:56:03 +0000]
Make CFX_FontMgr member variables private. (try 2)

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1412733011 .

3 years agoFix pdfium-i#236: memory leaks from RenderPdf
Qin Zhao [Tue, 20 Oct 2015 22:20:11 +0000]
Fix pdfium-i#236: memory leaks from RenderPdf

- add FPDFAvail_Destroy(pdf_avail) on the early return path in RenderPdf

R=thestig@chromium.org
BUG=pdfium:236

Review URL: https://codereview.chromium.org/1410333007 .

3 years agoCosmetic changes in fsdk_define.h
Tom Sepez [Tue, 20 Oct 2015 21:28:37 +0000]
Cosmetic changes in fsdk_define.h

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1412123004 .

3 years agoAdd type cast definitions for CPDF_Boolean.
Dan Sinclair [Tue, 20 Oct 2015 20:38:12 +0000]
Add type cast definitions for CPDF_Boolean.

This CL adds ToBoolean, CPDF_Object::AsBoolean and CPDF_Object::IsBoolean and
updates the src to use them as needed.

BUG=pdfium:201
R=thestig@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1417623005 .

3 years agoRoll DEPS for v8 to 2607e2b. Regular weekly roll.
Lei Zhang [Tue, 20 Oct 2015 19:19:55 +0000]
Roll DEPS for v8 to 2607e2b. Regular weekly roll.

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1415953003 .

3 years agoRevert "Revert "Add type cast definitions for CPDF_Dictionary.""
Dan Sinclair [Tue, 20 Oct 2015 18:57:56 +0000]
Revert "Revert "Add type cast definitions for CPDF_Dictionary.""

This reverts commit 937840e1722d1f2b77d80575d6e710d760662c9c.

Add type cast definitions for CPDF_Dictionary.

This CL adds ToCPDFDictionary type definitions and updates one file to use
instead of straight casts. I had to fix two places where we'd casted off the
constness of the original pointer.

BUG=pdfium:201
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1420583003 .

3 years agoMinor documentation updates for fpdfview.h.
Dan Sinclair [Tue, 20 Oct 2015 18:13:02 +0000]
Minor documentation updates for fpdfview.h.

This does some minor copy editing and formatting of the documentation in the
fpdfview.h header.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1411863004 .

3 years agoRevert "Make CFX_FontMgr member variables private."
Lei Zhang [Tue, 20 Oct 2015 17:43:15 +0000]
Revert "Make CFX_FontMgr member variables private."

This reverts commit c29bee029cd5fe3f8a4ceb580235ac2d0e5ce8fd.

because it broke corpus tests.

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1410733005 .

3 years agoRevert "Add type cast definitions for CPDF_Dictionary."
Dan Sinclair [Tue, 20 Oct 2015 17:30:34 +0000]
Revert "Add type cast definitions for CPDF_Dictionary."

This reverts commit 4816432671eef6467354aa252f22bb80acc315b7.

Reason, broke the javascript_test Rendering PDF file
/mnt/data/b/build/slave/linux/build/pdfium/out/Debug/gen/pdfium/testing/javascript/document_methods.pdf.
Non-linearized path...
FAILURE: document_methods.in; Command
'['/mnt/data/b/build/slave/linux/build/pdfium/out/Debug/pdfium_test',
'/mnt/data/b/build/slave/linux/build/pdfium/out/Debug/gen/pdfium/testing/javascript/document_methods.pdf']'
returned non-zero exit status -11

BUG=pdfium:201
TBR=thestig@chromium.org

Review URL: https://codereview.chromium.org/1412413002 .

3 years agoMake CFX_FontMgr member variables private.
Lei Zhang [Tue, 20 Oct 2015 17:22:56 +0000]
Make CFX_FontMgr member variables private.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1405213003 .

3 years agoAdd type cast definitions for CPDF_Dictionary.
Dan Sinclair [Tue, 20 Oct 2015 17:19:19 +0000]
Add type cast definitions for CPDF_Dictionary.

This CL adds ToCPDFDictionary type definitions and updates one file to use
instead of straight casts. I had to fix two places where we'd casted off the
constness of the original pointer.

BUG=pdfium:201
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1399233003 .

3 years agoRemove unused CFFL_Notify.
Lei Zhang [Tue, 20 Oct 2015 00:10:15 +0000]
Remove unused CFFL_Notify.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1411963002 .

3 years agoFix some override warnings in fpdfview.cpp.
Lei Zhang [Tue, 20 Oct 2015 00:08:16 +0000]
Fix some override warnings in fpdfview.cpp.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1410733004 .

3 years agoRemove duplicate core/include/thirdparties headers.
Tom Sepez [Mon, 19 Oct 2015 21:45:06 +0000]
Remove duplicate core/include/thirdparties headers.

These are unused in favor of the ones under the top-level
third_party/ directory.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1417483004 .

3 years agoRemove dead code that was reactivated when fixing overrides.
Lei Zhang [Mon, 19 Oct 2015 21:14:48 +0000]
Remove dead code that was reactivated when fixing overrides.

BUG=pdfium:205
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1409743004 .

3 years agoConsolidate test support code.
Tom Sepez [Mon, 19 Oct 2015 21:03:31 +0000]
Consolidate test support code.

Removes duplication between pdfium_test and pdfium_embeddertest

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1416713002 .

3 years agoSanity check the values of TRUE and FALSE.
Lei Zhang [Mon, 19 Oct 2015 19:00:05 +0000]
Sanity check the values of TRUE and FALSE.

Get rid of cond ? TRUE : FALSE.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1405723003 .

3 years agoRemove some checks for object creation failures. They cannot fail.
Lei Zhang [Mon, 19 Oct 2015 18:52:28 +0000]
Remove some checks for object creation failures. They cannot fail.

Also reduce nesting in if statements, remove CFX_SmartPointer, and
use more unique_ptrs.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1393303004 .

3 years agoAdd FPDFAPIJPEG_ prefix to more libjpeg functions
Tom Sepez [Mon, 19 Oct 2015 18:49:57 +0000]
Add FPDFAPIJPEG_ prefix to more libjpeg functions

Original patch by Evangelos Foutras.

Chromium built with use_system_libjpeg=1 can mistakenly try to use
symbols exported by the libjpeg library that's bundled with pdfium.

These name conflicts result in failure to encode the contents of a
canvas element using toDataURL('image/jpeg').

BUG=505226
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1409243004 .

3 years agoUnrevert commit a398ca6 and apply the proper fix.
Lei Zhang [Mon, 19 Oct 2015 18:46:02 +0000]
Unrevert commit a398ca6 and apply the proper fix.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1401493002 .

3 years agoRevert "Switch builds to clang by default for Linux and OS X."
Oliver Chang [Mon, 19 Oct 2015 18:23:52 +0000]
Revert "Switch builds to clang by default for Linux and OS X."

This reverts commit 5478df43a8970257e9644ae6f57a6fe7513029c6.

TBR=thestig@chromium.org

Review URL: https://codereview.chromium.org/1413193002 .

3 years agoSwitch builds to clang by default for Linux and OS X.
Oliver Chang [Mon, 19 Oct 2015 18:19:22 +0000]
Switch builds to clang by default for Linux and OS X.

Also adds support for ASan and sanitizer coverage.

BUG=pdfium:1,pdfium:171
R=thakis@chromium.org, thestig@chromium.org

Review URL: https://codereview.chromium.org/1406843002 .

3 years agoDon't bother passing -1 as the length to the CFX_ByteString ctor.
Lei Zhang [Fri, 16 Oct 2015 23:21:58 +0000]
Don't bother passing -1 as the length to the CFX_ByteString ctor.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1406363002 .

3 years agoDeclare PDF_GetStandardFontName() in the header.
Lei Zhang [Fri, 16 Oct 2015 21:35:18 +0000]
Declare PDF_GetStandardFontName() in the header.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1410043003 .

3 years agofxcrt convergence - master side
Tom Sepez [Fri, 16 Oct 2015 21:11:48 +0000]
fxcrt convergence - master side

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1410933002 .

3 years agoFix stray backslashes in README.md
Tom Sepez [Fri, 16 Oct 2015 19:26:17 +0000]
Fix stray backslashes in README.md

TBR=dsinclair@chromium.org

Review URL: https://codereview.chromium.org/1414463002 .

3 years agoUpdate link to chromium src.
dan sinclair [Fri, 16 Oct 2015 17:08:12 +0000]
Update link to chromium src.

This CL updates the documentation link to the Chromium PDF plugin to
point to Gitiles instead of the SVN repo.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1407313002 .

3 years agoDEPS include_rules no longer allows core/ -> fpsdfsk/ inclusion.
Tom Sepez [Fri, 16 Oct 2015 16:38:32 +0000]
DEPS include_rules no longer allows core/ -> fpsdfsk/ inclusion.

Adds the following new violations:
ERROR in core/include/fpdfapi/fpdf_parser.h
  Illegal include: "public/fpdfview.h"
ERROR in core/include/fpdfapi/fpdf_render.h
  Illegal include: "public/fpdf_progressive.h"
ERROR in core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp
  Illegal include: "public/fpdfview.h"

BUG=pdfium:217
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1411493002 .

3 years agoLoosen checking on the bytes following 'stream'
Jun Fang [Fri, 16 Oct 2015 02:45:01 +0000]
Loosen checking on the bytes following 'stream'

PDF specs say that end of line markers shall follow the
keyword "stream". But a white space before end of line
markers follows this keyword in the test pdf files.

BUG=543018
R=thestig@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1401923005 .

3 years agoMove conditionals inside target_defaults.
dan sinclair [Fri, 16 Oct 2015 01:44:11 +0000]
Move conditionals inside target_defaults.

This CL moves the conditionals inside the target_defaults configuration. This
causes the -fPIC to get picked up and allows component=shared_library to build
correctly.

BUG=pdfium:218
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1407903002 .

3 years agoAdd some community and testing info to README.md.
dan sinclair [Fri, 16 Oct 2015 00:43:02 +0000]
Add some community and testing info to README.md.

This CL adds some more context to the README on the various test suites and
community mailing lists which are available.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1412453004 .

3 years agoPlug a leak in CPDF_StreamParser::ReadInlineStream
Oliver Chang [Thu, 15 Oct 2015 23:55:21 +0000]
Plug a leak in CPDF_StreamParser::ReadInlineStream

R=thestig@chromium.org, tsepez@chromium.org
BUG=pdfium:212

Review URL: https://codereview.chromium.org/1405203002 .

3 years agoIntroduce CPDFPageFromFPFDPage()
Tom Sepez [Thu, 15 Oct 2015 23:34:32 +0000]
Introduce CPDFPageFromFPFDPage()

Abstracts the way that pages are passed to the embedder
between XFA and master.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1406543004 .

3 years agoReturn result of GetRBG instead of TRUE
dan sinclair [Thu, 15 Oct 2015 23:26:15 +0000]
Return result of GetRBG instead of TRUE

Propagate the return value of GetRBG to the callers instead of forcing the
return of TRUE.

BUG=pdfium:44
R=thestig@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1398633008 .

3 years agoAdd steps for Contributing Code to README.md
Tom Sepez [Thu, 15 Oct 2015 22:54:16 +0000]
Add steps for Contributing Code to README.md

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1413493002 .

3 years agoFix layering violation in CPDF_Document::FromFPDFDocument().
Tom Sepez [Thu, 15 Oct 2015 21:51:42 +0000]
Fix layering violation in CPDF_Document::FromFPDFDocument().

Make this a function in the fpdfsdk/ layer, rather than a method
in the core/ layer. Nothing in core should know about public FPDF
types.

BUG=pdfium:217
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1396283006 .

3 years agoIntroduce CPDF_Document::FromFPDFDocument().
Tom Sepez [Wed, 14 Oct 2015 23:34:46 +0000]
Introduce CPDF_Document::FromFPDFDocument().

This will be used to abstract one major difference between master
and XFA, namely that the CPDF_Document is not a direct cast in XFA.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1395493007 .

3 years agoNext round of master changes to match XFA
Tom Sepez [Wed, 14 Oct 2015 20:54:22 +0000]
Next round of master changes to match XFA

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1401423004 .

3 years agoLand temporary workaround for clang-cl not yet understanding __emul
Nico Weber [Wed, 14 Oct 2015 16:37:50 +0000]
Land temporary workaround for clang-cl not yet understanding __emul

BUG=543182
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1405553003 .