diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-08-30 16:36:53 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-30 21:02:57 +0000 |
commit | a94566f3833b885019bbea76d3261a3050b5ed04 (patch) | |
tree | 3fff0d5f89ce69b03fc65132dba37aa970f47efd /core/fxcrt/fx_basic_buffer.cpp | |
parent | cd07123993c2f6cfd2d08929e6ad27cab3ac74e9 (diff) | |
download | pdfium-a94566f3833b885019bbea76d3261a3050b5ed04.tar.xz |
Move CFX_WideTextBuf out of fx_basic
This CL moves CFX_WideTextBuf to its own files and updates includes as
needed.
Change-Id: Ibe66ecf3e66f8f01dd8e9eaf6b467588be86ad4f
Reviewed-on: https://pdfium-review.googlesource.com/12413
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt/fx_basic_buffer.cpp')
-rw-r--r-- | core/fxcrt/fx_basic_buffer.cpp | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp deleted file mode 100644 index e282aa4247..0000000000 --- a/core/fxcrt/fx_basic_buffer.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include <algorithm> -#include <limits> -#include <memory> -#include <utility> - -#include "core/fxcrt/fx_basic.h" -#include "core/fxcrt/fx_safe_types.h" -#include "third_party/base/numerics/safe_conversions.h" - -void CFX_WideTextBuf::AppendChar(wchar_t ch) { - ExpandBuf(sizeof(wchar_t)); - *(wchar_t*)(m_pBuffer.get() + m_DataSize) = ch; - m_DataSize += sizeof(wchar_t); -} - -CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideStringC& str) { - AppendBlock(str.unterminated_c_str(), str.GetLength() * sizeof(wchar_t)); - return *this; -} - -CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideString& str) { - AppendBlock(str.c_str(), str.GetLength() * sizeof(wchar_t)); - return *this; -} - -CFX_WideTextBuf& CFX_WideTextBuf::operator<<(int i) { - char buf[32]; - FXSYS_itoa(i, buf, 10); - FX_STRSIZE len = FXSYS_strlen(buf); - ExpandBuf(len * sizeof(wchar_t)); - wchar_t* str = (wchar_t*)(m_pBuffer.get() + m_DataSize); - for (FX_STRSIZE j = 0; j < len; j++) { - *str++ = buf[j]; - } - m_DataSize += len * sizeof(wchar_t); - return *this; -} - -CFX_WideTextBuf& CFX_WideTextBuf::operator<<(double f) { - char buf[32]; - FX_STRSIZE len = FX_ftoa((float)f, buf); - ExpandBuf(len * sizeof(wchar_t)); - wchar_t* str = (wchar_t*)(m_pBuffer.get() + m_DataSize); - for (FX_STRSIZE i = 0; i < len; i++) { - *str++ = buf[i]; - } - m_DataSize += len * sizeof(wchar_t); - return *this; -} - -CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const wchar_t* lpsz) { - AppendBlock(lpsz, FXSYS_wcslen(lpsz) * sizeof(wchar_t)); - return *this; -} - -CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideTextBuf& buf) { - AppendBlock(buf.m_pBuffer.get(), buf.m_DataSize); - return *this; -} |