summaryrefslogtreecommitdiff
path: root/xfa/fxfa/fm2js
AgeCommit message (Collapse)Author
2017-04-28CXFA_FMStringExpression: int16_t is not a good type for a string index.Tom Sepez
Use early return while we're at it. Bug: 716519 Change-Id: I4630d8b6121266c76a53f0171ba6dfd307da725a Reviewed-on: https://pdfium-review.googlesource.com/4611 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-04-25Use unique_ptr in CXFA_ScriptContext::m_mapVariableToContext.Tom Sepez
Remove unused CFXJSE_Arguments::GetRuntime(). Remove some default argument values. Make members of CFXJSE_Context private. Change-Id: Id21951f7d8d68929b2799a9d6a2cdd7a3677f52a Reviewed-on: https://pdfium-review.googlesource.com/4493 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-25Use fx_extension.h utilities in more places in xfa/Lei Zhang
Change-Id: Id58c313aa446ecfa223e5c8edc095586b62a61fa Reviewed-on: https://pdfium-review.googlesource.com/4455 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-24Use a pdfium-specific unittest main rather than gtest'sTom Sepez
We must initialize our partition allocator before calling into any test cases. We can then remove the FPDF_Test class, which did the same thing. Change-Id: I614480fa474b2032052857a02e94781f15a27a4e Reviewed-on: https://pdfium-review.googlesource.com/4473 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-20Cleanup the fx_extension code.Dan Sinclair
This CL cleans up the fx_extension file. The stream code was moved to fx_stream. IFX_FileAccess was removed and CFX_CRTFileAccess split to its own file. Code shuffled from header to cpp file. Change-Id: I700fdfcc9797cf4e8050cd9ba010ad8854feefbf Reviewed-on: https://pdfium-review.googlesource.com/4371 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-18Use Byte/WideString iteratorsTom Sepez
Change-Id: I85c8423c177fd7ecd5da90ef89419efc0f9cf44b Reviewed-on: https://pdfium-review.googlesource.com/4262 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-18Require unique_ptr arg for CXFA_FMLexer::SetToken()Tom Sepez
Change-Id: Id252b3b2208ac9f792220605ddc1eb3ba29e2d55 Reviewed-on: https://pdfium-review.googlesource.com/4260 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-13Add ability to make StringCs from std::vector<>s.Tom Sepez
Pre-cursor to using more std::vector<uint8_t> as byte buffers. The widestring test case is more complicated, where we're not sure of having any particular uint*_t type to match wchar_t. Change-Id: Ic27980f16cdbc61fac7c11f39a85eea58d19bacb Reviewed-on: https://pdfium-review.googlesource.com/4153 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-12Fix string passing coventions in xfa_fm2jscontext.hchromium/3070Tom Sepez
Change-Id: Ibcb3a95a52ab67c4c9c397ff9c4eab483ef1fcc3 Reviewed-on: https://pdfium-review.googlesource.com/3954 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-11Avoid long assignment chain in FM parserNicolas Pena
We only parse FM right before translating to JS. Our current implementation of assignment will duplicate to first expression's ToJavascript. So having a long chain of assignments will result in a huge ToJavascript. Bug: chromium:665087 Change-Id: I542371b5787113be2f2d686153ed0a6c48191bab Reviewed-on: https://pdfium-review.googlesource.com/4030 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-10Fix bytestring passing conventions, part 2.Tom Sepez
Change pass by reference to const reference or pointer. Change-Id: Ic007f14e6569679a846980a96cc627eac4ecd5d6 Reviewed-on: https://pdfium-review.googlesource.com/3953 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-04-06Fix unit tests to initialize PartitionAlloc.Chris Palmer
Tests need to be subclasses of FPDF_Test. BUG=pdfium:700 Change-Id: I317ec2c49567e58cb57c6222e387574226f594b3 Reviewed-on: https://pdfium-review.googlesource.com/3890 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Chris Palmer <palmer@chromium.org>
2017-04-03Drop FXSYS_ from mem methodsDan Sinclair
This Cl drops the FXSYS_ from mem methods which are the same on all platforms. Bug: pdfium:694 Change-Id: I9d5ae905997dbaaec5aa0b2ae4c07358ed9c6236 Reviewed-on: https://pdfium-review.googlesource.com/3613 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-03Drop FXSYS_ from math methodsDan Sinclair
This Cl drops the FXSYS_ from math methods which are the same on all platforms. Bug: pdfium:694 Change-Id: I85c9ff841fd9095b1434f67319847ba0cd9df7ac Reviewed-on: https://pdfium-review.googlesource.com/3598 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-29Remove fgas/localization directoryDan Sinclair
This Cl moves the CFX_DateTime, CFX_Decimal and IFX_Locale files into core/fxcrt and builds only for XFA. The CFX_FormatString code is moved info fgas/crt and renamed CFGAS_FormatString to match the fgas naming. Change-Id: I8d9061195d2225da0389cbc9d018fcbd2e9a3c0c Reviewed-on: https://pdfium-review.googlesource.com/3257 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-29Rename fgas/localization files to match contentsDan Sinclair
This Cl renames the files to match their contents and splits out headers where needed. Change-Id: Ibe2e90ca969a9d05ee73bb956ffa59a63c7ab076 Reviewed-on: https://pdfium-review.googlesource.com/3256 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-29Rename CFX_Unitime to CFX_DateTimeDan Sinclair
The name Unitime did not give any indication of what the class contained. This Cl renames to DateTime to more accurately refect the class holds a date and time. Change-Id: I95f96224822f46a7da46ae39c71d2e23fc16f7d5 Reviewed-on: https://pdfium-review.googlesource.com/3255 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-29Split xfa_object.h apart.Dan Sinclair
This Cl splits the xfa_object.h into individual class header files and fixes the needed includes. Change-Id: Ia011ee9bc5deee5e44b8a956fa54bc2c3849cff0 Reviewed-on: https://pdfium-review.googlesource.com/3254 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-29Return values instead of out paramschromium/3056Dan Sinclair
This CL updates the IFX_Locale code and subclasses to return CFX_WideStrings instead of taking out params. Change-Id: Id03499c68161e809607e73b9d8ec778e24631845 Reviewed-on: https://pdfium-review.googlesource.com/3252 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-28Renaming and splitting in xfa/fxfa/parser.Dan Sinclair
This Cl renames several of the files in xfa/fxfa/parser to match the name of the contained classes. Files with multiple clasess are split apart when renamed. Change-Id: Ice8a1279072ee13c2f62a81946be7f42f9ba6007 Reviewed-on: https://pdfium-review.googlesource.com/3250 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-28Remove CFX_ArrayTemplate in CXFA_ValueArrayTom Sepez
Change-Id: I68f317b9fb9b162a5d99cdacc619c85f96a5bf52 Reviewed-on: https://pdfium-review.googlesource.com/3239 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-23Tighten up XFA VisibilityDan Sinclair
This Cl changes the protected sections to be private where possible in XFA. Change-Id: Ibeb6ad00389686b666b1c3c5e136b9eefe35ec9e Reviewed-on: https://pdfium-review.googlesource.com/3164 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-17Add pdfium::clamp() as a placeholder for std::clamp().chromium/3046Lei Zhang
Ue it to fix a typo as well. BUG=pdfium:634 Change-Id: I2d686242ffb841aedc2fae6a3cf7a00bea667404 Reviewed-on: https://pdfium-review.googlesource.com/3113 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-15Cleanup nits from prior CLsDan Sinclair
Change-Id: Ie69dfc32e7b526eca2ac6ae621eed879ad98476e Reviewed-on: https://pdfium-review.googlesource.com/3054 Commit-Queue: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-14Replace CXFA_{Object,Node}Array with std::vectorTom Sepez
These two ought to happen at the same time as they are intertwined in spots. Remove blatant casts between the two along the way. Change-Id: I9ce5d2faadf1e38aba7cade316560d24a66d8669 Reviewed-on: https://pdfium-review.googlesource.com/2933 Commit-Queue: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-14Replace FX_FLOAT with underlying float type.Dan Sinclair
Change-Id: I158b7d80b0ec28b742a9f2d5a96f3dde7fb3ab56 Reviewed-on: https://pdfium-review.googlesource.com/3031 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-14Replace FX_DOUBLE with underlying double type.Dan Sinclair
Change-Id: Ife4a46157ec1044b24965f7d282858f8261031b1 Reviewed-on: https://pdfium-review.googlesource.com/3030 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-14Replace FX_CHAR and FX_WCHAR with underlying types.Dan Sinclair
Change-Id: I96e0a20d66b9184d22f64d8e4ce0dadd5a78c1e8 Reviewed-on: https://pdfium-review.googlesource.com/2967 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-13Simplify FX_UTF8Encode variants.chromium/3012Tom Sepez
Doing so reveals places where there are needless copies and conversions. Change-Id: I24a868d40aa63836f4167eaf4541964049df7916 Reviewed-on: https://pdfium-review.googlesource.com/2555 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-02Remove FX_WSTRC usagechromium/3003chromium/3002dan sinclair
Not needed with modern compilers, removed. Change-Id: Ia8977262b5791bd4445f02be8456641d1a7e18f3 Reviewed-on: https://pdfium-review.googlesource.com/2431 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-01-11Cleaning up memory allocation in CXFA_FM2JSContext - IVDan Sinclair
This CL removes the use of FX_Alloc and any remaining new'd CFXJSE_Value objects from CXFA_FM2JSContext and replaces them with unique_ptrs and vectors. Change-Id: I30ba697d65ee326d2faa895c3217bdc407419298 Reviewed-on: https://pdfium-review.googlesource.com/2157 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-01-06Cleaning up memory allocation in CXFA_FM2JSContext - IIIDan Sinclair
This CL updates the unique_ptrs to use MakeUnique instead of new. The types are updated to be auto. Change-Id: I2a82a4ec6659e5c343cc03d4840b3046ecb6934e Reviewed-on: https://pdfium-review.googlesource.com/2156 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-01-05Cleaning up memory allocation in CXFA_FM2JSContext - IIDan Sinclair
This CL removes the size arrays and variables and uses the vector to get the size directly. Change-Id: I0f7b5f48e53ff1ec379ad34a23807d70b02a538a Reviewed-on: https://pdfium-review.googlesource.com/2155 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-01-05Cleaning up memory allocation in CXFA_FM2JSContext - Ichromium/2974Dan Sinclair
This CL updates ::ParseResolveResult to accept a std::vector<std::unique_ptr<CFXJSE_Value>>& instead of a CFXJSE_Value**&. This removes a bunch of manual new/delete code used to mantain the values. The size parameter was also removed and is retrieved by calling .size() on the vector now. Change-Id: I60fc6176523ece112d41fdefc767aaefedfae2db Reviewed-on: https://pdfium-review.googlesource.com/2153 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-01-03Create individual exception methods.Dan Sinclair
This CL removes the LoadString method from CPDFXFA_Context and, instead, creates individual exception methods for each of the loaded strings and calls as needed. BUG=pdfium:549 Change-Id: I1d975f01f13f45a885946a9952f24b13387dc3e4 Reviewed-on: https://pdfium-review.googlesource.com/2135 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-01-03Cleaning out params in CPDFXFA_ContextDan Sinclair
This CL cleans up some of the out params in CPDFXFA_Context. In the process several of the strings returned by ::LoadString() are inlined in their call sites and the defines removed. BUG=pdfium:549 Change-Id: I41a7ceeba3962299eecd0cb714ddb03d28dbb0ea Reviewed-on: https://pdfium-review.googlesource.com/2134 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2016-12-08Replace CFX_WideStringCArray with std::vector.chromium/2946tsepez
Review-Url: https://codereview.chromium.org/2562833002
2016-12-07Refcount all the IFX_ stream classes all the time.tsepez
We can remove a lot of "bOwnsStream" logic in the process. Always pass these by const reference, in case the called method wants to hang on to the stream (one exception is where we stick a raw pointer into a void* slot in a context from another layer). Review-Url: https://codereview.chromium.org/2451493002
2016-12-01Move Init to constructor in CXFA_FMProgramNicolas Pena
Change-Id: I6b2d1a5b06211b32f3053aad4d7ae7501ec8d8f6 Reviewed-on: https://pdfium-review.googlesource.com/2093 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2016-11-29Use unique_ptr in CFXA_FM expressions constructorschromium/2937npm
Review-Url: https://codereview.chromium.org/2534143003
2016-11-28Use unique pointers in CXFA_FMParsenpm
Replaced CXFA_FMParse's returns to be unique pointers to prevent leaks. Review-Url: https://codereview.chromium.org/2530933002
2016-11-23More unique_ptrs in CXFA_FMParse::ParseForeachExpression and avoid leaknpm
Commit a31098417852bdf13e693a6e0913e0706cf94098 accidentally caused a leak. Replaced pointers with unique_ptr to prevent this from happening. BUG=664891 Review-Url: https://codereview.chromium.org/2528543003
2016-11-21Fixup lint flags.Dan Sinclair
The -build/include setting was masking out build/include_what_you_use. This CL restores them, fixes any build errors, and adds NOLINT as needed. As well, the runtime/explicit and runtime/printf flags are aslo enabled and NOLINT'd. lint cleanups Change-Id: Ib013b3eb29c8d0e48cad74c5df9028684130719f Reviewed-on: https://pdfium-review.googlesource.com/2030 Reviewed-by: Tom Sepez <tsepez@chromium.org>
2016-11-11Add fpdfppo_embeddertest.cpp.tsepez
The lack of coverage of the fpdfppo APIs was noticed while trying to diagnose another issue. Adding basic calls to these APIs then kicked out an assert in XFA, where duplicate global CFXA_TimeZoneProviders were not expected. These are cheap to create except for the global C RTL tzset() call, so keep track of that and make these on demand. Review-Url: https://codereview.chromium.org/2488403004
2016-11-02Remove FX_BOOL from xfa.tsepez
Review-Url: https://codereview.chromium.org/2467203003
2016-10-27Fix some FX_BOOL / int noise in fxfatsepez
Review-Url: https://codereview.chromium.org/2457673003
2016-10-24Rename IFX_ stream nameschromium/2900tsepez
It's been troubling for some time that an IFX_FileStream might actually be an in-memory buffer with no backing file. Review-Url: https://codereview.chromium.org/2443723002
2016-09-29Move fxjs/include to fxjsdsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2380713005
2016-09-29Move core/fxcrt/include to core/fxcrtdsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2382723003
2016-09-15Rename dictionary set and get methodsdsinclair
This Cl makes the Get and Set methods consistenly use {G|S}et<Type>For. BUG=pdfium:596 Review-Url: https://codereview.chromium.org/2334323005