diff options
author | tsepez <tsepez@chromium.org> | 2016-05-16 12:03:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-16 12:03:24 -0700 |
commit | 3f80c864d5318d4d80ac811d42c92d8f63e0b5ac (patch) | |
tree | efc4acca871bfb2fb1af80f5ee5779ac6ef70034 /xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | |
parent | b22504a8c589ff39a1d6eaa83dcd3ead454d3443 (diff) | |
download | pdfium-3f80c864d5318d4d80ac811d42c92d8f63e0b5ac.tar.xz |
Remove some c_str() calls from StringCs in xfa docs.
Avoids the risk of possibly getting a non-null terminated
buffer if the StringC happened to be created by Mid(), etc.
Doesn't seem to happen in practice.
Review-Url: https://codereview.chromium.org/1983683003
Diffstat (limited to 'xfa/fxfa/fm2js/xfa_fm2jscontext.cpp')
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 484191f1be..e47d0af390 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -5440,7 +5440,7 @@ void CXFA_FM2JSContext::Get(FXJSE_HOBJECT hThis, CFX_ByteString urlString; HValueToUTF8String(argOne, urlString); IFX_FileRead* pFile = pAppProvider->DownloadURL( - CFX_WideString::FromUTF8(urlString.AsStringC()).AsStringC()); + CFX_WideString::FromUTF8(urlString.AsStringC())); if (pFile) { int32_t size = pFile->GetSize(); uint8_t* pData = FX_Alloc(uint8_t, size); @@ -5500,12 +5500,11 @@ void CXFA_FM2JSContext::Post(FXJSE_HOBJECT hThis, } CFX_WideString decodedResponse; FX_BOOL bFlags = pAppProvider->PostRequestURL( - CFX_WideString::FromUTF8(bsURL.AsStringC()).AsStringC(), - CFX_WideString::FromUTF8(bsData.AsStringC()).AsStringC(), - CFX_WideString::FromUTF8(bsContentType.AsStringC()).AsStringC(), - CFX_WideString::FromUTF8(bsEncode.AsStringC()).AsStringC(), - CFX_WideString::FromUTF8(bsHeader.AsStringC()).AsStringC(), - decodedResponse); + CFX_WideString::FromUTF8(bsURL.AsStringC()), + CFX_WideString::FromUTF8(bsData.AsStringC()), + CFX_WideString::FromUTF8(bsContentType.AsStringC()), + CFX_WideString::FromUTF8(bsEncode.AsStringC()), + CFX_WideString::FromUTF8(bsHeader.AsStringC()), decodedResponse); FXJSE_Value_Release(argOne); FXJSE_Value_Release(argTwo); if (argc > 2) { @@ -5561,9 +5560,9 @@ void CXFA_FM2JSContext::Put(FXJSE_HOBJECT hThis, HValueToUTF8String(argThree, bsEncode); } FX_BOOL bFlags = pAppProvider->PutRequestURL( - CFX_WideString::FromUTF8(bsURL.AsStringC()).AsStringC(), - CFX_WideString::FromUTF8(bsData.AsStringC()).AsStringC(), - CFX_WideString::FromUTF8(bsEncode.AsStringC()).AsStringC()); + CFX_WideString::FromUTF8(bsURL.AsStringC()), + CFX_WideString::FromUTF8(bsData.AsStringC()), + CFX_WideString::FromUTF8(bsEncode.AsStringC())); FXJSE_Value_Release(argOne); FXJSE_Value_Release(argTwo); if (argc > 2) { |