summaryrefslogtreecommitdiff
path: root/core/fpdfapi
AgeCommit message (Collapse)Author
2017-08-28Unify CPDF_DataAvail::CheckTrailer.Artem Strygin
Use read validator to check trailer availability Change-Id: Id8c62a6c746f136c05cfa8d646268322e2543b52 Reviewed-on: https://pdfium-review.googlesource.com/11770 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-28Unify CPDF_DataAvail::LoadAllFile.chromium/3199Artem Strygin
Use read validator to check whole file availability. Change-Id: Ic118ccee38557d124ecde3893ee3c18c98c674d5 Reviewed-on: https://pdfium-review.googlesource.com/11712 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-28Unify CPDF_DataAvail::CheckCrossRef.Artem Strygin
Use read validator to check cross ref table availability Change-Id: I050c366a255598ca6d8bcd353afa94c4a09c33a9 Reviewed-on: https://pdfium-review.googlesource.com/11730 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-28Add a nullptr check in ReplaceIndirectObjectIfHigherGeneration().Lei Zhang
Avoid pushing nullptrs into the orphans list. Change-Id: I2d52c83e6f20e89be101365d3cca0960b4941a4f Reviewed-on: https://pdfium-review.googlesource.com/12190 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-28Move replaced indirect objects to the orphans list.Lei Zhang
ReplaceIndirectObjectIfHigherGeneration() deletes replaced objects, but those objects may be in use. So move them to the orphans list instead to avoid potential dangling pointers. BUG=chromium:757705 Change-Id: Ide83a1b85b754166d298fd50e655ca331ba4f942 Reviewed-on: https://pdfium-review.googlesource.com/11670 Reviewed-by: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-28Unify CPDF_SyntaxParser::GetObjectXXX methods.Artem Strygin
Merge CPDF_SyntaxParser::GetObject and CPDF_SyntaxParser::GetObjectForStrict. Change-Id: Ic9ff51e24ee981c268239847e3cca1c6f6a6f269 Reviewed-on: https://pdfium-review.googlesource.com/10511 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-23Convert string Find methods to return an OptionalRyan Harrison
The Find and ReverseFind methods for WideString, WideStringC, ByteString, and ByteStringC have been converted from returning a raw FX_STRSIZE, to returning Optional<FX_STRSIZE>, so that success/failure can be indicated without using FX_STRNPOS. This allows for removing FX_STRNPOS and by association makes the conversion of FX_STRSIZE to size_t easier, since it forces checking the return value of Find to be explictly done as well as taking the error value out of the range of FX_STRSIZE. New Contains methods have been added for cases where the success or failure is all the call site to Find cared about, and the actual position was ignored. BUG=pdfium:828 Change-Id: Id827e508c8660affa68cc08a13d96121369364b7 Reviewed-on: https://pdfium-review.googlesource.com/11350 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-23Remove useless code.Artem Strygin
Change-Id: Ie1fa04cdcdd426cf76413e7e5fe714ba7922458c Reviewed-on: https://pdfium-review.googlesource.com/11713 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-23Unify CPDF_DataAvail::CheckEnd.Artem Strygin
Use read validator to check "startxref" availability. Change-Id: I258a707e4269fe768898d74db0955302b34ccf34 Reviewed-on: https://pdfium-review.googlesource.com/11711 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-23Unify CPDF_DataAvail::CheckHeader.Artem Strygin
Use read validator to check header availability. Change-Id: Ib482347cb2f112e27a6bcc4e8da865d0ecf1a630 Reviewed-on: https://pdfium-review.googlesource.com/11710 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-23Simplify Trailers usage in CPDF_Parser.Artem Strygin
Do not store non main trailers in memory. Improve readability. Change-Id: I2eab5d31a5be056871e7e5953e4b38662b91f5ae Reviewed-on: https://pdfium-review.googlesource.com/10750 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-23Verify image returned from AddImageDan Sinclair
The ::AddImage call can return a nullptr if there is no stream provided. This CL adds the missing null check on the returned object when lookikng at the image. Bug: chromium:756418, chromium:753700 Change-Id: I48032c0f421c8889827540ae91f404ef0f503bfe Reviewed-on: https://pdfium-review.googlesource.com/11532 Reviewed-by: Rebekah Potter <rbpotter@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-22Converted CFX_Matrix::TransformRect() to take in constsJane Liu
Currently, all three of CFX_Matrix::TransformRect() take in rect values and modify them in place. This CL converts them to take in constant values and return the transformed values instead, and fixes all the call sites. Bug=pdfium:874 Change-Id: I9c274df3b14e9d88c100ba0530068e06e8fec32b Reviewed-on: https://pdfium-review.googlesource.com/11550 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-08-21Unify cross ref item check.chromium/3193Artem Strygin
Change-Id: I7c68d0f5a668019d23bbeebc66373f9b245f91a2 Reviewed-on: https://pdfium-review.googlesource.com/9551 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-08-21Remove useless code.Artem Strygin
Change-Id: Idd656dcf372c0b8ed515a4e0635b5098c0781d76 Reviewed-on: https://pdfium-review.googlesource.com/10991 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-21Converted CFX_FloatRect::{Init|Update}Rect() to take point objectsJane Liu
Converted CFX_FloatRect::Init() and CFX_FloatRect::UpdateRect() to take in a CFX_PointF object instead of two coordinates. Bug=pdfium:770 Change-Id: Ibcb620f192d6c086158c39f23c411777286005d0 Reviewed-on: https://pdfium-review.googlesource.com/11450 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-17Fix some issues with individual image mask renderingrbpotter
Re-enable individual image mask rendering to improve spool sizes, with bug fixes and improvements: - Fix bug with missing images by ensuring all masks are recorded - Fix printing to landscape paper sizes - Improve spool sizes by processing the location of the masks in the progressive renderer when rendering to the printer instead of needlessly fully rendering them (they will be rendered as bitmaps anyway). Bug: chromium:753700 Change-Id: I86bdcce9f10855274c56ba2ddae2c2522b36426d Reviewed-on: https://pdfium-review.googlesource.com/11115 Commit-Queue: Rebekah Potter <rbpotter@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-08-16Fix potential OOM / integer overflow in CPDF_Parser.Lei Zhang
The count passed into ParseAndAppendCrossRefSubsectionData() may be invalid. BUG=chromium:752796 Change-Id: Ic7bbfd16761d1df0855e6c77e4abc68823b12395 Reviewed-on: https://pdfium-review.googlesource.com/11130 Reviewed-by: Art Snake <art-snake@yandex-team.ru> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-16API and test for retrieving metadata from image objectsJane Liu
Added FPDFImageObj_GetImageMetadata() for retriving the image metadata of image objects, including its dimension, DPI, bits per pixel, and colorspace. * Added a corresponding embedder test. Bug=pdfium:677 Change-Id: I4229334d1ac2125b21a46e2e44ea937ea2e94b51 Reviewed-on: https://pdfium-review.googlesource.com/10110 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-08-15Remove useless code.Artem Strygin
Change-Id: I2c5ea6a0c4487c0200229f4709214bda1f287de8 Reviewed-on: https://pdfium-review.googlesource.com/10990 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-15Remove GetAt from string classesRyan Harrison
This method duplicates the behaviour of the const [] operator and doesn't offer any additional safety. Folding them into one implementation. SetAt is retained, since implementing the non-const [] operator to replace SetAt has potential performance concerns. Specifically many non-obvious cases of reading an element using [] will cause a realloc & copy. BUG=pdfium:860 Change-Id: I3ef5e5e5a15376f040256b646eb0d90636e24b67 Reviewed-on: https://pdfium-review.googlesource.com/10870 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-14Refactoring of CPDF_DataAvail::GetObject.Artem Strygin
Use ReadValidator to request exact data on object read. Change-Id: I1d1863097fa2b037e1bb2e4e89b93d26c5d8e066 Reviewed-on: https://pdfium-review.googlesource.com/10510 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-14Add CPDF_ObjectWalker.Artem Strygin
It is allow us to walk on all non-null sub-objects in an object in depth, include itself, Change-Id: Ia23051073984411668112422b47cf7a4460aa078 Reviewed-on: https://pdfium-review.googlesource.com/8910 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-14Refactoring of CPDF_DataAvail::AreObjectsAvailable.chromium/3186Artem Strygin
Use ReadValidator to request exact data on object read. Change-Id: Ie6c3f452e119fa3514e77f1824473c33bb6b855a Reviewed-on: https://pdfium-review.googlesource.com/10491 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-11Add checks of index operations on string classesRyan Harrison
Specifically the index parameter passed in to GetAt(), SetAt() and operator[] are now being tested to be in bounds. BUG=chromium:752480, pdfium:828 Change-Id: I9e94d58c98a8eaaaae53cd0e3ffe2123ea17d8c4 Reviewed-on: https://pdfium-review.googlesource.com/10651 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-10Move graphic state operations outside BT/ET operationsRyan Wiley
Bug: pdfium:857 Change-Id: Ic1fb12459cad79b45466df10a24fe6743377ae14 Reviewed-on: https://pdfium-review.googlesource.com/10612 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-08-09Add a FPDF_GetFileVersion() test for a linearized document.Lei Zhang
Change the CPDFParserEmbeddertest.Feature_Linearized_Loading test case into FPDFViewEmbeddertest.LinearizedDocument, and add a call to FPDF_GetFileVersion(). Change-Id: I0272c1e71c6f61393838bd3db41b154c4f5620ba Reviewed-on: https://pdfium-review.googlesource.com/10450 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-09Remove useless code.Artem Strygin
The CPDF_Parser::IsVersionUpdated is not used anymore. Change-Id: I896c42daca3c5bed7b9d700eaea6ced686ab5acb Reviewed-on: https://pdfium-review.googlesource.com/10490 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-09Unify initialization of CPDF_Parser.Artem Strygin
Move syntax parser initialization in separate method. Change-Id: I701284b1fee26a474c24ca68948a3462cc68faec Reviewed-on: https://pdfium-review.googlesource.com/10291 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-08-09Unify of saving documents.chromium/3181Artem Strygin
In the original code the method of writing of objects depends on a much unpredictable factors: as: 1) Is there an updated version of the at least one object in the document. 2) The password is changed. 3) Was this object loaded earlier. 4) The Object is compressed and document have a password. With these factors it is difficult to predict what will be the final file. To reduce volatility use only one method that works in all cases mentioned. This method is parse then serialize. Change-Id: I3d7dcadd10abffbad68d1f993f2dd60b039ed989 Reviewed-on: https://pdfium-review.googlesource.com/9572 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-09Unify CPDF_Parser::ParseIndirectObjectAtXXX methods.Artem Strygin
Change-Id: I9ee1da4d0a9751dae8d595b610cf77c074c22cdc Reviewed-on: https://pdfium-review.googlesource.com/10350 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-08-08Add validator into CPDF_SyntaxParser.Artem Strygin
Change-Id: I7fe8dcd8854e2f08b7b0ee53bde6c864108142ff Reviewed-on: https://pdfium-review.googlesource.com/9571 Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-08-04Remove CFX_ByteTextBuf from cpdfsdk_interform.cpp and others.chromium/3177Henrique Nakashima
New version of the CL that include fpdf_parser_utility.cpp where there is an overload for CFX_ByteTextBuf << CPDF_Object* used by CFDF_Document. Bug: pdfium:731 Change-Id: I54f4e9ee7e10e94388f6f6584f3999f43689e84c Reviewed-on: https://pdfium-review.googlesource.com/10170 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-08-04Revert "Remove CFX_ByteTextBuf from cpdfsdk_interform.cpp and others."Henrique Nakashima
This reverts commit aea80dcc0abc0c310316fa502f91a359bc684758. Reason for revert: WriteBuf's behavior was altered Original change's description: > Remove CFX_ByteTextBuf from cpdfsdk_interform.cpp and others. > > Bug: pdfium:731 > Change-Id: I61d38ab3f2b0ac68b8479ade25bab50f3a73c27b > Reviewed-on: https://pdfium-review.googlesource.com/9770 > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> TBR=tsepez@chromium.org,hnakashima@chromium.org,rharrison@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: pdfium:731 Change-Id: Ic66a2641c259173fb3792f7a4206e19ee4707fc9 Reviewed-on: https://pdfium-review.googlesource.com/10150 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-08-03APIs and tests for retrieving raw/decoded data from image objectsJane Liu
Added FPDFImageObj_GetImageDataDecoded() for retrieving the uncompressed data of an image, and FPDFImageObj_GetImageDataRaw() for retrieving the raw data of an image. * Refactored out DecodeStreamMaybeCopyAndReturnLength(), which is used to decode both attachment data and image data. * Within DecodeStreamMaybeCopyAndReturnLength(), used a different decoder function which takes care of multiple filters if exist. As a result, CPDF_StreamParser::DecodeInlineStream() which was made static previously is now moved back into namespace. Bug=pdfium:677 Change-Id: I22a22c99acaca98ef8c15f88911f2646a2c854d5 Reviewed-on: https://pdfium-review.googlesource.com/9811 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-08-03Remove CPDF_Array::Truncate().chromium/3176Lei Zhang
The only non-test caller is gone. Change-Id: I261bc6d97c3047b2935d7b663c1a5f7d15670714 Reviewed-on: https://pdfium-review.googlesource.com/10010 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-03Do not truncate the filter array in PDF_DataDecode().Lei Zhang
It is not needed to fix https://crbug.com/552046 and it causes different bug. BUG=chromium:750993 Change-Id: I11627045bd3e73fb439884c3362ab1c26eb95fe3 Reviewed-on: https://pdfium-review.googlesource.com/9990 Reviewed-by: Oliver Chang <ochang@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-03Avoid a redundant header offset check in CPDF_Parser.Lei Zhang
CPDF_Parser::StartLinearizedParse() calls StartParse(), but already knows the PDF header offset. Refactor StartParse() so it does not have to look for the header again. Change-Id: Id8cc39301ae72da868dafc53921622d5b28ce26e Reviewed-on: https://pdfium-review.googlesource.com/9830 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Art Snake <art-snake@yandex-team.ru>
2017-08-02Replace CFX_ByteTextBuf from cpdf_security_handler.cpp with std::vectorHenrique Nakashima
Bug: pdfium:731 Change-Id: I63532e06aa2c135f34a6adda24ae1cfbc5922ac9 Reviewed-on: https://pdfium-review.googlesource.com/9871 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-08-02Unify parsing of cross refs v4Artem Strygin
Change-Id: I7e3d45263a0bae61fd86fd4c3710de7fc0b9347d Reviewed-on: https://pdfium-review.googlesource.com/9290 Reviewed-by: Wei Li <weili@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-08-02Rewrite how string Insert() methods handle out of bound indicesRyan Harrison
The existing behaviour was to clamp the provided index to the valid bounds. This would lead to programming errors being hidden, since inserting would still do something even if the index calculation was wrong. The behaviour of these methods has been changed to instead early return when this occurs, returning the old length value. The caller can check if the call to Insert actually did anything by comparing the returned value to the length before calling insert. All of the existing calls to Insert have been tested by running all of the tests with asserts in the Insert method to check the index is in bounds. Additionally the call sites have been manually inspected. The majority of them are of the form Insert(0, foo) and the rest tend to be in a loop advancing from 0 to length. Convenience methods InsertAtFront/InsertAtBack have been added to handle calling Insert when the intent is for the character to be added to the beginning or end of the string. Existing call sites to Insert that do this have been converted. This work was originally being performed to check if there would be any issues in these methods with making FX_STRSIZE unsigned. BUG=pdfium:828 Change-Id: I60cee5ad45338aa8ed46569de7bcc78a76db18f7 Reviewed-on: https://pdfium-review.googlesource.com/9870 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-02Pass a CPDF_ImageObject* into CPDF_ImageRenderer::Start().Lei Zhang
Instead of passing in a CPDF_PageObject* and then converting it to an image, which is always what it is. Change-Id: I146a476147f4b344417982b5ace002b9bd7b3d80 Reviewed-on: https://pdfium-review.googlesource.com/9810 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-02Remove unused CPDF_FlateEncoder ctor.Lei Zhang
Callers removed in commit 4b78b18. Change-Id: I6eec6ba18712040180b12d56b59c6a8379de4379 Reviewed-on: https://pdfium-review.googlesource.com/9750 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-02Remove CFX_ByteTextBuf from cpdfsdk_interform.cpp and others.Henrique Nakashima
Bug: pdfium:731 Change-Id: I61d38ab3f2b0ac68b8479ade25bab50f3a73c27b Reviewed-on: https://pdfium-review.googlesource.com/9770 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-08-01Add public access for read stream into CPDF_SyntaxParserArtem Strygin
Change-Id: I5deb6049db41387ac030a6ba5296ee6187120190 Reviewed-on: https://pdfium-review.googlesource.com/9470 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-08-01Improve readability in CPDF_Parser::ObjectInfo.Artem Strygin
Make CPDF_Parser::ObjectInfo::pos a union, since the data is used as an object number when the object is compressed. Change-Id: Id7c32759f7411cc80285bb7f3088b5aa6ff5bf05 Reviewed-on: https://pdfium-review.googlesource.com/9570 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-08-01Implement read Session.Artem Strygin
Helper for validate read problems locally, Change-Id: I2bfbbaab8a67c0fd0cee3dadcd0f9cad5953101c Reviewed-on: https://pdfium-review.googlesource.com/9552 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-08-01Change CPDF_Parser::GetIndirectBinary() to return a std::vector.Lei Zhang
Fixes potential leaks in CPDF_Creator::WriteOldIndirectObject(), the only caller. Change-Id: I8a20da8a555c8d28f3bcd467a193a6a81c9f91d9 Reviewed-on: https://pdfium-review.googlesource.com/9751 Reviewed-by: Art Snake <art-snake@yandex-team.ru> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-01Remove support for negative params to ReleaseBuffer()Ryan Harrison
This CL removes the default param value for this method, which was negative. It also adds in a method to get buffer lengths, so that the callsites can explictly passing in the length of the buffer if they were using the default value previously. BUG=pdfium:828 Change-Id: I0170771ee81970b8b601631015ab3e6e39fea8ea Reviewed-on: https://pdfium-review.googlesource.com/9790 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-08-01Replace raw value for constant error value in string operationsRyan Harrison
Currently Find() and other methods that return a FX_STRSIZE return -1 to indicate error/failure. This means that there is a lot of magic numbers and magic checks floating around. The standard library for similar operations uses a npos constant. This CL implements FX_STRNPOS, and replaces usages of magic number checking. It also does some type cleanup along the way where it was obvious that FX_STRSIZE should be being used. Removing the magic numbers should make eventually changing FX_STRSIZE to be unsigned easier in the future. BUG=pdfium:828 Change-Id: I67e481e44cf2f75a1698afa8fbee4f375a74c490 Reviewed-on: https://pdfium-review.googlesource.com/9651 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>