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 #include "core/fxcrt/extension.h" | 7 #include "core/fxcrt/extension.h" |
8 #include "core/fxcrt/include/fx_basic.h" | 8 #include "core/fxcrt/include/fx_basic.h" |
9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
10 | 10 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 ch1 = (FX_CHAR)FXSYS_tolower(*s1++); | 212 ch1 = (FX_CHAR)FXSYS_tolower(*s1++); |
213 ch2 = (FX_CHAR)FXSYS_tolower(*s2++); | 213 ch2 = (FX_CHAR)FXSYS_tolower(*s2++); |
214 if (ch1 != ch2) { | 214 if (ch1 != ch2) { |
215 break; | 215 break; |
216 } | 216 } |
217 } | 217 } |
218 return ch1 - ch2; | 218 return ch1 - ch2; |
219 } | 219 } |
220 | 220 |
221 uint32_t FX_HashCode_GetA(const CFX_ByteStringC& str, bool bIgnoreCase) { | 221 uint32_t FX_HashCode_GetA(const CFX_ByteStringC& str, bool bIgnoreCase) { |
222 const FX_CHAR* pStr = str.c_str(); | |
223 const FX_CHAR* pStrEnd = pStr + str.GetLength(); | |
224 uint32_t dwHashCode = 0; | 222 uint32_t dwHashCode = 0; |
225 if (bIgnoreCase) { | 223 if (bIgnoreCase) { |
226 while (pStr < pStrEnd) { | 224 for (FX_STRSIZE i = 0; i < str.GetLength(); ++i) |
227 dwHashCode = 31 * dwHashCode + FXSYS_tolower(*pStr++); | 225 dwHashCode = 31 * dwHashCode + FXSYS_tolower(str.CharAt(i)); |
228 } | |
229 } else { | 226 } else { |
230 while (pStr < pStrEnd) { | 227 for (FX_STRSIZE i = 0; i < str.GetLength(); ++i) |
231 dwHashCode = 31 * dwHashCode + *pStr++; | 228 dwHashCode = 31 * dwHashCode + str.CharAt(i); |
232 } | |
233 } | 229 } |
234 return dwHashCode; | 230 return dwHashCode; |
235 } | 231 } |
236 | 232 |
237 uint32_t FX_HashCode_GetW(const CFX_WideStringC& str, bool bIgnoreCase) { | 233 uint32_t FX_HashCode_GetW(const CFX_WideStringC& str, bool bIgnoreCase) { |
238 const FX_WCHAR* pStr = str.c_str(); | 234 const FX_WCHAR* pStr = str.c_str(); |
239 const FX_WCHAR* pStrEnd = pStr + str.GetLength(); | 235 const FX_WCHAR* pStrEnd = pStr + str.GetLength(); |
240 uint32_t dwHashCode = 0; | 236 uint32_t dwHashCode = 0; |
241 if (bIgnoreCase) { | 237 if (bIgnoreCase) { |
242 while (pStr < pStrEnd) { | 238 while (pStr < pStrEnd) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 b = ((const uint8_t*)pGUID)[i]; | 367 b = ((const uint8_t*)pGUID)[i]; |
372 *pBuf++ = gs_FX_pHexChars[b >> 4]; | 368 *pBuf++ = gs_FX_pHexChars[b >> 4]; |
373 *pBuf++ = gs_FX_pHexChars[b & 0x0F]; | 369 *pBuf++ = gs_FX_pHexChars[b & 0x0F]; |
374 if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) { | 370 if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) { |
375 *pBuf++ = L'-'; | 371 *pBuf++ = L'-'; |
376 } | 372 } |
377 } | 373 } |
378 bsStr.ReleaseBuffer(bSeparator ? 36 : 32); | 374 bsStr.ReleaseBuffer(bSeparator ? 36 : 32); |
379 } | 375 } |
380 #endif // PDF_ENABLE_XFA | 376 #endif // PDF_ENABLE_XFA |
OLD | NEW |