summaryrefslogtreecommitdiffstats
path: root/sandbox
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 /sandbox
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 'sandbox')
-rw-r--r--sandbox/tests/common/controller.cc38
1 files changed, 2 insertions, 36 deletions
diff --git a/sandbox/tests/common/controller.cc b/sandbox/tests/common/controller.cc
index 5abc7a6..6ebd200 100644
--- a/sandbox/tests/common/controller.cc
+++ b/sandbox/tests/common/controller.cc
@@ -31,6 +31,7 @@
#include <string>
+#include "base/sys_string_conversions.h"
#include "sandbox/src/sandbox_factory.h"
#include "sandbox/src/sandbox_utils.h"
@@ -41,41 +42,6 @@ namespace {
static const int kDefaultTimeout = 3000;
-// Grabbed from chrome/common/string_util.h
-template <class char_type>
-inline char_type* WriteInto(
- std::basic_string<char_type, std::char_traits<char_type>,
- std::allocator<char_type> >* str,
- size_t length_including_null) {
- str->reserve(length_including_null);
- str->resize(length_including_null - 1);
- return &((*str)[0]);
-}
-
-// Grabbed from chrome/common/string_util.cc
-std::string WideToMultiByte(const std::wstring& wide, UINT code_page) {
- if (wide.length() == 0)
- return std::string();
-
- // compute the length of the buffer we'll need
- int charcount = WideCharToMultiByte(code_page, 0, wide.c_str(), -1,
- NULL, 0, NULL, NULL);
- if (charcount == 0)
- return std::string();
-
- // convert
- std::string mb;
- WideCharToMultiByte(code_page, 0, wide.c_str(), -1,
- WriteInto(&mb, charcount), charcount, NULL, NULL);
-
- return mb;
-}
-
-// Grabbed from chrome/common/string_util.cc
-std::string WideToUTF8(const std::wstring& wide) {
- return WideToMultiByte(wide, CP_UTF8);
-}
-
} // namespace
namespace sandbox {
@@ -287,7 +253,7 @@ int DispatchCall(int argc, wchar_t **argv) {
&module))
return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND;
- std::string command_name = WideToUTF8(argv[3]);
+ std::string command_name = base::SysWideToUTF8(argv[3]);
CommandFunction command = reinterpret_cast<CommandFunction>(
::GetProcAddress(module, command_name.c_str()));