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

Side by Side Diff: extensions/browser/api/usb/usb_api.cc

Issue 1549643002: Switch to standard integer types in extensions/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clean
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 | « extensions/browser/api/usb/usb_api.h ('k') | extensions/browser/api/usb/usb_apitest.cc » ('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 "extensions/browser/api/usb/usb_api.h" 5 #include "extensions/browser/api/usb/usb_api.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 return RespondNow(Error(kErrorInvalidNumberOfPackets)); 1146 return RespondNow(Error(kErrorInvalidNumberOfPackets));
1147 } 1147 }
1148 1148
1149 unsigned int packets = transfer.packets; 1149 unsigned int packets = transfer.packets;
1150 if (transfer.packet_length < 0 || 1150 if (transfer.packet_length < 0 ||
1151 transfer.packet_length >= kMaxPacketLength) { 1151 transfer.packet_length >= kMaxPacketLength) {
1152 return RespondNow(Error(kErrorInvalidPacketLength)); 1152 return RespondNow(Error(kErrorInvalidPacketLength));
1153 } 1153 }
1154 1154
1155 unsigned int packet_length = transfer.packet_length; 1155 unsigned int packet_length = transfer.packet_length;
1156 const uint64 total_length = packets * packet_length; 1156 const uint64_t total_length = packets * packet_length;
1157 if (packets > size || total_length > size) { 1157 if (packets > size || total_length > size) {
1158 return RespondNow(Error(kErrorTransferLength)); 1158 return RespondNow(Error(kErrorTransferLength));
1159 } 1159 }
1160 1160
1161 scoped_refptr<net::IOBuffer> buffer = 1161 scoped_refptr<net::IOBuffer> buffer =
1162 CreateBufferForTransfer(generic_transfer, direction, size); 1162 CreateBufferForTransfer(generic_transfer, direction, size);
1163 if (!buffer.get()) { 1163 if (!buffer.get()) {
1164 return RespondNow(Error(kErrorMalformedParameters)); 1164 return RespondNow(Error(kErrorMalformedParameters));
1165 } 1165 }
1166 1166
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 ReleaseDeviceHandle(parameters_->handle); 1209 ReleaseDeviceHandle(parameters_->handle);
1210 1210
1211 scoped_ptr<base::ListValue> error_args(new base::ListValue()); 1211 scoped_ptr<base::ListValue> error_args(new base::ListValue());
1212 error_args->AppendBoolean(false); 1212 error_args->AppendBoolean(false);
1213 // Returning arguments with an error is wrong but we're stuck with it. 1213 // Returning arguments with an error is wrong but we're stuck with it.
1214 Respond(ErrorWithArguments(std::move(error_args), kErrorResetDevice)); 1214 Respond(ErrorWithArguments(std::move(error_args), kErrorResetDevice));
1215 } 1215 }
1216 } 1216 }
1217 1217
1218 } // namespace extensions 1218 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/usb/usb_api.h ('k') | extensions/browser/api/usb/usb_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698