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

Side by Side Diff: xfa/fxfa/parser/xfa_document_serialize.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_document_imp.cpp ('k') | xfa/fxfa/parser/xfa_localevalue.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 "xfa/fxfa/parser/xfa_document_serialize.h" 7 #include "xfa/fxfa/parser/xfa_document_serialize.h"
8 8
9 #include "xfa/fde/xml/fde_xml_imp.h" 9 #include "xfa/fde/xml/fde_xml_imp.h"
10 #include "xfa/fgas/crt/fgas_codepage.h" 10 #include "xfa/fgas/crt/fgas_codepage.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 const XFA_ATTRIBUTEINFO* pAttr = 400 const XFA_ATTRIBUTEINFO* pAttr =
401 XFA_GetAttributeByID((XFA_ATTRIBUTE)pAttrs[iAttrs]); 401 XFA_GetAttributeByID((XFA_ATTRIBUTE)pAttrs[iAttrs]);
402 if (pAttr->eName == XFA_ATTRIBUTE_Name) { 402 if (pAttr->eName == XFA_ATTRIBUTE_Name) {
403 continue; 403 continue;
404 } 404 }
405 CFX_WideString wsAttr; 405 CFX_WideString wsAttr;
406 XFA_SaveAttribute(pNode, pAttr->eName, pAttr->pName, FALSE, wsAttr); 406 XFA_SaveAttribute(pNode, pAttr->eName, pAttr->pName, FALSE, wsAttr);
407 wsOutput += wsAttr; 407 wsOutput += wsAttr;
408 } 408 }
409 if (!wsOutput.IsEmpty()) { 409 if (!wsOutput.IsEmpty()) {
410 pStream->WriteString((const FX_WCHAR*)wsOutput, wsOutput.GetLength()); 410 pStream->WriteString(wsOutput.c_str(), wsOutput.GetLength());
411 } 411 }
412 CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); 412 CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
413 if (pChildNode) { 413 if (pChildNode) {
414 pStream->WriteString(L"\n>", 2); 414 pStream->WriteString(L"\n>", 2);
415 while (pChildNode) { 415 while (pChildNode) {
416 XFA_DataExporter_RegenerateFormFile_Container(pChildNode, pStream, 416 XFA_DataExporter_RegenerateFormFile_Container(pChildNode, pStream,
417 bSaveXML); 417 bSaveXML);
418 pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling); 418 pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling);
419 } 419 }
420 pStream->WriteString(L"</", 2); 420 pStream->WriteString(L"</", 2);
421 pStream->WriteString(wsElement.c_str(), wsElement.GetLength()); 421 pStream->WriteString(wsElement.c_str(), wsElement.GetLength());
422 pStream->WriteString(L"\n>", 2); 422 pStream->WriteString(L"\n>", 2);
423 } else { 423 } else {
424 pStream->WriteString(L"\n/>", 3); 424 pStream->WriteString(L"\n/>", 3);
425 } 425 }
426 } 426 }
427 void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode, 427 void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode,
428 IFX_Stream* pStream, 428 IFX_Stream* pStream,
429 const FX_CHAR* pChecksum, 429 const FX_CHAR* pChecksum,
430 FX_BOOL bSaveXML) { 430 FX_BOOL bSaveXML) {
431 if (pNode->GetObjectType() == XFA_OBJECTTYPE_ModelNode) { 431 if (pNode->GetObjectType() == XFA_OBJECTTYPE_ModelNode) {
432 static const FX_WCHAR s_pwsTagName[] = L"<form"; 432 static const FX_WCHAR s_pwsTagName[] = L"<form";
433 static const FX_WCHAR s_pwsClose[] = L"</form\n>"; 433 static const FX_WCHAR s_pwsClose[] = L"</form\n>";
434 pStream->WriteString(s_pwsTagName, FXSYS_wcslen(s_pwsTagName)); 434 pStream->WriteString(s_pwsTagName, FXSYS_wcslen(s_pwsTagName));
435 if (pChecksum) { 435 if (pChecksum) {
436 static const FX_WCHAR s_pwChecksum[] = L" checksum=\""; 436 static const FX_WCHAR s_pwChecksum[] = L" checksum=\"";
437 CFX_WideString wsChecksum = CFX_WideString::FromUTF8(pChecksum); 437 CFX_WideString wsChecksum = CFX_WideString::FromUTF8(pChecksum);
438 pStream->WriteString(s_pwChecksum, FXSYS_wcslen(s_pwChecksum)); 438 pStream->WriteString(s_pwChecksum, FXSYS_wcslen(s_pwChecksum));
439 pStream->WriteString((const FX_WCHAR*)wsChecksum, wsChecksum.GetLength()); 439 pStream->WriteString(wsChecksum.c_str(), wsChecksum.GetLength());
440 pStream->WriteString(L"\"", 1); 440 pStream->WriteString(L"\"", 1);
441 } 441 }
442 pStream->WriteString(L" xmlns=\"", FXSYS_wcslen(L" xmlns=\"")); 442 pStream->WriteString(L" xmlns=\"", FXSYS_wcslen(L" xmlns=\""));
443 const FX_WCHAR* pURI = XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI; 443 const FX_WCHAR* pURI = XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI;
444 pStream->WriteString(pURI, FXSYS_wcslen(pURI)); 444 pStream->WriteString(pURI, FXSYS_wcslen(pURI));
445 CFX_WideString wsVersionNumber; 445 CFX_WideString wsVersionNumber;
446 XFA_DataExporter_RecognizeXFAVersionNumber( 446 XFA_DataExporter_RecognizeXFAVersionNumber(
447 ToNode(pNode->GetDocument()->GetXFAObject(XFA_XDPPACKET_Template)), 447 ToNode(pNode->GetDocument()->GetXFAObject(XFA_XDPPACKET_Template)),
448 wsVersionNumber); 448 wsVersionNumber);
449 if (wsVersionNumber.IsEmpty()) { 449 if (wsVersionNumber.IsEmpty()) {
450 wsVersionNumber = FX_WSTRC(L"2.8"); 450 wsVersionNumber = FX_WSTRC(L"2.8");
451 } 451 }
452 wsVersionNumber += FX_WSTRC(L"/\"\n>"); 452 wsVersionNumber += FX_WSTRC(L"/\"\n>");
453 pStream->WriteString((const FX_WCHAR*)wsVersionNumber, 453 pStream->WriteString(wsVersionNumber.c_str(), wsVersionNumber.GetLength());
454 wsVersionNumber.GetLength());
455 CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); 454 CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
456 while (pChildNode) { 455 while (pChildNode) {
457 XFA_DataExporter_RegenerateFormFile_Container(pChildNode, pStream); 456 XFA_DataExporter_RegenerateFormFile_Container(pChildNode, pStream);
458 pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling); 457 pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling);
459 } 458 }
460 pStream->WriteString(s_pwsClose, FXSYS_wcslen(s_pwsClose)); 459 pStream->WriteString(s_pwsClose, FXSYS_wcslen(s_pwsClose));
461 } else { 460 } else {
462 XFA_DataExporter_RegenerateFormFile_Container(pNode, pStream, bSaveXML); 461 XFA_DataExporter_RegenerateFormFile_Container(pNode, pStream, bSaveXML);
463 } 462 }
464 } 463 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 pXMLElement->RemoveAttribute(L"xfa:dataNode"); 575 pXMLElement->RemoveAttribute(L"xfa:dataNode");
577 } 576 }
578 } else { 577 } else {
579 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); 578 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode();
580 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); 579 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element);
581 static_cast<CFDE_XMLElement*>(pXMLNode) 580 static_cast<CFDE_XMLElement*>(pXMLNode)
582 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); 581 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup"));
583 } 582 }
584 } 583 }
585 } 584 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_document_imp.cpp ('k') | xfa/fxfa/parser/xfa_localevalue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698