From 0c6b07d3fdbbabda8753e6457f4323237fc5be30 Mon Sep 17 00:00:00 2001 From: Jane Liu Date: Tue, 15 Aug 2017 10:50:22 -0400 Subject: Changed the return type of FPDFAnnot_Get{Rect|AttachmentPoints}() Instead of returning structs, changed FPDFAnnot_GetRect() and FPDFAnnot_GetAttachmentPoints() to return a bool and take a struct as an out parameter. Change-Id: I380e76eb1566b2488150fb31e9dad564a3ee10d4 Reviewed-on: https://pdfium-review.googlesource.com/10470 Reviewed-by: Lei Zhang Commit-Queue: Jane Liu --- samples/pdfium_test.cc | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'samples') diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc index f8096abc50..31235f0eff 100644 --- a/samples/pdfium_test.cc +++ b/samples/pdfium_test.cc @@ -416,18 +416,26 @@ void WriteAnnot(FPDF_PAGE page, const char* pdf_name, int num) { // Retrieve the annotation's quadpoints if it is a markup annotation. if (FPDFAnnot_HasAttachmentPoints(annot)) { - FS_QUADPOINTSF quadpoints = FPDFAnnot_GetAttachmentPoints(annot); - fprintf(fp, - "Quadpoints: (%.3f, %.3f), (%.3f, %.3f), (%.3f, %.3f), (%.3f, " - "%.3f)\n", - quadpoints.x1, quadpoints.y1, quadpoints.x2, quadpoints.y2, - quadpoints.x3, quadpoints.y3, quadpoints.x4, quadpoints.y4); + FS_QUADPOINTSF quadpoints; + if (FPDFAnnot_GetAttachmentPoints(annot, &quadpoints)) { + fprintf(fp, + "Quadpoints: (%.3f, %.3f), (%.3f, %.3f), (%.3f, %.3f), (%.3f, " + "%.3f)\n", + quadpoints.x1, quadpoints.y1, quadpoints.x2, quadpoints.y2, + quadpoints.x3, quadpoints.y3, quadpoints.x4, quadpoints.y4); + } else { + fprintf(fp, "Failed to retrieve quadpoints.\n"); + } } // Retrieve the annotation's rectangle coordinates. - FS_RECTF rect = FPDFAnnot_GetRect(annot); - fprintf(fp, "Rectangle: l - %.3f, b - %.3f, r - %.3f, t - %.3f\n\n", - rect.left, rect.bottom, rect.right, rect.top); + FS_RECTF rect; + if (FPDFAnnot_GetRect(annot, &rect)) { + fprintf(fp, "Rectangle: l - %.3f, b - %.3f, r - %.3f, t - %.3f\n\n", + rect.left, rect.bottom, rect.right, rect.top); + } else { + fprintf(fp, "Failed to retrieve annotation rectangle.\n"); + } FPDFPage_CloseAnnot(annot); } -- cgit v1.2.3