| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef CORE_INCLUDE_FXCRT_FX_EXT_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| 8 #define CORE_INCLUDE_FXCRT_FX_EXT_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| 9 | 9 |
| 10 #include <cctype> | 10 #include <cctype> |
| 11 #include <cwctype> | 11 #include <cwctype> |
| 12 | 12 |
| 13 #ifdef PDF_ENABLE_XFA |
| 13 #include "fx_string.h" | 14 #include "fx_string.h" |
| 15 #endif |
| 14 #include "fx_system.h" | 16 #include "fx_system.h" |
| 15 | 17 |
| 16 FX_FLOAT FXSYS_tan(FX_FLOAT a); | 18 FX_FLOAT FXSYS_tan(FX_FLOAT a); |
| 17 FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); | 19 FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); |
| 18 FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, | 20 FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, |
| 19 int32_t iLength = -1, | 21 int32_t iLength = -1, |
| 20 int32_t* pUsedLen = NULL); | 22 int32_t* pUsedLen = NULL); |
| 21 FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, | 23 FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, |
| 22 int32_t iLength = -1, | 24 int32_t iLength = -1, |
| 23 int32_t* pUsedLen = NULL); | 25 int32_t* pUsedLen = NULL); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 FX_DWORD FX_Random_MT_Generate(void* pContext); | 71 FX_DWORD FX_Random_MT_Generate(void* pContext); |
| 70 | 72 |
| 71 void FX_Random_MT_Close(void* pContext); | 73 void FX_Random_MT_Close(void* pContext); |
| 72 | 74 |
| 73 void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount); | 75 void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount); |
| 74 | 76 |
| 75 void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount); | 77 void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount); |
| 76 | 78 |
| 77 void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount); | 79 void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount); |
| 78 | 80 |
| 81 #ifdef PDF_ENABLE_XFA |
| 79 typedef struct FX_GUID { | 82 typedef struct FX_GUID { |
| 80 FX_DWORD data1; | 83 FX_DWORD data1; |
| 81 FX_WORD data2; | 84 FX_WORD data2; |
| 82 FX_WORD data3; | 85 FX_WORD data3; |
| 83 uint8_t data4[8]; | 86 uint8_t data4[8]; |
| 84 } FX_GUID, *FX_LPGUID; | 87 } FX_GUID, *FX_LPGUID; |
| 85 typedef FX_GUID const* FX_LPCGUID; | 88 typedef FX_GUID const* FX_LPCGUID; |
| 86 | 89 |
| 87 void FX_GUID_CreateV4(FX_LPGUID pGUID); | 90 void FX_GUID_CreateV4(FX_LPGUID pGUID); |
| 88 | 91 |
| 89 void FX_GUID_ToString(FX_LPCGUID pGUID, | 92 void FX_GUID_ToString(FX_LPCGUID pGUID, |
| 90 CFX_ByteString& bsStr, | 93 CFX_ByteString& bsStr, |
| 91 FX_BOOL bSeparator = TRUE); | 94 FX_BOOL bSeparator = TRUE); |
| 92 | 95 |
| 96 #endif |
| 93 template <class baseType> | 97 template <class baseType> |
| 94 class CFX_SSortTemplate { | 98 class CFX_SSortTemplate { |
| 95 public: | 99 public: |
| 96 void ShellSort(baseType* pArray, int32_t iCount) { | 100 void ShellSort(baseType* pArray, int32_t iCount) { |
| 97 FXSYS_assert(pArray != NULL && iCount > 0); | 101 FXSYS_assert(pArray != NULL && iCount > 0); |
| 98 int32_t i, j, gap; | 102 int32_t i, j, gap; |
| 99 baseType v1, v2; | 103 baseType v1, v2; |
| 100 gap = iCount >> 1; | 104 gap = iCount >> 1; |
| 101 while (gap > 0) { | 105 while (gap > 0) { |
| 102 for (i = gap; i < iCount; i++) { | 106 for (i = gap; i < iCount; i++) { |
| 103 j = i - gap; | 107 j = i - gap; |
| 104 v1 = pArray[i]; | 108 v1 = pArray[i]; |
| 105 while (j > -1 && (v2 = pArray[j]) > v1) { | 109 while (j > -1 && (v2 = pArray[j]) > v1) { |
| 106 pArray[j + gap] = v2; | 110 pArray[j + gap] = v2; |
| 107 j -= gap; | 111 j -= gap; |
| 108 } | 112 } |
| 109 pArray[j + gap] = v1; | 113 pArray[j + gap] = v1; |
| 110 } | 114 } |
| 111 gap >>= 1; | 115 gap >>= 1; |
| 112 } | 116 } |
| 113 } | 117 } |
| 114 }; | 118 }; |
| 115 | 119 |
| 116 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ | 120 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| OLD | NEW |