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_FXCRT_FX_EXT_H_ | 7 #ifndef CORE_FXCRT_FX_EXT_H_ |
8 #define CORE_FXCRT_FX_EXT_H_ | 8 #define CORE_FXCRT_FX_EXT_H_ |
9 | 9 |
10 #include <cctype> | 10 #include <cctype> |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 typedef struct FX_GUID { | 94 typedef struct FX_GUID { |
95 uint32_t data1; | 95 uint32_t data1; |
96 uint16_t data2; | 96 uint16_t data2; |
97 uint16_t data3; | 97 uint16_t data3; |
98 uint8_t data4[8]; | 98 uint8_t data4[8]; |
99 } FX_GUID, *FX_LPGUID; | 99 } FX_GUID, *FX_LPGUID; |
100 typedef FX_GUID const* FX_LPCGUID; | 100 typedef FX_GUID const* FX_LPCGUID; |
101 void FX_GUID_CreateV4(FX_LPGUID pGUID); | 101 void FX_GUID_CreateV4(FX_LPGUID pGUID); |
102 void FX_GUID_ToString(FX_LPCGUID pGUID, | 102 void FX_GUID_ToString(FX_LPCGUID pGUID, |
103 CFX_ByteString& bsStr, | 103 CFX_ByteString& bsStr, |
104 FX_BOOL bSeparator = TRUE); | 104 bool bSeparator = true); |
105 #endif // PDF_ENABLE_XFA | 105 #endif // PDF_ENABLE_XFA |
106 | 106 |
107 template <class baseType> | 107 template <class baseType> |
108 class CFX_SSortTemplate { | 108 class CFX_SSortTemplate { |
109 public: | 109 public: |
110 void ShellSort(baseType* pArray, int32_t iCount) { | 110 void ShellSort(baseType* pArray, int32_t iCount) { |
111 ASSERT(pArray && iCount > 0); | 111 ASSERT(pArray && iCount > 0); |
112 int32_t i, j, gap; | 112 int32_t i, j, gap; |
113 baseType v1, v2; | 113 baseType v1, v2; |
114 gap = iCount >> 1; | 114 gap = iCount >> 1; |
115 while (gap > 0) { | 115 while (gap > 0) { |
116 for (i = gap; i < iCount; i++) { | 116 for (i = gap; i < iCount; i++) { |
117 j = i - gap; | 117 j = i - gap; |
118 v1 = pArray[i]; | 118 v1 = pArray[i]; |
119 while (j > -1 && (v2 = pArray[j]) > v1) { | 119 while (j > -1 && (v2 = pArray[j]) > v1) { |
120 pArray[j + gap] = v2; | 120 pArray[j + gap] = v2; |
121 j -= gap; | 121 j -= gap; |
122 } | 122 } |
123 pArray[j + gap] = v1; | 123 pArray[j + gap] = v1; |
124 } | 124 } |
125 gap >>= 1; | 125 gap >>= 1; |
126 } | 126 } |
127 } | 127 } |
128 }; | 128 }; |
129 | 129 |
130 #endif // CORE_FXCRT_FX_EXT_H_ | 130 #endif // CORE_FXCRT_FX_EXT_H_ |
OLD | NEW |