summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/basictypes.h1
-rw-r--r--chrome/browser/extensions/webstore_installer.cc12
-rw-r--r--chrome/browser/sync/test/integration/sync_test.cc6
-rw-r--r--components/policy/core/browser/url_blacklist_manager.cc12
-rw-r--r--extensions/common/permissions/usb_device_permission_data.cc18
-rw-r--r--extensions/common/permissions/usb_device_permission_data.h21
-rw-r--r--jingle/notifier/communicator/single_login_attempt.cc10
-rw-r--r--net/dns/dns_session.cc13
-rw-r--r--net/dns/dns_session.h2
-rw-r--r--net/dns/dns_transaction_unittest.cc103
-rw-r--r--net/test/spawned_test_server/base_test_server.cc9
-rw-r--r--net/test/spawned_test_server/remote_test_server.cc11
-rw-r--r--net/test/spawned_test_server/spawner_communicator.cc12
-rw-r--r--net/test/spawned_test_server/spawner_communicator.h9
-rw-r--r--net/tools/dns_fuzz_stub/dns_fuzz_stub.cc24
-rw-r--r--sandbox/win/src/sandbox_nt_util.cc14
-rw-r--r--sandbox/win/src/sandbox_nt_util.h14
17 files changed, 127 insertions, 164 deletions
diff --git a/base/basictypes.h b/base/basictypes.h
index 7607735..dd10aea 100644
--- a/base/basictypes.h
+++ b/base/basictypes.h
@@ -27,6 +27,7 @@ typedef uint64_t uint64;
// (U)INT{8,16,32,64}_{MIN,MAX} in case of globals (and include <stdint.h>).
// http://crbug.com/138542
const uint8 kuint8max = 0xFF;
+const uint16 kuint16max = 0xFFFF;
const uint32 kuint32max = 0xFFFFFFFF;
const uint64 kuint64max = 0xFFFFFFFFFFFFFFFFULL;
const int32 kint32min = -0x7FFFFFFF - 1;
diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc
index e0639e94..f824dd6 100644
--- a/chrome/browser/extensions/webstore_installer.cc
+++ b/chrome/browser/extensions/webstore_installer.cc
@@ -4,12 +4,10 @@
#include "chrome/browser/extensions/webstore_installer.h"
-#include <stdint.h>
-
-#include <limits>
#include <set>
#include <vector>
+#include "base/basictypes.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
@@ -123,8 +121,8 @@ void GetDownloadFilePath(
// filename and when the download starts writing to it (think concurrently
// running sharded browser tests installing the same test file, for
// instance).
- std::string random_number = base::Uint64ToString(
- base::RandGenerator(std::numeric_limits<uint16_t>::max()));
+ std::string random_number =
+ base::Uint64ToString(base::RandGenerator(kuint16max));
base::FilePath file =
download_directory.AppendASCII(id + "_" + random_number + ".crx");
@@ -770,14 +768,14 @@ void WebstoreInstaller::RecordInterrupt(const DownloadItem* download) const {
// Use logarithmic bin sizes up to 1 TB.
const int kNumBuckets = 30;
- const int64_t kMaxSizeKb = 1 << kNumBuckets;
+ const int64 kMaxSizeKb = 1 << kNumBuckets;
UMA_HISTOGRAM_CUSTOM_COUNTS(
"Extensions.WebstoreDownload.InterruptReceivedKBytes",
download->GetReceivedBytes() / 1024,
1,
kMaxSizeKb,
kNumBuckets);
- int64_t total_bytes = download->GetTotalBytes();
+ int64 total_bytes = download->GetTotalBytes();
if (total_bytes >= 0) {
UMA_HISTOGRAM_CUSTOM_COUNTS(
"Extensions.WebstoreDownload.InterruptTotalKBytes",
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc
index 0b5efdb..f200924 100644
--- a/chrome/browser/sync/test/integration/sync_test.cc
+++ b/chrome/browser/sync/test/integration/sync_test.cc
@@ -4,11 +4,9 @@
#include "chrome/browser/sync/test/integration/sync_test.h"
-#include <stdint.h>
-
-#include <limits>
#include <vector>
+#include "base/basictypes.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/guid.h"
@@ -857,7 +855,7 @@ bool SyncTest::SetUpLocalPythonTestServer() {
LOG(ERROR) << "Could not find valid xmpp_port value";
return false;
}
- if ((xmpp_port <= 0) || (xmpp_port > std::numeric_limits<uint16_t>::max())) {
+ if ((xmpp_port <= 0) || (xmpp_port > kuint16max)) {
LOG(ERROR) << "Invalid xmpp port: " << xmpp_port;
return false;
}
diff --git a/components/policy/core/browser/url_blacklist_manager.cc b/components/policy/core/browser/url_blacklist_manager.cc
index 4b4d35e..5d85138 100644
--- a/components/policy/core/browser/url_blacklist_manager.cc
+++ b/components/policy/core/browser/url_blacklist_manager.cc
@@ -4,10 +4,6 @@
#include "components/policy/core/browser/url_blacklist_manager.h"
-#include <stdint.h>
-
-#include <limits>
-
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/location.h"
@@ -141,7 +137,7 @@ struct URLBlacklist::FilterComponents {
std::string scheme;
std::string host;
- uint16_t port;
+ uint16 port;
std::string path;
std::string query;
int number_of_key_value_pairs;
@@ -239,7 +235,7 @@ bool URLBlacklist::FilterToComponents(SegmentURLCallback segment_url,
std::string* scheme,
std::string* host,
bool* match_subdomains,
- uint16_t* port,
+ uint16* port,
std::string* path,
std::string* query) {
url::Parsed parsed;
@@ -302,7 +298,7 @@ bool URLBlacklist::FilterToComponents(SegmentURLCallback segment_url,
&int_port)) {
return false;
}
- if (int_port <= 0 || int_port > std::numeric_limits<uint16_t>::max())
+ if (int_port <= 0 || int_port > kuint16max)
return false;
*port = int_port;
} else {
@@ -332,7 +328,7 @@ scoped_refptr<URLMatcherConditionSet> URLBlacklist::CreateConditionSet(
const std::string& scheme,
const std::string& host,
bool match_subdomains,
- uint16_t port,
+ uint16 port,
const std::string& path,
const std::string& query,
bool allow) {
diff --git a/extensions/common/permissions/usb_device_permission_data.cc b/extensions/common/permissions/usb_device_permission_data.cc
index 5d49487..fbd4428 100644
--- a/extensions/common/permissions/usb_device_permission_data.cc
+++ b/extensions/common/permissions/usb_device_permission_data.cc
@@ -4,7 +4,6 @@
#include "extensions/common/permissions/usb_device_permission_data.h"
-#include <limits>
#include <string>
#include <tuple>
#include <vector>
@@ -31,12 +30,13 @@ UsbDevicePermissionData::UsbDevicePermissionData()
: vendor_id_(0), product_id_(0), interface_id_(ANY_INTERFACE) {
}
-UsbDevicePermissionData::UsbDevicePermissionData(uint16_t vendor_id,
- uint16_t product_id,
+UsbDevicePermissionData::UsbDevicePermissionData(uint16 vendor_id,
+ uint16 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 > std::numeric_limits<uint16_t>::max())
+ if (temp < 0 || temp > kuint16max)
return false;
vendor_id_ = temp;
if (!dict_value->GetInteger(kProductIdKey, &temp))
return false;
- if (temp < 0 || temp > std::numeric_limits<uint16_t>::max())
+ if (temp < 0 || temp > kuint16max)
return false;
product_id_ = temp;
if (!dict_value->GetInteger(kInterfaceIdKey, &temp))
interface_id_ = ANY_INTERFACE;
- else if (temp < ANY_INTERFACE || temp > std::numeric_limits<uint8_t>::max())
+ else if (temp < ANY_INTERFACE || temp > kuint8max)
return false;
else
interface_id_ = temp;
diff --git a/extensions/common/permissions/usb_device_permission_data.h b/extensions/common/permissions/usb_device_permission_data.h
index e72cc6c..001b12c 100644
--- a/extensions/common/permissions/usb_device_permission_data.h
+++ b/extensions/common/permissions/usb_device_permission_data.h
@@ -4,10 +4,9 @@
#ifndef EXTENSIONS_COMMON_PERMISSIONS_USB_DEVICE_PERMISSION_DATA_H_
#define EXTENSIONS_COMMON_PERMISSIONS_USB_DEVICE_PERMISSION_DATA_H_
-#include <stdint.h>
-
#include <string>
+#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "extensions/common/permissions/api_permission.h"
@@ -21,7 +20,7 @@ namespace extensions {
// A pattern that can be used to match a USB device permission.
// Should be of the format: vendorId:productId, where both vendorId and
-// productId are decimal strings representing uint16_t values.
+// productId are decimal strings representing uint16 values.
class UsbDevicePermissionData {
public:
enum SpecialInterfaces {
@@ -36,8 +35,8 @@ class UsbDevicePermissionData {
};
UsbDevicePermissionData();
- UsbDevicePermissionData(uint16_t vendor_id,
- uint16_t product_id,
+ UsbDevicePermissionData(uint16 vendor_id,
+ uint16 product_id,
int interface_id);
// Check if |param| (which must be a UsbDevicePermissionData::CheckParam)
@@ -53,17 +52,17 @@ class UsbDevicePermissionData {
bool operator<(const UsbDevicePermissionData& rhs) const;
bool operator==(const UsbDevicePermissionData& rhs) const;
- const uint16_t& vendor_id() const { return vendor_id_; }
- const uint16_t& product_id() const { return product_id_; }
+ const uint16& vendor_id() const { return vendor_id_; }
+ const uint16& product_id() const { return product_id_; }
// These accessors are provided for IPC_STRUCT_TRAITS_MEMBER. Please
// think twice before using them for anything else.
- uint16_t& vendor_id() { return vendor_id_; }
- uint16_t& product_id() { return product_id_; }
+ uint16& vendor_id() { return vendor_id_; }
+ uint16& product_id() { return product_id_; }
private:
- uint16_t vendor_id_;
- uint16_t product_id_;
+ uint16 vendor_id_;
+ uint16 product_id_;
int interface_id_;
};
diff --git a/jingle/notifier/communicator/single_login_attempt.cc b/jingle/notifier/communicator/single_login_attempt.cc
index 5b24b5d..04c074f 100644
--- a/jingle/notifier/communicator/single_login_attempt.cc
+++ b/jingle/notifier/communicator/single_login_attempt.cc
@@ -2,13 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "jingle/notifier/communicator/single_login_attempt.h"
-
-#include <stdint.h>
-
-#include <limits>
#include <string>
+#include "jingle/notifier/communicator/single_login_attempt.h"
+
+#include "base/basictypes.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
@@ -75,7 +73,7 @@ net::HostPortPair ParseRedirectText(const std::string& redirect_text) {
if (!base::StringToInt(parts[1], &port)) {
port = kDefaultXmppPort;
}
- if (port <= 0 || port > std::numeric_limits<uint16_t>::max()) {
+ if (port <= 0 || port > kuint16max) {
port = kDefaultXmppPort;
}
redirect_server.set_port(port);
diff --git a/net/dns/dns_session.cc b/net/dns/dns_session.cc
index 3a6c4d4..9ea2db9 100644
--- a/net/dns/dns_session.cc
+++ b/net/dns/dns_session.cc
@@ -4,10 +4,7 @@
#include "net/dns/dns_session.h"
-#include <stdint.h>
-
-#include <limits>
-
+#include "base/basictypes.h"
#include "base/bind.h"
#include "base/lazy_instance.h"
#include "base/metrics/histogram_macros.h"
@@ -89,9 +86,7 @@ DnsSession::DnsSession(const DnsConfig& config,
NetLog* net_log)
: config_(config),
socket_pool_(socket_pool.Pass()),
- rand_callback_(base::Bind(rand_int_callback,
- 0,
- std::numeric_limits<uint16_t>::max())),
+ rand_callback_(base::Bind(rand_int_callback, 0, kuint16max)),
net_log_(net_log),
server_index_(0) {
socket_pool_->Initialize(&config_.nameservers, net_log);
@@ -107,8 +102,8 @@ DnsSession::~DnsSession() {
RecordServerStats();
}
-uint16_t DnsSession::NextQueryId() const {
- return static_cast<uint16_t>(rand_callback_.Run());
+uint16 DnsSession::NextQueryId() const {
+ return static_cast<uint16>(rand_callback_.Run());
}
unsigned DnsSession::NextFirstServerIndex() {
diff --git a/net/dns/dns_session.h b/net/dns/dns_session.h
index ce1a917..48af67f 100644
--- a/net/dns/dns_session.h
+++ b/net/dns/dns_session.h
@@ -65,7 +65,7 @@ class NET_EXPORT_PRIVATE DnsSession
NetLog* net_log() const { return net_log_; }
// Return the next random query ID.
- uint16_t NextQueryId() const;
+ uint16 NextQueryId() const;
// Return the index of the first configured server to use on first attempt.
unsigned NextFirstServerIndex();
diff --git a/net/dns/dns_transaction_unittest.cc b/net/dns/dns_transaction_unittest.cc
index e875645..f86aae1 100644
--- a/net/dns/dns_transaction_unittest.cc
+++ b/net/dns/dns_transaction_unittest.cc
@@ -4,10 +4,6 @@
#include "net/dns/dns_transaction.h"
-#include <stdint.h>
-
-#include <limits>
-
#include "base/bind.h"
#include "base/memory/scoped_ptr.h"
#include "base/rand_util.h"
@@ -37,19 +33,19 @@ std::string DomainFromDot(const base::StringPiece& dotted) {
class DnsSocketData {
public:
// The ctor takes parameters for the DnsQuery.
- DnsSocketData(uint16_t id,
+ DnsSocketData(uint16 id,
const char* dotted_name,
- uint16_t qtype,
+ uint16 qtype,
IoMode mode,
bool use_tcp)
: query_(new DnsQuery(id, DomainFromDot(dotted_name), qtype)),
use_tcp_(use_tcp) {
if (use_tcp_) {
- scoped_ptr<uint16_t> length(new uint16_t);
+ scoped_ptr<uint16> length(new uint16);
*length = base::HostToNet16(query_->io_buffer()->size());
writes_.push_back(MockWrite(mode,
reinterpret_cast<const char*>(length.get()),
- sizeof(uint16_t), num_reads_and_writes()));
+ sizeof(uint16), num_reads_and_writes()));
lengths_.push_back(length.Pass());
}
writes_.push_back(MockWrite(mode, query_->io_buffer()->data(),
@@ -61,16 +57,15 @@ class DnsSocketData {
// All responses must be added before GetProvider.
// Adds pre-built DnsResponse. |tcp_length| will be used in TCP mode only.
- void AddResponseWithLength(scoped_ptr<DnsResponse> response,
- IoMode mode,
- uint16_t tcp_length) {
+ void AddResponseWithLength(scoped_ptr<DnsResponse> response, IoMode mode,
+ uint16 tcp_length) {
CHECK(!provider_.get());
if (use_tcp_) {
- scoped_ptr<uint16_t> length(new uint16_t);
+ scoped_ptr<uint16> length(new uint16);
*length = base::HostToNet16(tcp_length);
reads_.push_back(MockRead(mode,
reinterpret_cast<const char*>(length.get()),
- sizeof(uint16_t), num_reads_and_writes()));
+ sizeof(uint16), num_reads_and_writes()));
lengths_.push_back(length.Pass());
}
reads_.push_back(MockRead(mode, response->io_buffer()->data(),
@@ -81,12 +76,12 @@ class DnsSocketData {
// Adds pre-built DnsResponse.
void AddResponse(scoped_ptr<DnsResponse> response, IoMode mode) {
- uint16_t tcp_length = response->io_buffer()->size();
+ uint16 tcp_length = response->io_buffer()->size();
AddResponseWithLength(response.Pass(), mode, tcp_length);
}
// Adds pre-built response from |data| buffer.
- void AddResponseData(const uint8_t* data, size_t length, IoMode mode) {
+ void AddResponseData(const uint8* data, size_t length, IoMode mode) {
CHECK(!provider_.get());
AddResponse(make_scoped_ptr(
new DnsResponse(reinterpret_cast<const char*>(data), length, 0)), mode);
@@ -126,14 +121,16 @@ class DnsSocketData {
return provider_.get();
}
- uint16_t query_id() const { return query_->id(); }
+ uint16 query_id() const {
+ return query_->id();
+ }
private:
size_t num_reads_and_writes() const { return reads_.size() + writes_.size(); }
scoped_ptr<DnsQuery> query_;
bool use_tcp_;
- std::vector<scoped_ptr<uint16_t>> lengths_;
+ std::vector<scoped_ptr<uint16>> lengths_;
std::vector<scoped_ptr<DnsResponse>> responses_;
std::vector<MockWrite> writes_;
std::vector<MockRead> reads_;
@@ -223,14 +220,15 @@ class TransactionHelper {
public:
// If |expected_answer_count| < 0 then it is the expected net error.
TransactionHelper(const char* hostname,
- uint16_t qtype,
+ uint16 qtype,
int expected_answer_count)
: hostname_(hostname),
qtype_(qtype),
expected_answer_count_(expected_answer_count),
cancel_in_callback_(false),
quit_in_callback_(false),
- completed_(false) {}
+ completed_(false) {
+ }
// Mark that the transaction shall be destroyed immediately upon callback.
void set_cancel_in_callback() {
@@ -316,7 +314,7 @@ class TransactionHelper {
private:
std::string hostname_;
- uint16_t qtype_;
+ uint16 qtype_;
scoped_ptr<DnsTransaction> transaction_;
int expected_answer_count_;
bool cancel_in_callback_;
@@ -366,10 +364,10 @@ class DnsTransactionTest : public testing::Test {
// Add expected query for |dotted_name| and |qtype| with |id| and response
// taken verbatim from |data| of |data_length| bytes. The transaction id in
// |data| should equal |id|, unless testing mismatched response.
- void AddQueryAndResponse(uint16_t id,
+ void AddQueryAndResponse(uint16 id,
const char* dotted_name,
- uint16_t qtype,
- const uint8_t* response_data,
+ uint16 qtype,
+ const uint8* response_data,
size_t response_length,
IoMode mode,
bool use_tcp) {
@@ -380,27 +378,27 @@ class DnsTransactionTest : public testing::Test {
AddSocketData(data.Pass());
}
- void AddAsyncQueryAndResponse(uint16_t id,
+ void AddAsyncQueryAndResponse(uint16 id,
const char* dotted_name,
- uint16_t qtype,
- const uint8_t* data,
+ uint16 qtype,
+ const uint8* data,
size_t data_length) {
AddQueryAndResponse(id, dotted_name, qtype, data, data_length, ASYNC,
false);
}
- void AddSyncQueryAndResponse(uint16_t id,
+ void AddSyncQueryAndResponse(uint16 id,
const char* dotted_name,
- uint16_t qtype,
- const uint8_t* data,
+ uint16 qtype,
+ const uint8* data,
size_t data_length) {
AddQueryAndResponse(id, dotted_name, qtype, data, data_length, SYNCHRONOUS,
false);
}
// Add expected query of |dotted_name| and |qtype| and no response.
- void AddQueryAndTimeout(const char* dotted_name, uint16_t qtype) {
- uint16_t id = base::RandInt(0, std::numeric_limits<uint16_t>::max());
+ void AddQueryAndTimeout(const char* dotted_name, uint16 qtype) {
+ uint16 id = base::RandInt(0, kuint16max);
scoped_ptr<DnsSocketData> data(
new DnsSocketData(id, dotted_name, qtype, ASYNC, false));
AddSocketData(data.Pass());
@@ -409,27 +407,23 @@ class DnsTransactionTest : public testing::Test {
// Add expected query of |dotted_name| and |qtype| and matching response with
// no answer and RCODE set to |rcode|. The id will be generated randomly.
void AddQueryAndRcode(const char* dotted_name,
- uint16_t qtype,
+ uint16 qtype,
int rcode,
IoMode mode,
bool use_tcp) {
CHECK_NE(dns_protocol::kRcodeNOERROR, rcode);
- uint16_t id = base::RandInt(0, std::numeric_limits<uint16_t>::max());
+ uint16 id = base::RandInt(0, kuint16max);
scoped_ptr<DnsSocketData> data(
new DnsSocketData(id, dotted_name, qtype, mode, use_tcp));
data->AddRcode(rcode, mode);
AddSocketData(data.Pass());
}
- void AddAsyncQueryAndRcode(const char* dotted_name,
- uint16_t qtype,
- int rcode) {
+ void AddAsyncQueryAndRcode(const char* dotted_name, uint16 qtype, int rcode) {
AddQueryAndRcode(dotted_name, qtype, rcode, ASYNC, false);
}
- void AddSyncQueryAndRcode(const char* dotted_name,
- uint16_t qtype,
- int rcode) {
+ void AddSyncQueryAndRcode(const char* dotted_name, uint16 qtype, int rcode) {
AddQueryAndRcode(dotted_name, qtype, rcode, SYNCHRONOUS, false);
}
@@ -790,15 +784,19 @@ TEST_F(DnsTransactionTest, DontAppendToMultiLabelName) {
EXPECT_TRUE(helper2.Run(transaction_factory_.get()));
}
-const uint8_t kResponseNoData[] = {
- 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
- // Question
- 0x01, 'x', 0x01, 'y', 0x01, 'z', 0x01, 'b', 0x00, 0x00, 0x01, 0x00, 0x01,
- // Authority section, SOA record, TTL 0x3E6
- 0x01, 'z', 0x00, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x03, 0xE6,
- // Minimal RDATA, 18 bytes
- 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+const uint8 kResponseNoData[] = {
+ 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ // Question
+ 0x01, 'x', 0x01, 'y', 0x01, 'z', 0x01, 'b', 0x00, 0x00, 0x01, 0x00, 0x01,
+ // Authority section, SOA record, TTL 0x3E6
+ 0x01, 'z', 0x00, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x03, 0xE6,
+ // Minimal RDATA, 18 bytes
+ 0x00, 0x12,
+ 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
};
TEST_F(DnsTransactionTest, SuffixSearchStop) {
@@ -917,7 +915,8 @@ TEST_F(DnsTransactionTest, TCPMalformed) {
make_scoped_ptr(
new DnsResponse(reinterpret_cast<const char*>(kT0ResponseDatagram),
arraysize(kT0ResponseDatagram), 0)),
- ASYNC, static_cast<uint16_t>(kT0QuerySize - 1));
+ ASYNC,
+ static_cast<uint16>(kT0QuerySize - 1));
AddSocketData(data.Pass());
TransactionHelper helper0(kT0HostName, kT0Qtype, ERR_DNS_MALFORMED_RESPONSE);
@@ -946,7 +945,8 @@ TEST_F(DnsTransactionTest, TCPReadReturnsZeroAsync) {
make_scoped_ptr(
new DnsResponse(reinterpret_cast<const char*>(kT0ResponseDatagram),
arraysize(kT0ResponseDatagram) - 1, 0)),
- ASYNC, static_cast<uint16_t>(arraysize(kT0ResponseDatagram)));
+ ASYNC,
+ static_cast<uint16>(arraysize(kT0ResponseDatagram)));
// Then return a 0-length read.
data->AddReadError(0, ASYNC);
AddSocketData(data.Pass());
@@ -965,7 +965,8 @@ TEST_F(DnsTransactionTest, TCPReadReturnsZeroSynchronous) {
make_scoped_ptr(
new DnsResponse(reinterpret_cast<const char*>(kT0ResponseDatagram),
arraysize(kT0ResponseDatagram) - 1, 0)),
- SYNCHRONOUS, static_cast<uint16_t>(arraysize(kT0ResponseDatagram)));
+ SYNCHRONOUS,
+ static_cast<uint16>(arraysize(kT0ResponseDatagram)));
// Then return a 0-length read.
data->AddReadError(0, SYNCHRONOUS);
AddSocketData(data.Pass());
diff --git a/net/test/spawned_test_server/base_test_server.cc b/net/test/spawned_test_server/base_test_server.cc
index f45ef4a..d245cc2 100644
--- a/net/test/spawned_test_server/base_test_server.cc
+++ b/net/test/spawned_test_server/base_test_server.cc
@@ -4,9 +4,6 @@
#include "net/test/spawned_test_server/base_test_server.h"
-#include <stdint.h>
-
-#include <limits>
#include <string>
#include <vector>
@@ -288,11 +285,11 @@ bool BaseTestServer::GetAddressList(AddressList* address_list) const {
return true;
}
-uint16_t BaseTestServer::GetPort() {
+uint16 BaseTestServer::GetPort() {
return host_port_pair_.port();
}
-void BaseTestServer::SetPort(uint16_t port) {
+void BaseTestServer::SetPort(uint16 port) {
host_port_pair_.set_port(port);
}
@@ -417,7 +414,7 @@ bool BaseTestServer::ParseServerData(const std::string& server_data) {
LOG(ERROR) << "Could not find port value";
return false;
}
- if ((port <= 0) || (port > std::numeric_limits<uint16_t>::max())) {
+ if ((port <= 0) || (port > kuint16max)) {
LOG(ERROR) << "Invalid port value: " << port;
return false;
}
diff --git a/net/test/spawned_test_server/remote_test_server.cc b/net/test/spawned_test_server/remote_test_server.cc
index c563242..0e1303e 100644
--- a/net/test/spawned_test_server/remote_test_server.cc
+++ b/net/test/spawned_test_server/remote_test_server.cc
@@ -4,9 +4,6 @@
#include "net/test/spawned_test_server/remote_test_server.h"
-#include <stdint.h>
-
-#include <limits>
#include <vector>
#include "base/base_paths.h"
@@ -111,7 +108,7 @@ bool RemoteTestServer::Start() {
return false;
// Start the Python test server on the remote machine.
- uint16_t test_server_port;
+ uint16 test_server_port;
if (!spawner_communicator_->StartServer(arguments_string,
&test_server_port)) {
return false;
@@ -187,15 +184,13 @@ bool RemoteTestServer::Init(const base::FilePath& document_root) {
// Verify the ports information.
base::StringToInt(ports[0], &spawner_server_port_);
if (!spawner_server_port_ ||
- static_cast<uint32_t>(spawner_server_port_) >=
- std::numeric_limits<uint16_t>::max())
+ static_cast<uint32>(spawner_server_port_) >= kuint16max)
return false;
// Allow the test_server_port to be 0, which means the test server spawner
// will pick up a random port to run the test server.
base::StringToInt(ports[1], &test_server_port);
- if (static_cast<uint32_t>(test_server_port) >=
- std::numeric_limits<uint16_t>::max())
+ if (static_cast<uint32>(test_server_port) >= kuint16max)
return false;
SetPort(test_server_port);
diff --git a/net/test/spawned_test_server/spawner_communicator.cc b/net/test/spawned_test_server/spawner_communicator.cc
index 0962143..9a96d3c 100644
--- a/net/test/spawned_test_server/spawner_communicator.cc
+++ b/net/test/spawned_test_server/spawner_communicator.cc
@@ -4,8 +4,6 @@
#include "net/test/spawned_test_server/spawner_communicator.h"
-#include <limits>
-
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
@@ -26,7 +24,7 @@ namespace net {
namespace {
-GURL GenerateSpawnerCommandURL(const std::string& command, uint16_t port) {
+GURL GenerateSpawnerCommandURL(const std::string& command, uint16 port) {
// Always performs HTTP request for sending command to the spawner server.
return GURL(base::StringPrintf("%s:%u/%s", "http://127.0.0.1", port,
command.c_str()));
@@ -100,7 +98,7 @@ class SpawnerRequestData : public base::SupportsUserData::Data {
} // namespace
-SpawnerCommunicator::SpawnerCommunicator(uint16_t port)
+SpawnerCommunicator::SpawnerCommunicator(uint16 port)
: io_thread_("spawner_communicator"),
event_(false, false),
port_(port),
@@ -326,7 +324,7 @@ void SpawnerCommunicator::OnReadCompleted(URLRequest* request, int num_bytes) {
}
bool SpawnerCommunicator::StartServer(const std::string& arguments,
- uint16_t* port) {
+ uint16* port) {
*port = 0;
// Send the start command to spawner server to start the Python test server
// on remote machine.
@@ -354,11 +352,11 @@ bool SpawnerCommunicator::StartServer(const std::string& arguments,
}
int int_port;
if (!server_data->GetInteger("port", &int_port) || int_port <= 0 ||
- int_port > std::numeric_limits<uint16_t>::max()) {
+ int_port > kuint16max) {
LOG(ERROR) << "Invalid port value: " << int_port;
return false;
}
- *port = static_cast<uint16_t>(int_port);
+ *port = static_cast<uint16>(int_port);
return true;
}
diff --git a/net/test/spawned_test_server/spawner_communicator.h b/net/test/spawned_test_server/spawner_communicator.h
index ee1f057..15ae0c5 100644
--- a/net/test/spawned_test_server/spawner_communicator.h
+++ b/net/test/spawned_test_server/spawner_communicator.h
@@ -5,10 +5,9 @@
#ifndef NET_TEST_SPAWNED_TEST_SERVER_SPAWNER_COMMUNICATOR_H_
#define NET_TEST_SPAWNED_TEST_SERVER_SPAWNER_COMMUNICATOR_H_
-#include <stdint.h>
-
#include <string>
+#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/synchronization/waitable_event.h"
@@ -61,7 +60,7 @@ class ScopedPortException;
// fetched from spawner server or timed-out.
class SpawnerCommunicator : public URLRequest::Delegate {
public:
- explicit SpawnerCommunicator(uint16_t port);
+ explicit SpawnerCommunicator(uint16 port);
~SpawnerCommunicator() override;
// Starts an instance of the Python test server on the host/ machine.
@@ -69,7 +68,7 @@ class SpawnerCommunicator : public URLRequest::Delegate {
// on the local machine that can be used to communicate with the remote
// test server.
bool StartServer(const std::string& arguments,
- uint16_t* port) WARN_UNUSED_RESULT;
+ uint16* port) WARN_UNUSED_RESULT;
bool StopServer() WARN_UNUSED_RESULT;
@@ -123,7 +122,7 @@ class SpawnerCommunicator : public URLRequest::Delegate {
// used to control the startup and shutdown of the Python TestServer running
// on the remote machine. On Android, this port will be redirected to the
// same port on the host machine.
- const uint16_t port_;
+ const uint16 port_;
// Helper to add |port_| to the list of the globally explicitly allowed ports.
scoped_ptr<ScopedPortException> allowed_port_;
diff --git a/net/tools/dns_fuzz_stub/dns_fuzz_stub.cc b/net/tools/dns_fuzz_stub/dns_fuzz_stub.cc
index 2a2c88e..5bb6e11 100644
--- a/net/tools/dns_fuzz_stub/dns_fuzz_stub.cc
+++ b/net/tools/dns_fuzz_stub/dns_fuzz_stub.cc
@@ -2,14 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <stdint.h>
-
#include <algorithm>
-#include <limits>
#include <sstream>
#include <string>
#include <vector>
+#include "base/basictypes.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/json/json_reader.h"
@@ -41,17 +39,15 @@ void CrashNullPointerDereference(void) {
}
bool FitsUint8(int num) {
- return (num >= 0) && (num <= std::numeric_limits<uint8_t>::max());
+ return (num >= 0) && (num <= kuint8max);
}
bool FitsUint16(int num) {
- return (num >= 0) && (num <= std::numeric_limits<uint16_t>::max());
+ return (num >= 0) && (num <= kuint16max);
}
bool ReadTestCase(const char* filename,
- uint16_t* id,
- std::string* qname,
- uint16_t* qtype,
+ uint16* id, std::string* qname, uint16* qtype,
std::vector<char>* resp_buf,
bool* crash_test) {
base::FilePath filepath = base::FilePath::FromUTF8Unsafe(filename);
@@ -89,7 +85,7 @@ bool ReadTestCase(const char* filename,
LOG(ERROR) << filename << ": id is out of range.";
return false;
}
- *id = static_cast<uint16_t>(id_int);
+ *id = static_cast<uint16>(id_int);
if (!dict->GetStringASCII("qname", qname)) {
LOG(ERROR) << filename << ": qname is missing or not a string.";
@@ -105,7 +101,7 @@ bool ReadTestCase(const char* filename,
LOG(ERROR) << filename << ": qtype is out of range.";
return false;
}
- *qtype = static_cast<uint16_t>(qtype_int);
+ *qtype = static_cast<uint16>(qtype_int);
base::ListValue* resp_list;
if (!dict->GetList("response", &resp_list)) {
@@ -138,9 +134,7 @@ bool ReadTestCase(const char* filename,
return true;
}
-void RunTestCase(uint16_t id,
- std::string& qname,
- uint16_t qtype,
+void RunTestCase(uint16 id, std::string& qname, uint16 qtype,
std::vector<char>& resp_buf) {
net::DnsQuery query(id, qname, qtype);
net::DnsResponse response;
@@ -171,9 +165,9 @@ void RunTestCase(uint16_t id,
}
bool ReadAndRunTestCase(const char* filename) {
- uint16_t id = 0;
+ uint16 id = 0;
std::string qname;
- uint16_t qtype = 0;
+ uint16 qtype = 0;
std::vector<char> resp_buf;
bool crash_test = false;
diff --git a/sandbox/win/src/sandbox_nt_util.cc b/sandbox/win/src/sandbox_nt_util.cc
index 82de75c..2b2a3ba 100644
--- a/sandbox/win/src/sandbox_nt_util.cc
+++ b/sandbox/win/src/sandbox_nt_util.cc
@@ -290,8 +290,7 @@ NTSTATUS AllocAndGetFullPath(HANDLE root,
// Hacky code... replace with AllocAndCopyObjectAttributes.
NTSTATUS AllocAndCopyName(const OBJECT_ATTRIBUTES* in_object,
- wchar_t** out_name,
- uint32_t* attributes,
+ wchar_t** out_name, uint32* attributes,
HANDLE* root) {
if (!InitHeap())
return STATUS_NO_MEMORY;
@@ -434,7 +433,7 @@ UNICODE_STRING* AnsiToUnicode(const char* string) {
return out_string;
}
-UNICODE_STRING* GetImageInfoFromModule(HMODULE module, uint32_t* flags) {
+UNICODE_STRING* GetImageInfoFromModule(HMODULE module, uint32* flags) {
// PEImage's dtor won't be run during SEH unwinding, but that's OK.
#pragma warning(push)
#pragma warning(disable: 4509)
@@ -530,7 +529,7 @@ UNICODE_STRING* ExtractModuleName(const UNICODE_STRING* module_path) {
// Based on the code above, size_bytes should always be small enough
// to make the static_cast below safe.
- DCHECK_NT(UINT16_MAX > size_bytes);
+ DCHECK_NT(kuint16max > size_bytes);
char* str_buffer = new(NT_ALLOC) char[size_bytes + sizeof(UNICODE_STRING)];
if (!str_buffer)
return NULL;
@@ -586,9 +585,8 @@ NTSTATUS AutoProtectMemory::RevertProtection() {
return ret;
}
-bool IsSupportedRenameCall(FILE_RENAME_INFORMATION* file_info,
- DWORD length,
- uint32_t file_info_class) {
+bool IsSupportedRenameCall(FILE_RENAME_INFORMATION* file_info, DWORD length,
+ uint32 file_info_class) {
if (FileRenameInformation != file_info_class)
return false;
@@ -608,7 +606,7 @@ bool IsSupportedRenameCall(FILE_RENAME_INFORMATION* file_info,
// Check if it starts with \\??\\. We don't support relative paths.
if (file_info->FileNameLength < sizeof(kPathPrefix) ||
- file_info->FileNameLength > UINT16_MAX)
+ file_info->FileNameLength > kuint16max)
return false;
if (file_info->FileName[0] != kPathPrefix[0] ||
diff --git a/sandbox/win/src/sandbox_nt_util.h b/sandbox/win/src/sandbox_nt_util.h
index 3dee932..83dd7c0 100644
--- a/sandbox/win/src/sandbox_nt_util.h
+++ b/sandbox/win/src/sandbox_nt_util.h
@@ -6,9 +6,8 @@
#define SANDBOX_SRC_SANDBOX_NT_UTIL_H_
#include <intrin.h>
-#include <stdint.h>
-#include "base/macros.h"
+#include "base/basictypes.h"
#include "sandbox/win/src/nt_internals.h"
#include "sandbox/win/src/sandbox_nt_types.h"
@@ -102,9 +101,7 @@ NTSTATUS CopyData(void* destination, const void* source, size_t bytes);
// Copies the name from an object attributes.
NTSTATUS AllocAndCopyName(const OBJECT_ATTRIBUTES* in_object,
- wchar_t** out_name,
- uint32_t* attributes,
- HANDLE* root);
+ wchar_t** out_name, uint32* attributes, HANDLE* root);
// Determine full path name from object root and path.
NTSTATUS AllocAndGetFullPath(HANDLE root,
@@ -137,7 +134,7 @@ enum MappedModuleFlags {
// }
// InsertYourLogicHere(name);
// operator delete(name, NT_ALLOC);
-UNICODE_STRING* GetImageInfoFromModule(HMODULE module, uint32_t* flags);
+UNICODE_STRING* GetImageInfoFromModule(HMODULE module, uint32* flags);
// Returns the full path and filename for a given dll.
// May return NULL if the provided address is not backed by a named section, or
@@ -185,9 +182,8 @@ class AutoProtectMemory {
// Returns true if the file_rename_information structure is supported by our
// rename handler.
-bool IsSupportedRenameCall(FILE_RENAME_INFORMATION* file_info,
- DWORD length,
- uint32_t file_info_class);
+bool IsSupportedRenameCall(FILE_RENAME_INFORMATION* file_info, DWORD length,
+ uint32 file_info_class);
} // namespace sandbox