diff options
author | Bo Xu <bo_xu@foxitsoftware.com> | 2015-01-21 14:20:28 -0800 |
---|---|---|
committer | Bo Xu <bo_xu@foxitsoftware.com> | 2015-01-21 14:24:36 -0800 |
commit | 70ad112e874cd076144cc1254db254ee651b5c81 (patch) | |
tree | c459b44c000bd60cd16c66dd18f46f7ccdada1da /fpdfsdk | |
parent | a6f95eb2eb735e593f201a3ff9daad77c765cce0 (diff) | |
download | pdfium-70ad112e874cd076144cc1254db254ee651b5c81.tar.xz |
Merge to XFA: Use signed long for FPDF_GetNamedDest buffer length.
Need to have return value -1 indicating insufficient buffer.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/862163002
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/include/fpdfview.h | 14 | ||||
-rw-r--r-- | fpdfsdk/src/fpdfview.cpp | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/fpdfsdk/include/fpdfview.h b/fpdfsdk/include/fpdfview.h index 2ae1d1f5b9..d99826350d 100644 --- a/fpdfsdk/include/fpdfview.h +++ b/fpdfsdk/include/fpdfview.h @@ -741,19 +741,19 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,FPDF_ // Function: FPDF_GetNamedDest // Get the specified named destinations of the PDF document by index. // Parameters: -// document - Handle to a document -// index - The index of named destination. -// buffer - The buffer to obtain destination name, used as wchar_t*. -// buflen - The length of the buffer in byte. +// document - Handle to a document +// index - The index of named destination. +// buffer - The buffer to obtain destination name, used as wchar_t*. +// buflen [in/out] - Size of the buffer in bytes on input, length of the result in bytes on output or -1 if the buffer is too small. // Return value: -// The destination handle of a named destination, NULL when retrieving the length. +// The destination handle of a named destination, or NULL if no named destination corresponding to |index|. // Comments: // Call this function twice to get the name of the named destination: // 1) First time pass in |buffer| as NULL and get buflen. // 2) Second time pass in allocated |buffer| and buflen to retrieve |buffer|, which should be used as wchar_t*. -// If buflen is not sufficiently large, it will be returned as -1. +// If buflen is not sufficiently large, it will be set to -1 upon return. // -DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, int index, void* buffer, unsigned long& buflen); +DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, int index, void* buffer, long& buflen); // Function: FPDF_BStr_Init // Helper function to initialize a byte string. diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index f084ce0da7..4114dac01c 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -1017,7 +1017,7 @@ FPDF_RESULT FPDF_BStr_Clear(FPDF_BSTR* str) return 0; } -DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, int index, void* buffer, unsigned long& buflen) +DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, int index, void* buffer, long& buflen) { if (!buffer) buflen = 0; @@ -1059,7 +1059,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, int index, } else if (buflen >= len) { memcpy(buffer, utf16Name.c_str(), len); } else { - len = -1; + buflen = -1; } return (FPDF_DEST)pDestObj; } |