diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-10-04 23:24:30 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-04 23:24:30 +0000 |
commit | 57353fb32972af2254070bfb2f662c8add8b2efb (patch) | |
tree | 5f4c87d9411ce1a368697fc3d9d9b6a217f15e5e | |
parent | c38c9d15f18c2b883df6e29f2364d05699b87d53 (diff) | |
download | pdfium-57353fb32972af2254070bfb2f662c8add8b2efb.tar.xz |
Remove some unused code in fxcrt strings.
Unused static method in StringDataTemplate<>.
Unused WideString::GetFloat(), which in turn allows us to remove
another custom string to float parser.
Change-Id: If7ae60a0ba90563598232bad229f97cb74d682ba
Reviewed-on: https://pdfium-review.googlesource.com/c/43513
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
-rw-r--r-- | core/fxcrt/string_data_template.h | 6 | ||||
-rw-r--r-- | core/fxcrt/widestring.cpp | 38 | ||||
-rw-r--r-- | core/fxcrt/widestring.h | 1 |
3 files changed, 0 insertions, 45 deletions
diff --git a/core/fxcrt/string_data_template.h b/core/fxcrt/string_data_template.h index bc797c07e2..f65d37c3ef 100644 --- a/core/fxcrt/string_data_template.h +++ b/core/fxcrt/string_data_template.h @@ -41,12 +41,6 @@ class StringDataTemplate { return new (pData) StringDataTemplate(nLen, usableLen); } - static StringDataTemplate* Create(const StringDataTemplate& other) { - StringDataTemplate* result = Create(other.m_nDataLength); - result->CopyContents(other); - return result; - } - static StringDataTemplate* Create(const CharType* pStr, size_t nLen) { StringDataTemplate* result = Create(nLen); result->CopyContents(pStr, nLen); diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp index e3c08d72e1..146de3af0c 100644 --- a/core/fxcrt/widestring.cpp +++ b/core/fxcrt/widestring.cpp @@ -1024,48 +1024,10 @@ void WideString::TrimRight(const WideStringView& targets) { } } -float FX_wtof(const wchar_t* str, int len) { - if (len == 0) { - return 0.0; - } - int cc = 0; - bool bNegative = false; - if (str[0] == '+') { - cc++; - } else if (str[0] == '-') { - bNegative = true; - cc++; - } - int integer = 0; - while (cc < len) { - if (str[cc] == '.') { - break; - } - integer = integer * 10 + FXSYS_DecimalCharToInt(str[cc]); - cc++; - } - float fraction = 0; - if (str[cc] == '.') { - cc++; - float scale = 0.1f; - while (cc < len) { - fraction += scale * FXSYS_DecimalCharToInt(str[cc]); - scale *= 0.1f; - cc++; - } - } - fraction += static_cast<float>(integer); - return bNegative ? -fraction : fraction; -} - int WideString::GetInteger() const { return m_pData ? FXSYS_wtoi(m_pData->m_String) : 0; } -float WideString::GetFloat() const { - return m_pData ? FX_wtof(m_pData->m_String, m_pData->m_nDataLength) : 0.0f; -} - std::wostream& operator<<(std::wostream& os, const WideString& str) { return os.write(str.c_str(), str.GetLength()); } diff --git a/core/fxcrt/widestring.h b/core/fxcrt/widestring.h index c51c74506b..799eb98686 100644 --- a/core/fxcrt/widestring.h +++ b/core/fxcrt/widestring.h @@ -176,7 +176,6 @@ class WideString { void ReleaseBuffer(size_t len); int GetInteger() const; - float GetFloat() const; Optional<size_t> Find(const WideStringView& pSub, size_t start = 0) const; Optional<size_t> Find(wchar_t ch, size_t start = 0) const; |