Age | Commit message (Collapse) | Author |
|
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
|
|
-remove parameter from FPDF_InitLibrary
-remove a bunch of ifdefs that are unused
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/801913002
|
|
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.
R=bo_xu@foxitsoftware.com, tsepez@chromium.org
Review URL: https://codereview.chromium.org/729293003
|
|
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)
R=bo_xu@foxitsoftware.com, tsepez@chromium.org
Review URL: https://codereview.chromium.org/733693003
|
|
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
|
|
Complementary patch in chromium is in https://codereview.chromium.org/711553003
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/700373006
|
|
BUG=https://code.google.com/p/pdfium/issues/detail?id=78
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/726143002
|
|
Found by VC++'s /analyze. Warning was:
fpdfsdk\src\javascript\js_runtime.cpp(352) : warning C6276:
Cast between semantically different string types: char * to wchar_t *.
Use of invalid string can lead to undefined behavior.
This mismatch has been there as far back as the history goes (to May of this year).
It looks like a real bug to me. However I don't know the implications of this bug and why it would not have been noticed at run-time.
The code has been this way as far back as the git history goes, but that is only to May 2014.
Original patch from Bruce Dawson(brucedawson@chromium.org)
BUG=427616
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/705503004
|
|
found by /analyze on some error paths
Warning from /analyze was:
src\third_party\pdfium\fpdfsdk\include\fsdk_mgr.h(96) : warning C6001: Using uninitialized memory 'fxtime'.
Other error paths can also lead to reading from an uninitialized _FX_SYSTEMTIME object.
Code-gen for the constructor is small enough (four writes of zeroed EAX with VC++, less with gcc) to make putting the constructor in a .cc file unnecessary.
Approval of in-class member initialization would make this fix simpler but that has not quite been approved yet.
BUG=https://code.google.com/p/pdfium/issues/detail?id=70
BUG=427616
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/692533005
|
|
BUG=425129
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/688303003
|
|
BUG=pdfium-52
R=jun_fang@foxitsoftware.com
Review URL: https://codereview.chromium.org/623893003
|
|
BUG=410326
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/594403003
|
|
BUG=none
R=jam@chromium.org
Review URL: https://codereview.chromium.org/581413002
|
|
Security handler revision number is needed to interpret file permission.
BUG=None
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/589813002
|
|
but no its direct object '112 0 object' in the test pdf file. Without checking the validity, it causes a null pointer when trying to get the direct object by an indirect object.
BUG=390781
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/553613003
|
|
app::response().
I also clean up the code while we are here, rewriting a strange switch statement and tidying whitespace.
BUG=406142
R=jun_fang@foxitsoftware.com
Review URL: https://codereview.chromium.org/498773004
|
|
In CPDFSDK_InterForm::SubmitFields, the buffer pointed by m_pBuffer is returned
and released by the caller. However, it will be released again in the destructor.
BUG=401580
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/481733002
|
|
BUG=387969
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/461343003
|
|
BUG=chromium:395832
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/478353002
|
|
Should there be cases where this fails to compile, it indicates a mistake,
either an incorrectly declared overrriden virtual method, or a method that
should be declared non-virtual.
The only issues were with CPDF_CustomAccess::GetBlock(), CPDF_CustomAccess::GetByte(),
and CPDF_CustomAccess::GetFullPath(). These don't appear to be used anywhere,
and are removed. Two members are removed that are no longer needed once those
methods are removed.
R=jam@chromium.org, jun_fang@foxitsoftware.com
Review URL: https://codereview.chromium.org/454983003
|
|
BUG=pdfium:28
R=thakis@chromium.org
Review URL: https://codereview.chromium.org/472563002
|
|
To be complient with PDF reference chapter 7.3.7
BUG=402437
R=vitalybuka@chromium.org
Review URL: https://codereview.chromium.org/469573002
|
|
This has no ill-effect at present, but may be distracting when viewing the file
since it just looks wrong.
R=jun_fang@foxitsoftware.com
Review URL: https://codereview.chromium.org/461933003
|
|
BUG=400662
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/445303002
|
|
BUG=https://code.google.com/p/pdfium/issues/detail?id=35
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/451483003
|
|
Edge closer to the goal of building PDFium with the chromium_code
configuration.
BUG=https://code.google.com/p/pdfium/issues/detail?id=29
R=bo_xu@foxitsoftware.com, thakis@chromium.org
Review URL: https://codereview.chromium.org/441763002
|
|
When newPos == file size, the current block will not be read or Get. If this block is a crucial part of the document (like m_pTrailer), the program will exit with parse error and
the document will not be rendered.
BUG=None
R=jun_fang@foxitsoftware.com
Review URL: https://codereview.chromium.org/440563003
|
|
No intended behavior change.
BUG=pdfium:29
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/436483002
|
|
It's unused, and it caused a warning about CPDFSDK_Widget::ResetAppearance()
failing to override it (since these two unrelated methods had the same name).
No intended behavior change.
BUG=pdfium:29
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/429483004
|
|
No intended behavior change.
BUG=pdfium:29
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/426763003
|
|
BUG=pdfium:29
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/427353003
|
|
No intended behavior change.
BUG=pdfium:29
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/426763004
|
|
There are many warnings that look like:
error: 'CPWL_RadioButton::OnChar' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
virtual FX_BOOL OnChar(FX_WORD nChar);
^
note: hidden overloaded virtual function 'CPWL_Wnd::OnChar' declared here: different number of parameters (2 vs 1)
virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
^
It looks like someone added the nFlag parameter to the methods in CPWL_Wnd
at some point and missed to update all overloads This patch attempts to fix this:
It adds the parameter to all methods that look like they're trying to overload the base
class method, and renames the method in one case where it fairly clearly looks like
that it's not supposed to be an overload.
BUG=pdfium:29
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/416383004
|
|
fsdk_baseform.h:63:19: error: 'CPDFSDK_Widget::GetLayoutOrder' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
virtual int GetLayoutOrder() {return 2;}
^
fsdk_baseannot.h:70:18: note: hidden overloaded virtual function 'CPDFSDK_Annot::GetLayoutOrder' declared here: different qualifiers (const vs none)
virtual int GetLayoutOrder() const { return 5; }
^
On Windows, I believe MSVS treats these as override since it's such a common and
easy mistake, but clang and gcc do what the standard specifies. Add a "const" to
the function in the subclass so that this is actually an override, as intended.
BUG=pdfium:29
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/427173002
|
|
fpdfview.cpp
BUG=397258
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/419063002
|
|
If somehow different length values could be obtained by two successive calls
to Doc_getFilePath() (and FieldBrowse() for that matter), and the method is
true to the API documentation that says "The return value always indicated
number of bytes required for the buffer, even when there is no buffer
specified, or the buffer size is less then required", then it is possible
to get a returned length describing memory beyond the current buffer.
We can make the corresponding JS_docGetFilePath() method more robust against
this case by applying better checks to the returned value.
This probably is unrelated since ASAN seems to be flagging the corresponding bug
as UAF, but doesn't hurt to make things more robust.
BUG=392956
R=jun_fang@foxitsoftware.com
Review URL: https://codereview.chromium.org/423233002
|
|
Follow-up from https://codereview.chromium.org/424883002/
- Remove some stray whitespace.
- Fix "else after return".
- Remove unused swResponse local.
- Treat unexpectedly large responses as errors.
BUG=
R=jun_fang@foxitsoftware.com
Review URL: https://codereview.chromium.org/423953002
|
|
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
|
|
Found by clang's -Wunused-variable, -Wunused-function, -Wunused-const-variable.
BUG=none
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/404653005
|
|
BUG=395266
R=jun_fang@foxitsoftware.com
Review URL: https://codereview.chromium.org/411713003
|
|
BUG=396255
R=jun_fang@foxitsoftware.com
Review URL: https://codereview.chromium.org/407243003
|
|
BUG=179413
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/410073002
|
|
The function is looking ahead N characters at both its "format" and "value"
strings without validating that accesses are in bounds. Add those validations.
There are also duplicate checks in the else-branches which re-test the inverse
of the if-branch. These are removed for simplicity.
I also tidied some stray whitespace in the function while I was at it.
BUG=393831
R=jun_fang@foxitsoftware.com
Review URL: https://codereview.chromium.org/395303004
|
|
Calling `delete` on an object of a type that has virtual functions but
not a virtual destructor is questionable: Since the object has virtual functions,
it likely has subclasses, so if it's deleted through the base pointer and the
destructor isn't virtual, the subclass destructor won't be called.
In most cases, the classes getting deleted can just be marked final to tell
the compiler that it can't possibly have subclasses (this also enables the
compiler to generate better code).
Two classes didn't have any sub- or superclasses but virtual functions -
this doesn't make sense, so make all methods of these classes non-virtual.
(Also delete an unused function on one of the two classes.)
In one case, a class actually did have a subclass that needs to be deleted
virtually, so mark one destructor as virtual.
BUG=none
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/370853002
|
|
It remains to call the PumpMessageLoop() method at a regular interval,
however, since nothing posts to the loop yet, that shouldn't be a
problem.
BUG=25
R=jam@chromium.org
Review URL: https://codereview.chromium.org/374123002
|
|
Fixes a warning.
BUG=
TBR=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/395293002
|
|
This change adds the support to extract "NumCopies", "PrintPageRange", "Duplex" viewer preferences for printing.
BUG=169120
R=bo_xu@foxitsoftware.com, vitalybuka@chromium.org
Review URL: https://codereview.chromium.org/345123002
|