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

Side by Side Diff: remoting/protocol/client_control_dispatcher.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 4 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/client_control_dispatcher.h" 5 #include "remoting/protocol/client_control_dispatcher.h"
6 6
7 #include <stdint.h>
8
7 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
8 #include "base/callback.h" 10 #include "base/callback.h"
9 #include "base/callback_helpers.h" 11 #include "base/callback_helpers.h"
10 #include "net/socket/stream_socket.h" 12 #include "net/socket/stream_socket.h"
11 #include "remoting/base/constants.h" 13 #include "remoting/base/constants.h"
12 #include "remoting/proto/control.pb.h" 14 #include "remoting/proto/control.pb.h"
13 #include "remoting/proto/internal.pb.h" 15 #include "remoting/proto/internal.pb.h"
14 #include "remoting/protocol/client_stub.h" 16 #include "remoting/protocol/client_stub.h"
15 #include "remoting/protocol/message_serialization.h" 17 #include "remoting/protocol/message_serialization.h"
16 18
(...skipping 20 matching lines...) Expand all
37 39
38 // Verify that |width| and |height| are within sane limits. Otherwise integer 40 // Verify that |width| and |height| are within sane limits. Otherwise integer
39 // overflow can occur while calculating |cursor_total_bytes| below. 41 // overflow can occur while calculating |cursor_total_bytes| below.
40 if (width < 0 || width > (SHRT_MAX / 2) || 42 if (width < 0 || width > (SHRT_MAX / 2) ||
41 height < 0 || height > (SHRT_MAX / 2)) { 43 height < 0 || height > (SHRT_MAX / 2)) {
42 LOG(ERROR) << "Cursor dimensions are out of bounds for SetCursor: " 44 LOG(ERROR) << "Cursor dimensions are out of bounds for SetCursor: "
43 << width << "x" << height; 45 << width << "x" << height;
44 return false; 46 return false;
45 } 47 }
46 48
47 uint32 cursor_total_bytes = width * height * kBytesPerPixel; 49 uint32_t cursor_total_bytes = width * height * kBytesPerPixel;
48 if (cursor_shape.data().size() < cursor_total_bytes) { 50 if (cursor_shape.data().size() < cursor_total_bytes) {
49 LOG(ERROR) << "Expected " << cursor_total_bytes << " bytes for a " 51 LOG(ERROR) << "Expected " << cursor_total_bytes << " bytes for a "
50 << width << "x" << height << " cursor. Only received " 52 << width << "x" << height << " cursor. Only received "
51 << cursor_shape.data().size() << " bytes"; 53 << cursor_shape.data().size() << " bytes";
52 return false; 54 return false;
53 } 55 }
54 56
55 return true; 57 return true;
56 } 58 }
57 59
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 client_stub_->SetPairingResponse(message->pairing_response()); 136 client_stub_->SetPairingResponse(message->pairing_response());
135 } else if (message->has_extension_message()) { 137 } else if (message->has_extension_message()) {
136 client_stub_->DeliverHostMessage(message->extension_message()); 138 client_stub_->DeliverHostMessage(message->extension_message());
137 } else { 139 } else {
138 LOG(WARNING) << "Unknown control message received."; 140 LOG(WARNING) << "Unknown control message received.";
139 } 141 }
140 } 142 }
141 143
142 } // namespace protocol 144 } // namespace protocol
143 } // namespace remoting 145 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/client_control_dispatcher.h ('k') | remoting/protocol/client_event_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698