From 7431dc7e4c62b6884daa751d871f6465ebe7e76a Mon Sep 17 00:00:00 2001 From: Tudor Bosman Date: Mon, 17 Dec 2012 19:00:40 -0800 Subject: [PATCH] unbreak fbstring default constructor (!!!) Test Plan: folly/test/fbstring_test in debug mode Reviewed By: sdoroshenko@fb.com FB internal diff: D661622 --- folly/FBString.h | 2 +- folly/test/FBStringTest.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/folly/FBString.h b/folly/FBString.h index bf8a9807..931c4c3b 100644 --- a/folly/FBString.h +++ b/folly/FBString.h @@ -274,7 +274,7 @@ public: fbstring_core() { // Only initialize the tag, will set the MSBs (i.e. the small // string size) to zero too - ml_.capacity_ = maxSmallSize << (8 * (sizeof(size_t) - 1)); + ml_.capacity_ = maxSmallSize << (8 * (sizeof(size_t) - sizeof(Char))); // or: setSmallSize(0); writeTerminator(); assert(category() == isSmall && size() == 0); diff --git a/folly/test/FBStringTest.cpp b/folly/test/FBStringTest.cpp index bd13a669..a4948ce1 100644 --- a/folly/test/FBStringTest.cpp +++ b/folly/test/FBStringTest.cpp @@ -993,6 +993,11 @@ TEST(FBString, testFixedBugs) { cp += "bb"; } } + { + // D661622 + basic_fbstring s; + EXPECT_EQ(0, s.size()); + } } -- 2.34.1