Tidy XFA public interfaces.
XFA is still experimental, so small changes to interfaces are allowed.
-- Replace typedefs with underlying types.
-- Remove leading underscores.
-- Fix spelling of |respone|.
-- Remove completely unused FPDF_ERROR and FPDF_LPCBYTE types, but
leave FPDF_RESULT for the present time.
Change-Id: I8306b07f529c509eaed8a907a6e522d8352028a3
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/63590
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index 07da61a..b2734cc 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -497,7 +497,7 @@
return nullptr;
ByteString bstrURL = url.ToUTF16LE();
- FPDF_LPFILEHANDLER fileHandler =
+ FPDF_FILEHANDLER* fileHandler =
m_pInfo->FFI_DownloadFromURL(m_pInfo, AsFPDFWideString(&bstrURL));
return MakeSeekableStream(fileHandler);
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index 40e13b8..c25d4d1 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -1110,7 +1110,7 @@
}
FPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Set(FPDF_BSTR* bstr,
- FPDF_LPCSTR cstr,
+ const char* cstr,
int length) {
if (!bstr || !cstr)
return -1;
diff --git a/public/fpdf_formfill.h b/public/fpdf_formfill.h
index 5fdb047..99db580 100644
--- a/public/fpdf_formfill.h
+++ b/public/fpdf_formfill.h
@@ -1021,8 +1021,8 @@
* Return value:
* The handle to FPDF_FILEHANDLER.
**/
- FPDF_LPFILEHANDLER (*FFI_DownloadFromURL)(struct _FPDF_FORMFILLINFO* pThis,
- FPDF_WIDESTRING URL);
+ FPDF_FILEHANDLER* (*FFI_DownloadFromURL)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_WIDESTRING URL);
/**
* Method: FFI_PostRequestURL
* This method will post the request to the server URL.
@@ -1045,12 +1045,12 @@
* TRUE indicates success, otherwise FALSE.
**/
FPDF_BOOL (*FFI_PostRequestURL)(struct _FPDF_FORMFILLINFO* pThis,
- FPDF_WIDESTRING wsURL,
- FPDF_WIDESTRING wsData,
- FPDF_WIDESTRING wsContentType,
- FPDF_WIDESTRING wsEncode,
- FPDF_WIDESTRING wsHeader,
- FPDF_BSTR* respone);
+ FPDF_WIDESTRING wsURL,
+ FPDF_WIDESTRING wsData,
+ FPDF_WIDESTRING wsContentType,
+ FPDF_WIDESTRING wsEncode,
+ FPDF_WIDESTRING wsHeader,
+ FPDF_BSTR* response);
/**
* Method: FFI_PutRequestURL
diff --git a/public/fpdfview.h b/public/fpdfview.h
index e3eb65e..ef1d0e0 100644
--- a/public/fpdfview.h
+++ b/public/fpdfview.h
@@ -75,17 +75,10 @@
// Basic data types
typedef int FPDF_BOOL;
-typedef int FPDF_ERROR;
+typedef int FPDF_RESULT;
typedef unsigned long FPDF_DWORD;
typedef float FS_FLOAT;
-#ifdef PDF_ENABLE_XFA
-typedef void* FPDF_LPVOID;
-typedef void const* FPDF_LPCVOID;
-typedef char const* FPDF_LPCSTR;
-typedef int FPDF_RESULT;
-#endif
-
// Duplex types
typedef enum _FPDF_DUPLEXTYPE_ {
DuplexUndefined = 0,
@@ -96,7 +89,6 @@
// String types
typedef unsigned short FPDF_WCHAR;
-typedef unsigned char const* FPDF_LPCBYTE;
// FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE
// encoded), and platform dependent string
@@ -110,7 +102,7 @@
// Structure for persisting a string beyond the duration of a callback.
// Note: although represented as a char*, string may be interpreted as
// a UTF-16LE formated string.
-typedef struct _FPDF_BSTR {
+typedef struct FPDF_BSTR_ {
char* str; // String buffer, manipulate only with FPDF_BStr_* methods.
int len; // Length of the string, in bytes.
} FPDF_BSTR;
@@ -403,12 +395,12 @@
*
* @note This is a handler and should be implemented by callers.
*/
-typedef struct _FPDF_FILEHANDLER {
+typedef struct FPDF_FILEHANDLER_ {
/**
* @brief User-defined data.
* @note Callers can use this field to track controls.
*/
- FPDF_LPVOID clientData;
+ void* clientData;
/**
* @brief Callback function to release the current file stream object.
*
@@ -416,7 +408,7 @@
*
* @return None.
*/
- void (*Release)(FPDF_LPVOID clientData);
+ void (*Release)(void* clientData);
/**
* @brief Callback function to retrieve the current file stream size.
*
@@ -424,7 +416,7 @@
*
* @return Size of file stream.
*/
- FPDF_DWORD (*GetSize)(FPDF_LPVOID clientData);
+ FPDF_DWORD (*GetSize)(void* clientData);
/**
* @brief Callback function to read data from the current file stream.
*
@@ -439,9 +431,9 @@
*
* @return 0 for success, other value for failure.
*/
- FPDF_RESULT (*ReadBlock)(FPDF_LPVOID clientData,
+ FPDF_RESULT (*ReadBlock)(void* clientData,
FPDF_DWORD offset,
- FPDF_LPVOID buffer,
+ void* buffer,
FPDF_DWORD size);
/**
* @brief Callback function to write data into the current file stream.
@@ -456,9 +448,9 @@
*
* @return 0 for success, other value for failure.
*/
- FPDF_RESULT (*WriteBlock)(FPDF_LPVOID clientData,
+ FPDF_RESULT (*WriteBlock)(void* clientData,
FPDF_DWORD offset,
- FPDF_LPCVOID buffer,
+ const void* buffer,
FPDF_DWORD size);
/**
* @brief Callback function to flush all internal accessing buffers.
@@ -467,7 +459,7 @@
*
* @return 0 for success, other value for failure.
*/
- FPDF_RESULT (*Flush)(FPDF_LPVOID clientData);
+ FPDF_RESULT (*Flush)(void* clientData);
/**
* @brief Callback function to change file size.
*
@@ -479,8 +471,8 @@
*
* @return 0 for success, other value for failure.
*/
- FPDF_RESULT (*Truncate)(FPDF_LPVOID clientData, FPDF_DWORD size);
-} FPDF_FILEHANDLER, *FPDF_LPFILEHANDLER;
+ FPDF_RESULT (*Truncate)(void* clientData, FPDF_DWORD size);
+} FPDF_FILEHANDLER;
#endif // PDF_ENABLE_XFA
@@ -1251,7 +1243,7 @@
// Function: FPDF_BStr_Set
// Helper function to copy string data into the FPDF_BSTR.
FPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Set(FPDF_BSTR* bstr,
- FPDF_LPCSTR cstr,
+ const char* cstr,
int length);
// Function: FPDF_BStr_Clear