summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-28 20:19:31 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-28 20:19:31 +0000
commit9eb7b11b614e987d7608678d0396873f37ca817e (patch)
tree7f222f4ae73bd3c3edc33d39f3bf7050d10f4254 /sync
parent97f37d558f60a245190b17ce14d3d9039fc83767 (diff)
downloadchromium_src-9eb7b11b614e987d7608678d0396873f37ca817e.zip
chromium_src-9eb7b11b614e987d7608678d0396873f37ca817e.tar.gz
chromium_src-9eb7b11b614e987d7608678d0396873f37ca817e.tar.bz2
Add base::HostToNetXX() & NetToHostXX(), and use them to replace htonX() & ntohX() in Chrome.
This primarily addresses issues with code using the OS-provided htonX() & ntohX() functions from within the Chrome sandbox. Under Windows these functions are provided by ws2_32.dll, which is no longer available within Chrome's sandbox. The new base::HostToNetXX() and NetToHostXX() functions are safe for use by sandboxed code on Windows, and provide a single place where future fixes for other platforms can be made. BUG=117252 Review URL: http://codereview.chromium.org/9716020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/util/nigori.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sync/util/nigori.cc b/sync/util/nigori.cc
index 1b0e3c1..0b96b37 100644
--- a/sync/util/nigori.cc
+++ b/sync/util/nigori.cc
@@ -31,7 +31,7 @@ class NigoriStream {
// Append the big-endian representation of the length of |value| with 32 bits,
// followed by |value| itself to the stream.
NigoriStream& operator<<(const std::string& value) {
- uint32 size = htonl(value.size());
+ uint32 size = base::HostToNet32(value.size());
stream_.write((char *) &size, sizeof(uint32));
stream_ << value;
return *this;
@@ -41,9 +41,9 @@ class NigoriStream {
// followed by the big-endian representation of the value of |type|, with 32
// bits, to the stream.
NigoriStream& operator<<(const Nigori::Type type) {
- uint32 size = htonl(sizeof(uint32));
+ uint32 size = base::HostToNet32(sizeof(uint32));
stream_.write((char *) &size, sizeof(uint32));
- uint32 value = htonl(type);
+ uint32 value = base::HostToNet32(type);
stream_.write((char *) &value, sizeof(uint32));
return *this;
}