Age | Commit message (Collapse) | Author |
|
CFX_Object is a type that implements its own new operators that return
NULL on error. There's no need for this given the |new (std::nothrow)|
syntax; in fact, the current code can only work if there is no activity
in the constructors. This may explain the pervasive lack of
constructors and reliance on Init() methods throughout the codebase.
The activity takes place in fx_memory.h, where FX_NEW is mapped onto
the std::nothrow syntax. The rest is just cleanup.
Down the road, we will simply throw and remove all the error-checking
paths for new objects. Landing this patch first will at least show a
simple path back to the old behaviour without having to re-introduce
CFX_Object should someone want to do so in their own fork.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1088733002
|
|
VS 2015 RC ships without afxres.h, so fpdfsdkdll.rc fails to
compile. afxres.h is really intended for MFC apps so depending on
it is a bad idea anyway, so I changed both references to
windows.h. See http://stackoverflow.com/questions/1575559 for
some other perspective on this.
R=tsepez@chromium.org
BUG=440500
Review URL: https://codereview.chromium.org/1078513002
|
|
It turns out that 'timezone' has been deprecated for a while. If
deprecation messages are enabled then VS 2013 says this when 'timezone'
is referenced:
warning C4996: 'timezone': This function or variable may be unsafe.
Consider using _get_timezone instead.
Sometimes features stay deprecated for decades, but in this case
'timezone' is now gone.
R=tsepez@chromium.org
BUG=440500
Review URL: https://codereview.chromium.org/1075673002
|
|
Original CL was accidentally based off of XFA. This CL is
off of master.
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1069553002
|
|
TBR=tsepez@chromium.org
BUG=N/A
Review URL: https://codereview.chromium.org/1068513002
|
|
BUG=454595
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1053373002
|
|
BUG=https://code.google.com/p/pdfium/issues/detail?id=137
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1039063002
|
|
I thought I had done this already, apart from the third-party
libraries, but there were a couple remaining (the third-party
libraries will still call this, they should be tweaked
upstream as needed).
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/999543002
|
|
Precursor to taking a second shot at cleaning up the FPDF_*
APIs. A FPDF_LINK is a CPDF_Dictionary, and a CPDF_Link
is a structure holding a FPDF_LINK. This goes against the
convention that FPDF_ types get cast to CPDF_* types, so we
want to make it clear where objects are getting constructed.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/985503005
|
|
Precursor to taking a second shot at cleaning up the FPDF_*
APIs. A FPDF_Dest is a CPDF_Array, and a CPDF_Dest
is a structure holding a FPDF_Dest. This goes against the
convention that FPDF_ types get cast to CPDF_* types, so we
want to make it clear where objects are getting constructed,
etc.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/984703004
|
|
Precursor to taking a second shot at cleaning up the FPDF_*
APIs. A FPDF_Action is a CPDF_Dictionary, and a CPDF_Action
is a structure holding a FPDF_Action. This goes against the
convention that FPDF_ types get cast to CPDF_* types, so we
want to make it clear where objects are getting constructed,
etc.
Also tidy fpdf_actionhandler.cpp because it bugs me.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/984773002
|
|
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
|
|
This implements the previously unimplemented JS_Error() function.
Along the way:
- fix some IWYU when the include order in global.cpp was perturbed.
- remove some uses of JS_ErrorString, to increase transparency.
- use vp.IsSetting() in place of !vp.IsGetting() for clarity.
- specify an error string on several error return paths.
- add an error string for writing readonly properties.
- rename an error string constant to reflect the actual message.
- replace calls to variadic Format() with a function doing string appends.
- remove unused JS_GetClassName()
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/963193003
|
|
Along the way, I noticed that one of these is used in a header file
that isn't included anywhere and describes no actual code (JS_Console.h).
Also add missing header guards, and IWYU to resources.h
Also move a static function from a header to the new resources.cpp file.
Also fix the grammar on some of the error messages. Most of these
appear to be JS error messages destined for a JS error handler or (someday)
a console (which can remain in english), and oddly, some appear to be about
failed form validation, which smells user-facing.
Also check that the message makes sense for the point the C++ code
wants to use it, and reword accordingly.
As it turns out, these currently don't make it back to JS due to the
unimplemented JS_Error() function; this is an enabling step towards
implementing it.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/955273003
|
|
For chromium checkouts, the top-level gmock is used instead.
Verify build with a simple test that ensures neither mock
method is fired.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/955513009
|
|
Re-work of original CL at:
https://codereview.chromium.org/933043002/
Much of the IFXJS interface appears completely unused, so
Kill off unused IFXJS interface methods. The code itself
appears incomplete against all of the objects present
in the paths that actually do register objects with JS.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/954923004
|
|
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
|
|
BUG=pdfium:29
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/891113002
|
|
The bstring's read from file is unused.
The load from file paths aren't taken.
R=jam@chromium.org
Review URL: https://codereview.chromium.org/902943003
|
|
Note that this work was done opposite the usual branch order, because I
didn't want to kill things in master that turned out to be in use in XFA.
Original Review URL: https://codereview.chromium.org/883393007
TBR=jam@chromium.org
Review URL: https://codereview.chromium.org/903893002
|
|
Handles the case of this malformed PDF without crashing. Note that to
get a reproducible test case, a small fix is applied to our .py script
which results in some whitespace/numbering difs across the resources
(down the road, we ought to generate them on the fly in an intermediate
directory).
BUG=454695
R=jun_fang@foxitsoftware.com, thestig@chromium.org
Review URL: https://codereview.chromium.org/895933003
|
|
Any projects DEPS'd into chromium and requiring a /base
subset should have a local copy of that subset in a
separate namespace. This will avoid future naming conflicts.
Re-arrange the directory structure to better identify what
came from chromium's base, and to make drop-in replacement
easier for files that contain hard-coded "base/" in their
#include directives.
R=jam@chromium.org
Review URL: https://codereview.chromium.org/900753002
|
|
This is similar to how we initialize ICU for V8 inside PDFium.
BUG=455399
R=wfh@chromium.org
Review URL: https://codereview.chromium.org/897973002
|
|
Headers in /include directories should be free of implementation details
from third_party. Put the types into a new header outside of /include.
Requires https://codereview.chromium.org/902443003/ before a version containing this patch is rolled into chromium.
R=jam@chromium.org
Review URL: https://codereview.chromium.org/896023003
|
|
BUG=https://code.google.com/p/pdfium/issues/detail?id=113
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/880043004
|
|
BUG=452455
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/887063003
|
|
This removes some duplicated code from each individual test.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/885403002
|
|
Original Review URL: https://codereview.chromium.org/878333003
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/884873002
|
|
This was fixed by https://codereview.chromium.org/743263002, but the
bug remained open due to confusion.
BUG=https://code.google.com/p/pdfium/issues/detail?id=57
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/878523003
|
|
A suitably corrupted file can cause the parser(s) to repeatedly re-read
sections of the file at increasing parser recursion depth until the
stack is exhausted. There is supposed to be a check for this based upon
the parser "level", but not all call paths pass or update the level as
required.
Much as I hate per-class statics, this introduces one to track the depth
so that the check is enforced no matter how screwy the call path might be
that leads the parser to re-enter itself. This is more palatable than trying
to find all these paths and fix them. We know this is OK since there is
only one thread in here modifying the static.
BUG=451830
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/875263002
|
|
The embeddertests binary should have source files ending in
_embeddertest, not _unittest.
TBR=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/871093004
|
|
We are making checks in the incorrect order. Also adds two test
cases, one for the this crash, and another for the original issue
that motivated the patch.
Original Patch by Bo at https://codereview.chromium.org/866003003/
BUG=450871
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/872563002
|
|
Currently, no callers go through the Interface, which makes having a
separate interface class kind of pointless. After converting callers
away from using the CPDF_DataAvail concrete class, it can be moved
from the header to the .cpp file.
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/873523002
|
|
This also adds a fpdfdoc_embeddertest.cpp to keep the test
file name matching with the API call under test.
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/812933004
|
|
Follow-on work from patch at https://codereview.chromium.org/845643008. This
incorporates that patch, plus adds tests for it and similar conditions. A few
changes are introduced to correct expected behaviour.
This also incoprorates Deepak's fix in https://codereview.chromium.org/845643008/
This incorporates a formerly unlanded tool to generate small valid PDF
files from template input, which is needed to cover all the error cases
here. See https://codereview.chromium.org/791993006/
BUG=450133
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/837723009
|
|
Need to have return value -1 indicating insufficient buffer.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/862163002
|
|
Previously, UTF16LE_Encode take an optional flag to indicate
if the returned byte string has trailing zeros. In fact, no where
needs the flag to be false. So just get rid of it so callers won't
misuse.
The bug is found by https://codereview.chromium.org/837723009
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/860973002
|
|
This includes:
- Fix TestLoader lifetime.
- Rename test file to match the equivalent .cpp under test
- Re-organize a few tests to avoid duplicate loading
- add tests for a few additional functions.
R=jam@chromium.org
Review URL: https://codereview.chromium.org/857483005
|
|
Previously when passing a NULL bookmark to FPDFBookmark_GetFirstChild it returned NULL instead of returning the top level bookmark. This change removes the early exit in this case allowing the top level bookmark to be retrieved.
BUG=https://code.google.com/p/pdfium/issues/detail?id=110
R=bo_xu@foxitsoftware.com, tsepez@chromium.org
Review URL: https://codereview.chromium.org/847243005
|
|
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/834703002
|
|
This is done by explicitly adding a virtual dtor to interface classes,
since the cost is small given that there are already virtual functions.
The exceptions are for classes that have a Release() or Delete() method,
in which case it is non-virtual and protected to indicate that the virtual
class is never the deletion point.
BUG=
R=brucedawson@chromium.org, thestig@chromium.org
Review URL: https://codereview.chromium.org/810883005
|
|
R=brucedawson@chromium.org
Review URL: https://codereview.chromium.org/837533003
|
|
g_timeMap is a global variable with a constructor and destructor so it
must be removed.
BUG=441899
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/832703003
|
|
PDFium static initializers must go. Static initializers are prohibited
by the style guide. They have negative consequences including increased
startup time (from pulling in additional code pages) and reduced sharing
of data pages (since the variables can't go in the read-only data
segment).
This change uses a template struct and typed enums to reproduce
JS_CalcHash at run-time. An unsigned long long constant and masking with
0xFFFFFFFF are used to avoid compile errors due to integer overflow of
compile-time constants.
The HashVerify class is used to check the results, necessary since none
of the functions in global.cpp are called when pdfium_test.exe runs.
const_expr would be a much cleaner way to implement this change but it
is not yet widely supported.
On the Windows release build this reduces the code size (.text
virtual size) by 0x240 (576) bytes, the .data section by 0x20 bytes
(for eight unsigned globals), and the .rdata section by 0x20 bytes
(the unneeded string savings, minus the eight unsigned globals now
being there).
BUG=441899
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/792043005
|
|
m_sTimeMap is a global variable with a constructor and destructor, which
is not allowed. This change moves it to a function with a static pointer
so that it is constructed on demand and then leaked, thus avoiding
having startup and shutdown code.
This also fixes a worrisome bug caused by having m_sTimeMap defined in
a header file. Because m_sTimeMap was defined (and marked as static) in
a header file there were fifteen separate copies of it, one for each
source file which included the header file. This could easily lead to
bugs because a timer that was added from one source file would be
invisible to other source files.
Each instance of m_sTimeMap added four entries to the
dump-static-initializers.py report, for a total of sixty, so this fix
significantly cleans up that report.
BUG=441899
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/831903002
|
|
Remove CPDF_Dictionary*() operator in CPDF_Bookmark class.
Unify naming conventions and coding styles.
Change some functions to const.
Change the name of function argument to |pDict| for FPDF_xxx type variable.
This makes the code more clear and gives better variable naming
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/828203002
|
|
When dealing with transparency, the printing procedure will generate a bitmap first,
then draw this bitmap in windows DC.
The format of source bitmap is argb, but the destination bitmap is rgb.
Simply doing memcpy will lose the alpha channel information, so CompositeBitmap function is needed.
BUG=412908
R=vitalybuka@chromium.org
Review URL: https://codereview.chromium.org/826633002
|
|
Doing the type conversion on demand is just as efficient as doing it at
startup time, and makes for more efficient startup.
Also mark g_nan as const, to reduce .data section size and enforce
desired semantics.
BUG=441899
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/788143009
|
|
Follow up on https://codereview.chromium.org/733693003
R=brucedawson@chromium.org, tsepez@chromium.org
Review URL: https://codereview.chromium.org/809993004
|
|
QeTable is a 752 byte array that was defined in a header file. This
caused it to be instantiated by the VC++ compiler 12 times, wasting
8,272 bytes of space in the data segment. Because 'const' implies
'static' this did not cause any duplicate symbol errors.
JSCONST_n*HASH are a set of eight variables that are defined in a header
file. This causes them to be replicated 15 times. The variables
themselves are tiny but they are dynamically initialized and this
dynamic initialization code is replicated 15 times.
When tested on pdfium_test.exe the effect of this change is to:
Reduce the .text (code) segment by 3,616 bytes.
Reduce the .rdata section by 8,656 bytes.
Reduce the total binary file size by 13312 bytes.
These are the worst offenders for pdf.dll as shown in:
https://drive.google.com/open?id=1BvubxoA2SU_2e4T5cq7jHTjc1TlT0qOndpIfX3DMeA8&authuser=0
This will also drastically simplify the list of work to be done
for bug 441899 (getting rid of initializers).
BUG=441988
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/802013002
|