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

Side by Side Diff: xfa/fxfa/parser/xfa_utils_imp.cpp

Issue 1882043004: Remove implicit cast from CFX_WideString to (const wchar_t*) (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: win error #2 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 | « xfa/fxfa/parser/xfa_script_resolveprocessor.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 "xfa/fxfa/parser/xfa_utils.h" 7 #include "xfa/fxfa/parser/xfa_utils.h"
8 8
9 #include "core/fxcrt/include/fx_ext.h" 9 #include "core/fxcrt/include/fx_ext.h"
10 #include "xfa/fde/xml/fde_xml_imp.h" 10 #include "xfa/fde/xml/fde_xml_imp.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode, 190 void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode,
191 CFX_WideString& wsPlainText) { 191 CFX_WideString& wsPlainText) {
192 if (pXMLNode == NULL) { 192 if (pXMLNode == NULL) {
193 return; 193 return;
194 } 194 }
195 switch (pXMLNode->GetType()) { 195 switch (pXMLNode->GetType()) {
196 case FDE_XMLNODE_Element: { 196 case FDE_XMLNODE_Element: {
197 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); 197 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
198 CFX_WideString wsTag; 198 CFX_WideString wsTag;
199 pXMLElement->GetLocalTagName(wsTag); 199 pXMLElement->GetLocalTagName(wsTag);
200 uint32_t uTag = FX_HashCode_String_GetW(wsTag, wsTag.GetLength(), TRUE); 200 uint32_t uTag =
201 FX_HashCode_String_GetW(wsTag.c_str(), wsTag.GetLength(), TRUE);
201 if (uTag == 0x0001f714) { 202 if (uTag == 0x0001f714) {
202 wsPlainText += L"\n"; 203 wsPlainText += L"\n";
203 } else if (uTag == 0x00000070) { 204 } else if (uTag == 0x00000070) {
204 if (!wsPlainText.IsEmpty()) { 205 if (!wsPlainText.IsEmpty()) {
205 wsPlainText += L"\n"; 206 wsPlainText += L"\n";
206 } 207 }
207 } else if (uTag == 0xa48ac63) { 208 } else if (uTag == 0xa48ac63) {
208 if (!wsPlainText.IsEmpty() && 209 if (!wsPlainText.IsEmpty() &&
209 wsPlainText[wsPlainText.GetLength() - 1] != '\n') { 210 wsPlainText[wsPlainText.GetLength() - 1] != '\n') {
210 wsPlainText += L"\n"; 211 wsPlainText += L"\n";
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 0.0000000000000001}; 315 0.0000000000000001};
315 FX_DOUBLE XFA_WideStringToDouble(const CFX_WideString& wsStringVal) { 316 FX_DOUBLE XFA_WideStringToDouble(const CFX_WideString& wsStringVal) {
316 CFX_WideString wsValue = wsStringVal; 317 CFX_WideString wsValue = wsStringVal;
317 wsValue.TrimLeft(); 318 wsValue.TrimLeft();
318 wsValue.TrimRight(); 319 wsValue.TrimRight();
319 int64_t nIntegral = 0; 320 int64_t nIntegral = 0;
320 uint32_t dwFractional = 0; 321 uint32_t dwFractional = 0;
321 int32_t nExponent = 0; 322 int32_t nExponent = 0;
322 int32_t cc = 0; 323 int32_t cc = 0;
323 FX_BOOL bNegative = FALSE, bExpSign = FALSE; 324 FX_BOOL bNegative = FALSE, bExpSign = FALSE;
324 const FX_WCHAR* str = (const FX_WCHAR*)wsValue; 325 const FX_WCHAR* str = wsValue.c_str();
325 int32_t len = wsValue.GetLength(); 326 int32_t len = wsValue.GetLength();
326 if (str[0] == '+') { 327 if (str[0] == '+') {
327 cc++; 328 cc++;
328 } else if (str[0] == '-') { 329 } else if (str[0] == '-') {
329 bNegative = TRUE; 330 bNegative = TRUE;
330 cc++; 331 cc++;
331 } 332 }
332 int32_t nIntegralLen = 0; 333 int32_t nIntegralLen = 0;
333 while (cc < len) { 334 while (cc < len) {
334 if (str[cc] == '.' || str[cc] == 'E' || str[cc] == 'e' || 335 if (str[cc] == '.' || str[cc] == 'E' || str[cc] == 'e' ||
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal) { 395 FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal) {
395 CFX_WideString wsValue = CFX_WideString::FromUTF8(szStringVal); 396 CFX_WideString wsValue = CFX_WideString::FromUTF8(szStringVal);
396 return XFA_WideStringToDouble(wsValue); 397 return XFA_WideStringToDouble(wsValue);
397 } 398 }
398 399
399 int32_t XFA_MapRotation(int32_t nRotation) { 400 int32_t XFA_MapRotation(int32_t nRotation) {
400 nRotation = nRotation % 360; 401 nRotation = nRotation % 360;
401 nRotation = nRotation < 0 ? nRotation + 360 : nRotation; 402 nRotation = nRotation < 0 ? nRotation + 360 : nRotation;
402 return nRotation; 403 return nRotation;
403 } 404 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_script_resolveprocessor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698