From aa7022833db1a6e21b81fcca30b45ba652298f32 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 10 May 2017 13:54:54 -0400 Subject: Cleaning up Edit code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl conslidates if statements, converts int returns to bools where possible and various other cleanups in fpdfapi/edit. Change-Id: Ia31ecc69843117eb5ebfff449a6046a267d08e89 Reviewed-on: https://pdfium-review.googlesource.com/5190 Reviewed-by: Nicolás Peña Commit-Queue: dsinclair --- core/fxcrt/fx_basic_buffer.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'core/fxcrt') diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp index 701676f71e..13057f1670 100644 --- a/core/fxcrt/fx_basic_buffer.cpp +++ b/core/fxcrt/fx_basic_buffer.cpp @@ -255,11 +255,9 @@ int32_t CFX_FileBufferArchive::AppendBlock(const void* pBuf, size_t size) { size_t buf_size = std::min(kBufSize - m_Length, temp_size); memcpy(m_pBuffer.get() + m_Length, buffer, buf_size); m_Length += buf_size; - if (m_Length == kBufSize) { - if (!Flush()) { - return -1; - } - } + if (m_Length == kBufSize && !Flush()) + return -1; + temp_size -= buf_size; buffer += buf_size; } -- cgit v1.2.3