From c62e8489042c5efaa3b666846b38a52da3b91481 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 20 Jun 2018 20:32:04 +0000 Subject: Avoid more .c_str() usage, part 3 Change-Id: I5dfadcb68e640235be6e3eb7c8d57ae3b8013d26 Reviewed-on: https://pdfium-review.googlesource.com/35691 Reviewed-by: dsinclair Commit-Queue: Tom Sepez --- fxjs/cjs_util.cpp | 4 ++-- fxjs/xfa/cjx_packet.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'fxjs') diff --git a/fxjs/cjs_util.cpp b/fxjs/cjs_util.cpp index fec727302d..3889f5ab63 100644 --- a/fxjs/cjs_util.cpp +++ b/fxjs/cjs_util.cpp @@ -183,7 +183,7 @@ CJS_Return CJS_Util::printd(CJS_Runtime* pRuntime, return CJS_Return(JSMessage::kValueError); } - return CJS_Return(pRuntime->NewString(swResult.c_str())); + return CJS_Return(pRuntime->NewString(swResult.AsStringView())); } if (params[0]->IsString()) { @@ -259,7 +259,7 @@ CJS_Return CJS_Util::printx(CJS_Runtime* pRuntime, return CJS_Return( pRuntime->NewString(printx(pRuntime->ToWideString(params[0]), pRuntime->ToWideString(params[1])) - .c_str())); + .AsStringView())); } enum CaseMode { kPreserveCase, kUpperCase, kLowerCase }; diff --git a/fxjs/xfa/cjx_packet.cpp b/fxjs/xfa/cjx_packet.cpp index e4119baf91..b27cfbadfb 100644 --- a/fxjs/xfa/cjx_packet.cpp +++ b/fxjs/xfa/cjx_packet.cpp @@ -38,7 +38,7 @@ CJS_Return CJX_Packet::getAttribute( CFX_XMLNode* pXMLNode = GetXFANode()->GetXMLMappingNode(); if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) { attributeValue = static_cast(pXMLNode)->GetAttribute( - runtime->ToWideString(params[0]).c_str()); + runtime->ToWideString(params[0])); } return CJS_Return( runtime->NewString(attributeValue.UTF8Encode().AsStringView())); @@ -68,8 +68,8 @@ CJS_Return CJX_Packet::removeAttribute( if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) { WideString name = runtime->ToWideString(params[0]); CFX_XMLElement* pXMLElement = static_cast(pXMLNode); - if (pXMLElement->HasAttribute(name.c_str())) - pXMLElement->RemoveAttribute(name.c_str()); + if (pXMLElement->HasAttribute(name)) + pXMLElement->RemoveAttribute(name); } return CJS_Return(runtime->NewNull()); } -- cgit v1.2.3