/*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2016 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
while (!s.empty()) {
auto num_to_add = s.size();
if (maxLength) {
- num_to_add = std::min(num_to_add, maxLength);
+ num_to_add = std::min<uint64_t>(num_to_add, maxLength);
}
if (!cb(StringPiece(s.begin(), num_to_add))) {
return false;
// The stream ended with a delimiter; our contract is to swallow
// the final empty piece.
if (s.empty()) {
- return false;
+ return true;
}
if (s.back() != this->delimiter_) {
return body(s);
StringPiece source_;
DelimiterType delimiter_;
public:
- SplitStringSource(const StringPiece& source,
+ SplitStringSource(const StringPiece source,
DelimiterType delimiter)
: source_(source)
, delimiter_(std::move(delimiter)) { }