summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi
AgeCommit message (Collapse)Author
2015-11-09Add some nullptr checks that were missing from commit f7992b39.Lei Zhang
BUG=pdfium:268 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1425293010 .
2015-11-09Fix leaks in CPDF_SyntaxParser::ReadStream.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1419533016 .
2015-11-05Fix all relative includes to third_party.chromium/2560chromium/2559chromium/2558chromium/2557Lei Zhang
- In non-standalone builds, use the provided jpeg library. - Run gn format over all the GN files. - Also roll DEPS for buildtools to c2f2598. BUG=541704 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1425153006 .
2015-11-04Add base test for RebuildCrossRef function.Wei Li
This tests whether RebuildCrossRef could handle well-formatted pdf file. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1409013005 .
2015-11-04Enforce input and output dimensionalities for CPDF_StitchFunc.Oliver Chang
Also cleans up some places in the relevant functions since we're here. BUG=551460 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1421783004 .
2015-11-04Make checkdeps --resolve-dotdot succeed.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1419373005 .
2015-11-04Remove state from RebuildCrossRef state-machine.Dan Sinclair
The state '12' is only used once. This CL folds the contents of state 12 back into the place where we set our state to 12. This works because all state 12 does is decrement the loop counter so we process the same character again and move us to state 0. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1430643007 .
2015-11-03Revert "Revert "Revert "Cleanup some numeric code."""Dan Sinclair
This reverts commit e0e922db5fb77df9a5a9cc802096f484ed21da1c. Broke Windows build. FAILED: ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\core\src\fxcrt\fxcrt.fx_basic_gcc.obj.rsp /c ..\..\core\src\fxcrt\fx_basic_gcc.cpp /Foobj\core\src\fxcrt\fxcrt.fx_basic_gcc.obj /Fdobj\fxcrt.cc.pdb e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_gcc.cpp(28) : error C2220: warning treated as error - no 'object' file generated e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_gcc.cpp(75) : see reference to function template instantiation 'T FXSYS_StrToInt<int32_t,const FX_WCHAR*>(STR_T)' being compiled with [ T=int32_t , STR_T=const FX_WCHAR * ] e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_gcc.cpp(28) : warning C4244: 'argument' : conversion from 'const FX_WCHAR' to 'char', possible loss of data FAILED: ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\core\src\fpdftext\fpdftext.fpdf_text.obj.rsp /c ..\..\core\src\fpdftext\fpdf_text.cpp /Foobj\core\src\fpdftext\fpdftext.fpdf_text.obj /Fdobj\fpdftext.cc.pdb e:\b\build\slave\windows\build\pdfium\core\src\fpdftext\fpdf_text.cpp(439) : error C2039: 'isdigit' : is not a member of 'std' FAILED: ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\core\src\fxcrt\fxcrt.fx_basic_wstring.obj.rsp /c ..\..\core\src\fxcrt\fx_basic_wstring.cpp /Foobj\core\src\fxcrt\fxcrt.fx_basic_wstring.obj /Fdobj\fxcrt.cc.pdb e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_wstring.cpp(973) : error C2220: warning treated as error - no 'object' file generated e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_wstring.cpp(973) : warning C4244: 'argument' : conversion from 'const FX_WCHAR' to 'char', possible loss of data e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_wstring.cpp(981) : warning C4244: 'argument' : conversion from 'const FX_WCHAR' to 'char', possible loss of data FAILED: ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\core\src\fpdftext\fpdftext.fpdf_text_int.obj.rsp /c ..\..\core\src\fpdftext\fpdf_text_int.cpp /Foobj\core\src\fpdftext\fpdftext.fpdf_text_int.obj /Fdobj\fpdftext.cc.pdb e:\b\build\slave\windows\build\pdfium\core\src\fpdftext\fpdf_text_int.cpp(2436) : error C2039: 'isdigit' : is not a member of 'std' e:\b\build\slave\windows\build\pdfium\core\src\fpdftext\fpdf_text_int.cpp(2440) : error C2039: 'isdigit' : is not a member of 'std' ninja: build stopped: subcommand failed. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1431683008 .
2015-11-03Revert "Revert "Cleanup some numeric code.""Dan Sinclair
This reverts commit 23d576f0b498bd4f37ef2175916223a2e5ea0324. 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=tsepez@chromium.org Review URL: https://codereview.chromium.org/1405253007 .
2015-11-03Use std::numeric_limits::max() to put in the large position value.Dan Sinclair
This size is different on Windows vs Mac and Linux. Need to use numeric_limits instead of a hard coded value. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1414793010 .
2015-11-03Add test for CPDF_SyntaxParser::ReadHexString.Dan Sinclair
This CL adds tests for the ReadHexString method of the syntax parser. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1433503002 .
2015-11-02Add test for CPDF_StreamParser::ReadHexString.chromium/2555chromium/2554chromium/2553Dan Sinclair
This CL adds a unit test for the ReadHexString method. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1408213008 .
2015-11-02Add tests for CMap_GetCode and CMap_GetCodeRange.Dan Sinclair
This CL adds tests for the CMap_GetCode and CMap_GetCodeRange methods. To do so, it moves the methods to be static private members of CPDF_CMapParser and makes the test class a friend. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1414013005 .
2015-11-02Add a test for the HexDecode method.Dan Sinclair
I moved the declaration to be public, instead of having it implicit in one file and defined in a seperate cpp file. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1410873009 .
2015-11-02Remove _FPDF_ByteStringFromHex as it is unusedDan Sinclair
There are no uses of this method, I also checked the XFA branch and there don't appear to be any uses there either. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1427913006 .
2015-11-02Add test for StringToCode and StringToWideStringDan Sinclair
This CL adds a test case for the StringToCode and StringToWideString methods in fpdf_font.cpp. In order to do so, it moves the methods to be private methods of CPDF_ToUnicodeMap and make the tests friends of the class. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1428593005 .
2015-11-02Use standard true and false to replace 'TRUE' and 'FALSE' in pdfium_testJun Fang
BUG=446715 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1410073009 .
2015-11-02Support linearized loadingJun Fang
BUG=446715 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1353093003 .
2015-10-29Revert "Cleanup some numeric code."dan sinclair
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 .
2015-10-29Cleanup some numeric code.Dan Sinclair
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 .
2015-10-29Cosmetic change to make fpdf_page_image.cpp identical to xfa.Tom Sepez
Also stray newline in fpdf_parser_document.cpp in master. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1424213004 .
2015-10-28Add PDFCharIsLineEnding helperDan Sinclair
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 .
2015-10-28Add a NULL check in pdf_page_colors.cppOliver Chang
R=thestig@chromium.org BUG=548714 Review URL: https://codereview.chromium.org/1430653002 .
2015-10-28Add constants for the path operators.Dan Sinclair
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 .
2015-10-28Check if document was opened during testing.Dan Sinclair
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 .
2015-10-28Add PositionIsInBounds to CPDF_StreamParserDan Sinclair
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 .
2015-10-28Add helpers to check the PDF_CharType.Dan Sinclair
This CL adds helpers to provide more descriptive access to PDF_CharType. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1407913004 .
2015-10-27Use static_cast for various CPDF_Object conversions.Dan Sinclair
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 .
2015-10-27Give names to the shading typesDan Sinclair
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 .
2015-10-27Type check the m_pShadingObj before assuming it's a stream.Dan Sinclair
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 .
2015-10-26Remove usage of std::vector::dataOliver Chang
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1412823005 .
2015-10-26Remove default argument from CPDF_Dictionary::SetAt().Lei Zhang
Also fix a potential object leak. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1414963005 .
2015-10-26Fix a leak in CPDF_SyntaxParser::GetObject().Lei Zhang
As seen in FPDFViewEmbeddertest.Crasher_451830. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1385803002 .
2015-10-26Revert "Make m_pShadingObj a CPDF_Stream instead of CPDF_Object."Dan Sinclair
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 .
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 .