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 <stddef.h> // For offsetof(). | 7 #include <stddef.h> // For offsetof(). |
8 | 8 |
9 #include "../../include/fxcrt/fx_basic.h" | 9 #include "../../include/fxcrt/fx_basic.h" |
10 #include "../../../third_party/base/numerics/safe_math.h" | 10 #include "../../../third_party/base/numerics/safe_math.h" |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 } | 478 } |
479 return FXSYS_wcsicmp(m_pData->m_String, lpsz); | 479 return FXSYS_wcsicmp(m_pData->m_String, lpsz); |
480 } | 480 } |
481 int CFX_WideString::Compare(const CFX_WideString& str) const | 481 int CFX_WideString::Compare(const CFX_WideString& str) const |
482 { | 482 { |
483 if (m_pData == NULL) { | 483 if (m_pData == NULL) { |
484 if (str.m_pData == NULL) { | 484 if (str.m_pData == NULL) { |
485 return 0; | 485 return 0; |
486 } | 486 } |
487 return -1; | 487 return -1; |
488 } else if (str.m_pData == NULL) { | 488 } |
| 489 if (str.m_pData == NULL) { |
489 return 1; | 490 return 1; |
490 } | 491 } |
491 int this_len = m_pData->m_nDataLength; | 492 int this_len = m_pData->m_nDataLength; |
492 int that_len = str.m_pData->m_nDataLength; | 493 int that_len = str.m_pData->m_nDataLength; |
493 int min_len = this_len < that_len ? this_len : that_len; | 494 int min_len = this_len < that_len ? this_len : that_len; |
494 for (int i = 0; i < min_len; i ++) { | 495 for (int i = 0; i < min_len; i ++) { |
495 if (m_pData->m_String[i] < str.m_pData->m_String[i]) { | 496 if (m_pData->m_String[i] < str.m_pData->m_String[i]) { |
496 return -1; | 497 return -1; |
497 } else if (m_pData->m_String[i] > str.m_pData->m_String[i]) { | 498 } |
| 499 if (m_pData->m_String[i] > str.m_pData->m_String[i]) { |
498 return 1; | 500 return 1; |
499 } | 501 } |
500 } | 502 } |
501 if (this_len < that_len) { | 503 if (this_len < that_len) { |
502 return -1; | 504 return -1; |
503 } else if (this_len > that_len) { | 505 } |
| 506 if (this_len > that_len) { |
504 return 1; | 507 return 1; |
505 } | 508 } |
506 return 0; | 509 return 0; |
507 } | 510 } |
508 void CFX_WideString::SetAt(FX_STRSIZE nIndex, FX_WCHAR ch) | 511 void CFX_WideString::SetAt(FX_STRSIZE nIndex, FX_WCHAR ch) |
509 { | 512 { |
510 if (m_pData == NULL) { | 513 if (m_pData == NULL) { |
511 return; | 514 return; |
512 } | 515 } |
513 ASSERT(nIndex >= 0); | 516 ASSERT(nIndex >= 0); |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 return (CFX_CharMap*)&g_DefaultJISMapper; | 1080 return (CFX_CharMap*)&g_DefaultJISMapper; |
1078 case 936: | 1081 case 936: |
1079 return (CFX_CharMap*)&g_DefaultGBKMapper; | 1082 return (CFX_CharMap*)&g_DefaultGBKMapper; |
1080 case 949: | 1083 case 949: |
1081 return (CFX_CharMap*)&g_DefaultUHCMapper; | 1084 return (CFX_CharMap*)&g_DefaultUHCMapper; |
1082 case 950: | 1085 case 950: |
1083 return (CFX_CharMap*)&g_DefaultBig5Mapper; | 1086 return (CFX_CharMap*)&g_DefaultBig5Mapper; |
1084 } | 1087 } |
1085 return NULL; | 1088 return NULL; |
1086 } | 1089 } |
OLD | NEW |