summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-07 15:29:49 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-07 15:29:49 +0000
commit6b27db809e959efaf7183ea2de64c6ab3947ef3d (patch)
treeed2ed10f826f6eb40884231ee0c98d86afef44a7 /net
parent65b1094478e054ef1f924d3681f8d34ec88d9fcf (diff)
downloadchromium_src-6b27db809e959efaf7183ea2de64c6ab3947ef3d.zip
chromium_src-6b27db809e959efaf7183ea2de64c6ab3947ef3d.tar.gz
chromium_src-6b27db809e959efaf7183ea2de64c6ab3947ef3d.tar.bz2
Remove the old NativeMB functions from string util, and use the new ones in sys_strings.h. I also removed duplicated code from the sandbox that can now use this, and fixed one case in the bug reporter that should not have been using the native multibyte encoding.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@515 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/net_util.cc7
-rw-r--r--net/http/http_transaction_winhttp.cc6
2 files changed, 8 insertions, 5 deletions
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index e339838..d8d0949 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -46,6 +46,7 @@
#include "base/scoped_ptr.h"
#include "base/string_tokenizer.h"
#include "base/string_util.h"
+#include "base/sys_string_conversions.h"
#include "base/time.h"
#include "base/string_escape.h"
#include "googleurl/src/gurl.h"
@@ -260,7 +261,7 @@ bool DecodeWord(const std::string& encoded_word,
if (IsStringUTF8(encoded_word.c_str())) {
*output = encoded_word;
} else {
- *output = WideToUTF8(NativeMBToWide(encoded_word));
+ *output = WideToUTF8(base::SysNativeMBToWide(encoded_word));
}
*is_rfc2047 = false;
return true;
@@ -722,7 +723,7 @@ bool FileURLToFilePath(const GURL& url, std::wstring* file_path) {
// are giving the conversion function a nonempty string, and it may fail if
// the given string is not in the current encoding and give us an empty
// string back. We detect this and report failure.
- *file_path = NativeMBToWide(path);
+ *file_path = base::SysNativeMBToWide(path);
return !file_path->empty();
}
file_path->assign(UTF8ToWide(path));
@@ -748,7 +749,7 @@ bool FileURLToFilePath(const GURL& url, std::wstring* file_path) {
} else {
// Our wide string contains only 8-bit characters and it's not UTF-8, so
// we assume it's in the native codepage.
- *file_path = NativeMBToWide(narrow);
+ *file_path = base::SysNativeMBToWide(narrow);
}
// Fail if 8-bit -> wide conversion failed and gave us an empty string back
diff --git a/net/http/http_transaction_winhttp.cc b/net/http/http_transaction_winhttp.cc
index 1c0914b..0d7fda2 100644
--- a/net/http/http_transaction_winhttp.cc
+++ b/net/http/http_transaction_winhttp.cc
@@ -35,6 +35,7 @@
#include "base/memory_debug.h"
#include "base/message_loop.h"
#include "base/string_util.h"
+#include "base/sys_string_conversions.h"
#include "googleurl/src/gurl.h"
#include "net/base/auth_cache.h"
#include "net/base/cert_status_flags.h"
@@ -1155,7 +1156,7 @@ bool HttpTransactionWinHttp::OpenRequest() {
// Add request headers. WinHttp is known to convert the headers to bytes
// using the system charset converter, so we use the same converter to map
// our request headers to UTF-16 before handing the data to WinHttp.
- std::wstring request_headers = NativeMBToWide(GetRequestHeaders());
+ std::wstring request_headers = base::SysNativeMBToWide(GetRequestHeaders());
DWORD len = static_cast<DWORD>(request_headers.size());
if (!WinHttpAddRequestHeaders(request_handle_,
@@ -1490,7 +1491,8 @@ int HttpTransactionWinHttp::DidReceiveHeaders() {
// From experimentation, it appears that WinHttp translates non-ASCII bytes
// found in the response headers to UTF-16 assuming that they are encoded
// using the default system charset. We attempt to undo that here.
- response_.headers = new HttpResponseHeaders(WideToNativeMB(raw_headers));
+ response_.headers =
+ new HttpResponseHeaders(base::SysWideToNativeMB(raw_headers));
// WinHTTP truncates a response longer than 2GB. Perhaps it stores the
// response's content length in a signed 32-bit integer. We fail rather