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

Unified Diff: extensions/common/permissions/usb_device_permission_data.cc

Issue 1475803002: Remove kuint16max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kint2
Patch Set: cloud print 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 side-by-side diff with in-line comments
Download patch
Index: extensions/common/permissions/usb_device_permission_data.cc
diff --git a/extensions/common/permissions/usb_device_permission_data.cc b/extensions/common/permissions/usb_device_permission_data.cc
index fbd442809af7c981ce500cade41b9569d33feb03..5d49487bbc19ce733205ded8b89d82f305c1de25 100644
--- a/extensions/common/permissions/usb_device_permission_data.cc
+++ b/extensions/common/permissions/usb_device_permission_data.cc
@@ -4,6 +4,7 @@
#include "extensions/common/permissions/usb_device_permission_data.h"
+#include <limits>
#include <string>
#include <tuple>
#include <vector>
@@ -30,13 +31,12 @@ UsbDevicePermissionData::UsbDevicePermissionData()
: vendor_id_(0), product_id_(0), interface_id_(ANY_INTERFACE) {
}
-UsbDevicePermissionData::UsbDevicePermissionData(uint16 vendor_id,
- uint16 product_id,
+UsbDevicePermissionData::UsbDevicePermissionData(uint16_t vendor_id,
+ uint16_t product_id,
int interface_id)
- : vendor_id_(vendor_id),
- product_id_(product_id),
- interface_id_(interface_id) {
-}
+ : vendor_id_(vendor_id),
+ product_id_(product_id),
+ interface_id_(interface_id) {}
bool UsbDevicePermissionData::Check(
const APIPermission::CheckParam* param) const {
@@ -69,19 +69,19 @@ bool UsbDevicePermissionData::FromValue(const base::Value* value) {
int temp;
if (!dict_value->GetInteger(kVendorIdKey, &temp))
return false;
- if (temp < 0 || temp > kuint16max)
+ if (temp < 0 || temp > std::numeric_limits<uint16_t>::max())
return false;
vendor_id_ = temp;
if (!dict_value->GetInteger(kProductIdKey, &temp))
return false;
- if (temp < 0 || temp > kuint16max)
+ if (temp < 0 || temp > std::numeric_limits<uint16_t>::max())
return false;
product_id_ = temp;
if (!dict_value->GetInteger(kInterfaceIdKey, &temp))
interface_id_ = ANY_INTERFACE;
- else if (temp < ANY_INTERFACE || temp > kuint8max)
+ else if (temp < ANY_INTERFACE || temp > std::numeric_limits<uint8_t>::max())
return false;
else
interface_id_ = temp;
« no previous file with comments | « extensions/common/permissions/usb_device_permission_data.h ('k') | jingle/notifier/communicator/single_login_attempt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698