summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi
AgeCommit message (Collapse)Author
2015-06-19Small cleanup of CPDF_TextObject and other CPDF_PageObject subclasses.Lei Zhang
- Add overrides - Remove empty overrides - Remove dead friends - Cleanup bad formatting R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1199563002.
2015-06-19Disintermediation.Tom Sepez
Removed several header files that simply proxy other headers. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1199553002.
2015-06-19Move zlib to third_party/Tom Sepez
Remove some fx_* files that simply included other files along the way. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1197693003.
2015-06-18Fix CPDF_ICCBasedCS::GetDefaultValue heap-buffer-overflow.Tom Sepez
Introduced in ea44bd0. Re-animating the dead (code) usually turns out badly, and this is no exception. Make both of the uncallable methods go away. BUG=501889 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1179773007.
2015-06-17Replace some Release() calls with virtual destructors.Tom Sepez
A virtual method that does |delete this| is an anti-pattern. Some classes can be de-virtualized instead. Throw in some unique_ptrs and delete dead code for good measure. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1192013002.
2015-06-16Add constructor for CPDF_ColorSpace.Tom Sepez
Prevents sub-classes from tweaking parent class instance vars. Also "fix" https://code.google.com/p/pdfium/issues/detail?id=170, assuming 0 is a good value. BUG=pdfium:170 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1185903002.
2015-06-15Make CPDF_PageModuleDef and CPDF_RenderModuleDef pure virtual.Lei Zhang
Get rid of the dummy implementations, which are never used when the modules have been initialized. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1177383003.
2015-06-15Do some IWYU cleanups.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1176333002.
2015-06-15Provide a constructor for CPDF_CountedObject.Tom Sepez
Make members protected and remove external manipulations. Move "*" into template since its always an indirection. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1182903002.
2015-06-12Remove unneeded checks in CPDF_DocPageData::GetFontFileStreamAcc().Lei Zhang
The input cannot be null. Same for CPDF_Document::LoadFontFile(). Also set the contract for CPDF_Document::LoadFont() and adjust callers accordingly. Also remove unused CPDF_Document::FindFont(). R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1184673002.
2015-06-11Remove trailing whitespaces in core.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1177973008.
2015-06-11Kill FXSYS_mem{cpy,cmp,set.move}{32,8}.Tom Sepez
At one point in time, it may have made sense to indicate the expected alignment of the memory you're about to copy, but that was last century. The compiler will take care of it just fine. I stopped short of removing the FXSYS_ wrapper macros entirely. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1179693003.
2015-06-10Convert CPDF_FontFileMap to std::map.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1144333008.
2015-06-10Convert CPDF_IccProfileMap to use std::map.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1143133008.
2015-06-10Remove FX_BSTR and FX_WSTR typedefs.chromium/2434chromium/2433chromium/2432chromium/2431chromium/2430Tom Sepez
These stand for const CFX_{Byte,Wide}StringC&, which is just monumentally confusing, since there are so many string types running around here. The following had manual changes: core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp core/src/fpdfdoc/doc_form.cpp fpdfsdk/src/fpdf_ext.cpp R=thestig@chromium.org Review URL: https://codereview.chromium.org/1180593004.
2015-06-10Convert CPDF_ImageMap to std::map.Lei Zhang
Also simplify CPDF_DocPageData::ReleaseIccProfile() since its first argument is always null. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1149273004.
2015-06-10Convert CPDF_PatternMap to std::map.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1162123004.
2015-06-10Convert CPDF_ColorSpaceMap to std::map.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1154963003.
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-10Convert CPDF_FontMap to std::map.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1151133004.
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-06-08Remove more cruft from fx_system.hTom Sepez
- include system headers first and alphabetize. - remove unsupported FX_WIN32_MOBILE symbol. - actually define a FX_WIN64 symbol and make consistent. - use final/override, not FX_FINAL. - let stdint.h resolve FX_WORDSIZE concerns. - unused FX_ERR and FX_SUCCESS() macros. - unused FX_LSB_FIRST macro. - outline FX type deprecation plan. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1169963003
2015-06-08Fix potentially massive memory leak in CPDF_DIBSource::LoadJpxBitmap().chromium/2429chromium/2428chromium/2427Lei Zhang
Leaks can happen in several places. For this particular bug, it happens when there is a colorspace component count mismatch. BUG=497191 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1153633009
2015-06-04Move fx_safe_types.h to include/ directory.Tom Sepez
Small bit of OCD here, since this file is included cross-library (i.e. from fpdfsk), it can't be in src/. In other words, the following should be empty: grep -R 'include.*core/src/' fpdfsdk Fix some IWYU in it at the same time. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1147353006
2015-06-03Kill unused IPDF_ classes.Tom Sepez
Some are simply never defined. Some are never instantiated. Some have paths that are never reached. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1168503003
2015-06-02kill IPDF_DocParser().Tom Sepez
Its fine to program to interfaces, but since the sole concrete implementation is in the same header as the interface, the code is bypassing it anyways. We can de-virtualize some things along the way, and remove two non-existent function prototypes from one of the headers. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1158053003
2015-05-28Fix ALL the include guards.Tom Sepez
Get rid of leading _CAPITAL identifiers. A large number of these didn't actually match the filename. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1160443004
2015-05-21Fix four annoying warnings:Tom Sepez
Two "set but unused", one of which is surely an artifact from copying code around, and the other which ought to be used for the sake of clarity. Two are unknown "optimize" pragmas, remove them since the code has been shipped for years on other platforms under full optimization. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1148353002
2015-05-19Re-land: Remove FX_Alloc() null checks now that it can't return NULL.Tom Sepez
Fixes the ordering of some assignments broken when converting to checked numerics in CFX_PathData::AddPointCount(). Original Review URL: https://codereview.chromium.org/1142713005 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1135893008
2015-05-19Revert "Remove FX_Alloc() null checks now that it can't return NULL."Tom Sepez
This reverts commit eb6527763171cdb4b0fbfea5a20d691f4d67b660. Reason for revert: broke javascript tests. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1145843005
2015-05-19Remove FX_Alloc() null checks now that it can't return NULL.Tom Sepez
This permits some functions to become void's since they, in turn, can't fail. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1142713005
2015-05-18Add safe FX_Alloc2D() macroTom Sepez
This avoids unchecked multiplications when computing a size argument to malloc(). Such an overflow is very scary, and can result in exploitable bugs. Along the way, kill off some return checks, since we know this can't return NULL. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1143663004
2015-05-15Fix leaks in embedder test's FlateEncode() usage and in FlateEncode().Lei Zhang
For FlateEncode(), error handling code leaked memory. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1144603002
2015-05-15Fix leaks in the embedder tests themselves.Lei Zhang
Also change EmbedderTest::TearDown() to match the destruction order in Chromium's PDF code. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1138143003
2015-05-15Remove FX_NEW_VECTOR() macros.Tom Sepez
There isn't much point in having macros that obscure obvious language features. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1135273004
2015-05-14Fix another batch of compiler warnings.Lei Zhang
Also fix typos and remove trailing spaces/tabs. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1141123002
2015-05-11Create top-level public/ header directory.Tom Sepez
These are the only files that embedders of PDFium should be including. They are entirely self-contained, and compile cleanly against -Wall so as to not offend the code that may include them. Having done this, we can see that chromium is pulling in two additional files from the fpdfsdk/include/pdfwindow directory, which is not guaranteed to work. A few files are renamed, adding an "_" to make the names consistent. The exception is fpdfview, which is doc'd as such in the doc. Naturally, paths will need updating in a handful of files in chrome when this rolls in. BUG=pdfium:154 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1135913002
2015-05-08Fix a bunch of -Wunused-but-set-variable warnings.Lei Zhang
Also fix a few nits and other errors along the way. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1098583002
2015-05-06Remove FX_STRSIZE casts, use safe conversionsTom Sepez
BUG=pdfium:153 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1124043003
2015-04-27SEGV in CFX_BaseSegmentedArray::Iterate() when CS has malformed dictionary.Tom Sepez
Failure to check document-controlled value before using it. BUG=481363 R=palmer@chromium.org, thestig@chromium.org Review URL: https://codereview.chromium.org/1110653002
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-23Fix segmentation fault 'denial of service condition'JUN FANG
BUG=467392 R=thestig@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/1064713008
2015-04-22Add missing operators for CFX_ByteStringC.Tom Sepez
Removing the implicit cast operator forces a build breakage should we use ByteStringC in STL containers. Adding an operator< restores correct behaviour. Adding an operator[] avoids re-writing some code to call GetPtr() prior to array indexing. Part 1 of 4. R=thestig@chromium.org TBR=brucedawson@chromium.org BUG=pdfium:142. Review URL: https://codereview.chromium.org/1090303003
2015-04-21Fix a regression with cut off images.chromium/2387chromium/2386chromium/2385chromium/2384chromium/2383chromium/2382chromium/2381chromium/2380chromium/2379chromium/2378Lei Zhang
This regressed in commit 3f41851 due to shadow variables. BUG=478164 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1101443004
2015-04-20Remove Release() from CPDF_PageObjectTom Sepez
BUG=pdfium:140 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1093213002
2015-04-17Set m_FontType in CPDF_Font() constructor.Tom Sepez
This can't change for the life of the object, so tidy up some wild uses throughout the code. Also kill pointless Initialize() method. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1060813003
2015-04-16Make CFX_StockFontArray more robust.Lei Zhang
- Check bounds when accessing array. - Remove potential memory leak. - Merge duplicate code. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1094763002
2015-04-16Replace FX_NEW with new, remove tests from fpdfapiTom Sepez
Very few places where a change is required, but remove FX_NEW to show they've been audited. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1075953004