FBString iomanip fix.
Summary: D1090936 noticed some problems with fbstring iomanip behavior. The root cause is that os.write(ostream, char*, size_t) is an UnformattedOutputFunction, so disregards setw(), setfill(), and left/right alignment. The use of os.write instead of os << str.data() is intentional: D367009 switched from the latter to the former so that strings containing a '\0' are printed properly. There does not seem to be a public function to write with formatting. Where needed in libgcc, the function __ostream_insert is used. Since FBString already uses such 'private' functions, __ostream_insert is an appropriate solution. @override-unit-failures Test Plan: Added test cases to FBStringTest.cpp to cover iomanip. fbconfig -r folly && fbmake opt && fbmake runtests_opt Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D1091474
Showing
Please register or sign in to comment