diff --git a/container/bloom_filter_test.cpp b/container/bloom_filter_test.cpp index 28481c6..f84311b 100644 --- a/container/bloom_filter_test.cpp +++ b/container/bloom_filter_test.cpp @@ -27,8 +27,9 @@ TEST(BloomFilter, FalsePositiveRate) } } std::cout << "total_conflicts: " << total_conflicts << "\n"; - if (total_conflicts > 0) + if (total_conflicts > 0) { EXPECT_GT(capacity/total_conflicts, 1000) << total_conflicts; + } } TEST(BloomFilter, Bitmap) diff --git a/container/lru_cache_test.cpp b/container/lru_cache_test.cpp index 1ba99da..d3a3a6b 100644 --- a/container/lru_cache_test.cpp +++ b/container/lru_cache_test.cpp @@ -111,8 +111,9 @@ static void ReadThread(LruCache *cache) { while (RealtimeClock.MicroSeconds() - now < 500) { for (int i = 2; i < 1000; ++i) { bool r = cache->Get(i, &value); - if (r) + if (r) { ASSERT_EQ(0, value % i); + } } } } diff --git a/hash/hash_benchmark.cpp b/hash/hash_benchmark.cpp index d8e312c..67176fc 100644 --- a/hash/hash_benchmark.cpp +++ b/hash/hash_benchmark.cpp @@ -62,7 +62,7 @@ static void MurmurHash64B(int n) { static void CRC32(int n) { for (int i = 0; i < n; i++) { - toft::CRC32(test_str); + toft::CRC32::Digest(test_str); } } diff --git a/net/uri/uri.cpp b/net/uri/uri.cpp index c964c0d..840ffa5 100644 --- a/net/uri/uri.cpp +++ b/net/uri/uri.cpp @@ -915,7 +915,7 @@ bool URI::WriteToBuffer(char* buffer, size_t buffer_size, size_t* result_size) c *result_size = static_cast(oss.tellp()); buffer[*result_size] = '\0'; - return oss; + return oss.good(); } void URI::Swap(URI* other) diff --git a/net/uri/uri_test.cpp b/net/uri/uri_test.cpp index cadaac1..f133dff 100644 --- a/net/uri/uri_test.cpp +++ b/net/uri/uri_test.cpp @@ -234,8 +234,9 @@ TEST_F(BatchTest, Test) { bool parse_result = uri.Parse(urls[j]); EXPECT_TRUE(parse_result) << urls[j]; - if (parse_result) + if (parse_result) { EXPECT_EQ(urls[j], uri.ToString()); + } } } } diff --git a/system/atomic/functions.h b/system/atomic/functions.h index 203e876..8392f7c 100644 --- a/system/atomic/functions.h +++ b/system/atomic/functions.h @@ -83,7 +83,8 @@ void EnsureLinkedWithAtomicLibrary(); template T AtomicGet(const T* ptr) { - return __sync_fetch_and_add(const_cast(ptr), 0); + __sync_synchronize(); + return *ptr; } template