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>
diff --git a/core/fxcrt/string_data_template.h b/core/fxcrt/string_data_template.h
index bc797c0..f65d37c 100644
--- a/core/fxcrt/string_data_template.h
+++ b/core/fxcrt/string_data_template.h
@@ -41,12 +41,6 @@
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 e3c08d7..146de3a 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -1024,48 +1024,10 @@
}
}
-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 c51c745..799eb98 100644
--- a/core/fxcrt/widestring.h
+++ b/core/fxcrt/widestring.h
@@ -176,7 +176,6 @@
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;