diff options
Diffstat (limited to 'xfa/src')
-rw-r--r-- | xfa/src/fdp/src/css/fde_cssstyleselector.h | 6 | ||||
-rw-r--r-- | xfa/src/fgas/include/fx_sys.h | 50 | ||||
-rw-r--r-- | xfa/src/fgas/src/crt/fx_system.cpp | 143 | ||||
-rw-r--r-- | xfa/src/fgas/src/crt/fx_utils.cpp | 8 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_textlayout.cpp | 4 | ||||
-rw-r--r-- | xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp | 2 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_object_imp.cpp | 4 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_script_imp.cpp | 4 |
8 files changed, 30 insertions, 191 deletions
diff --git a/xfa/src/fdp/src/css/fde_cssstyleselector.h b/xfa/src/fdp/src/css/fde_cssstyleselector.h index 4814a9c818..92e58f5ba1 100644 --- a/xfa/src/fdp/src/css/fde_cssstyleselector.h +++ b/xfa/src/fdp/src/css/fde_cssstyleselector.h @@ -179,7 +179,7 @@ class CFDE_CSSStyleSelector : public IFDE_CSSStyleSelector, public CFX_Target { }; typedef struct _FDE_CSSCOUNTERDATA { public: - _FDE_CSSCOUNTERDATA() { FX_memset(this, 0, sizeof(_FDE_CSSCOUNTERDATA)); } + _FDE_CSSCOUNTERDATA() { FXSYS_memset(this, 0, sizeof(_FDE_CSSCOUNTERDATA)); } FX_BOOL GetCounterIncrement(int32_t& iValue) { iValue = m_iIncVal; return m_bIncrement; @@ -234,7 +234,7 @@ class CFDE_CSSCounterStyle { class CFDE_CSSInheritedData { public: void Reset() { - FX_memset(this, 0, sizeof(CFDE_CSSInheritedData)); + FXSYS_memset(this, 0, sizeof(CFDE_CSSInheritedData)); m_LetterSpacing.Set(FDE_CSSLENGTHUNIT_Normal); m_WordSpacing.Set(FDE_CSSLENGTHUNIT_Normal); m_TextIndent.Set(FDE_CSSLENGTHUNIT_Point, 0); @@ -283,7 +283,7 @@ class CFDE_CSSInheritedData { class CFDE_CSSNonInheritedData { public: void Reset() { - FX_memset(this, 0, sizeof(CFDE_CSSNonInheritedData)); + FXSYS_memset(this, 0, sizeof(CFDE_CSSNonInheritedData)); m_MarginWidth = m_BorderWidth = m_PaddingWidth.Set(FDE_CSSLENGTHUNIT_Point, 0); m_MinBoxSize.Set(FDE_CSSLENGTHUNIT_Point, 0); diff --git a/xfa/src/fgas/include/fx_sys.h b/xfa/src/fgas/include/fx_sys.h index b4732d7728..5b5382ec14 100644 --- a/xfa/src/fgas/include/fx_sys.h +++ b/xfa/src/fgas/include/fx_sys.h @@ -7,61 +7,15 @@ #ifndef XFA_SRC_FGAS_INCLUDE_FX_SYS_H_ #define XFA_SRC_FGAS_INCLUDE_FX_SYS_H_ -#ifdef __cplusplus -extern "C" { -#endif #define FX_RAD2DEG(r) ((r)*180.0f / FX_PI) #define FX_DEG2RAD(a) ((a)*FX_PI / 180.0f) -typedef int8_t* FX_LPINT8; -typedef int8_t const* FX_LPCINT8; -typedef int32_t* FX_LPINT32; -typedef int32_t const* FX_LPCINT32; -typedef long FX_LONG; -typedef FX_LONG* FX_LPLONG; -typedef FX_LONG const* FX_LPCLONG; -typedef FX_FLOAT const* FX_LPCFLOAT; -typedef double FX_DOUBLE; -typedef FX_DOUBLE* FX_LPDOUBLE; -typedef FX_DOUBLE const* FX_LPCDOUBLE; -FX_FLOAT FX_tan(FX_FLOAT a); -FX_FLOAT FX_log(FX_FLOAT b, FX_FLOAT x); -FX_FLOAT FX_strtof(const FX_CHAR* pcsStr, - int32_t iLength = -1, - int32_t* pUsedLen = NULL); + FX_FLOAT FX_wcstof(const FX_WCHAR* pwsStr, int32_t iLength = -1, int32_t* pUsedLen = NULL); -FX_WCHAR* FX_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count); int32_t FX_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count); -int32_t FX_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count); -inline FX_BOOL FX_islower(int32_t ch) { - return ch >= 'a' && ch <= 'z'; -} -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; -} -inline int32_t FX_toupper(int32_t ch) { - return FX_islower(ch) ? (ch - 0x20) : ch; -} + int32_t FX_filelength(FXSYS_FILE* file); FX_BOOL FX_fsetsize(FXSYS_FILE* file, int32_t size); -void FX_memset(void* pBuf, int32_t iValue, size_t size); -void FX_memcpy(void* pDst, const void* pSrc, size_t size); -FX_BOOL FX_IsRelativePath(const CFX_WideStringC& wsPath); -FX_BOOL FX_JoinPath(const CFX_WideStringC& wsBasePath, - const CFX_WideStringC& wsRelativePath, - CFX_WideString& wsAbsolutePath); -typedef struct _FX_VERSION { - FX_DWORD dwMajorVersion; - FX_DWORD dwMinorVersion; - FX_DWORD dwBuildVersion; -} FX_VERSION, *FX_LPVERSION; -typedef FX_VERSION const* FX_LPCVERSION; -#ifdef __cplusplus -}; -#endif #endif // XFA_SRC_FGAS_INCLUDE_FX_SYS_H_ diff --git a/xfa/src/fgas/src/crt/fx_system.cpp b/xfa/src/fgas/src/crt/fx_system.cpp index b11fcd271e..cfac8bfcd7 100644 --- a/xfa/src/fgas/src/crt/fx_system.cpp +++ b/xfa/src/fgas/src/crt/fx_system.cpp @@ -13,23 +13,19 @@ #elif _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_LINUX_Mini_ #include <sys/times.h> #endif -#ifdef __cplusplus -extern "C" { -#endif -FX_FLOAT FX_tan(FX_FLOAT a) { - return (FX_FLOAT)tan(a); -} -FX_FLOAT FX_log(FX_FLOAT b, FX_FLOAT x) { - return FXSYS_log(x) / FXSYS_log(b); + +namespace { + +inline FX_BOOL FX_isupper(int32_t ch) { + return ch >= 'A' && ch <= 'Z'; } -FX_WCHAR* FX_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count) { - FXSYS_assert(dstStr != NULL && srcStr != NULL && count > 0); - for (size_t i = 0; i < count; ++i) - if ((dstStr[i] = srcStr[i]) == L'\0') { - break; - } - return dstStr; + +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) { FXSYS_assert(s1 != NULL && s2 != NULL && count > 0); FX_WCHAR wch1 = 0, wch2 = 0; @@ -42,18 +38,7 @@ int32_t FX_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count) { } return wch1 - wch2; } -int32_t FX_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count) { - FXSYS_assert(s1 != NULL && s2 != NULL && count > 0); - FX_CHAR ch1 = 0, ch2 = 0; - while (count-- > 0) { - ch1 = (FX_CHAR)FX_tolower(*s1++); - ch2 = (FX_CHAR)FX_tolower(*s2++); - if (ch1 != ch2) { - break; - } - } - return ch1 - ch2; -} + int32_t FX_filelength(FXSYS_FILE* file) { FXSYS_assert(file != NULL); #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ @@ -66,6 +51,7 @@ int32_t FX_filelength(FXSYS_FILE* file) { return iLen; #endif } + FX_BOOL FX_fsetsize(FXSYS_FILE* file, int32_t size) { FXSYS_assert(file != NULL); #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ @@ -81,14 +67,7 @@ FX_BOOL FX_fsetsize(FXSYS_FILE* file, int32_t size) { return FALSE; #endif } -FX_FLOAT FX_strtof(const FX_CHAR* pcsStr, int32_t iLength, int32_t* pUsedLen) { - FXSYS_assert(pcsStr != NULL); - if (iLength < 0) { - iLength = FXSYS_strlen(pcsStr); - } - return FX_wcstof(CFX_WideString::FromLocal(CFX_ByteString(pcsStr, iLength)), - iLength, pUsedLen); -} + FX_FLOAT FX_wcstof(const FX_WCHAR* pwsStr, int32_t iLength, int32_t* pUsedLen) { FXSYS_assert(pwsStr != NULL); if (iLength < 0) { @@ -133,97 +112,3 @@ FX_FLOAT FX_wcstof(const FX_WCHAR* pwsStr, int32_t iLength, int32_t* pUsedLen) { } return bNegtive ? -fValue : fValue; } -void FX_memset(void* pBuf, int32_t iValue, size_t size) { - FXSYS_assert(pBuf != NULL && size > 0 && (size & 0x03) == 0); - FXSYS_assert((((size_t)pBuf) & 0x03) == 0); - FX_DWORD* pStart = (FX_DWORD*)pBuf; - FX_DWORD* pEnd = pStart + (size >> 2); - while (pStart < pEnd) { - *pStart++ = iValue; - } -} -void FX_memcpy(void* pDst, const void* pSrc, size_t size) { - FXSYS_assert(pDst != NULL && pSrc != NULL && size > 0 && (size & 0x03) == 0); - FXSYS_assert((((size_t)pDst) & 0x03) == 0 && (((size_t)pSrc) & 0x03) == 0); - FX_DWORD* pStart = (FX_DWORD*)pDst; - FX_DWORD* pEnd = pStart + (size >> 2); - FX_DWORD* pValue = (FX_DWORD*)pSrc; - while (pStart < pEnd) { - *pStart++ = *pValue++; - } -} -FX_BOOL FX_IsRelativePath(const CFX_WideStringC& wsUrl) { - int32_t iUrlLen = wsUrl.GetLength(); - if (iUrlLen == 0) { - return TRUE; - } - for (int32_t i = std::min(5, iUrlLen) - 1; i >= 0; --i) - if (wsUrl.GetAt(i) == ':') { - return FALSE; - } - return TRUE; -} -FX_BOOL FX_JoinPath(const CFX_WideStringC& wsBasePath, - const CFX_WideStringC& wsRelativePath, - CFX_WideString& wsAbsolutePath) { - if (!FX_IsRelativePath(wsRelativePath)) { - wsAbsolutePath = wsRelativePath; - return TRUE; - } - const FX_WCHAR* pRelStart = wsRelativePath.GetPtr(); - const FX_WCHAR* pRelEnd = pRelStart + wsRelativePath.GetLength(); - if (pRelStart < pRelEnd) { - switch (*pRelStart) { - case '#': - wsAbsolutePath = CFX_WideString(wsBasePath, wsRelativePath); - return wsAbsolutePath.GetLength() > 0; - case '/': - case '\\': - wsAbsolutePath = wsRelativePath; - return wsAbsolutePath.GetLength() > 0; - } - } - int32_t nBackCount = 0; - for (;;) { - if (pRelStart >= pRelEnd) { - wsAbsolutePath = wsBasePath; - return TRUE; - } - if (*pRelStart != '.') { - break; - } - if (pRelStart + 1 < pRelEnd && - (pRelStart[1] == '/' || pRelStart[1] == '\\')) { - pRelStart += 2; - } else if (pRelStart + 2 < pRelEnd && pRelStart[1] == '.' && - (pRelStart[2] == '/' || pRelStart[2] == '\\')) { - pRelStart += 3; - nBackCount++; - } else { - return FALSE; - } - } - const FX_WCHAR* pBaseStart = wsBasePath.GetPtr(); - const FX_WCHAR* pBaseEnd = pBaseStart + wsBasePath.GetLength(); - while (pBaseStart < (--pBaseEnd) && *pBaseEnd != '/' && *pBaseEnd != '\\') - ; - if (pBaseStart == pBaseEnd) { - wsAbsolutePath = CFX_WideStringC(pRelStart, pRelEnd - pRelStart); - return wsAbsolutePath.GetLength() > 0; - } - while (nBackCount > 0) { - if (pBaseStart >= (--pBaseEnd)) { - return FALSE; - } else if (*pBaseEnd == '/' || *pBaseEnd == '\\') - if ((--nBackCount) <= 0) { - break; - } - } - wsAbsolutePath = - CFX_WideString(CFX_WideStringC(pBaseStart, pBaseEnd - pBaseStart + 1), - CFX_WideStringC(pRelStart, pRelEnd - pRelStart)); - return wsAbsolutePath.GetLength() > 0; -} -#ifdef __cplusplus -}; -#endif diff --git a/xfa/src/fgas/src/crt/fx_utils.cpp b/xfa/src/fgas/src/crt/fx_utils.cpp index 470abf4319..8f43d4474b 100644 --- a/xfa/src/fgas/src/crt/fx_utils.cpp +++ b/xfa/src/fgas/src/crt/fx_utils.cpp @@ -88,8 +88,8 @@ int32_t CFX_BaseArray::Append(const CFX_BaseArray& src, } uint8_t* pDst = m_pData->pBuffer + iBlockCount * iBlockSize; AddSpaceTo(iBlockCount + iCount - 1); - FX_memcpy(pDst, src.m_pData->pBuffer + iStart * iBlockSize, - iCount * iBlockSize); + FXSYS_memcpy(pDst, src.m_pData->pBuffer + iStart * iBlockSize, + iCount * iBlockSize); return iCount; } int32_t CFX_BaseArray::Copy(const CFX_BaseArray& src, @@ -110,8 +110,8 @@ int32_t CFX_BaseArray::Copy(const CFX_BaseArray& src, } RemoveAll(TRUE); AddSpaceTo(iCount - 1); - FX_memcpy(m_pData->pBuffer, src.m_pData->pBuffer + iStart * iBlockSize, - iCount * iBlockSize); + FXSYS_memcpy(m_pData->pBuffer, src.m_pData->pBuffer + iStart * iBlockSize, + iCount * iBlockSize); return iCount; } int32_t CFX_BaseArray::RemoveLast(int32_t iCount) { diff --git a/xfa/src/fxfa/src/app/xfa_textlayout.cpp b/xfa/src/fxfa/src/app/xfa_textlayout.cpp index 637e7b848a..b6eb986f4c 100644 --- a/xfa/src/fxfa/src/app/xfa_textlayout.cpp +++ b/xfa/src/fxfa/src/app/xfa_textlayout.cpp @@ -52,8 +52,8 @@ void CXFA_TextParseContext::SetDecls(const IFDE_CSSDeclaration** ppDeclArray, } m_dwMatchedDecls = iDeclCount; m_ppMatchedDecls = FX_Alloc(IFDE_CSSDeclaration*, iDeclCount); - FX_memcpy(m_ppMatchedDecls, ppDeclArray, - iDeclCount * sizeof(IFDE_CSSDeclaration*)); + FXSYS_memcpy(m_ppMatchedDecls, ppDeclArray, + iDeclCount * sizeof(IFDE_CSSDeclaration*)); } CXFA_TextParser::~CXFA_TextParser() { if (m_pUASheet != NULL) { diff --git a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp index fd6b23d1ec..4b6fc0ccbe 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp @@ -7172,7 +7172,7 @@ static FXJSE_FUNCTION formcalc_fm2js_functions[] = { }; CXFA_FM2JSContext::CXFA_FM2JSContext() : m_hFMClass(nullptr), m_pDocument(nullptr) { - FX_memset(&m_fmClass, 0, sizeof(FXJSE_CLASS)); + FXSYS_memset(&m_fmClass, 0, sizeof(FXJSE_CLASS)); } CXFA_FM2JSContext::~CXFA_FM2JSContext() { m_pDocument = NULL; diff --git a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp index 02e214de18..8c820fcb99 100644 --- a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp @@ -3931,13 +3931,13 @@ FX_BOOL CXFA_Node::TryMeasure(XFA_ATTRIBUTE eAttr, void* pValue; int32_t iBytes; if (GetMapModuleBuffer(pKey, pValue, iBytes) && iBytes == sizeof(mValue)) { - FX_memcpy(&mValue, pValue, sizeof(mValue)); + FXSYS_memcpy(&mValue, pValue, sizeof(mValue)); return TRUE; } if (bUseDefault && XFA_GetAttributeDefaultValue(pValue, GetClassID(), eAttr, XFA_ATTRIBUTETYPE_Measure, m_ePacket)) { - FX_memcpy(&mValue, pValue, sizeof(mValue)); + FXSYS_memcpy(&mValue, pValue, sizeof(mValue)); return TRUE; } return FALSE; diff --git a/xfa/src/fxfa/src/parser/xfa_script_imp.cpp b/xfa/src/fxfa/src/parser/xfa_script_imp.cpp index f5c1673460..6897acf785 100644 --- a/xfa/src/fxfa/src/parser/xfa_script_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_script_imp.cpp @@ -29,8 +29,8 @@ CXFA_ScriptContext::CXFA_ScriptContext(CXFA_Document* pDocument) m_pThisObject(nullptr), m_dwBuiltInInFlags(0), m_eRunAtType(XFA_ATTRIBUTEENUM_Client) { - FX_memset(&m_JsGlobalClass, 0, sizeof(FXJSE_CLASS)); - FX_memset(&m_JsNormalClass, 0, sizeof(FXJSE_CLASS)); + FXSYS_memset(&m_JsGlobalClass, 0, sizeof(FXJSE_CLASS)); + FXSYS_memset(&m_JsNormalClass, 0, sizeof(FXJSE_CLASS)); } CXFA_ScriptContext::~CXFA_ScriptContext() { FX_POSITION ps = m_mapXFAToHValue.GetStartPosition(); |