summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfdoc.cpp
diff options
context:
space:
mode:
authorFelix Kauselmann <licorn@gmail.com>2017-08-09 21:44:31 +0200
committerChromium commit bot <commit-bot@chromium.org>2017-08-09 20:14:43 +0000
commit00334675c18a0203f313cceb670c970a77280f49 (patch)
tree431cc04539913358cedf9f1386b7dda0e3982562 /fpdfsdk/fpdfdoc.cpp
parentd0f2dcd0802969494e991d8cef00b4bd81aefc8d (diff)
downloadpdfium-00334675c18a0203f313cceb670c970a77280f49.tar.xz
Add a build target and a proper export header for shared library builds.
This CL adds support for Chromium's component build feature to pdfium. The export header stub in fpdfview.h is expanded to match Chromium's export mechanisms and patterns (fixes pdfium:825). A component/shared library build can be triggered by adding is_component_build = true as a gn argument. Please note that setting this will also affect some of pdfiums dependencies like v8, which will be build as components too. Additionally, this CL provides a "pdf_source_set" template which dynamically enables the use of "source_set" when building a complete static library or a shared library to reduce build time. When testing this it is recommended to only build the pdfium target as most of pdfiums test rely on non-public functions which aren't exported by the shared library. Bug: pdfium:825,pdfium:826 Change-Id: Icedc538ec535e11d1e53c4d5fabc8c064b275752 Reviewed-on: https://pdfium-review.googlesource.com/8970 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfdoc.cpp')
-rw-r--r--fpdfsdk/fpdfdoc.cpp113
1 files changed, 58 insertions, 55 deletions
diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp
index b6088604fd..8f81b3a840 100644
--- a/fpdfsdk/fpdfdoc.cpp
+++ b/fpdfsdk/fpdfdoc.cpp
@@ -62,7 +62,7 @@ CPDF_LinkList* GetLinkList(CPDF_Page* page) {
} // namespace
-DLLEXPORT FPDF_BOOKMARK STDCALL
+FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK pDict) {
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
@@ -73,7 +73,7 @@ FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK pDict) {
return tree.GetFirstChild(bookmark).GetDict();
}
-DLLEXPORT FPDF_BOOKMARK STDCALL
+FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK pDict) {
if (!pDict)
return nullptr;
@@ -86,9 +86,8 @@ FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK pDict) {
return tree.GetNextSibling(bookmark).GetDict();
}
-DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK pDict,
- void* buffer,
- unsigned long buflen) {
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFBookmark_GetTitle(FPDF_BOOKMARK pDict, void* buffer, unsigned long buflen) {
if (!pDict)
return 0;
CPDF_Bookmark bookmark(ToDictionary(static_cast<CPDF_Object*>(pDict)));
@@ -96,8 +95,8 @@ DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK pDict,
return Utf16EncodeMaybeCopyAndReturnLength(title, buffer, buflen);
}
-DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document,
- FPDF_WIDESTRING title) {
+FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
+FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title) {
if (!title || title[0] == 0)
return nullptr;
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
@@ -110,8 +109,8 @@ DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document,
return FindBookmark(tree, CPDF_Bookmark(), encodedTitle, &visited).GetDict();
}
-DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document,
- FPDF_BOOKMARK pDict) {
+FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFBookmark_GetDest(FPDF_DOCUMENT document,
+ FPDF_BOOKMARK pDict) {
if (!pDict)
return nullptr;
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
@@ -129,14 +128,15 @@ DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document,
return action.GetDest(pDoc).GetObject();
}
-DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK pDict) {
+FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV
+FPDFBookmark_GetAction(FPDF_BOOKMARK pDict) {
if (!pDict)
return nullptr;
CPDF_Bookmark bookmark(ToDictionary(static_cast<CPDF_Object*>(pDict)));
return bookmark.GetAction().GetDict();
}
-DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION pDict) {
+FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetType(FPDF_ACTION pDict) {
if (!pDict)
return PDFACTION_UNSUPPORTED;
@@ -156,8 +156,8 @@ DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION pDict) {
}
}
-DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document,
- FPDF_ACTION pDict) {
+FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFAction_GetDest(FPDF_DOCUMENT document,
+ FPDF_ACTION pDict) {
if (!pDict)
return nullptr;
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
@@ -167,9 +167,8 @@ DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document,
return action.GetDest(pDoc).GetObject();
}
-DLLEXPORT unsigned long STDCALL FPDFAction_GetFilePath(FPDF_ACTION pDict,
- void* buffer,
- unsigned long buflen) {
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAction_GetFilePath(FPDF_ACTION pDict, void* buffer, unsigned long buflen) {
unsigned long type = FPDFAction_GetType(pDict);
if (type != PDFACTION_REMOTEGOTO && type != PDFACTION_LAUNCH)
return 0;
@@ -182,10 +181,11 @@ DLLEXPORT unsigned long STDCALL FPDFAction_GetFilePath(FPDF_ACTION pDict,
return len;
}
-DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document,
- FPDF_ACTION pDict,
- void* buffer,
- unsigned long buflen) {
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAction_GetURIPath(FPDF_DOCUMENT document,
+ FPDF_ACTION pDict,
+ void* buffer,
+ unsigned long buflen) {
if (!pDict)
return 0;
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
@@ -199,8 +199,8 @@ DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document,
return len;
}
-DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document,
- FPDF_DEST pDict) {
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFDest_GetPageIndex(FPDF_DOCUMENT document, FPDF_DEST pDict) {
if (!pDict)
return 0;
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
@@ -210,13 +210,14 @@ DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document,
return dest.GetPageIndex(pDoc);
}
-DLLEXPORT FPDF_BOOL STDCALL FPDFDest_GetLocationInPage(FPDF_DEST pDict,
- FPDF_BOOL* hasXVal,
- FPDF_BOOL* hasYVal,
- FPDF_BOOL* hasZoomVal,
- FS_FLOAT* x,
- FS_FLOAT* y,
- FS_FLOAT* zoom) {
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFDest_GetLocationInPage(FPDF_DEST pDict,
+ FPDF_BOOL* hasXVal,
+ FPDF_BOOL* hasYVal,
+ FPDF_BOOL* hasZoomVal,
+ FS_FLOAT* x,
+ FS_FLOAT* y,
+ FS_FLOAT* zoom) {
if (!pDict)
return false;
@@ -235,9 +236,9 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFDest_GetLocationInPage(FPDF_DEST pDict,
return true;
}
-DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page,
- double x,
- double y) {
+FPDF_EXPORT FPDF_LINK FPDF_CALLCONV FPDFLink_GetLinkAtPoint(FPDF_PAGE page,
+ double x,
+ double y) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage)
return nullptr;
@@ -253,9 +254,9 @@ DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page,
.GetDict();
}
-DLLEXPORT int STDCALL FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page,
- double x,
- double y) {
+FPDF_EXPORT int FPDF_CALLCONV FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page,
+ double x,
+ double y) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage)
return -1;
@@ -271,8 +272,8 @@ DLLEXPORT int STDCALL FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page,
return z_order;
}
-DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document,
- FPDF_LINK pDict) {
+FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFLink_GetDest(FPDF_DOCUMENT document,
+ FPDF_LINK pDict) {
if (!pDict)
return nullptr;
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
@@ -289,7 +290,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document,
return action.GetDest(pDoc).GetObject();
}
-DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK pDict) {
+FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDFLink_GetAction(FPDF_LINK pDict) {
if (!pDict)
return nullptr;
@@ -297,9 +298,9 @@ DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK pDict) {
return link.GetAction().GetDict();
}
-DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page,
- int* startPos,
- FPDF_LINK* linkAnnot) {
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_Enumerate(FPDF_PAGE page,
+ int* startPos,
+ FPDF_LINK* linkAnnot) {
if (!startPos || !linkAnnot)
return false;
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
@@ -322,8 +323,8 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page,
return false;
}
-DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot,
- FS_RECTF* rect) {
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot,
+ FS_RECTF* rect) {
if (!linkAnnot || !rect)
return false;
CPDF_Dictionary* pAnnotDict =
@@ -336,7 +337,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot,
return true;
}
-DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot) {
+FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot) {
if (!linkAnnot)
return 0;
CPDF_Dictionary* pAnnotDict =
@@ -347,9 +348,10 @@ DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot) {
return static_cast<int>(pArray->GetCount() / 8);
}
-DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot,
- int quadIndex,
- FS_QUADPOINTSF* quadPoints) {
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot,
+ int quadIndex,
+ FS_QUADPOINTSF* quadPoints) {
if (!linkAnnot || !quadPoints)
return false;
CPDF_Dictionary* pAnnotDict =
@@ -375,10 +377,10 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot,
return true;
}
-DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT document,
- FPDF_BYTESTRING tag,
- void* buffer,
- unsigned long buflen) {
+FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetMetaText(FPDF_DOCUMENT document,
+ FPDF_BYTESTRING tag,
+ void* buffer,
+ unsigned long buflen) {
if (!tag)
return 0;
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
@@ -392,10 +394,11 @@ DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT document,
return Utf16EncodeMaybeCopyAndReturnLength(text, buffer, buflen);
}
-DLLEXPORT unsigned long STDCALL FPDF_GetPageLabel(FPDF_DOCUMENT document,
- int page_index,
- void* buffer,
- unsigned long buflen) {
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDF_GetPageLabel(FPDF_DOCUMENT document,
+ int page_index,
+ void* buffer,
+ unsigned long buflen) {
if (page_index < 0)
return 0;