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

Unified Diff: net/base/net_util.cc

Issue 9614004: Avoid loading ws2_32.dll just to get htons() and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make patch 4.7% uglier with helpful TODOs. Created 8 years, 10 months 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
« no previous file with comments | « crypto/p224.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util.cc
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 5ecf74042bf250a4b164cb1aeeafa50b6d534aaa..2ba3b4688f1dc3718c58f0d03aa52ba211edebb3 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -48,6 +48,7 @@
#include "base/stringprintf.h"
#include "base/synchronization/lock.h"
#include "base/sys_string_conversions.h"
+#include "base/sys_byteorder.h"
#include "base/time.h"
#include "base/utf_offset_string_conversions.h"
#include "base/utf_string_conversions.h"
@@ -75,6 +76,14 @@
using base::Time;
+#if defined(OS_WIN)
+// Allow htons/ntohs to be called without requiring ws2_32.dll to be loaded,
+// which isn't available in Chrome's sandbox. See crbug.com/116591.
+// TODO(wez): Replace these calls with base::htons() etc when available.
+#define ntohs(x) _byteswap_ushort(x)
+#define htons(x) _byteswap_ushort(x)
+#endif // OS_WIN
+
namespace net {
namespace {
« no previous file with comments | « crypto/p224.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698