summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authormaruel@google.com <maruel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-23 16:29:05 +0000
committermaruel@google.com <maruel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-23 16:29:05 +0000
commit6e13b1df93d706045f2da60a61ffebda047385ce (patch)
treef1d5803b278cfcfe08ce12328a50d711cfbe71e7 /net
parent3285544e4190d671613e871ca27341268d0776a5 (diff)
downloadchromium_src-6e13b1df93d706045f2da60a61ffebda047385ce.zip
chromium_src-6e13b1df93d706045f2da60a61ffebda047385ce.tar.gz
chromium_src-6e13b1df93d706045f2da60a61ffebda047385ce.tar.bz2
HttpVersion had to be changed because glibc defines macros named "major" and "minor" which was causing compilation problems.
Patch contributed by James Vega <vega.james@gmail.com>. Note: Took the leasure to make some globals const. Review URL: http://codereview.chromium.org/4217 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2491 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/http/http_response_headers.cc8
-rw-r--r--net/http/http_version.h31
2 files changed, 19 insertions, 20 deletions
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc
index 604a522..8dca8a7 100644
--- a/net/http/http_response_headers.cc
+++ b/net/http/http_response_headers.cc
@@ -28,7 +28,7 @@ namespace {
// These response headers are not persisted in a cached representation of the
// response headers. (This list comes from Mozilla's nsHttpResponseHead.cpp)
-const char* kTransientHeaders[] = {
+const char* const kTransientHeaders[] = {
"connection",
"proxy-connection",
"keep-alive",
@@ -43,7 +43,7 @@ const char* kTransientHeaders[] = {
// These respones headers are not copied from a 304/206 response to the cached
// response headers. This list is based on Mozilla's nsHttpResponseHead.cpp.
-const char* kNonUpdatedHeaders[] = {
+const char* const kNonUpdatedHeaders[] = {
"connection",
"proxy-connection",
"keep-alive",
@@ -453,8 +453,8 @@ void HttpResponseHeaders::ParseStatusLine(string::const_iterator line_begin,
raw_headers_ = "HTTP/1.0";
}
if (parsed_http_version_ != http_version_) {
- DLOG(INFO) << "assuming HTTP/" << http_version_.major() << "."
- << http_version_.minor();
+ DLOG(INFO) << "assuming HTTP/" << http_version_.major_value() << "."
+ << http_version_.minor_value();
}
// TODO(eroman): this doesn't make sense if ParseVersion failed.
diff --git a/net/http/http_version.h b/net/http/http_version.h
index 9f4cfba..8ea8fd5 100644
--- a/net/http/http_version.h
+++ b/net/http/http_version.h
@@ -11,49 +11,48 @@ namespace net {
// Wrapper for an HTTP (major,minor) version pair.
class HttpVersion {
- private:
- uint32 value; // Packed as <major>:<minor>
-
public:
// Default constructor (major=0, minor=0).
- HttpVersion() : value(0) { }
+ HttpVersion() : value_(0) { }
// Build from unsigned major/minor pair.
- HttpVersion(uint16 major, uint16 minor) : value(major << 16 | minor) { }
+ HttpVersion(uint16 major, uint16 minor) : value_(major << 16 | minor) { }
// Major version number.
- uint16 major() const {
- return value >> 16;
+ uint16 major_value() const {
+ return value_ >> 16;
}
// Minor version number.
- uint16 minor() const {
- return value & 0xffff;
+ uint16 minor_value() const {
+ return value_ & 0xffff;
}
// Overloaded operators:
bool operator==(const HttpVersion& v) const {
- return value == v.value;
+ return value_ == v.value_;
}
bool operator!=(const HttpVersion& v) const {
- return value != v.value;
+ return value_ != v.value_;
}
bool operator>(const HttpVersion& v) const {
- return value > v.value;
+ return value_ > v.value_;
}
bool operator>=(const HttpVersion& v) const {
- return value >= v.value;
+ return value_ >= v.value_;
}
bool operator<(const HttpVersion& v) const {
- return value < v.value;
+ return value_ < v.value_;
}
bool operator<=(const HttpVersion& v) const {
- return value <= v.value;
+ return value_ <= v.value_;
}
+
+ private:
+ uint32 value_; // Packed as <major>:<minor>
};
} // namespace net
#endif // NET_HTTP_VERSION_H_
-