Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(781)

Side by Side Diff: fpdfsdk/src/fpdfview.cpp

Issue 1130843003: Make (and verify) public/ files compile under C. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Blank line. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « BUILD.gn ('k') | fpdfsdk/src/fpdfview_c_api_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../include/fsdk_define.h" 7 #include "../include/fsdk_define.h"
8 #include "../include/fsdk_mgr.h" 8 #include "../include/fsdk_mgr.h"
9 #include "../include/fsdk_rendercontext.h" 9 #include "../include/fsdk_rendercontext.h"
10 #include "../../public/fpdfview.h" 10 #include "../../public/fpdfview.h"
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 if (!document) 818 if (!document)
819 return NULL; 819 return NULL;
820 if (!name || name[0] == 0) 820 if (!name || name[0] == 0)
821 return NULL; 821 return NULL;
822 822
823 CPDF_Document* pDoc = (CPDF_Document*)document; 823 CPDF_Document* pDoc = (CPDF_Document*)document;
824 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests")); 824 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests"));
825 return name_tree.LookupNamedDest(pDoc, name); 825 return name_tree.LookupNamedDest(pDoc, name);
826 } 826 }
827 827
828 DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, int index, void* buffer, long& buflen) 828 DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, int index, void* buffer, long* buflen)
829 { 829 {
830 if (!buffer) 830 if (!buffer)
831 buflen = 0; 831 *buflen = 0;
832 if (!document || index < 0) return NULL; 832 if (!document || index < 0) return NULL;
833 CPDF_Document* pDoc = (CPDF_Document*)document; 833 CPDF_Document* pDoc = (CPDF_Document*)document;
834 834
835 CPDF_Dictionary* pRoot = pDoc->GetRoot(); 835 CPDF_Dictionary* pRoot = pDoc->GetRoot();
836 if (!pRoot) return NULL; 836 if (!pRoot) return NULL;
837 837
838 CPDF_Object* pDestObj = NULL; 838 CPDF_Object* pDestObj = NULL;
839 CFX_ByteString bsName; 839 CFX_ByteString bsName;
840 CPDF_NameTree nameTree(pDoc, FX_BSTRC("Dests")); 840 CPDF_NameTree nameTree(pDoc, FX_BSTRC("Dests"));
841 int count = nameTree.GetCount(); 841 int count = nameTree.GetCount();
(...skipping 16 matching lines...) Expand all
858 if (!pDestObj) return NULL; 858 if (!pDestObj) return NULL;
859 if (pDestObj->GetType() == PDFOBJ_DICTIONARY) { 859 if (pDestObj->GetType() == PDFOBJ_DICTIONARY) {
860 pDestObj = ((CPDF_Dictionary*)pDestObj)->GetArray(FX_BSTRC("D")); 860 pDestObj = ((CPDF_Dictionary*)pDestObj)->GetArray(FX_BSTRC("D"));
861 if (!pDestObj) return NULL; 861 if (!pDestObj) return NULL;
862 } 862 }
863 if (pDestObj->GetType() != PDFOBJ_ARRAY) return NULL; 863 if (pDestObj->GetType() != PDFOBJ_ARRAY) return NULL;
864 CFX_WideString wsName = PDF_DecodeText(bsName); 864 CFX_WideString wsName = PDF_DecodeText(bsName);
865 CFX_ByteString utf16Name = wsName.UTF16LE_Encode(); 865 CFX_ByteString utf16Name = wsName.UTF16LE_Encode();
866 unsigned int len = utf16Name.GetLength(); 866 unsigned int len = utf16Name.GetLength();
867 if (!buffer) { 867 if (!buffer) {
868 buflen = len; 868 *buflen = len;
869 } else if (buflen >= len) { 869 } else if (*buflen >= len) {
870 memcpy(buffer, utf16Name.c_str(), len); 870 memcpy(buffer, utf16Name.c_str(), len);
871 buflen = len; 871 *buflen = len;
872 } else { 872 } else {
873 buflen = -1; 873 *buflen = -1;
874 } 874 }
875 return (FPDF_DEST)pDestObj; 875 return (FPDF_DEST)pDestObj;
876 } 876 }
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | fpdfsdk/src/fpdfview_c_api_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698