| 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 "fx_arb.h" | 10 #include "fx_arb.h" |
| 11 #include "fx_basic.h" | 11 #include "fx_basic.h" |
| 12 #include "fx_coordinates.h" | 12 #include "fx_coordinates.h" |
| 13 #include "fx_ucd.h" | 13 #include "fx_ucd.h" |
| 14 #include "fx_xml.h" | 14 #include "fx_xml.h" |
| 15 | 15 |
| 16 #ifdef __cplusplus | 16 #ifdef __cplusplus |
| 17 extern "C" { | 17 extern "C" { |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 FX_FLOAT FXSYS_tan(FX_FLOAT a); | 20 FX_FLOAT FXSYS_tan(FX_FLOAT a); |
| 21 FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); | 21 FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); |
| 22 FX_FLOAT» » FXSYS_strtof(FX_LPCSTR pcsStr, FX_INT32 iLength = -1, FX
_INT32 *pUsedLen = NULL); | 22 FX_FLOAT» » FXSYS_strtof(FX_LPCSTR pcsStr, int32_t iLength = -1, int
32_t *pUsedLen = NULL); |
| 23 FX_FLOAT» » FXSYS_wcstof(FX_LPCWSTR pwsStr, FX_INT32 iLength = -1, F
X_INT32 *pUsedLen = NULL); | 23 FX_FLOAT» » FXSYS_wcstof(FX_LPCWSTR pwsStr, int32_t iLength = -1, in
t32_t *pUsedLen = NULL); |
| 24 FX_LPWSTR FXSYS_wcsncpy(FX_LPWSTR dstStr, FX_LPCWSTR srcStr, size_
t count); | 24 FX_LPWSTR FXSYS_wcsncpy(FX_LPWSTR dstStr, FX_LPCWSTR srcStr, size_
t count); |
| 25 FX_INT32» » FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t coun
t); | 25 int32_t»» FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count); |
| 26 FX_INT32» » FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count)
; | 26 int32_t»» FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count); |
| 27 | 27 |
| 28 inline FX_BOOL» FXSYS_islower(FX_INT32 ch) | 28 inline FX_BOOL» FXSYS_islower(int32_t ch) |
| 29 { | 29 { |
| 30 return ch >= 'a' && ch <= 'z'; | 30 return ch >= 'a' && ch <= 'z'; |
| 31 } | 31 } |
| 32 inline FX_BOOL» FXSYS_isupper(FX_INT32 ch) | 32 inline FX_BOOL» FXSYS_isupper(int32_t ch) |
| 33 { | 33 { |
| 34 return ch >= 'A' && ch <= 'Z'; | 34 return ch >= 'A' && ch <= 'Z'; |
| 35 } | 35 } |
| 36 inline FX_INT32»FXSYS_tolower(FX_INT32 ch) | 36 inline int32_t» FXSYS_tolower(int32_t ch) |
| 37 { | 37 { |
| 38 return ch < 'A' || ch > 'Z' ? ch : (ch + 0x20); | 38 return ch < 'A' || ch > 'Z' ? ch : (ch + 0x20); |
| 39 } | 39 } |
| 40 inline FX_INT32 FXSYS_toupper(FX_INT32 ch) | 40 inline int32_t FXSYS_toupper(int32_t ch) |
| 41 { | 41 { |
| 42 return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); | 42 return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); |
| 43 } | 43 } |
| 44 | 44 |
| 45 FX_DWORD» FX_HashCode_String_GetA(FX_LPCSTR pStr, FX_INT32 iLength, FX_BOO
L bIgnoreCase = FALSE); | 45 FX_DWORD» FX_HashCode_String_GetA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL
bIgnoreCase = FALSE); |
| 46 FX_DWORD» FX_HashCode_String_GetW(FX_LPCWSTR pStr, FX_INT32 iLength, FX_BO
OL bIgnoreCase = FALSE); | 46 FX_DWORD» FX_HashCode_String_GetW(FX_LPCWSTR pStr, int32_t iLength, FX_BOO
L bIgnoreCase = FALSE); |
| 47 | 47 |
| 48 #ifdef __cplusplus | 48 #ifdef __cplusplus |
| 49 } | 49 } |
| 50 #endif | 50 #endif |
| 51 #ifdef __cplusplus | 51 #ifdef __cplusplus |
| 52 extern "C" { | 52 extern "C" { |
| 53 #endif | 53 #endif |
| 54 | 54 |
| 55 FX_LPVOID FX_Random_MT_Start(FX_DWORD dwSeed); | 55 FX_LPVOID FX_Random_MT_Start(FX_DWORD dwSeed); |
| 56 | 56 |
| 57 FX_DWORD FX_Random_MT_Generate(FX_LPVOID pContext); | 57 FX_DWORD FX_Random_MT_Generate(FX_LPVOID pContext); |
| 58 | 58 |
| 59 void FX_Random_MT_Close(FX_LPVOID pContext); | 59 void FX_Random_MT_Close(FX_LPVOID pContext); |
| 60 | 60 |
| 61 void» » FX_Random_GenerateBase(FX_LPDWORD pBuffer, FX_INT32 iCount); | 61 void» » FX_Random_GenerateBase(FX_LPDWORD pBuffer, int32_t iCount); |
| 62 | 62 |
| 63 void» » FX_Random_GenerateMT(FX_LPDWORD pBuffer, FX_INT32 iCount); | 63 void» » FX_Random_GenerateMT(FX_LPDWORD pBuffer, int32_t iCount); |
| 64 | 64 |
| 65 void» » FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, FX_INT32 iCount); | 65 void» » FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, int32_t iCount); |
| 66 #ifdef __cplusplus | 66 #ifdef __cplusplus |
| 67 } | 67 } |
| 68 #endif | 68 #endif |
| 69 #ifdef __cplusplus | 69 #ifdef __cplusplus |
| 70 extern "C" { | 70 extern "C" { |
| 71 #endif | 71 #endif |
| 72 | 72 |
| 73 typedef struct FX_GUID { | 73 typedef struct FX_GUID { |
| 74 FX_DWORD data1; | 74 FX_DWORD data1; |
| 75 FX_WORD data2; | 75 FX_WORD data2; |
| 76 FX_WORD data3; | 76 FX_WORD data3; |
| 77 FX_BYTE» » data4[8]; | 77 uint8_t» » data4[8]; |
| 78 } FX_GUID, * FX_LPGUID; | 78 } FX_GUID, * FX_LPGUID; |
| 79 typedef FX_GUID const * FX_LPCGUID; | 79 typedef FX_GUID const * FX_LPCGUID; |
| 80 | 80 |
| 81 void FX_GUID_CreateV4(FX_LPGUID pGUID); | 81 void FX_GUID_CreateV4(FX_LPGUID pGUID); |
| 82 | 82 |
| 83 void FX_GUID_ToString(FX_LPCGUID pGUID, CFX_ByteString &bsStr, FX_BOOL bSepar
ator = TRUE); | 83 void FX_GUID_ToString(FX_LPCGUID pGUID, CFX_ByteString &bsStr, FX_BOOL bSepar
ator = TRUE); |
| 84 #ifdef __cplusplus | 84 #ifdef __cplusplus |
| 85 } | 85 } |
| 86 #endif | 86 #endif |
| 87 template<class baseType> | 87 template<class baseType> |
| 88 class CFX_SSortTemplate | 88 class CFX_SSortTemplate |
| 89 { | 89 { |
| 90 public: | 90 public: |
| 91 void ShellSort(baseType *pArray, FX_INT32 iCount) | 91 void ShellSort(baseType *pArray, int32_t iCount) |
| 92 { | 92 { |
| 93 FXSYS_assert(pArray != NULL && iCount > 0); | 93 FXSYS_assert(pArray != NULL && iCount > 0); |
| 94 FX_INT32 i, j, gap; | 94 int32_t i, j, gap; |
| 95 baseType v1, v2; | 95 baseType v1, v2; |
| 96 gap = iCount >> 1; | 96 gap = iCount >> 1; |
| 97 while (gap > 0) { | 97 while (gap > 0) { |
| 98 for (i = gap; i < iCount; i ++) { | 98 for (i = gap; i < iCount; i ++) { |
| 99 j = i - gap; | 99 j = i - gap; |
| 100 v1 = pArray[i]; | 100 v1 = pArray[i]; |
| 101 while (j > -1 && (v2 = pArray[j]) > v1) { | 101 while (j > -1 && (v2 = pArray[j]) > v1) { |
| 102 pArray[j + gap] = v2; | 102 pArray[j + gap] = v2; |
| 103 j -= gap; | 103 j -= gap; |
| 104 } | 104 } |
| 105 pArray[j + gap] = v1; | 105 pArray[j + gap] = v1; |
| 106 } | 106 } |
| 107 gap >>= 1; | 107 gap >>= 1; |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ | 112 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| OLD | NEW |