summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser
AgeCommit message (Collapse)Author
2016-02-17Banish CFX_ByteArray and CFX_WideArray to the XFA side.Tom Sepez
Fix IWYU and include paths as we go. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1701883004 .
2016-02-16Fix name change after rebase 970c11eWei Li
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1705553002 .
2016-02-16Refactor CPDF_SimpleParser and add unit tests.Wei Li
Remove unused member functions and simplify calls to find tag parameters. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1681403007 .
2016-02-16Simplify string function test macroWei Li
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1701123002 .
2016-02-09Add unit tests for ascii85 and hex decoders.chromium/2652chromium/2651chromium/2650chromium/2649chromium/2648chromium/2647chromium/2646Wei Li
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1666663004 .
2016-02-08Fix for-loop which results in no-opLei Zhang
The existing code (added in https://codereview.chromium.org/1650793002/) changes the state of a copy of the object. Original CL: https://codereview.chromium.org/1679783002/ Original Author: hashimoto@chromium.org R=hashimoto@chromium.org Review URL: https://codereview.chromium.org/1681863002 .
2016-02-08Convert NULLs to nullptrs in fpdf_parser_decode.cppOliver Chang
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1680923002 .
2016-02-08Tidy fpdfsave.cppTom Sepez
Remove CFX_PtrArray filelist. Promote ScopedFileStream to .h file and use it. Fix _CAPS names, bool returns, and put in anonymous namespace. FX_CreateMemoryStream() can't return null, so remove checks. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1672153002 .
2016-02-05Remove CFX_FileSizeArray.Tom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1671113002 .
2016-02-03Merge to XFA: Complete unit tests for CPDF_ArrayWei Li
Also remove one unnecessary member function. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1660523003 . (cherry picked from commit 6f358daa2e8b1639a1c3a3f07a449f8450197e8b) Review URL: https://codereview.chromium.org/1667873002 .
2016-02-01Merge to XFA: Remove the m_ObjVersion member variable from CPDF_Parser.Lei Zhang
Use the gennum field in the m_ObjectInfo map instead. BUG=pdfium:111 R=weili@chromium.org TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1654303002 . (cherry picked from commit a620372c9e1d0ff825bcbe6620fe7e1b63c769c2) Review URL: https://codereview.chromium.org/1653023004 .
2016-02-01Merge to XFA: Remove the m_V5Type member variable from CPDF_Parser.chromium/2641chromium/2640chromium/2639chromium/2638Lei Zhang
Use the type field in the m_ObjectInfo map instead. BUG=pdfium:111 TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1650793002 . (cherry picked from commit 93c196d868535f684007a7d3ed1f7146851a0ab9) Review URL: https://codereview.chromium.org/1652083004 .
2016-01-29Merge to XFA: Refactor CPDF_Object and its subclasses.Wei Li
Mainly use virtual functions to replace functions with switch statements. Also remove a few unused functions and make some format changes. BUG=pdfium:63 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1634373003 . (cherry picked from commit df1ab41e000069dda7bf21527308f3bf41e126ca) Review URL: https://codereview.chromium.org/1650493003 .
2016-01-29Another round of cleanup in CPDF_Parser and friends.Lei Zhang
- Remove dead code. - Add more public methods and remove friends. TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1566133002 . (cherry picked from commit 9e8185948f7631515951770ca8778f42cc9fd2fc) Review URL: https://codereview.chromium.org/1649233002 .
2016-01-29Merge to XFA: Member function name refactoringWei Li
This is needed by Cl 1634373003 as the name collision with virtual functions will be shown as warnings on Linux. Also, it is better to use different names for different cases. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1644633003 . (cherry picked from commit d45e7a51904164fb22049f0a7a80d2a94c06936b) Review URL: https://codereview.chromium.org/1648233002 .
2016-01-27XFA: Fix DOS newlines, final round.Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1641963002 .
2016-01-26War on #defines - part 2Tom Sepez
Introduce CPDF_Parser::Error. Introduce CPDF_Color::Type. Unused XFA_DATASETS and XFA_FORMS defines. Move FPDF_CreateStandardSecurityHandler() prototype to header. Delete prototype for nonexistent FPDF_CreatePubKeyHandler(). Make PBS_* defines local to .cpp file. Tidy whitespace. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1634123004 .
2016-01-26Merge to XFA: Move struct ContentParam off of CPDF_Object's enumsTom Sepez
Original Review URL: https://codereview.chromium.org/1635173003 . (cherry picked from commit 0ec8bb4486ab315283f36d071be2ddc1b80998c3) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1636133002 .
2016-01-26Merge to XFA: War on #defines, part 1.Tom Sepez
Contains additional XFA-specific changes. Original Review URL: https://codereview.chromium.org/1632143002 . (cherry picked from commit 66a9dc9dd65ed2b9c7ede448d046b770140f16d5) R=thestig@chromium.org Review URL: https://codereview.chromium.org/1636503006 .
2016-01-25Remove several more unused parser values.Tom Sepez
unused progressive enum unused members m_bFileStream, m_dwWordPos Remove PDFWORD_* types R=thestig@chromium.org Review URL: https://codereview.chromium.org/1634683003 .
2016-01-25Remove struct PARSE_OPTIONS.Tom Sepez
Its members are assigned to, but never used in any calculations (besides for other members). R=thestig@chromium.org Review URL: https://codereview.chromium.org/1630973002 .
2016-01-25Remove unused IsContentUsedElsewhere()Tom Sepez
Then CPDF_Object::GetDirectType() becomes unused. Then GetIndirectType() becomes unused. Then PDFPARSE_TYPEONLY becomes unused. Then we can remove hideous casts of ints to ptrs. Also, PDFPARSE_NOSTREAM is unused. Then we can remove m_Flags from PARSE_CONTEXT. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1638493002 .
2016-01-22Merge to XFA: Fixed object references in CPDF_ObjectWei Li
This is a regression from commit 90853cb. BUG=pdfium:365 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1617043004 . (cherry picked from commit 7671d304ca4d3aec658c0ac8d5eea4c64e23b144) Review URL: https://codereview.chromium.org/1628643002 .
2016-01-20Merge to XFA: Replace more CFX_MapPtrToPtr.Tom Sepez
Original Review URL: https://codereview.chromium.org/1580573002 . (cherry picked from commit a505d9d3e13485e090e50d5d83f882fb707d3f48) R=ochang@chromium.org Review URL: https://codereview.chromium.org/1610163003 .
2016-01-19Merge to XFA: Remove an extra "const" in fpdf_objects.Oliver Chang
TBR=weili@chromium.org Original Review URL: https://codereview.chromium.org/1602323002 . (cherry picked from commit b196c7bebad66c9938d2705ccf64961bcdd774e2) Review URL: https://codereview.chromium.org/1607473008 .
2016-01-19Merge to XFA: Fix infinite loops caused by calling circular indirect objectsWei Li
There are multiple functions in CPDF_Object class which can cause infinite loop due to recursively calling circular indirect objects. Fix them by deference indirect object first. BUG=pdfium:355 TBR=jun_fang@foxitsoftware.com, thestig@chromium.org Review URL: https://codereview.chromium.org/1585533002 . (cherry picked from commit 90853cb1dfd1bf3803ec21cfae3e93948137be61) Review URL: https://codereview.chromium.org/1602103004 .
2016-01-14Merge to XFA: Loose checking for trailer's size fieldWei Li
Although trailer's size value is required by spec, other readers such as Acrobat or libpoppler can handle without it. Loose up the check to be more tolerant. BUG=pdfium:213 R=thestig@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1582193002 . (cherry picked from commit 34291b900ad0472eef582215cfce0d942a40fd16) Review URL: https://codereview.chromium.org/1589783004 .
2016-01-14Merge to XFA: Correct the way to count pages and to avoid infinite loopWei Li
BUG=pdfium:360 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1585823003 . (cherry picked from commit 5d5d9fe7bd1c9566b9d6570015b7c60894d9fc0c) Review URL: https://codereview.chromium.org/1583073004 .
2016-01-13Merge to XFA: Fix some iterator invalidation issues while traversing ↵Oliver Chang
CPDF_Dictionary. Also fixes a potential issue in CPDF_Dictionary::ReplaceKey. TBR=thestig@chromium.org BUG=577030 Original Review URL: https://codereview.chromium.org/1582963003 . (cherry picked from commit cae57daaa0f7ed4c92e22c4e7ef30392393d1128) Review URL: https://codereview.chromium.org/1587703003 .
2016-01-13Merge to XFA: Fix out of bound access in CPDF_Parser::ParseIndirectObject().Lei Zhang
This regressed in commit f6dafc9. BUG=576915 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1582763002 . (cherry picked from commit e02f30bb59b01c159b010fc5c6bb55e677aba8ce) Review URL: https://codereview.chromium.org/1584663003 .
2016-01-13Merge to XFA: Use the compiler to type check DocAvailStatus return values.Lei Zhang
TBR=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/1575363007 . (cherry picked from commit 2fa5c7a8b6602bb2fe1df7cd09b12de666ca8a0a) Review URL: https://codereview.chromium.org/1585773002 .
2016-01-12Merget to XFA: Use std::map in CPDF_IndirectObjectsTom Sepez
Review URL: https://codereview.chromium.org/1576113003 . (cherry picked from commit fce548047a44c7015996874452f3e778bf64cad6) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1579693004 .
2016-01-11Merge to XFA: Fix an infinite loop parsing in CPDF_SyntaxParser::GetObject()Wei Li
CPDF_SyntaxParser::GetObject() may enter into an infinite loop when a signature dictionary doesn't have 'Contents' field. Add a check to avoid that. BUG=pdfium:344 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1575833004 . (cherry picked from commit d3ab0f383f6736657480a8bb418c5e715a1aed3b) Review URL: https://codereview.chromium.org/1571333004 .
2016-01-11Merge to XFA: Use std::map as CPDF_Dictionary's underlying store.Oliver Chang
Replaces CFX_CMapByteStringToPtr. XFA still uses CFX_CMapByteStringToPtr so it's not completely removed just yet. Adds begin()/end() to CPDF_Dictionary and removes the GetStartPos()/GetNextElement() functions to traverse the dictionary. Callers are changed accordingly. AddValue() is also removed. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1541703003 . (cherry picked from commit 14f39950451bb9c2a11fbc7173fd47367410f80f) Review URL: https://codereview.chromium.org/1576033002 .
2016-01-08Merge to XFA: Fix infinite loop caused by parsing same indirect objectsWei Li
BUG=pdfium:343 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1569343002 . (cherry picked from commit 149f1db8bba85bdf2b40d330c38f2478695ca0d5) Review URL: https://codereview.chromium.org/1575663002 .
2016-01-08Merge to XFA: Clean up misc nits found while fixing bugs.Lei Zhang
Some bits regressed in commit 338805f. Also merge: IWYU fix after commit c5a8933. R=tsepez@chromium.org TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1544963002 . Review URL: https://codereview.chromium.org/1570973002 . (cherry picked from commit c5a8933f260ca1034fde902058442984e55c0f7a) (cherry picked from commit e6bd31873c3dba3f79c5ebbbefed636948629cc9) Review URL: https://codereview.chromium.org/1577453002 .
2016-01-07Cleanup includes, comments, and unused codeWei Li
TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1563673002 . (cherry picked from commit 6664977832350e4a9717bd67b09e3d01196791ba) Review URL: https://codereview.chromium.org/1568923002 .
2016-01-06Merge to XFA: Change CPDF_SyntaxParser::GetNextWord() to not pass by ↵Lei Zhang
non-const ref. Change the internal version to GetNextWordInternal(). TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1558083002 . (cherry picked from commit 61197421793e24add7a250d3f15ab83dc75f80c6) Review URL: https://codereview.chromium.org/1561093002 .
2016-01-05Merge to XFA: Replace CPDF_SortObjNumArray with a std::set.Lei Zhang
R=tsepez@chromium.org TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1566553002 . (cherry picked from commit 6caae4d3c6815c5a1e12340734412a3bc7548652) Review URL: https://codereview.chromium.org/1561853002 .
2016-01-05Merge to XFA: Fix a few uses of default arguments.Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1555293002 . (cherry picked from commit dbfaa8d11404a53b4807b3dbd0185047367bbff6) Review URL: https://codereview.chromium.org/1565603002 .
2016-01-05Merge to XFA: Fix an infinite loop in CPDF_Parser::RebuildCrossRef().Lei Zhang
BUG=pdfium:325 TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1543043003 . (cherry picked from commit 2d88e91ca5538470c9f4bc098e7f1f1ea9013c37) Review URL: https://codereview.chromium.org/1560903002 .
2016-01-05Merge to XFA: Make more CPDF_Parser method const.Lei Zhang
TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1549103002 . (cherry picked from commit a3235d0f5ca92c89b1de0f135a05e9891e499fb9) Review URL: https://codereview.chromium.org/1560183003 .
2016-01-05Merge to XFA: Exit infinite loops for cross reference loadingWei Li
When cross reference sections form a loop, our code will enter an infinite loop. Add detection and exit code for v4 cross reference loading. V5 loading was done previously. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1558093002 . (cherry picked from commit aab8f462ea3368ed4825172231131e1a10db978d) Review URL: https://codereview.chromium.org/1556423002 .
2015-12-24Merge to XFA: Fix another regression from commit f6dafc9.Lei Zhang
TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1548963004 . (cherry picked from commit b43b8859153e129053f3fa790c182fa04c3336db) Review URL: https://codereview.chromium.org/1549963002 .
2015-12-24Merge to XFA: Switch from nonstd::unique_ptr to std::unique_ptr.Lei Zhang
TBR=thakis@chromium.org Review URL: https://codereview.chromium.org/1547833002 . (cherry picked from commit d20dfba2ae10e8aeb328328f09da79ff904110a8) Review URL: https://codereview.chromium.org/1545183002 .
2015-12-24Merge to XFA: Call CheckLinearizedFirstPage() when loading the first ↵Lei Zhang
linearized page. Otherwise CheckLinearizedFirstPage() has no other callers. BUG=pdfium:330 TBR=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/1543193002 . (cherry picked from commit bab9a98b71f351cf9f4eb39138bca55e3be4ef15) Review URL: https://codereview.chromium.org/1543353002 .
2015-12-22Merge to XFA: Start using allowed C++11 features.Lei Zhang
TBR=dml@google.com, thakis@chromium.org Review URL: https://codereview.chromium.org/1544923002 . Review URL: https://codereview.chromium.org/1545823002 . (cherry picked from commit ba2586d2c0a50df14aa2549a0a841e1d4b9af4b6) (cherry picked from commit 87f7d29531dabfd66e547a6be31a08272ff631d5) Review URL: https://codereview.chromium.org/1542213002 .
2015-12-22Merge to XFA: Add ContainsKey() and ContainsValue() and use them where ↵Lei Zhang
appropriate. TBR=ochang@chromium.org Review URL: https://codereview.chromium.org/1540263003 . (cherry picked from commit 1fc92867ca53f0fba4272fbee3814d844f487495) Review URL: https://codereview.chromium.org/1542193002 .
2015-12-22Merge to XFA: Convert CPDF_Parser::m_CrossRef to a std::map.Lei Zhang
This improvements memory usage in case PDFs have sparse object numbers. The map holds a struct that currently has only one member. The struct will contain more members as other internal data structures get converted. BUG=pdfium:111 TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1539573003 . (cherry picked from commit f6dafc90ec1a0df8d618efc68c0223f0cdd80ffb) Review URL: https://codereview.chromium.org/1544913002 .
2015-12-18Merge to XFA: Get rid of a few CPDF_Object Create() methods and just use new ↵Lei Zhang
instead. R=ochang@chromium.org Review URL: https://codereview.chromium.org/1540693002 . (cherry picked from commit d866ab0b44a571c884fdd8ba5a5319adaf607559) Review URL: https://codereview.chromium.org/1541563002 .