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

Side by Side Diff: remoting/protocol/message_serialization.cc

Issue 1542203002: Switch to standard integer types in remoting/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@int-remoting-host
Patch Set: Created 5 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
« no previous file with comments | « remoting/protocol/message_reader.h ('k') | remoting/protocol/monitored_video_stub.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/protocol/message_serialization.h" 5 #include "remoting/protocol/message_serialization.h"
6 6
7 #include "base/basictypes.h" 7 #include <stdint.h>
8
8 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "net/base/io_buffer.h" 11 #include "net/base/io_buffer.h"
11 #include "third_party/webrtc/base/byteorder.h" 12 #include "third_party/webrtc/base/byteorder.h"
12 13
13 namespace remoting { 14 namespace remoting {
14 namespace protocol { 15 namespace protocol {
15 16
16 scoped_refptr<net::IOBufferWithSize> SerializeAndFrameMessage( 17 scoped_refptr<net::IOBufferWithSize> SerializeAndFrameMessage(
17 const google::protobuf::MessageLite& msg) { 18 const google::protobuf::MessageLite& msg) {
18 // Create a buffer with 4 extra bytes. This is used as prefix to write an 19 // Create a buffer with 4 extra bytes. This is used as prefix to write an
19 // int32 of the serialized message size for framing. 20 // int32_t of the serialized message size for framing.
20 const int kExtraBytes = sizeof(int32); 21 const int kExtraBytes = sizeof(int32_t);
21 int size = msg.ByteSize() + kExtraBytes; 22 int size = msg.ByteSize() + kExtraBytes;
22 scoped_refptr<net::IOBufferWithSize> buffer(new net::IOBufferWithSize(size)); 23 scoped_refptr<net::IOBufferWithSize> buffer(new net::IOBufferWithSize(size));
23 rtc::SetBE32(buffer->data(), msg.GetCachedSize()); 24 rtc::SetBE32(buffer->data(), msg.GetCachedSize());
24 msg.SerializeWithCachedSizesToArray( 25 msg.SerializeWithCachedSizesToArray(
25 reinterpret_cast<uint8*>(buffer->data()) + kExtraBytes); 26 reinterpret_cast<uint8_t*>(buffer->data()) + kExtraBytes);
26 return buffer; 27 return buffer;
27 } 28 }
28 29
29 } // namespace protocol 30 } // namespace protocol
30 } // namespace remoting 31 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/message_reader.h ('k') | remoting/protocol/monitored_video_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698