From 57353fb32972af2254070bfb2f662c8add8b2efb Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 4 Oct 2018 23:24:30 +0000 Subject: 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 Commit-Queue: Tom Sepez --- core/fxcrt/string_data_template.h | 6 ------ core/fxcrt/widestring.cpp | 38 -------------------------------------- core/fxcrt/widestring.h | 1 - 3 files changed, 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(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 Find(const WideStringView& pSub, size_t start = 0) const; Optional Find(wchar_t ch, size_t start = 0) const; -- cgit v1.2.3