summaryrefslogtreecommitdiff
path: root/fpdfsdk
AgeCommit message (Collapse)Author
2016-04-27Standardize on ASSERT.dsinclair
There are currently three ways to assert in the code (ASSERT, FXSYS_assert and assert). This CL standardizes on ASSERT. The benefit of ASSERT is that it can be overridden if the platform requies and we can pickup the Chromium version if it has already been defined in the build. This does change behaviour. Currently FXSYS_assert is always defined but ASSERT is only defined in debug builds. So, the FXSYS_assert's would fire in Release builds. That will no longer happen. BUG=pdfium:219 Review-Url: https://codereview.chromium.org/1914303003
2016-04-27Fix incorrect v8 TryCatch.etienneb
The Try-Catch object must live the whole lexical scope. Without the giving a name to the object, this is equivalent to create a temporary that is destroy at the end of the statement. /src/pdfium/pdfium/out/Debug/../../fpdfsdk/javascript/JS_Value.cpp:154:3: warning: object destroyed immediately after creation; did you mean to name the object? [misc-unused-raii] This issue was found by clang-tidy R=dsinclair BUG=589955 Review-Url: https://codereview.chromium.org/1929513002
2016-04-27Remove IFX_SystemHandler.dsinclair
This CL folds IFX_SystemHandler into CFX_SystemHandler. Methods which either had no implementation, or returned a default value have been removed. Review URL: https://codereview.chromium.org/1923093002
2016-04-26Move CPDF_Document code into cpdf_document.cpp.thestig
Review URL: https://codereview.chromium.org/1925453002
2016-04-26Remove several IPDF_ interfaces and CPDF_RenderModule.dsinclair
This CL removes the interfaces: * IPDF_ObjectRenderer * IPDF_OCContext * IPDF_RenderModule * IPDF_PageModule The CPDF_RenderModule was just wrapping new and delete calls. This Cl moves those up to the callers and removes the CPDF_RenderModule class. Review URL: https://codereview.chromium.org/1918323003
2016-04-26Clean up CPDF_Page.thestig
- Merge CPDF_Page::Load() into ctor. - Remove always nullptr param for CPDF_Page::ParseContent(). - Remove unneeded indirection in IPDF_RenderModule. - Delete CPDF_ParseOptions. - Fix up CPDF_Pattern. Review URL: https://codereview.chromium.org/1918113002
2016-04-26Remove no-op ShowFileDialog(s).tsepez
Two different versions, one in xfa and one in fpdfsdk, both do nothing. Review URL: https://codereview.chromium.org/1915323002
2016-04-26Fix unittest with embedded NUL character.etienneb
There is an embedded NUL character (previously line 40). The test was working because the beginning ot the string is identical. But, the rest of the string wasn't compare at all. TESTED: manually etienneb@burger:~/src/pdfium/pdfium$ out/Debug/pdfium_embeddertests --gtest_filter=*.EmptyCreation Note: Google Test filter = *.EmptyCreation [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from FPDFEditEmbeddertest [ RUN ] FPDFEditEmbeddertest.EmptyCreation [ OK ] FPDFEditEmbeddertest.EmptyCreation (13 ms) [----------] 1 test from FPDFEditEmbeddertest (13 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test case ran. (13 ms total) [ PASSED ] 1 test. R=dsinclair BUG=589955 Review URL: https://codereview.chromium.org/1916083002
2016-04-25Fixup page removal for XFA documents.dsinclair
Currently when you call DelegePage on a CPDFXFA_Document the page will not be correctly removed. The page is left in the underlying document and, if GetPage was never called for that page index nothing will happen. This CL updates the code to always remove the page_index from the underlying CPDF_Document then, if needed, the original code runs to clear out the XFA page list for that page. BUG=chromium:596373 Review URL: https://codereview.chromium.org/1921033003
2016-04-25Pass CFX_*StringCs to FX_HashCode_GETA and _GETW hash functions.tsepez
Too many calls were of the form fn(x.c_str(), x.GetLength()) which is an anti-pattern given the StringC classes which tie these together. There are a few places where explicit CFX_*StringCs are constructed, but this can be avoided by changing the args to these functions in the same manner. Removed String_ from name of functions since it added little value. Also removed default argument. Review URL: https://codereview.chromium.org/1919563002
2016-04-22Remove CFX_MapPtrTemplate usage in fsdk_baseform.cpptsepez
Replace one instance with std::map. Remove another instance that is never inserted into. Review URL: https://codereview.chromium.org/1919433002
2016-04-21Remove unused CFX_IntArray.tsepez
The only place its used, elements are added to it but the array is not used otherwise. Review URL: https://codereview.chromium.org/1906133002
2016-04-21Replace CFX_RectArray with std::vector<CFX_FloatRect>tsepez
Use RVO now that we use an array type compatible with it. Review URL: https://codereview.chromium.org/1906903002
2016-04-21Remove CFX_ArrayTemplate from CPDF_LinkExtracttsepez
Use unqiue_ptrs while we're at it, also better ctor. Review URL: https://codereview.chromium.org/1896303002
2016-04-19Remove IPDF_TextPage, IPDF_TextPageFind and IPDF_LinkExtract interfaces.dsinclair
Each was only used by one subclass. Removed and used the concrete classes. BUG=pdfium:468 Review URL: https://codereview.chromium.org/1897993002
2016-04-15Pass WideStrings without narrowing to c_str in javascript/tsepez
Avoid string duplication when the caller already has one. Review URL: https://codereview.chromium.org/1883273003
2016-04-14Simplify XFA event handling.thestig
- Avoid casting to void* - Don't bother firing events that no one listens for Review URL: https://codereview.chromium.org/1890563003
2016-04-14Pass CFX_WideString to CXFA_FFDocView::GetWidgetByName.tsepez
Avoids downgrade followed by duplication of existing strings. Review URL: https://codereview.chromium.org/1891673003
2016-04-14Rename CFX_ByteTextBuf::GetByteString() to AsStringC().tsepez
Do the same for CFX_WideTextBuf as well. The name is confusing because these return CFX_ByteStringC, not CFX_ByteString. The AsStringC naming gives parallelism with the string types themselves, and may help to indicate that the result is only good for the lifetime of the object being operated upon. Review URL: https://codereview.chromium.org/1886263003
2016-04-14Make CPDF_Dictionary methods take CFX_ByteString argumentstsepez
This will help avoid duplicate allocation of CFX_ByteStrings when the caller already has one. It may seem counter-intuitive that requiring the caller to pass an allocated CFX_ByteString rather than a static CFX_ByteStringC would improve the situation, but due to the idiosyncrasies of std::map, the CPDF_Dictionary methods must always do an allocation under the covers which can't be avoided. The changed callers in this CL are places where we would previously demote to CFX_ByteStringC and then allocate a a duplicate CFX_ByteString in the dictionary method. Review URL: https://codereview.chromium.org/1889863002
2016-04-14Replace calls to deprecated CFX_{Wide,Byte}String::Empty()tsepez
Use the more standard name "clear()" instead. Review URL: https://codereview.chromium.org/1888103002
2016-04-13Remove implicit cast from CFX_WideString to (const wchar_t*)tsepez
BUG= Review URL: https://codereview.chromium.org/1882043004
2016-04-13Remove implicit cast from CFX_ByteString to (const char*).tsepez
BUG= Review URL: https://codereview.chromium.org/1885973002
2016-04-13Cleanup CPDFXFA_Page.thestig
- Use std::unique_ptr. - Make dtor protected. - Simplify logic. - Remove unused bits from CXFA_FFPageView as well. Review URL: https://codereview.chromium.org/1878963004
2016-04-12Make CJS_PublicMethods::StrTrim() take a CFX_ByteStringtsepez
Similar to https://codereview.chromium.org/1876203002 but in a different file. The result is still not as efficient as possible owing to the conversions back and forth to C types. Convert these methods to ordinary functions in anon namespace while we're at it. Review URL: https://codereview.chromium.org/1882173002
2016-04-11Pass CFX_ByteStrings rather than raw ptrs to JS_GlobalData.tsepez
Helps to avoid re-allocating strings when the caller already has one allocated. Review URL: https://codereview.chromium.org/1876203002
2016-04-11Use std::vector as internal storage for CPDF_ArrayWei Li
Replace the usage of CFX_ArrayTemplate inside CPDF_Array, which has non-standard APIs such as GetSize() returns int. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1867183002 .
2016-04-08Make converstion explicit from CFX_ByteString to uint8_t*tsepez
BUG= Review URL: https://codereview.chromium.org/1868293002
2016-04-08Rename both As{Byte,Wide}StringC() helpers to AsStringC().tsepez
The naming is redundant given the base type, and will stand in the way of consolidating Byte and Wide code. BUG= Review URL: https://codereview.chromium.org/1862123003
2016-04-08Make CFX_WideString::FromLocal() take a CFX_ByteStringC argtsepez
It doesn't persist the string beyond the duration of the call, hence it should take the *StringC variant. Doing so avoids some allocs by changing to the *StringC ctor in a few places, at the cost of some explicit .ToByteStringC() calls (which are cheap). Review URL: https://codereview.chromium.org/1862953004
2016-04-07Remove all PWL_Note classesdsinclair
The PWL_Note clasess are never instantiated, remove them and their implementation. PWL_Note was the only caller to enable spellcheck so this allows us to remove IPWL_SpellCheck and the conditionals for PES_SPELLCHECK. BUG=pdfium:468 Review URL: https://codereview.chromium.org/1869533003
2016-04-07Cleanup DEPS files after include/ changes.dsinclair
This cleans up left over DEPS files or DEPS file entries from moving the code into subfolder include/ directories. Review URL: https://codereview.chromium.org/1865313002
2016-04-06Move remaining xfa/include/fxfa filesdsinclair
This CL moves the remaining files in xfa/include/fxfa to xfa/fxfa/include. Review URL: https://codereview.chromium.org/1864973005
2016-04-06Remove IPWL_NoteNotify and CPWL_Note.dsinclair
The IPWL_NoteNotify interface was never implemented. In removing, found that CPWL_Note was never created. Removed both classes. There were a bunch of methods that were never called that interacted with this code that have also been removed. BUG=pdfium:468 Review URL: https://codereview.chromium.org/1867623002
2016-04-06Remove IPWL_IconList_Notify.dsinclair
This interface is never implemented, removed. BUG=pdfium:468 Review URL: https://codereview.chromium.org/1865123002
2016-04-06Move include/fxcodec to fxcodec/includedsinclair
Review URL: https://codereview.chromium.org/1864153002
2016-04-06FPDF_GetSecurityHandlerRevision() should not crash.thestig
Same for FPDF_GetDocPermissions(). Empty documents do not have parsers. BUG=pdfium:465 Review URL: https://codereview.chromium.org/1865523003
2016-04-06Move remaining fpdfdoc filesdsinclair
This CL moves the last two fpdfdoc files from core/include/fpdfdoc to core/fpdfdoc/include. Review URL: https://codereview.chromium.org/1864163002
2016-04-06Make CFX_WideString::FromUTF8() take a CFX_ByteStringC argument.tsepez
Methods that take string arguments and do not persist them should take *StringC types as argument rather than discrete ptr/len args. Avoids a number of implicit casts from CFX_ByteString to char*. BUG= Review URL: https://codereview.chromium.org/1861183002
2016-04-06Move code from fpdfsdk/include to the sub directories.dsinclair
This CL moves the fxedit, jsapi and fpdfxfa code out of fpdfsdk/include to the various sub-include directories. Review URL: https://codereview.chromium.org/1863163002
2016-04-06Move core/include/fxge to core/fxge/include.dsinclair
This CL is a straight move of the fxge includes into core/fxge/include. Review URL: https://codereview.chromium.org/1868533002
2016-04-06Mark FPDF_BStr_* with DLLEXPORT / STDCALL.thestig
BUG=pdfium:464 Review URL: https://codereview.chromium.org/1859303002
2016-04-06Rename CFX_WideStringC::raw_str() to c_str()tsepez
No functional change intended. This difference in naming is standing in the way of consolidating some of the string code between Wide and Byte strings. The Wide code wants to call raw_str() in exactly the same spots that the Byte code calls c_str(). This makes sense, because in both places we get a character type back, and not a uint*_t type. If WideStringC had a raw_str() method, it would have to return uint32_t or similar. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1863593004
2016-04-05Make down-conversion explicit from CFX_Widetring to CFX_WideStringC.tsepez
Companion to https://codereview.chromium.org/1853233002 BUG= Review URL: https://codereview.chromium.org/1857073002
2016-04-05Remove core/include/fpdfdoc/fpdf_vt.hdsinclair
This CL removes the core/include/fpdfdoc/fpdf_vt.h file. The IPDF_VariableText class was removed in favour of the only concrete class of CPD_VariableText. CPVT_Provider was moved to CPDF_VariableText::Provider and CPDF_VariableText_Iterator was moved to CPDF_VariableText::Iterator. The IFX_Edit_FontMap interface was merged into the IPVT_FontMap interface so there is only one. Other classes were split out as needed in order to keep things compiling. BUG=pdfium:468 Review URL: https://codereview.chromium.org/1860063002
2016-04-05Rename GetCStr and GetPtr to match CFX_ByteString.dsinclair
This CL updates CFX_ByteStringC to use the more common c_str and raw_str instead of GetCStr and GetPtr. Review URL: https://codereview.chromium.org/1857713003
2016-04-04Make down-conversion explicit from CFX_ByteString to CFX_ByteStringC.tsepez
Having this happen implicitly can be dangerous because the lifetime has to be considered; we should have caught the "red bots" in https://codereview.chromium.org/1847333004/#ps60001 at compile time. Review URL: https://codereview.chromium.org/1853233002
2016-04-04Make IPDF_VariableText_{Provider,Iterator} inner classes.dsinclair
This CL moves the IPDF_VariableText_Provider and IPDF_VariableText_Iterator classes to be nested sub-classes of IPDF_VariableText. BUG=pdfium:455 Review URL: https://codereview.chromium.org/1855403002
2016-04-04Cleanup the FF Handler proxy methods.dsinclair
This CL removes the proxy methods from CXFA_FFWidgetHandler and CXFA_DocHandler and removes CXFA_FFMenuHandler as it was only proxy methods. The calls are made directly on the object now. Review URL: https://codereview.chromium.org/1857893002
2016-04-01Remove CFX_{Byte,Wide}String::Equal in favor of "==".tsepez
Makes the code slightly cleaner. Review URL: https://codereview.chromium.org/1846083002