OLD | NEW |
1 // Copyright (C) 2009-2013, International Business Machines | 1 // Copyright (C) 2009-2013, International Business Machines |
2 // Corporation and others. All Rights Reserved. | 2 // Corporation and others. All Rights Reserved. |
3 // | 3 // |
4 // Copyright 2004 and onwards Google Inc. | 4 // Copyright 2004 and onwards Google Inc. |
5 // | 5 // |
6 // Author: wilsonh@google.com (Wilson Hsieh) | 6 // Author: wilsonh@google.com (Wilson Hsieh) |
7 // | 7 // |
8 | 8 |
9 #include "unicode/utypes.h" | 9 #include "unicode/utypes.h" |
10 #include "unicode/stringpiece.h" | 10 #include "unicode/stringpiece.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 const char* p = x.data(); | 61 const char* p = x.data(); |
62 const char* p2 = y.data(); | 62 const char* p2 = y.data(); |
63 // Test last byte in case strings share large common prefix | 63 // Test last byte in case strings share large common prefix |
64 --len; | 64 --len; |
65 if (p[len] != p2[len]) return false; | 65 if (p[len] != p2[len]) return false; |
66 // At this point we can, but don't have to, ignore the last byte. | 66 // At this point we can, but don't have to, ignore the last byte. |
67 return uprv_memcmp(p, p2, len) == 0; | 67 return uprv_memcmp(p, p2, len) == 0; |
68 } | 68 } |
69 | 69 |
70 | 70 |
| 71 /* Microsoft Visual Studio (even 2013) complains about redefinition of this |
| 72 * static const class variable. However, the C++ standard states that this |
| 73 * definition is correct. Perhaps there is a bug in the Microsoft compiler. |
| 74 * This is not an issue on any other compilers (that we know of). |
| 75 * Cygwin with MSVC 9.0 also complains here about redefinition. |
| 76 */ |
| 77 #if (!defined(_MSC_VER) || (_MSC_VER > 1800)) && !defined(CYGWINMSVC) |
71 const int32_t StringPiece::npos = 0x7fffffff; | 78 const int32_t StringPiece::npos = 0x7fffffff; |
| 79 #endif |
72 | 80 |
73 U_NAMESPACE_END | 81 U_NAMESPACE_END |
OLD | NEW |