Age | Commit message (Collapse) | Author |
|
Get rid of g_timeMap global object.
g_timeMap is a global variable with a constructor and destructor so it
must be removed.
BUG=441899
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/832703003
Review URL: https://codereview.chromium.org/837483006
|
|
Remove run-time calculation of hash constants in pdfium.
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
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/792043005
Review URL: https://codereview.chromium.org/828883004
|
|
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/823653004
|
|
Get rid of fifteen copies of m_sTimeMap and their initializers.
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
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/831903002
Review URL: https://codereview.chromium.org/800883004
|
|
Clean up bookmark related codes.
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
Conflicts:
fpdfsdk/src/fpdfdoc.cpp
|
|
Note that the merge of this fix to XFA found six bugs. Five
were fixed in https://codereview.chromium.org/826573003 and
one was fixed in https://codereview.chromium.org/831293002.
These bugs are now impossible to compile.
Replace manual/error-prone/hard-to-verify arraysize calculations with
safe FX_ArraySize macro.
pdfium has numerous places where the number of elements in an array is
calculated with expressions like:
sizeof(cFormats)/sizeof(FX_LPCWSTR)
This is suboptimal because it is verbose, it is easy to get wrong, and
it cannot be determined through casual inspection whether the code is
correct. It will give incorrect results if cFormats is a pointer instead
of an array and it will give incorrect results if FX_LPCWSTR is not the
type of the array elements.
The FX_WSTRC macro in fx_string.h which I fixed was particularly scary
because it would silently misbehave if passed a pointer.
The FX_ArraySize macro which I have added and started using (taken from
arraysize in v8's macros.h) is easier to use and will always give correct
results. If passed a pointer it will fail to compile.
For this change I only fixed instances of sizeof(FX_LPCWSTR). There
appear to be about 150 other places in the pdfium code that could
benefit from using FX_ArraySize.
TBR=bo_xu@foxitsoftware.com, tsepez@chromium.org
Review URL: https://codereview.chromium.org/818193004
|
|
FX_WSTRC is only valid on arrays, not pointers. In this code it was
being passed a pointer to a URL. This was found when integrating a
change to FX_WSTRC that disallows pointer arguments.
The consequence of this bug is that the URL will end up with incorrect
lengths. It will be one character long in 32-bit builds, and three
characters long in 64-bit builds (sizeof(WCHAR*)-1).
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/831293002
|
|
Remove static declared SymbolDictCache.
This is a follow up CL on https://codereview.chromium.org/761313004/
BUG=https://code.google.com/p/pdfium/issues/detail?id=93
R=brucedawson@chromium.org, tsepez@chromium.org
Review URL: https://codereview.chromium.org/828183002
|
|
Previous CL at https://codereview.chromium.org/830553002/ broke the standalone build.
TBR=brucedawson@chromium.org
Review URL: https://codereview.chromium.org/831283003
|
|
In windows printing, convert src bitmap to dest bitmap using CompositeBitmap.
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
|
|
FX_WSTRC is only valid on arrays, not pointers. In five places it was
being passed a pointer, which leads to incorrect string objects being
created. This was found when integrating a change to FX_WSTRC that
disallows pointer arguments.
The consequence of this bug is that five XML strings (quot, amp,
apos, lt, and gt) will all end up with incorrect lengths. They
will all be one character long in 32-bit builds, and three characters
long in 64-bit builds (sizeof(WCHAR*)-1).
Also removed some unneeded casts and marked some arrays as const.
Fixing this is necessary in order to allow landing of
https://codereview.chromium.org/818193004/
Testing this was attempted by using the xfa branch of pdfium in
Chrome:
cd third_party\pdfium
git checkout xfa
However even without these changes this caused a CHECK failure in
V8::InitializePlatform due to double initialization, so the fix
has not been tested, but is clearly an improvement.
BUG= https://code.google.com/p/pdfium/issues/detail?id=96
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/826573003
|
|
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
TBR=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/788143009
Review URL: https://codereview.chromium.org/832933002
|
|
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/720323008
|
|
Get rid of FX_LPCSTR cast.
Follow up on https://codereview.chromium.org/733693003
R=brucedawson@chromium.org, tsepez@chromium.org
Review URL: https://codereview.chromium.org/809993004
|
|
Original CL at https://codereview.chromium.org/831653002/
TBR=palmer@chromium.org, brucedawson@chromium.org
Review URL: https://codereview.chromium.org/830553002
|
|
TBR=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/798723003
|
|
Previously no big integer support in Pdfium and XFA.
The PDF417 barcode functionality could not work properly.
BUG=https://code.google.com/p/pdfium/issues/detail?id=98
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/777553002
|
|
Getting rid of more (FX_LPCWSTR) casts and fixing two bugs revealed by this.
Since casts to FX_LPCWSTR have been shown to hide bugs I tried removing
more of them, targeting those places where a cast was used to force a
conversion from CFX_WideString to FX_LPCWSTR, replacing these casts with
calls to the newly added .c_str() function. This revealed two places
where the cast was hiding a bug -- where ->c_str() was required instead!
This removes ~33 FX_LPCWSTR casts and there are ~31 left, many of which
will go away in some future change.
Also includes this change:
Removing unnecessary casts from wchar_t* to wchar_t*, by various names.
Original patch from Bruce Dawson(brucedawson@chromium.org)
TBR=bo_xu@foxitsoftware.com, tsepez@chromium.org
Review URL: https://codereview.chromium.org/811593007
|
|
Fixing operator so that bCheckRight isn't always true. Unknown effect!
VC++'s /analyze points out that this expression:
FX_BOOL bCheckRight = type != 'D' || type != 'W';"
is always true. This means that the tests for the right edge of a word
Original patch from Bruce Dawson(brucedawson@chromium.org)
BUG=427616
TBR=jun_fang@foxitsoftware.com
Review URL: https://codereview.chromium.org/822763003
|
|
Zero initialize ch to avoid possible bug - conditions are very subtle.
Whether ch and iRet are read without being initialized depends on complex
preconditions and cannot be determined by looking at these function.
Therefore it seems prudent to zero initialize them to avoid any risk.
BUG=427616
TBR=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/727083002
Review URL: https://codereview.chromium.org/793763005
|
|
Add the license back to ftmodule.h after the freetype 2.5.4 upgrade.
Review URL: https://codereview.chromium.org/815333002
Set the freetype options missing in the recent update.
Turn on the FT_CONFIG_OPTION_SUBPIXEL_RENDERING to enable sub-pixel rendering.
Also undef some other options to match what they look like before.
BUG=444243
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/789163008
|
|
Transform font size to user space for valid text size comparison.
BUG=438441
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/816153002
|
|
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/821493002
|
|
Update freetype to 2.5.4.
Put freetype into third_party directory, cleaning up header files.
Previously freetype header files are in core/src/fxge/freetype and core/include/thirdparties. There were also multiple fx_freetype.h.
This patch removes the additional Foxit wrapper to make further update easier.
Notice, for original freetype source code, the following files are modified and need to be updated accordingly in future update:
third_party/freetype/include/config/ftmodule.h
third_party/freetype/include/config/ftoption.h
BUG=407341
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/815103002
|
|
Fix a few windows compile warnings
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/817753002
|
|
Cleanup: Refactor some code into its own function in fpdf_text_int.cpp.
Also use stdlib algorithms in a few places.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/810223003
Conflicts:
core/src/fpdftext/fpdf_text_int.cpp
|
|
Cleanup: Remove a shadow variable in CPDF_TextPage::CloseTempLine().
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/816593002
|
|
Add a small LRU cache for the JBIG2 symbol dictionary.
This reduces rendering time on my test document by over
10 seconds. It is super common for a JBIG2 dictionary to
span multiple pages, so we don't want to decode the same
dictionary over and over again.
Original patch from Jeff Breidenbach (breidenbach@gmail.com)
BUG=https://code.google.com/p/pdfium/issues/detail?id=85
R=bo_xu@foxitsoftware.com, thestig@chromium.org
Review URL: https://codereview.chromium.org/761313004
|
|
Cleanup: Pass by const reference in fpdftext.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/790213005
|
|
Avoid duplicate definitions of JSCONST_n*Hash and QeTable variables.
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
|
|
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/818543002
|
|
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/814903002
|
|
This is a quick patch to fix the segv which occurs in pdfium_test when
the v8 external data is not provided. Fixing the full-up initialization
is left as a follow-on exercise.
Path manipulations remain a nuisance since we don't want to depend on a
particular /base library.
BUG=439793
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/810793004
|
|
Before this fix, the root will be released when an indirect object has the
same object number with the root. However, the root object is loaded when
the trailer is parsed. It shall not be updated or replaced anymore.
BUG=425040
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/803103002
|
|
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/811493002
|
|
Simplify PDFium by removing code that's not used in the open source repo.
-remove parameter from FPDF_InitLibrary
-remove a bunch of ifdefs that are unused
Fix build after previous commit.
TBR=tsepez@chromium.org
BUG=
Review URL: https://codereview.chromium.org/809513002
|
|
m_pColorSpace can not be NULL for image object with DCTDecode filter
BUG=411842
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/792113003
|
|
Do not do strict check of BitsPerComponent for RunLengthDecode filter
BUG=438421
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/790363002
|
|
Lab colorspace needs to be 3 component
BUG=429134
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/791223002
|
|
Trailer should be a dictionary object
BUG=https://code.google.com/p/pdfium/issues/detail?id=86
a "<<" token should follow "trailer" but "<" will trick the parser to make trailer a hex string object.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/787753002
|
|
This is needed as an aid to testing.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/788433002
|
|
BUG= https://code.google.com/p/pdfium/issues/detail?id=89
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/786523004
|
|
A minor change to make it obvious when generated/test XFA files are not
being fully processed.
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/732173003
|
|
Follow-up to work on (wide) string literals.
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/751113003
|
|
Using an incomplete type here avoids casting later on, and allows the
debugger to more easily dig through these data structures.
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/766183009
|
|
This patch merges the 3 commits in master branch into one
|
|
One table is also reformatted to put one entry per line for readability.
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/749273003
|
|
Update to openjpeg r2944
BUG=429139,430566,431288
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/758593002
|
|
Fix blank page issues caused by too strict check
Before this fix, PDF parser aborts the parsering process when detecting an error.
For this case, PDF parser just gives up parsering when it detects that the length of
image stream is incorrect. The solution to this case is to find the tag "endstream"
and "endobj" to calculate the length rather than aborting the parsering process.
BUG=433339
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/743263002
|
|
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/715133004
|