From 1e934f6868465bca960f9f13489489ba1d649581 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 11 Apr 2018 21:11:28 +0000 Subject: Remove use of GetBuffer()/ReleaseBuffer() when c_str() is sufficient. Greatly simplify the code which was neither changing allocations nor doing any actual work. Eventually GetBuffer() will return a span, and this makes fewer places to change. Comment AsFPDFWideString() as a place where we may want a redundant copy, and make available outside the .cpp file. Fix one "const" along the way. Change-Id: I187758b69a0ba3501b3622f6c06280793cd5d464 Reviewed-on: https://pdfium-review.googlesource.com/30011 Reviewed-by: dsinclair Commit-Queue: Tom Sepez --- fpdfsdk/cpdfsdk_interform.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'fpdfsdk/cpdfsdk_interform.cpp') diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp index 6d3e9cd848..e83e59938c 100644 --- a/fpdfsdk/cpdfsdk_interform.cpp +++ b/fpdfsdk/cpdfsdk_interform.cpp @@ -521,12 +521,7 @@ bool CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, size_t& nBufSize) { ByteString csBValue = pField->GetStringFor("V"); WideString csWValue = PDF_DecodeText(csBValue); ByteString csValue_b = ByteString::FromUnicode(csWValue); - - fdfEncodedData << name_b.GetBuffer(name_b.GetLength()); - name_b.ReleaseBuffer(name_b.GetStringLength()); - fdfEncodedData << "="; - fdfEncodedData << csValue_b.GetBuffer(csValue_b.GetLength()); - csValue_b.ReleaseBuffer(csValue_b.GetStringLength()); + fdfEncodedData << name_b.c_str() << "=" << csValue_b.c_str(); if (i != pFields->GetCount() - 1) fdfEncodedData << "&"; } -- cgit v1.2.3