summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi
AgeCommit message (Collapse)Author
2015-10-26Make m_pShadingObj a CPDF_Stream instead of CPDF_Object.Dan Sinclair
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 .
2015-10-26Revert "Revert "Add type cast definitions for CPDF_Reference.""Dan Sinclair
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 .
2015-10-26Revert "Add type cast definitions for CPDF_Reference."Dan Sinclair
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 .
2015-10-26Add type cast definitions for CPDF_Reference.Dan Sinclair
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 .
2015-10-23Convert some pointers in fpdf_parser_parser to unique_ptr and std::vector.Oliver Chang
R=thestig@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/1411043003 .
2015-10-23One line whitespace change for fpdf_render.cpp (clang format)Tom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1420873003 .
2015-10-22Set a recursion limit on CPDF_DataAvail::CheckPageNodeOliver Chang
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 .
2015-10-22Add type cast definitions for CPDF_Stream.Dan Sinclair
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 .
2015-10-22Add type cast definitions for CPDF_Array.Dan Sinclair
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 .
2015-10-21Add type cast definitions for CPDF_Name.Dan Sinclair
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 .
2015-10-21Add type cast definitions for CPDF_String.Dan Sinclair
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 .
2015-10-21Add type cast definitions for CPDF_Number.Dan Sinclair
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 .
2015-10-21Remove void* ctor from CPDF_Number.Dan Sinclair
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 .
2015-10-20Add type cast definitions for CPDF_Boolean.Dan Sinclair
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 .
2015-10-20Revert "Revert "Add type cast definitions for CPDF_Dictionary.""Dan Sinclair
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 .
2015-10-20Revert "Add type cast definitions for CPDF_Dictionary."Dan Sinclair
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 .
2015-10-20Add type cast definitions for CPDF_Dictionary.Dan Sinclair
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 .
2015-10-19Sanity check the values of TRUE and FALSE.Lei Zhang
Get rid of cond ? TRUE : FALSE. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1405723003 .
2015-10-19Remove some checks for object creation failures. They cannot fail.Lei Zhang
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 .
2015-10-19Unrevert commit a398ca6 and apply the proper fix.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1401493002 .
2015-10-16Don't bother passing -1 as the length to the CFX_ByteString ctor.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1406363002 .
2015-10-16Declare PDF_GetStandardFontName() in the header.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1410043003 .
2015-10-16Loosen checking on the bytes following 'stream'chromium/2540chromium/2539chromium/2538Jun Fang
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 .
2015-10-15Plug a leak in CPDF_StreamParser::ReadInlineStreamOliver Chang
R=thestig@chromium.org, tsepez@chromium.org BUG=pdfium:212 Review URL: https://codereview.chromium.org/1405203002 .
2015-10-15Return result of GetRBG instead of TRUEdan sinclair
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 .
2015-10-15Fix layering violation in CPDF_Document::FromFPDFDocument().Tom Sepez
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 .
2015-10-14Introduce CPDF_Document::FromFPDFDocument().Tom Sepez
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 .
2015-10-08Minimal revert from commit d03ba8d.Lei Zhang
The values that were changed to size_t can go negative. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1400723002 .
2015-10-08Fix a bunch of sign mismatch warnings.Lei Zhang
Also remove some gotos and move code into an anonymous namespace. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1356373003 .
2015-10-09Various changes to JBig2 cache:David Lattimore
- Makes the cache be per-document - Keys the cache on ObjNum and stream offset instead of keying on a pointer to the data (which can result in false cache hits). - Makes it so the cache is only used for the globals stream. - Reenable the cache. R=thestig@chromium.org BUG=pdfium:207 Review URL: https://codereview.chromium.org/1380243004 .
2015-10-08Relax the check on 0 length streams.chromium/2531Lei Zhang
CPDF_SyntaxParser::ReadStream() originally created stream objects when the length is 0. Commit 2526930 tightened the constraint and returned NULL. This has some adverse affects, as seen in Chromium's print preview of PDFs. Instead, relax the constraint a little so when the length is 0, return a CPDF_Stream with NULL data and size 0. BUG=531835 Review URL: https://codereview.chromium.org/1394743002 .
2015-10-02Get rid of gotos in CPDF_SyntaxParser and FlateUncompress().Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1360103002 .
2015-10-02Fix a leak in PDF_DataDecode() on failure.Lei Zhang
Found using the test examples from https://crbug.com/537780 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1376413003 .
2015-10-01Clean up some image decoder classes:Lei Zhang
- Use std::vector<uint8_t> instead of raw uint8_t* - Make ICodec_ScanlineDecoder::GetScanline() return const uint8_t* - Add FxFreeDeleter, use it in CCodec_ImageDataCache. - Make CCodec_ImageDataCache encapsulate its data members. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1361053002 .
2015-09-29Fix blank page issue caused by too strict correction on bpcchromium/2523Jun Fang
For bit per component (bpc), PDF spec mentions that a RunLengthDecode or DCTDecode filter shall always deliver 8-bit samples. However, some PDF files don't follow this rule. We can find that filter is RunLengthDecode but bpc is 1 in the provided test file. In this case, pdfium will correct bpc to 8 but the actual bpc is 1. It causes a failure because the data is much more than the expected. To handle this case, pdfium doesn't correct bpc to 8 when the original bpc is 1. BUG=512557 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1328213002 .
2015-09-25Revert "Revert "Fix the issue that pdfium swallows 'fi' or 'ff' in some pdf ↵Jun Fang
files"" This reverts commit fa9756f77ad6145940d3dc697814b84f5755ae17. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1307353005/
2015-09-25Revert "Fix the issue that pdfium swallows 'fi' or 'ff' in some pdf files"Jun Fang
This reverts commit 9bd18183ba8210c91d71c3060146235750a4c71c.
2015-09-25Fix the issue that pdfium swallows 'fi' or 'ff' in some pdf filesJun Fang
Pdfium swallows 'fi' or 'ff' in some tested files because it doesn't load the embedded font file correctly. The root cause is that there is incorrect keyword like 'ngendstream' in the stream of the embedded font file. Pdfium tries to find another correct keyword but uses wrong offset rather than accumulated offset. BUG=524043 R=thestig@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/1307353005 .
2015-09-22Change nonstd::unique_ptr to take a custom deleter.Lei Zhang
Code is mostly stolen from Chromium's scoped_ptr. - Add unit tests. - Use this to fix a leak. BUG=chromium:531408 R=jyasskin@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/1351383004 .
2015-09-18Fix a #include in fpdf_page_func.cpp.David Lattimore
Not sure why building with gyp was working despite the missing '../' but it wasn't working in stricter build systems. BUG= R=thestig@chromium.org Review URL: https://codereview.chromium.org/1321293003.
2015-09-11Cleanup casting of FX_Alloc() return values.Lei Zhang
Also convert some FX_AllocOrDie() calls to FX_Alloc(). R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1332173002 .
2015-09-08Remove unneeded checks for CPDF_Object::GetDict() return values.Lei Zhang
CPDF_Object::GetDict() always returns a valid pointer for dictionaries. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1317733007 .
2015-09-03Turn a failing assert into an actual check.chromium/2506chromium/2505chromium/2504chromium/2503chromium/2502chromium/2501Lei Zhang
BUG=522131 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1327913002 .
2015-09-02Reapply Foxit's libopenjpeg modifications.Lei Zhang
They were lost in commit d53e6fd. BUG=pdfium:168 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1196523002 .
2015-09-01Cleanup dead code in CPDF_DIBSource::LoadJpxBitmap() and friends.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1310603006 .
2015-08-31Fix two issues shown by bug 489995Tom Sepez
- Handle NULL in buffer operator<< under JS mailForm() calls. - Ensure correct type in JS addIcon() calls. BUG=489995 R=brucedawson@chromium.org, thestig@chromium.org Review URL: https://codereview.chromium.org/1327473002 .
2015-08-30Fix infinite loop for objects that reference themselves.Lei Zhang
BUG=pdfium:193 R=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/1306793002 .
2015-08-20Fix some -Wmaybe-uninitialized errors.Lei Zhang
- Break up CPDF_DIBSource::DownSampleScanline() into smaller functions. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1287843004 .
2015-08-19Extern in .cpp file is a code smell, part 2.Tom Sepez
Fixes the remaining issues, except for JBIG2/Skia ... R=thestig@chromium.org Review URL: https://codereview.chromium.org/1298393003 .
2015-08-19Extern in .cpp files is a code smell.Tom Sepez
Part 1. Move to headers so compiler can type check against the definitions. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1299963002 .