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

Side by Side Diff: core/fpdfdoc/doc_form.cpp

Issue 1862953004: Make CFX_WideString::FromLocal() take a CFX_ByteStringC arg (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use GetConstStringBy(). Created 4 years, 8 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 | « core/fpdfdoc/doc_basic.cpp ('k') | core/fxcrt/fx_basic_bstring.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 <vector> 7 #include <vector>
8 8
9 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" 9 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h"
10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" 10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
(...skipping 17 matching lines...) Expand all
28 {"GBK", 936}, 28 {"GBK", 936},
29 {"Shift-JIS", 932}, 29 {"Shift-JIS", 932},
30 {"UHC", 949}, 30 {"UHC", 949},
31 }; 31 };
32 32
33 CFX_WideString FPDFDOC_FDF_GetFieldValue(const CPDF_Dictionary& pFieldDict, 33 CFX_WideString FPDFDOC_FDF_GetFieldValue(const CPDF_Dictionary& pFieldDict,
34 const CFX_ByteString& bsEncoding) { 34 const CFX_ByteString& bsEncoding) {
35 const CFX_ByteString csBValue = pFieldDict.GetStringBy("V"); 35 const CFX_ByteString csBValue = pFieldDict.GetStringBy("V");
36 for (const auto& encoding : g_fieldEncoding) { 36 for (const auto& encoding : g_fieldEncoding) {
37 if (bsEncoding == encoding.m_name) 37 if (bsEncoding == encoding.m_name)
38 return CFX_WideString::FromCodePage(csBValue, encoding.m_codePage); 38 return CFX_WideString::FromCodePage(csBValue.AsByteStringC(),
39 encoding.m_codePage);
39 } 40 }
40 CFX_ByteString csTemp = csBValue.Left(2); 41 CFX_ByteString csTemp = csBValue.Left(2);
41 if (csTemp == "\xFF\xFE" || csTemp == "\xFE\xFF") 42 if (csTemp == "\xFF\xFE" || csTemp == "\xFE\xFF")
42 return PDF_DecodeText(csBValue); 43 return PDF_DecodeText(csBValue);
43 return CFX_WideString::FromLocal(csBValue); 44 return CFX_WideString::FromLocal(csBValue.AsByteStringC());
44 } 45 }
45 46
46 } // namespace 47 } // namespace
47 48
48 class CFieldNameExtractor { 49 class CFieldNameExtractor {
49 public: 50 public:
50 explicit CFieldNameExtractor(const CFX_WideString& full_name) { 51 explicit CFieldNameExtractor(const CFX_WideString& full_name) {
51 m_pStart = full_name.c_str(); 52 m_pStart = full_name.c_str();
52 m_pEnd = m_pStart + full_name.GetLength(); 53 m_pEnd = m_pStart + full_name.GetLength();
53 m_pCur = m_pStart; 54 m_pCur = m_pStart;
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 FDF_ImportField(pField, L"", bNotify); 1202 FDF_ImportField(pField, L"", bNotify);
1202 } 1203 }
1203 if (bNotify && m_pFormNotify) { 1204 if (bNotify && m_pFormNotify) {
1204 m_pFormNotify->AfterFormImportData(this); 1205 m_pFormNotify->AfterFormImportData(this);
1205 } 1206 }
1206 return TRUE; 1207 return TRUE;
1207 } 1208 }
1208 void CPDF_InterForm::SetFormNotify(const CPDF_FormNotify* pNotify) { 1209 void CPDF_InterForm::SetFormNotify(const CPDF_FormNotify* pNotify) {
1209 m_pFormNotify = (CPDF_FormNotify*)pNotify; 1210 m_pFormNotify = (CPDF_FormNotify*)pNotify;
1210 } 1211 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/doc_basic.cpp ('k') | core/fxcrt/fx_basic_bstring.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698