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

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

Issue 1410343003: [Merge to XFA] Revert "Revert "Add type cast definitions for CPDF_Dictionary."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Rebase to origin/xfa Created 5 years, 2 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 | « fpdfsdk/src/fpdfppo.cpp ('k') | fpdfsdk/src/fsdk_baseform.cpp » ('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 "../../core/include/fpdfapi/fpdf_module.h" 7 #include "../../core/include/fpdfapi/fpdf_module.h"
8 #include "../../core/include/fxcodec/fx_codec.h" 8 #include "../../core/include/fxcodec/fx_codec.h"
9 #include "../../core/include/fxcrt/fx_safe_types.h" 9 #include "../../core/include/fxcrt/fx_safe_types.h"
10 #include "../../public/fpdf_ext.h" 10 #include "../../public/fpdf_ext.h"
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 continue; 1044 continue;
1045 if (i == index) 1045 if (i == index)
1046 break; 1046 break;
1047 i++; 1047 i++;
1048 } 1048 }
1049 } else { 1049 } else {
1050 pDestObj = nameTree.LookupValue(index, bsName); 1050 pDestObj = nameTree.LookupValue(index, bsName);
1051 } 1051 }
1052 if (!pDestObj) 1052 if (!pDestObj)
1053 return NULL; 1053 return NULL;
1054 if (pDestObj->GetType() == PDFOBJ_DICTIONARY) { 1054 if (CPDF_Dictionary* pDict = pDestObj->AsDictionary()) {
1055 pDestObj = ((CPDF_Dictionary*)pDestObj)->GetArray(FX_BSTRC("D")); 1055 pDestObj = pDict->GetArray(FX_BSTRC("D"));
1056 if (!pDestObj) 1056 if (!pDestObj)
1057 return NULL; 1057 return NULL;
1058 } 1058 }
1059 if (pDestObj->GetType() != PDFOBJ_ARRAY) 1059 if (pDestObj->GetType() != PDFOBJ_ARRAY)
1060 return NULL; 1060 return NULL;
1061 CFX_WideString wsName = PDF_DecodeText(bsName); 1061 CFX_WideString wsName = PDF_DecodeText(bsName);
1062 CFX_ByteString utf16Name = wsName.UTF16LE_Encode(); 1062 CFX_ByteString utf16Name = wsName.UTF16LE_Encode();
1063 unsigned int len = utf16Name.GetLength(); 1063 unsigned int len = utf16Name.GetLength();
1064 if (!buffer) { 1064 if (!buffer) {
1065 *buflen = len; 1065 *buflen = len;
1066 } else if (*buflen >= len) { 1066 } else if (*buflen >= len) {
1067 memcpy(buffer, utf16Name.c_str(), len); 1067 memcpy(buffer, utf16Name.c_str(), len);
1068 *buflen = len; 1068 *buflen = len;
1069 } else { 1069 } else {
1070 *buflen = -1; 1070 *buflen = -1;
1071 } 1071 }
1072 return (FPDF_DEST)pDestObj; 1072 return (FPDF_DEST)pDestObj;
1073 } 1073 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdfppo.cpp ('k') | fpdfsdk/src/fsdk_baseform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698