summaryrefslogtreecommitdiff
path: root/core/include
AgeCommit message (Collapse)Author
2015-01-21Simplify UTF16LE_Encode and add unittest.Bo Xu
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
2015-01-09Fix -Wnon-virtual-dtor compiler warnings.Tom Sepez
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
2015-01-07Finish unit test for CFX_ByteStringC class.Tom Sepez
This fixes a few cut-n-paste errors in the previous version, plus adds more corner cases. The implementation is fixed to handle a few of these that failed. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/808553013
2015-01-07Add ostream helpers for FX String classes.Tom Sepez
This allows integration with the gtest EXPECT_* macros. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/837843002
2015-01-05Clean up bookmark related codes.Bo Xu
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
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-12-19Update freetype to 2.5.4.Bo Xu
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
2014-12-17Cleanup: Pass by const reference in fpdftext.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/790213005
2014-12-12Simplify PDFium by removing code that's not used in the open source repo.John Abd-El-Malek
-remove parameter from FPDF_InitLibrary -remove a bunch of ifdefs that are unused R=tsepez@chromium.org Review URL: https://codereview.chromium.org/801913002
2014-12-08Replace manual/error-prone/hard-to-verify arraysize calculations with safe ↵Bruce Dawson
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
2014-12-08Getting rid of more (FX_LPCWSTR) casts and fixing two bugs revealed by this.Bruce Dawson
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
2014-11-18Fixing format strings to remove 'z' size specifier.Bruce Dawson
As of the 2013 version VC++ still doesn't support the 'z' size specifier. This makes portable printing of size_t types frustrating. The simplest general solution is to use %u and cast to unsigned. If there was any possibility of the numbers getting larger than 32-bit then we would need better alternatives, but there is not. This was found through code inspection, through /analyze, and through pdfium_test print this non-helpful message: Loaded, parsed and rendered zu pages. Skipped zu bad pages. I can confirm that the fix works on Windows and it should work identically on mac. This is a follow-on to change 02e6ca4c4f. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/738433003
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-10-21Add missing parenthesis in FXARGB_GETDIB macroBo Xu
You can get warning when using FXARGB_GETDIB() with & operation in the same statement like: FXARGB_GETDIB(src_scan) & 0xffffff in fx_dib_composite.cpp: ../../third_party/pdfium/core/src/fxge/dib/fx_dib_composite.cpp:737:205: error: '&' within '|' [-Werror,-Wbitwise-op-parentheses] Original patch from jiangj@opera.com R=thakis@chromium.org Review URL: https://codereview.chromium.org/578253002
2014-10-14Store the address of the page data map's value for proper referencing.Bo Xu
CPDF_Pattern objects are counted and maintained in m_PatternedMap. When a CPDF_Pattern object "pattern" is deleted, it's address is marked as NULL in m_PatternMap. This patch stores the address of CPDF_Pattern's adderss in all objects that references "pattern", to ensure valid referencing after deletion. BUG=416319, 419976, 418392 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/656753002
2014-10-13Fix off-by-one in sizing of m_EmbeddedToUnicodes.Tom Sepez
BUG=421196 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/656463006
2014-09-16When forcing clear page data, no need to release colorspace when releasing ↵Bo Xu
pattern BUG=414661 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/572853006
2014-09-09Change the forced clear order of CPDF_DocPageData::Clear, and remove ↵Bo Xu
m_pDocument in CPDF_Color If not forced clear, the counter of CPDF_Pattern will take care the count of referenced instance. When forced clear, clear color first to make sure pattern still exists when referencing it. BUG=411154 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/554913003
2014-09-09Fix uninitialized value in CPDF_ColorStateDataBo Xu
BUG=411161 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/560673002
2014-09-09Revert of Fix uninitialized value in CPDF_ColorStateData (patchset #1 id:1 ↵Bo Xu
of https://codereview.chromium.org/547863002/) Reason for revert: The initialized member variable is wrong. Needs to undo this. Original issue's description: > Fix uninitialized value in CPDF_ColorStateData > > BUG=411161 > R=tsepez@chromium.org > > Committed: https://pdfium.googlesource.com/pdfium/+/a38d4c3572b566f8e64b9ca4f725cbbc581e85ab TBR=tsepez@chromium.org,jun_fang@foxitsoftware.com NOTREECHECKS=true NOTRY=true BUG=411161 Review URL: https://codereview.chromium.org/558803004
2014-09-08Fix uninitialized value in CPDF_ColorStateDataBo Xu
BUG=411161 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/547863002
2014-09-02Add m_pDocument in CPDF_Color and check if page date has been forced clearBo Xu
This will prevent using freed pattern object. This is a better solution than https://pdfium.googlesource.com/pdfium/+/1b9c5c4dc41956b8c5ab17b9a882adf8a2513768 and in essence revert that patch BUG=409373 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/522483003
2014-08-25Use number of components from ICC profile and alternate color spaceBo Xu
BUG=406806 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/503883002
2014-08-25Revert of Use number of components from ICC profile and alternateCS ↵Bo Xu
(patchset #1 of https://codereview.chromium.org/493163003/) Reason for revert: Needs to address comments before landing Original issue's description: > Use number of components from ICC profile and alternate color space > > BUG=406806 > > Committed: https://pdfium.googlesource.com/pdfium/+/be83103 TBR=tsepez@chromium.org,jun_fang@foxitsoftware.com NOTREECHECKS=true NOTRY=true BUG=406806 Review URL: https://codereview.chromium.org/504883003
2014-08-25Use number of components from ICC profile and alternate color spaceBo Xu
BUG=406806 Review URL: https://codereview.chromium.org/493163003
2014-08-22Fix the issue 'SEGV on unknown address in CPDF_DataAvail::GetObjectSize'Jun Fang
BUG=387983 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/454283002
2014-08-18Font is used after release in CPDF_TextStateData::~CPDF_TextStateDataJun Fang
BUG=400996 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/477323002
2014-08-13Add FX_OVERRIDE and use it for virtual functions of FX_FINAL classes.Tom Sepez
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
2014-08-12Fix missing or broken include guard macros in pdfium headers.Tom Sepez
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
2014-08-07When normalize coordinate, return instead of assert() when divide by 0Bo Xu
BUG=382988 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/433293002
2014-08-05The root cause of this issue is shown as below:Jun Fang
Patterns are managed in CPDF_DocPageData. When a document is closed, all patterns will be released in the deconstruction of CPDF_DocPageData. However, some patterns which are referenced in CPDF_Color can't get the notification from the destroy of CPDF_DocPageData. It will cause use-after-free in CPDF_Color::~CPDF_Color. BUG=392719 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/439693002
2014-07-31Correct the names of the FX_SAFE_* typedefs.Chris Palmer
R=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/417263008
2014-07-30Fix the potential integer overflow from 'offset+size' in extension.h and ↵JUN FANG
fpdfview.cpp BUG=397258 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/419063002
2014-07-24CalRGB color correctionBo Xu
BUG=pdfium:19 R=thestig@chromium.org Review URL: https://codereview.chromium.org/403163002
2014-07-23Refactor CFX_BasicArray.chromium/2112chromium/2111chromium/2110chromium/2109chromium/2108chromium/2107chromium/2106chromium/2105chromium/2104Chris Palmer
The |nGrowBy| argument to |SetSize| was always -1, which caused the effective m_nGrowBy value to always be its default value: 0. So it was not needed, and was cluttering up the logic. BUG=384662 Check for integer overflow in CFX_BasicArray. BUG=384662 R=bo_xu@foxitsoftware.com, rsesek@chromium.org Review URL: https://codereview.chromium.org/415803002
2014-07-23Only use "final" on MSVS2012+, to keep pdfium building with 2010.Nico Weber
BUG=pdfium:26 TBR=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/418463002
2014-07-18pdfium: Fix all -Wdelete-non-virtual-dtor violations on Mac.Nico Weber
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
2014-07-14Add support to extract viewer preferenceBo Xu
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
2014-07-14Fix an out-of-boundary issue for wide stringBo Xu
BUG=381521 R=palmer@chromium.org Review URL: https://codereview.chromium.org/383563002
2014-07-09Fixes for re-enabling more MSVC level 4 warnings: pdfium/ edition (try 2)chromium/2095chromium/2094chromium/2093chromium/2092chromium/2091chromium/2090chromium/2089chromium/2088chromium/2087chromium/2086Lei Zhang
This contains fixes for the following sorts of issues: * Nonstandard extension: unnamed struct/union This also changes the signature of FPDF_FillRect() to enable the cleanest possible changes in https://codereview.chromium.org/372273005 . BUG=81439 TEST=none Original patch by Peter Kasting <pkasting@chromium.org> Original code review: https://codereview.chromium.org/376003003/ R=pkasting@chromium.org Review URL: https://codereview.chromium.org/377353002
2014-07-08Revert commit 95c018e2d15ecc3a5bd2a9aab18638316a6d3d46Lei Zhang
Fixes for re-enabling more MSVC level 4 warnings: pdfium/ edition BUG=81439 TBR=pkasting@chromium.org Review URL: https://codereview.chromium.org/376043003
2014-07-08Fixes for re-enabling more MSVC level 4 warnings: pdfium/ editionLei Zhang
This contains fixes for the following sorts of issues: * Nonstandard extension: unnamed struct/union This also changes the signature of FPDF_FillRect() to enable the cleanest possible changes in https://codereview.chromium.org/372273005 . BUG=81439 TEST=none Original patch by Peter Kasting <pkasting@chromium.org> Original code review: https://codereview.chromium.org/376003003/ R=pkasting@chromium.org Review URL: https://codereview.chromium.org/372383004
2014-07-08Remove custom memory managerBo Xu
BUG= R=palmer@chromium.org Review URL: https://codereview.chromium.org/372473003
2014-07-08Fix integer overflow in fx_basic_[bw]string.cpp.Chris Palmer
BUG=382601 R=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/336003004
2014-07-07fix a crash issue in _CMapLookupCallbackfoxit
BUG=382242 R=palmer@chromium.org Review URL: https://codereview.chromium.org/341333004
2014-07-07Integer overflow in fx_basic.h and fx_memory.hfoxit
BUG=382656 R=palmer@chromium.org Review URL: https://codereview.chromium.org/334573007
2014-06-30Remove "this==NULL" and adjust corresponding callersBo Xu
BUG= R=thakis@chromium.org Review URL: https://codereview.chromium.org/361553002
2014-06-20Stack-buffer-overflow in IccLib_Translatefoxit
BUG=382240 R=palmer@chromium.org Review URL: https://codereview.chromium.org/332143002
2014-06-12resolve symbol collsion with zlib 1.2.8Bo Xu
R=jam@chromium.org Review URL: https://codereview.chromium.org/330023004
2014-06-12Enable security removal in FPDF_Doc_SaveBo Xu
R=jam@chromium.org Review URL: https://codereview.chromium.org/333753002