diff options
author | Jane Liu <janeliulwq@google.com> | 2017-06-26 11:28:36 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-06-27 18:13:48 +0000 |
commit | d60e9ad5194e13475ccb21575a7c57de1e2e22c4 (patch) | |
tree | 040f7bcade94671b71e5148f716e18416cd06558 /public | |
parent | 22eb7ae54e4351f70a5a01b0130c8b0dc713586c (diff) | |
download | pdfium-d60e9ad5194e13475ccb21575a7c57de1e2e22c4.tar.xz |
Changed the return type for annotation APIs
Before:
When returning FPDF_ANNOTATION, the APIs would take in a
FPDF_ANNTOATION* and write the handle of the annotation to it, while
returning a boolean as status.
This CL:
This CL changes the APIs to directly return FPDF_ANNOTATION, which
would be null on failure.
Also adds more null checks within the annotation APIs.
Bug=pdfium:737
Change-Id: I4f77dd1b16d43eab3f16c303598b76591da0dcab
Reviewed-on: https://pdfium-review.googlesource.com/6952
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Jane Liu <janeliulwq@google.com>
Diffstat (limited to 'public')
-rw-r--r-- | public/fpdf_annot.h | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/public/fpdf_annot.h b/public/fpdf_annot.h index bd18898695..0a1646fd5c 100644 --- a/public/fpdf_annot.h +++ b/public/fpdf_annot.h @@ -71,13 +71,10 @@ FPDFAnnot_IsSupportedSubtype(FPDF_ANNOTATION_SUBTYPE subtype); // // page - handle to a page. // subtype - the subtype of the new annotation. -// annot - receives the newly created annotation. // -// Returns true if successful, false otherwise. -DLLEXPORT FPDF_BOOL STDCALL -FPDFPage_CreateAnnot(FPDF_PAGE page, - FPDF_ANNOTATION_SUBTYPE subtype, - FPDF_ANNOTATION* annot); +// Returns a handle to the new annotation object, or NULL on failure. +DLLEXPORT FPDF_ANNOTATION STDCALL +FPDFPage_CreateAnnot(FPDF_PAGE page, FPDF_ANNOTATION_SUBTYPE subtype); // Get the number of annotations in |page|. // @@ -90,12 +87,9 @@ DLLEXPORT int STDCALL FPDFPage_GetAnnotCount(FPDF_PAGE page); // // page - handle to a page. // index - the index of the annotation. -// annot - receives the annotation. // -// Returns true if successful, false otherwise. -DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetAnnot(FPDF_PAGE page, - int index, - FPDF_ANNOTATION* annot); +// Returns a handle to the annotation object, or NULL on failure. +DLLEXPORT FPDF_ANNOTATION STDCALL FPDFPage_GetAnnot(FPDF_PAGE page, int index); // Close an annotation. Must be called when the annotation returned by // FPDFPage_CreateAnnot() or FPDFPage_GetAnnot() is no longer needed. This @@ -169,12 +163,10 @@ FPDFAnnot_SetAttachmentPoints(FPDF_ANNOTATION annot, FS_QUADPOINTSF quadPoints); // Get the attachment points (i.e. quadpoints) of an annotation. // // annot - handle to an annotation. -// quadPoints - receives the attachment points. // -// Returns true if successful, false otherwise. -DLLEXPORT FPDF_BOOL STDCALL -FPDFAnnot_GetAttachmentPoints(FPDF_ANNOTATION annot, - FS_QUADPOINTSF* quadPoints); +// Returns a quadpoints object, or an empty set of quadpoints on failure. +DLLEXPORT FS_QUADPOINTSF STDCALL +FPDFAnnot_GetAttachmentPoints(FPDF_ANNOTATION annot); // Set the annotation rectangle defining the location of the annotation. // @@ -188,11 +180,9 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFAnnot_SetRect(FPDF_ANNOTATION annot, // Get the annotation rectangle defining the location of the annotation. // // annot - handle to an annotation. -// rect - receives the annotation rectangle. // -// Returns true if successful, false otherwise. -DLLEXPORT FPDF_BOOL STDCALL FPDFAnnot_GetRect(FPDF_ANNOTATION annot, - FS_RECTF* rect); +// Returns a rectangle object, or an empty rectangle on failure. +DLLEXPORT FS_RECTF STDCALL FPDFAnnot_GetRect(FPDF_ANNOTATION annot); // Set the contents of an annotation. // |