Migrate deprecated StringPiece::CopyToString to string::assign (or construction of string, if appropriate)
REF_BUG=36048983
REF_CL=155522173
REF_TIME=2017-05-09T10:33:34-07:00
REF_TIME_RAW=1494351214 -0700
Jorg Brown
6 years ago
363 | 363 |
len += pieces[i].size();
|
364 | 364 |
}
|
365 | 365 |
output->reserve(len);
|
366 | |
pieces[0].CopyToString(output);
|
|
366 |
output->assign(pieces[0].data(), pieces[0].size());
|
367 | 367 |
for (size_t i = 1; i < pieces.size(); ++i) {
|
368 | 368 |
output->append(delim, delim_len);
|
369 | 369 |
output->append(pieces[i].data(), pieces[i].size());
|
|
371 | 371 |
}
|
372 | 372 |
|
373 | 373 |
void Util::ConcatStrings(StringPiece s1, StringPiece s2, string *output) {
|
374 | |
s1.CopyToString(output);
|
|
374 |
output->assign(s1.data(), s1.size());
|
375 | 375 |
output->append(s2.data(), s2.size());
|
376 | 376 |
}
|
377 | 377 |
|
|
868 | 868 |
string *result) {
|
869 | 869 |
DCHECK(result);
|
870 | 870 |
const StringPiece substr = SubStringPiece(src, start, length);
|
871 | |
substr.CopyToString(result);
|
|
871 |
result->assign(substr.data(), substr.size());
|
872 | 872 |
}
|
873 | 873 |
|
874 | 874 |
void Util::StripUTF8BOM(string *line) {
|
|
1285 | 1285 |
if (iter == end || iter->GetOpenBracket() != key) {
|
1286 | 1286 |
return false;
|
1287 | 1287 |
}
|
1288 | |
iter->GetCloseBracket().CopyToString(close_bracket);
|
|
1288 |
*close_bracket = string(iter->GetCloseBracket());
|
1289 | 1289 |
return true;
|
1290 | 1290 |
}
|
1291 | 1291 |
|
|
1301 | 1301 |
if (iter == end || iter->GetCloseBracket() != key) {
|
1302 | 1302 |
return false;
|
1303 | 1303 |
}
|
1304 | |
iter->GetOpenBracket().CopyToString(open_bracket);
|
|
1304 |
*open_bracket = string(iter->GetOpenBracket());
|
1305 | 1305 |
return true;
|
1306 | 1306 |
}
|
1307 | 1307 |
|
105 | 105 |
// String utils
|
106 | 106 |
template <typename StringContainer>
|
107 | 107 |
static void PushBackStringPiece(StringPiece s, StringContainer *container) {
|
108 | |
container->push_back(string());
|
109 | |
s.CopyToString(&container->back());
|
|
108 |
container->push_back(string(s));
|
110 | 109 |
}
|
111 | 110 |
|
112 | 111 |
static void SplitStringUsing(StringPiece str,
|
29 | 29 |
|
30 | 30 |
MAJOR=2
|
31 | 31 |
MINOR=21
|
32 | |
BUILD=2709
|
|
32 |
BUILD=2710
|
33 | 33 |
REVISION=102
|
34 | 34 |
# This version represents the version of Mozc IME engine (converter, predictor,
|
35 | 35 |
# etc.). This version info is included both in the Mozc server and in the Mozc
|
737 | 737 |
|
738 | 738 |
// decoded_key = "γγΌγγ" (= key + prediction suffix)
|
739 | 739 |
decoded_key.clear();
|
740 | |
key.CopyToString(&decoded_key);
|
|
740 |
decoded_key.assign(key.data(), key.size());
|
741 | 741 |
codec_->DecodeKey(encoded_actual_key_prediction_suffix, &decoded_key);
|
742 | 742 |
switch (callback->OnKey(decoded_key)) {
|
743 | 743 |
case Callback::TRAVERSE_DONE:
|