summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/util.cpp
AgeCommit message (Collapse)Author
2015-12-25Speculative IWYU fix for failing Chromium DEPS roll.chromium/2606chromium/2605chromium/2604chromium/2603Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1546133002 .
2015-12-22Add ContainsKey() and ContainsValue() and use them where appropriate.Lei Zhang
R=ochang@chromium.org Review URL: https://codereview.chromium.org/1540263003 .
2015-12-21Cleanup CJS_PublicMethods:Lei Zhang
- Use FXSYS_iswdigit() instead of CJS_PublicMethods::IsDigit(). - Ditto for FXSYS_iswalpha() and FXSYS_iswalnum(). - Change CJS_PublicMethods::ParseNormalDate() and CJS_PublicMethods::MakeRegularDate() to take an out parameter by ptr. R=ochang@chromium.org Review URL: https://codereview.chromium.org/1539113002 .
2015-11-16Reland "Cleanup some numeric code.""chromium/2567Dan Sinclair
This reverts commit 0569ab0b11b723d9bca4ddd642b0cf8828c4bdd1. 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/1449873003 .
2015-11-12Remove relative includes.Lei Zhang
That refer to parent directories. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1434223002 .
2015-11-11Replace CJS_Parameters with std::vector<CJS_Value>.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1437713003 .
2015-11-10Revert x4 "Cleanup some numeric code."dan sinclair
This reverts commit b27902b8995bb3e003daed6b0811ed746763c68d. 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. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1432973003 .
2015-11-10Revert "Revert "Revert "Revert "Cleanup some numeric code.""""dan sinclair
This reverts commit da06e60fb5a095a91c9a4f509466667878624cb3. 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/1433513002 .
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-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-08Wean CJS_Value off of v8::Isolate.Tom Sepez
CJS_Values should belong to CJS_Runtimes so that we may eventually cram much of the v8 dependencies down into fxjs. This is a first step; the remaining split in this code between isolate and CJS_Runtime goes away when fxjs provides a CFXJS_Runtime object, and the CJS_Runtime is-a/has-a CFXJS_Runtime. But that can't happen until this is resolved. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1394103002 .
2015-10-07Rename IFXJS_Runtime and IFXJS_Context to IJS_.Tom Sepez
Nothing but sed. FXJS is a layer that makes it easier to define objects in V8, but has no knowledge of PDF-specific native objects. It could in theory be used to implement other sets of native objects. JS is the layer that implements PDF-specific native objects on top of FXJS. Therefore, the classes used to interface to JS should be named using IJS_. IFXJS_ is reserved for someday adding better API for FXJS iteslf. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1386173002 .
2015-10-06Make the vast majority of JS headers private to src/javascript.Tom Sepez
The fpdfsdk/include/javascript/IJavascript.h is the sole API. This required moving a creaton method to it from JS_Runtime. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1389783002 .
2015-10-05Remove JavaScript.hTom Sepez
It merely includes a bunch of other .h files which are handled better since we fixed IWYU. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1385983002 .
2015-09-16Ensure functions in FXJS_V8 are prefixed by FXJS_.Tom Sepez
Currently, its hard to tell which functions come from the JS_ layer at fpdfsdk/include/javascript vs. which functions come from the FXJS_V8 layer at fpdfsdk/include/jsapi. Until we take up the task of using namespaces, at least make the prefix consistent. Move objects out of FXJS_V8 that are really part of JS_. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1347833002 .
2015-08-14Use override in more classes in fpdfsdk/Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1287193005 .
2015-08-11Fix some sign comparison warnings.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1279493003 .
2015-08-04clang-format all pdfium code.Nico Weber
No behavior change. Generated by: find . -name '*.cpp' -o -name '*.h' | \ grep -E -v 'third_party|thirdparties|lpng_v163' | \ xargs ../../buildtools/mac/clang-format -i See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion. BUG=none R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1265503005 .
2015-07-27Revert "FX Bool considered harmful, part 3"Tom Sepez
This reverts commit ff46aaf499edcf153ee2f57c7016587aa96dcfa0. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1255293002 .
2015-07-27FX Bool considered harmful, part 3Tom Sepez
Try to reland this patch after fixing underlying issues that caused it to be reverted. fx_system.h is the only manual edit. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1258093002 .
2015-07-23Revert "FX_BOOL considered harmful, part 2."Tom Sepez
This reverts commit 320b2313d19869333ed453af546e61a9fc2b81c9. Reason for revert: build failure. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1255693002 .
2015-07-23FX_BOOL considered harmful, part 2.Tom Sepez
Fully automatic change, execpt for cleanup in fx_system.h R=thestig@chromium.org Review URL: https://codereview.chromium.org/1254703002 .
2015-07-22Re-land else-after-returnsTom Sepez
Revert "Revert "Fix else-after-returns throughout pdfium."" This reverts commit 4eb4d7f6c707cc2c23c806aa540d055c8832b55d. Fix one naming conflict. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1243953004 .
2015-07-22Revert "Fix else-after-returns throughout pdfium."Tom Sepez
This reverts commit 7cc97521db1e52d5927f5605de5f9a7102f8af40.
2015-07-22Fix else-after-returns throughout pdfium.Tom Sepez
Driven by CS search for pcre:yes file:third_party/pdfium/ -file:pdfium/third_party/ \breturn\b[^;]*;\s*\n*\s*\}*\s*\n*\r*else Note: Care is required to ensure the preceding block is not an else-if. As usual, removed any tabs I saw. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1243883003 .
2015-07-01Fix some clang warnings with -Wmissing-braces in pdfium.Nico Weber
Clang warns if there are missing braces around a subobject initializer. The most common idiom that triggers this is: STRUCT s = {0}; if the first field of STRUCT is itself a struct. This can be more simply written as: STRUCT s = {}; which also prevents the warning from firing. Other instances of the warning have been fixed by adding braces where appropriate. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/1213523004.
2015-06-11Remove trailing whitespaces in fpdfsdk.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1173343004.
2015-06-10Remove typdefs for pointer types in fx_system.h.Tom Sepez
This involves fixing some multiple variable per line declarations, as the textually-substituted "*" applies only to the first one. This involves moving some consts around following the substitution. This involves replacing some typedefs used as constructors with better code. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1171733003
2015-06-09Use stdint.h types throughout PDFium.Tom Sepez
It's redundant nowadays to provide our own equivalents, now that this is done for us by the system header. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1177483002
2015-04-27Reduce usage of operator LPCWSTR from CFX_WideString().Tom Sepez
This involves adding some explicit c_str() calls. Doing so flagged PDF_EncodeText() and FindOptionValue() as having suboptimal signatures, in that we are often throwing away a perfectly fine length and recomputing it. There are still some platform-specific code that needs the operator. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/1101933003
2015-04-27Revert "Kill operator LPCWSTR from CFX_WideString()."Tom Sepez
This reverts commit 15a62973b9b89c3e229cc0ab501c45967f91b325. Reason for revert: broke build on windows, mac. I must have missed some platform-specific conversions. TBR=brucedawson@chromium.org Review URL: https://codereview.chromium.org/1108883002
2015-04-27Kill operator LPCWSTR from CFX_WideString().Tom Sepez
This involves adding some explicit c_str() calls. Doing so flagged PDF_EncodeText() and FindOptionValue() as having suboptimal signatures, in that we are often throwing away a perfectly fine length and recomputing it. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/1101933003
2015-04-23Remove unused nParamNum values from JS method tables.Tom Sepez
The code to validate the number of parameters happens inside each particular method, rather than prior to method dispatch. As such, there's no point in having this number take up space in the table. Add some test to cover at least some of the per-method validations, and update error messages to be more useful. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1084183008
2015-04-23Kill overloaded cast operators in CJS_Value.Tom Sepez
The red-flag here is the explicit invocation of things like params[1].operator CFX_WideString() rather than static_cast<CFX_WideString>(params[1]) to invoke the conversion. Turns out the above won't compile due to ambiguity given the number of implicit constructors for widestrings. CJS_Value has both constructors and assignment operators for the primitive types, which means that conversions can take place unexpectedly in both directions, a second red flag. We don't want the compiler invoking these at will since it may hide bugs. In fact, when they are removed, three such places were discovered. Also rename ToJSValue to ToV8Value to match the other ToV8xxxxx functions added. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1096813008
2015-03-02Kill off JS_ErrorString type.Tom Sepez
This provides no benefit, and reduces transparency. Along the way: Kill off some unused/commented-out code. Return void where a bool return doesn't make sense. Remove a pointless template type. Remove now unused constants and types. R=thestig@chromium.org Review URL: https://codereview.chromium.org/971033002
2015-02-17Tidy up JS_Defines.hTom Sepez
This is a purely mechanical change, no new functionality. - Expand some macros which were merely a short-cut to save typing but reduced transparency. - Put GET_VALUE_TYPE() implementation into a .cpp file. This is a portion of the patch from issue 908033002 at patchset 40001 (http://crrev.com/908033002#ps40001) R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/927263003
2014-12-30Get rid of FX_LPCSTR cast.Bo Xu
Follow up on https://codereview.chromium.org/733693003 R=brucedawson@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/809993004
2014-11-17Removing unnecessary casts from wchar_t* to wchar_t*, by various names.Bruce Dawson
Remove casts that merely cast from wchar_t* to wchar_t*. Sometimes the types or casts are FX_LPCWSTR but the idea is the same. Excess casts can (and have) hidden bugs so removing these may prevent future problems. Original patch from Bruce Dawson(brucedawson@chromium.org) R=bo_xu@foxitsoftware.com, tsepez@chromium.org Review URL: https://codereview.chromium.org/730993002
2014-11-14Remove FX_LPCWSTR cast to wchar_t* literalsBo Xu
BUG=https://code.google.com/p/pdfium/issues/detail?id=78 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/726143002
2014-07-30Add missing braces for aggregate initializers.Nico Weber
No intended behavior change. BUG=pdfium:29 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/426763004
2014-07-29Fix a few more warnings in chromium_code mode.Nico Weber
No intended behavior change. - Remove more unused variables, functions, member variables. - Put a few constructor initializers in the order they execute in. - Add braces for subobject initializers. - Fix a handful of signed / unsigned comparisons. BUG=pdfium:29 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/429593005
2014-05-23Convert all line endings to LF.John Abd-El-Malek
2014-05-17Initial commit.John Abd-El-Malek