Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: third_party/protobuf/src/google/protobuf/stubs/stringpiece.h

Issue 2600753002: Reverts third_party/protobuf: Update to HEAD (f52e188fe4) (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 length_ = CheckedSsizeTFromSizeT(strlen(str)); 215 length_ = CheckedSsizeTFromSizeT(strlen(str));
216 } 216 }
217 } 217 }
218 218
219 template <class Allocator> 219 template <class Allocator>
220 StringPiece( // NOLINT(runtime/explicit) 220 StringPiece( // NOLINT(runtime/explicit)
221 const std::basic_string<char, std::char_traits<char>, Allocator>& str) 221 const std::basic_string<char, std::char_traits<char>, Allocator>& str)
222 : ptr_(str.data()), length_(0) { 222 : ptr_(str.data()), length_(0) {
223 length_ = CheckedSsizeTFromSizeT(str.size()); 223 length_ = CheckedSsizeTFromSizeT(str.size());
224 } 224 }
225 #if defined(HAS_GLOBAL_STRING)
226 template <class Allocator>
227 StringPiece( // NOLINT(runtime/explicit)
228 const basic_string<char, std::char_traits<char>, Allocator>& str)
229 : ptr_(str.data()), length_(0) {
230 length_ = CheckedSsizeTFromSizeT(str.size());
231 }
232 #endif
225 233
226 StringPiece(const char* offset, stringpiece_ssize_type len) 234 StringPiece(const char* offset, stringpiece_ssize_type len)
227 : ptr_(offset), length_(len) { 235 : ptr_(offset), length_(len) {
228 assert(len >= 0); 236 assert(len >= 0);
229 } 237 }
230 238
231 // Substring of another StringPiece. 239 // Substring of another StringPiece.
232 // pos must be non-negative and <= x.length(). 240 // pos must be non-negative and <= x.length().
233 StringPiece(StringPiece x, stringpiece_ssize_type pos); 241 StringPiece(StringPiece x, stringpiece_ssize_type pos);
234 // Substring of another StringPiece. 242 // Substring of another StringPiece.
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 size_t result = 0; 482 size_t result = 0;
475 for (const char *str = s.data(), *end = str + s.size(); str < end; str++) { 483 for (const char *str = s.data(), *end = str + s.size(); str < end; str++) {
476 result = 5 * result + *str; 484 result = 5 * result + *str;
477 } 485 }
478 return result; 486 return result;
479 } 487 }
480 }; 488 };
481 GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END 489 GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END
482 490
483 #endif // STRINGS_STRINGPIECE_H_ 491 #endif // STRINGS_STRINGPIECE_H_
OLDNEW
« no previous file with comments | « third_party/protobuf/src/google/protobuf/stubs/port.h ('k') | third_party/protobuf/src/google/protobuf/stubs/strutil.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698