summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-08-11 11:24:11 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-11 11:24:11 -0700
commite0347a6408dc21b4fcf7a713de69aacb785c7230 (patch)
tree38ca627be5d72c7823926cfe0b5736888e5b4152
parentc18ffca5a35ab4b2218fadcca4006b3ea09e7875 (diff)
downloadpdfium-e0347a6408dc21b4fcf7a713de69aacb785c7230.tar.xz
Remove fgas_system files.
The two methods in fgas_system also exist in core/fxcrt/include/fx_ext with the FXSYS_ prefix instead of FX_. Remove the fgas_system files and use the fx_ext versions instead. Review-Url: https://codereview.chromium.org/2233133002
-rw-r--r--BUILD.gn2
-rw-r--r--xfa.gyp2
-rw-r--r--xfa/fde/css/fde_cssdatatable.cpp11
-rw-r--r--xfa/fde/css/fde_cssdeclaration.cpp3
-rw-r--r--xfa/fde/css/fde_cssstyleselector.h1
-rw-r--r--xfa/fde/xml/fde_xml_imp.cpp14
-rw-r--r--xfa/fgas/crt/fgas_stream.cpp1
-rw-r--r--xfa/fgas/crt/fgas_system.cpp82
-rw-r--r--xfa/fgas/crt/fgas_system.h15
-rw-r--r--xfa/fxfa/parser/cxfa_measurement.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp9
11 files changed, 20 insertions, 126 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 3ead13c849..d128719462 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1040,8 +1040,6 @@ if (pdf_enable_xfa) {
"xfa/fgas/crt/fgas_memory.h",
"xfa/fgas/crt/fgas_stream.cpp",
"xfa/fgas/crt/fgas_stream.h",
- "xfa/fgas/crt/fgas_system.cpp",
- "xfa/fgas/crt/fgas_system.h",
"xfa/fgas/crt/fgas_utils.cpp",
"xfa/fgas/crt/fgas_utils.h",
"xfa/fgas/font/fgas_font.h",
diff --git a/xfa.gyp b/xfa.gyp
index 42013def6d..e75f4fa942 100644
--- a/xfa.gyp
+++ b/xfa.gyp
@@ -91,8 +91,6 @@
"xfa/fgas/crt/fgas_memory.h",
"xfa/fgas/crt/fgas_stream.cpp",
"xfa/fgas/crt/fgas_stream.h",
- "xfa/fgas/crt/fgas_system.cpp",
- "xfa/fgas/crt/fgas_system.h",
"xfa/fgas/crt/fgas_utils.cpp",
"xfa/fgas/crt/fgas_utils.h",
"xfa/fgas/font/fgas_font.h",
diff --git a/xfa/fde/css/fde_cssdatatable.cpp b/xfa/fde/css/fde_cssdatatable.cpp
index 9bccd32602..0d253ba594 100644
--- a/xfa/fde/css/fde_cssdatatable.cpp
+++ b/xfa/fde/css/fde_cssdatatable.cpp
@@ -8,7 +8,6 @@
#include "core/fxcrt/include/fx_ext.h"
#include "xfa/fgas/crt/fgas_codepage.h"
-#include "xfa/fgas/crt/fgas_system.h"
namespace {
@@ -679,7 +678,7 @@ FX_BOOL FDE_ParseCSSNumber(const FX_WCHAR* pszValue,
FDE_CSSPRIMITIVETYPE& eUnit) {
ASSERT(pszValue && iValueLen > 0);
int32_t iUsedLen = 0;
- fValue = FX_wcstof(pszValue, iValueLen, &iUsedLen);
+ fValue = FXSYS_wcstof(pszValue, iValueLen, &iUsedLen);
if (iUsedLen <= 0)
return FALSE;
@@ -719,7 +718,7 @@ FX_BOOL FDE_ParseCSSURI(const FX_WCHAR* pszValue,
int32_t& iLength) {
ASSERT(pszValue && iValueLen > 0);
if (iValueLen < 6 || pszValue[iValueLen - 1] != ')' ||
- FX_wcsnicmp(L"url(", pszValue, 4)) {
+ FXSYS_wcsnicmp(L"url(", pszValue, 4)) {
return FALSE;
}
if (FDE_ParseCSSString(pszValue + 4, iValueLen - 5, iOffset, iLength)) {
@@ -756,7 +755,7 @@ FX_BOOL FDE_ParseCSSColor(const FX_WCHAR* pszValue,
}
if (iValueLen >= 10) {
- if (pszValue[iValueLen - 1] != ')' || FX_wcsnicmp(L"rgb(", pszValue, 4))
+ if (pszValue[iValueLen - 1] != ')' || FXSYS_wcsnicmp(L"rgb(", pszValue, 4))
return FALSE;
uint8_t rgb[3] = {0};
@@ -836,7 +835,7 @@ FX_BOOL CFDE_CSSValueListParser::NextValue(FDE_CSSPRIMITIVETYPE& eType,
m_pCur++;
eType = FDE_CSSPRIMITIVETYPE_String;
} else if (m_pEnd - m_pCur > 5 && m_pCur[3] == '(') {
- if (FX_wcsnicmp(L"url", m_pCur, 3) == 0) {
+ if (FXSYS_wcsnicmp(L"url", m_pCur, 3) == 0) {
wch = m_pCur[4];
if (wch == '\"' || wch == '\'') {
pStart += 5;
@@ -848,7 +847,7 @@ FX_BOOL CFDE_CSSValueListParser::NextValue(FDE_CSSPRIMITIVETYPE& eType,
m_pCur++;
}
eType = FDE_CSSPRIMITIVETYPE_URI;
- } else if (FX_wcsnicmp(L"rgb", m_pCur, 3) == 0) {
+ } else if (FXSYS_wcsnicmp(L"rgb", m_pCur, 3) == 0) {
iLength = SkipTo(')') + 1;
m_pCur++;
eType = FDE_CSSPRIMITIVETYPE_RGB;
diff --git a/xfa/fde/css/fde_cssdeclaration.cpp b/xfa/fde/css/fde_cssdeclaration.cpp
index da1f42fabd..34a91ec83c 100644
--- a/xfa/fde/css/fde_cssdeclaration.cpp
+++ b/xfa/fde/css/fde_cssdeclaration.cpp
@@ -7,7 +7,6 @@
#include "xfa/fde/css/fde_cssdeclaration.h"
#include "core/fxcrt/include/fx_ext.h"
-#include "xfa/fgas/crt/fgas_system.h"
IFDE_CSSValue* CFDE_CSSDeclaration::GetProperty(FDE_CSSPROPERTY eProperty,
FX_BOOL& bImportant) const {
@@ -106,7 +105,7 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs,
ASSERT(iValueLen > 0);
FX_BOOL bImportant = FALSE;
if (iValueLen >= 10 && pszValue[iValueLen - 10] == '!' &&
- FX_wcsnicmp(L"important", pszValue + iValueLen - 9, 9) == 0) {
+ FXSYS_wcsnicmp(L"important", pszValue + iValueLen - 9, 9) == 0) {
if ((iValueLen -= 10) == 0) {
return FALSE;
}
diff --git a/xfa/fde/css/fde_cssstyleselector.h b/xfa/fde/css/fde_cssstyleselector.h
index 469712fb5d..6a3f2bf594 100644
--- a/xfa/fde/css/fde_cssstyleselector.h
+++ b/xfa/fde/css/fde_cssstyleselector.h
@@ -15,7 +15,6 @@
#include "xfa/fde/css/fde_csscache.h"
#include "xfa/fde/css/fde_cssdeclaration.h"
#include "xfa/fgas/crt/fgas_memory.h"
-#include "xfa/fgas/crt/fgas_system.h"
class CFDE_CSSAccelerator;
class CFDE_CSSComputedStyle;
diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp
index 8e14f021ce..2642ed2202 100644
--- a/xfa/fde/xml/fde_xml_imp.cpp
+++ b/xfa/fde/xml/fde_xml_imp.cpp
@@ -8,9 +8,9 @@
#include <algorithm>
+#include "core/fxcrt/include/fx_ext.h"
#include "core/fxcrt/include/fx_safe_types.h"
#include "xfa/fgas/crt/fgas_codepage.h"
-#include "xfa/fgas/crt/fgas_system.h"
namespace {
@@ -627,7 +627,7 @@ FX_FLOAT CFDE_XMLInstruction::GetFloat(const FX_WCHAR* pwsAttriName,
int32_t iCount = m_Attributes.GetSize();
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- return FX_wcstof(m_Attributes[i + 1].c_str(), -1, nullptr);
+ return FXSYS_wcstof(m_Attributes[i + 1].c_str(), -1, nullptr);
}
}
return fDefValue;
@@ -843,7 +843,7 @@ FX_FLOAT CFDE_XMLElement::GetFloat(const FX_WCHAR* pwsAttriName,
int32_t iCount = m_Attributes.GetSize();
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- return FX_wcstof(m_Attributes[i + 1].c_str(), -1, nullptr);
+ return FXSYS_wcstof(m_Attributes[i + 1].c_str(), -1, nullptr);
}
}
return fDefValue;
@@ -1619,10 +1619,10 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
m_pStart++;
break;
case FDE_XmlSyntaxState::SkipCommentOrDecl:
- if (FX_wcsnicmp(m_pStart, L"--", 2) == 0) {
+ if (FXSYS_wcsnicmp(m_pStart, L"--", 2) == 0) {
m_pStart += 2;
m_syntaxParserState = FDE_XmlSyntaxState::SkipComment;
- } else if (FX_wcsnicmp(m_pStart, L"[CDATA[", 7) == 0) {
+ } else if (FXSYS_wcsnicmp(m_pStart, L"[CDATA[", 7) == 0) {
m_pStart += 7;
m_syntaxParserState = FDE_XmlSyntaxState::SkipCData;
} else {
@@ -1632,7 +1632,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
}
break;
case FDE_XmlSyntaxState::SkipCData: {
- if (FX_wcsnicmp(m_pStart, L"]]>", 3) == 0) {
+ if (FXSYS_wcsnicmp(m_pStart, L"]]>", 3) == 0) {
m_pStart += 3;
syntaxParserResult = FDE_XmlSyntaxResult::CData;
m_iTextDataLength = m_iDataLength;
@@ -1721,7 +1721,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
}
break;
case FDE_XmlSyntaxState::SkipComment:
- if (FX_wcsnicmp(m_pStart, L"-->", 3) == 0) {
+ if (FXSYS_wcsnicmp(m_pStart, L"-->", 3) == 0) {
m_pStart += 2;
m_syntaxParserState = FDE_XmlSyntaxState::Text;
}
diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp
index 25d8514257..74c19eab32 100644
--- a/xfa/fgas/crt/fgas_stream.cpp
+++ b/xfa/fgas/crt/fgas_stream.cpp
@@ -15,7 +15,6 @@
#include <memory>
#include "xfa/fgas/crt/fgas_codepage.h"
-#include "xfa/fgas/crt/fgas_system.h"
namespace {
diff --git a/xfa/fgas/crt/fgas_system.cpp b/xfa/fgas/crt/fgas_system.cpp
deleted file mode 100644
index b5cabedec5..0000000000
--- a/xfa/fgas/crt/fgas_system.cpp
+++ /dev/null
@@ -1,82 +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 "xfa/fgas/crt/fgas_system.h"
-
-#include <algorithm>
-
-#include "core/fxcrt/include/fx_system.h"
-
-namespace {
-
-inline FX_BOOL FX_isupper(int32_t ch) {
- return ch >= 'A' && ch <= 'Z';
-}
-
-inline int32_t FX_tolower(int32_t ch) {
- return FX_isupper(ch) ? (ch + 0x20) : ch;
-}
-
-} // namespace
-
-int32_t FX_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count) {
- ASSERT(s1 && s2 && count > 0);
- FX_WCHAR wch1 = 0;
- FX_WCHAR wch2 = 0;
- while (count-- > 0) {
- wch1 = (FX_WCHAR)FX_tolower(*s1++);
- wch2 = (FX_WCHAR)FX_tolower(*s2++);
- if (wch1 != wch2) {
- break;
- }
- }
- return wch1 - wch2;
-}
-
-FX_FLOAT FX_wcstof(const FX_WCHAR* pwsStr, int32_t iLength, int32_t* pUsedLen) {
- ASSERT(pwsStr);
- if (iLength < 0) {
- iLength = FXSYS_wcslen(pwsStr);
- }
- if (iLength == 0) {
- return 0.0f;
- }
- int32_t iUsedLen = 0;
- FX_BOOL bNegtive = FALSE;
- switch (pwsStr[iUsedLen]) {
- case '-':
- bNegtive = TRUE;
- case '+':
- iUsedLen++;
- break;
- }
- FX_FLOAT fValue = 0.0f;
- while (iUsedLen < iLength) {
- FX_WCHAR wch = pwsStr[iUsedLen];
- if (wch >= L'0' && wch <= L'9') {
- fValue = fValue * 10.0f + (wch - L'0');
- } else {
- break;
- }
- iUsedLen++;
- }
- if (iUsedLen < iLength && pwsStr[iUsedLen] == L'.') {
- FX_FLOAT fPrecise = 0.1f;
- while (++iUsedLen < iLength) {
- FX_WCHAR wch = pwsStr[iUsedLen];
- if (wch >= L'0' && wch <= L'9') {
- fValue += (wch - L'0') * fPrecise;
- fPrecise *= 0.1f;
- } else {
- break;
- }
- }
- }
- if (pUsedLen) {
- *pUsedLen = iUsedLen;
- }
- return bNegtive ? -fValue : fValue;
-}
diff --git a/xfa/fgas/crt/fgas_system.h b/xfa/fgas/crt/fgas_system.h
deleted file mode 100644
index 6cf628f9d4..0000000000
--- a/xfa/fgas/crt/fgas_system.h
+++ /dev/null
@@ -1,15 +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
-
-#ifndef XFA_FGAS_CRT_FGAS_SYSTEM_H_
-#define XFA_FGAS_CRT_FGAS_SYSTEM_H_
-
-#include "core/fxcrt/include/fx_system.h"
-
-FX_FLOAT FX_wcstof(const FX_WCHAR* pwsStr, int32_t iLength, int32_t* pUsedLen);
-int32_t FX_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count);
-
-#endif // XFA_FGAS_CRT_FGAS_SYSTEM_H_
diff --git a/xfa/fxfa/parser/cxfa_measurement.cpp b/xfa/fxfa/parser/cxfa_measurement.cpp
index 7c6db2ec26..90726b249e 100644
--- a/xfa/fxfa/parser/cxfa_measurement.cpp
+++ b/xfa/fxfa/parser/cxfa_measurement.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fgas/crt/fgas_system.h"
+#include "core/fxcrt/include/fx_ext.h"
CXFA_Measurement::CXFA_Measurement(const CFX_WideStringC& wsMeasure) {
Set(wsMeasure);
@@ -28,8 +28,8 @@ void CXFA_Measurement::Set(const CFX_WideStringC& wsMeasure) {
}
int32_t iUsedLen = 0;
int32_t iOffset = (wsMeasure.GetAt(0) == L'=') ? 1 : 0;
- FX_FLOAT fValue = FX_wcstof(wsMeasure.c_str() + iOffset,
- wsMeasure.GetLength() - iOffset, &iUsedLen);
+ FX_FLOAT fValue = FXSYS_wcstof(wsMeasure.c_str() + iOffset,
+ wsMeasure.GetLength() - iOffset, &iUsedLen);
XFA_UNIT eUnit = GetUnit(wsMeasure.Mid(iOffset + iUsedLen));
Set(fValue, eUnit);
}
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index fd185771aa..793e37bee2 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -14,7 +14,6 @@
#include "third_party/base/stl_util.h"
#include "xfa/fde/xml/fde_xml_imp.h"
#include "xfa/fgas/crt/fgas_codepage.h"
-#include "xfa/fgas/crt/fgas_system.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/include/cxfa_eventparam.h"
#include "xfa/fxfa/parser/cxfa_document.h"
@@ -3701,10 +3700,10 @@ FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr,
case XFA_ATTRIBUTETYPE_Boolean:
return SetBoolean(pAttr->eName, wsValue != FX_WSTRC(L"0"), bNotify);
case XFA_ATTRIBUTETYPE_Integer:
- return SetInteger(
- pAttr->eName,
- FXSYS_round(FX_wcstof(wsValue.c_str(), wsValue.GetLength(), nullptr)),
- bNotify);
+ return SetInteger(pAttr->eName,
+ FXSYS_round(FXSYS_wcstof(wsValue.c_str(),
+ wsValue.GetLength(), nullptr)),
+ bNotify);
case XFA_ATTRIBUTETYPE_Measure:
return SetMeasure(pAttr->eName, CXFA_Measurement(wsValue), bNotify);
default: