Add BasicCStringRef to represent a null-termated string (#100)

and use it instead of BasicStringRef in cases that assume that the
string is null-terminated such as POSIX function and format string
parser.
This commit is contained in:
vitaut
2015-06-26 07:43:54 -07:00
parent 88c7c20102
commit 438bd9b0e6
7 changed files with 141 additions and 83 deletions

View File

@@ -64,7 +64,7 @@ File open_file() {
// Attempts to write a string to a file.
void write(File &f, fmt::StringRef s) {
std::size_t num_chars_left = s.size();
const char *ptr = s.c_str();
const char *ptr = s.data();
do {
std::streamsize count = f.write(ptr, num_chars_left);
ptr += count;