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

Side by Side Diff: fpdfsdk/src/javascript/Document.cpp

Issue 1417823005: Add type cast definitions for CPDF_Name. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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') | no next file » | 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 "Document.h" 7 #include "Document.h"
8 8
9 #include "../../../third_party/base/numerics/safe_math.h" 9 #include "../../../third_party/base/numerics/safe_math.h"
10 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment. 10 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment.
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 cwCreationDate.c_str()); 841 cwCreationDate.c_str());
842 FXJS_PutObjectString(isolate, pObj, L"ModDate", cwModDate.c_str()); 842 FXJS_PutObjectString(isolate, pObj, L"ModDate", cwModDate.c_str());
843 FXJS_PutObjectString(isolate, pObj, L"Trapped", cwTrapped.c_str()); 843 FXJS_PutObjectString(isolate, pObj, L"Trapped", cwTrapped.c_str());
844 844
845 // It's to be compatible to non-standard info dictionary. 845 // It's to be compatible to non-standard info dictionary.
846 FX_POSITION pos = pDictionary->GetStartPos(); 846 FX_POSITION pos = pDictionary->GetStartPos();
847 while (pos) { 847 while (pos) {
848 CFX_ByteString bsKey; 848 CFX_ByteString bsKey;
849 CPDF_Object* pValueObj = pDictionary->GetNextElement(pos, bsKey); 849 CPDF_Object* pValueObj = pDictionary->GetNextElement(pos, bsKey);
850 CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey, bsKey.GetLength()); 850 CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey, bsKey.GetLength());
851 if (pValueObj->IsString() || (pValueObj->GetType() == PDFOBJ_NAME)) { 851
852 if (pValueObj->IsString() || pValueObj->IsName()) {
852 FXJS_PutObjectString(isolate, pObj, wsKey.c_str(), 853 FXJS_PutObjectString(isolate, pObj, wsKey.c_str(),
853 pValueObj->GetUnicodeText().c_str()); 854 pValueObj->GetUnicodeText().c_str());
854 } 855 } else if (pValueObj->IsNumber()) {
855
856 if (pValueObj->IsNumber()) {
857 FXJS_PutObjectNumber(isolate, pObj, wsKey.c_str(), 856 FXJS_PutObjectNumber(isolate, pObj, wsKey.c_str(),
858 (float)pValueObj->GetNumber()); 857 (float)pValueObj->GetNumber());
859 } 858 } else if (pValueObj->IsBoolean()) {
860
861 if (pValueObj->IsBoolean()) {
862 FXJS_PutObjectBoolean(isolate, pObj, wsKey.c_str(), 859 FXJS_PutObjectBoolean(isolate, pObj, wsKey.c_str(),
863 (bool)pValueObj->GetInteger()); 860 (bool)pValueObj->GetInteger());
864 } 861 }
865 } 862 }
866 vp << pObj; 863 vp << pObj;
867 } 864 }
868 return TRUE; 865 return TRUE;
869 } 866 }
870 867
871 FX_BOOL Document::creationDate(IJS_Context* cc, 868 FX_BOOL Document::creationDate(IJS_Context* cc,
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 CFX_DWordArray DelArray; 1822 CFX_DWordArray DelArray;
1826 1823
1827 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { 1824 for (int j = DelArray.GetSize() - 1; j >= 0; j--) {
1828 m_DelayData.RemoveAt(DelArray[j]); 1825 m_DelayData.RemoveAt(DelArray[j]);
1829 } 1826 }
1830 } 1827 }
1831 1828
1832 CJS_Document* Document::GetCJSDoc() const { 1829 CJS_Document* Document::GetCJSDoc() const {
1833 return static_cast<CJS_Document*>(m_pJSObject); 1830 return static_cast<CJS_Document*>(m_pJSObject);
1834 } 1831 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdfppo.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698