Commit 77cf88a7 authored by Qinfan Wu's avatar Qinfan Wu Committed by Facebook Github Bot 6

Fix FBStringTest build failure and hash computation for wchar

Summary:
Getting some build errors when doing `buck test folly/...`. This seems to be fixing it.

  folly/test/FBStringTest.cpp:1290:23: error: unknown type name 'basic_fbstring'; did you mean 'basic_fstream'?
    using u16fbstring = basic_fbstring<char16_t>;
                        ^~~~~~~~~~~~~~
                        basic_fstream

Also the test `testHashChar16` was failing because only part of the string is used when computing hash.

Reviewed By: yfeldblum

Differential Revision: D3575858

fbshipit-source-id: cdd5bdb9653d50beaf0ec82b659d31354b345441
parent 6871c5cc
......@@ -2440,9 +2440,9 @@ _GLIBCXX_END_NAMESPACE_VERSION
#define FOLLY_FBSTRING_HASH1(T) \
template <> \
struct hash< ::folly::basic_fbstring<T> > { \
struct hash<::folly::basic_fbstring<T>> { \
size_t operator()(const ::folly::basic_fbstring<T>& s) const { \
return ::folly::hash::fnv32_buf(s.data(), s.size()); \
return ::folly::hash::fnv32_buf(s.data(), s.size() * sizeof(T)); \
} \
};
......
......@@ -1287,7 +1287,7 @@ TEST(FBString, testHash) {
#if FOLLY_HAVE_WCHAR_SUPPORT
TEST(FBString, testHashChar16) {
using u16fbstring = basic_fbstring<char16_t>;
using u16fbstring = folly::basic_fbstring<char16_t>;
u16fbstring a;
u16fbstring b;
a.push_back(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment