Skip to content

Commit

Permalink
url: Use std::numeric_limits in place of deprecated types from basict…
Browse files Browse the repository at this point in the history
…ypes.h

Small cleanup to help remove basictypes.h one day.

BUG=138542
TEST=url_unittests
R=brettw@chromium.org

Review URL: https://codereview.chromium.org/1124403002

Cr-Commit-Position: refs/heads/master@{#328850}
  • Loading branch information
tfarina authored and Commit bot committed May 7, 2015
1 parent b916ecb commit 5595f3b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions url/url_canon_ip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "url/url_canon_ip.h"

#include <stdlib.h>
#include <limits>

#include "base/basictypes.h"
#include "base/logging.h"
Expand Down Expand Up @@ -146,7 +147,7 @@ CanonHostInfo::Family IPv4ComponentToNumber(const CHAR* spec,
uint64 num = _strtoui64(buf, NULL, BaseForType(base));

// Check for 32-bit overflow.
if (num > kuint32max)
if (num > std::numeric_limits<uint32_t>::max())
return CanonHostInfo::BROKEN;

// No overflow. Success!
Expand Down Expand Up @@ -198,7 +199,7 @@ CanonHostInfo::Family DoIPv4AddressToNumber(const CHAR* spec,
// First, process all components but the last, while making sure each fits
// within an 8-bit field.
for (int i = 0; i < existing_components - 1; i++) {
if (component_values[i] > kuint8max)
if (component_values[i] > std::numeric_limits<uint8_t>::max())
return CanonHostInfo::BROKEN;
address[i] = static_cast<unsigned char>(component_values[i]);
}
Expand Down

0 comments on commit 5595f3b

Please sign in to comment.