diff options
Diffstat (limited to 'core/fxcrt')
-rw-r--r-- | core/fxcrt/fx_basic_gcc_unittest.cpp | 10 | ||||
-rw-r--r-- | core/fxcrt/include/fx_string.h | 4 |
2 files changed, 8 insertions, 6 deletions
diff --git a/core/fxcrt/fx_basic_gcc_unittest.cpp b/core/fxcrt/fx_basic_gcc_unittest.cpp index 8d8d2f5deb..c6913cfd82 100644 --- a/core/fxcrt/fx_basic_gcc_unittest.cpp +++ b/core/fxcrt/fx_basic_gcc_unittest.cpp @@ -93,16 +93,16 @@ TEST(fxcrt, FXSYS_wtoi64) { } TEST(fxcrt, FXSYS_atoui) { - EXPECT_EQ(0, FXSYS_atoui("")); - EXPECT_EQ(0, FXSYS_atoui("0")); + EXPECT_EQ(0u, FXSYS_atoui("")); + EXPECT_EQ(0u, FXSYS_atoui("0")); EXPECT_EQ(4294967295, FXSYS_atoui("-1")); - EXPECT_EQ(2345, FXSYS_atoui("2345")); + EXPECT_EQ(2345u, FXSYS_atoui("2345")); // Handle the sign. EXPECT_EQ(4294964951, FXSYS_atoui("-2345")); - EXPECT_EQ(2345, FXSYS_atoui("+2345")); + EXPECT_EQ(2345u, FXSYS_atoui("+2345")); // The max value. EXPECT_EQ(4294967295, FXSYS_atoui("4294967295")); - EXPECT_EQ(9, FXSYS_atoui("9x9")); + EXPECT_EQ(9u, FXSYS_atoui("9x9")); // Out of range values. EXPECT_EQ(4294967295, FXSYS_atoui("2147483623423412348")); diff --git a/core/fxcrt/include/fx_string.h b/core/fxcrt/include/fx_string.h index e5f9466b21..0aa34171c2 100644 --- a/core/fxcrt/include/fx_string.h +++ b/core/fxcrt/include/fx_string.h @@ -134,7 +134,9 @@ inline bool operator==(const char* lhs, const CFX_ByteStringC& rhs) { inline bool operator!=(const char* lhs, const CFX_ByteStringC& rhs) { return rhs != lhs; } -#define FXBSTR_ID(c1, c2, c3, c4) ((c1 << 24) | (c2 << 16) | (c3 << 8) | (c4)) +#define FXBSTR_ID(c1, c2, c3, c4) \ + (((uint32_t)c1 << 24) | ((uint32_t)c2 << 16) | ((uint32_t)c3 << 8) | \ + ((uint32_t)c4)) // A mutable string with shared buffers using copy-on-write semantics that // avoids the cost of std::string's iterator stability guarantees. |