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

Side by Side Diff: third_party/protobuf/src/google/protobuf/util/internal/json_escaping.cc

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 // and returns a StringPiece that points to this buffer. The input buffer needs 248 // and returns a StringPiece that points to this buffer. The input buffer needs
249 // to be at least 6 bytes long. 249 // to be at least 6 bytes long.
250 StringPiece ToHex(uint16 cp, char* buffer) { 250 StringPiece ToHex(uint16 cp, char* buffer) {
251 buffer[5] = kHex[cp & 0x0f]; 251 buffer[5] = kHex[cp & 0x0f];
252 cp >>= 4; 252 cp >>= 4;
253 buffer[4] = kHex[cp & 0x0f]; 253 buffer[4] = kHex[cp & 0x0f];
254 cp >>= 4; 254 cp >>= 4;
255 buffer[3] = kHex[cp & 0x0f]; 255 buffer[3] = kHex[cp & 0x0f];
256 cp >>= 4; 256 cp >>= 4;
257 buffer[2] = kHex[cp & 0x0f]; 257 buffer[2] = kHex[cp & 0x0f];
258 return StringPiece(buffer, 0, 6); 258 return StringPiece(buffer).substr(0, 6);
259 } 259 }
260 260
261 // Stores the 32-bit unicode code point as its hexadecimal digits in buffer 261 // Stores the 32-bit unicode code point as its hexadecimal digits in buffer
262 // and returns a StringPiece that points to this buffer. The input buffer needs 262 // and returns a StringPiece that points to this buffer. The input buffer needs
263 // to be at least 12 bytes long. 263 // to be at least 12 bytes long.
264 StringPiece ToSurrogateHex(uint32 cp, char* buffer) { 264 StringPiece ToSurrogateHex(uint32 cp, char* buffer) {
265 uint16 low = ToLowSurrogate(cp); 265 uint16 low = ToLowSurrogate(cp);
266 uint16 high = ToHighSurrogate(cp); 266 uint16 high = ToHighSurrogate(cp);
267 267
268 buffer[11] = kHex[low & 0x0f]; 268 buffer[11] = kHex[low & 0x0f];
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 if (num_left > 0) { 395 if (num_left > 0) {
396 // Treat as case iii: report error. 396 // Treat as case iii: report error.
397 // TODO(wpoon): Add error reporting. 397 // TODO(wpoon): Add error reporting.
398 } 398 }
399 } 399 }
400 400
401 } // namespace converter 401 } // namespace converter
402 } // namespace util 402 } // namespace util
403 } // namespace protobuf 403 } // namespace protobuf
404 } // namespace google 404 } // namespace google
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698