diff options
author | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-18 16:07:55 +0000 |
---|---|---|
committer | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-18 16:07:55 +0000 |
commit | 33edeab42b851a5617a77caa1d65a3782a01ee7b (patch) | |
tree | d1baa44ff796c9f0c4881e9819e7e5b359489b1d /base/file_util_win.cc | |
parent | f348b92e95dd67fef3a9a6109bc0465fb4078d6b (diff) | |
download | chromium_src-33edeab42b851a5617a77caa1d65a3782a01ee7b.zip chromium_src-33edeab42b851a5617a77caa1d65a3782a01ee7b.tar.gz chromium_src-33edeab42b851a5617a77caa1d65a3782a01ee7b.tar.bz2 |
Renames the function CreateTemporaryFilename to CreateTemporaryFile and track down all callers, also removes the
deprecated function that uses std::wstring.
BUG=3078 (http://crbug.com/3078)
TEST=run base_unittests, installer_util_unittests, net_unittests, setup_unittests, and unit_tests.
Review URL: http://codereview.chromium.org/164537
Patch from Thiago Farina.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23631 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_win.cc')
-rw-r--r-- | base/file_util_win.cc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc index c83322e..cffe72e 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -445,14 +445,14 @@ bool GetShmemTempDir(FilePath* path) { return GetTempDir(path); } -bool CreateTemporaryFileName(FilePath* path) { - std::wstring temp_path, temp_file; +bool CreateTemporaryFile(FilePath* path) { + FilePath temp_file; - if (!GetTempDir(&temp_path)) + if (!GetTempDir(path)) return false; - if (CreateTemporaryFileNameInDir(temp_path, &temp_file)) { - *path = FilePath(temp_file); + if (CreateTemporaryFileInDir(*path, &temp_file)) { + *path = temp_file; return true; } @@ -468,29 +468,29 @@ FILE* CreateAndOpenTemporaryShmemFile(FilePath* path) { // TODO(jrg): is there equivalent call to use on Windows instead of // going 2-step? FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path) { - std::wstring wstring_path; - if (!CreateTemporaryFileNameInDir(dir.value(), &wstring_path)) { + if (!CreateTemporaryFileInDir(dir, path)) { return NULL; } - *path = FilePath(wstring_path); // Open file in binary mode, to avoid problems with fwrite. On Windows // it replaces \n's with \r\n's, which may surprise you. // Reference: http://msdn.microsoft.com/en-us/library/h9t88zwz(VS.71).aspx return OpenFile(*path, "wb+"); } -bool CreateTemporaryFileNameInDir(const std::wstring& dir, - std::wstring* temp_file) { +bool CreateTemporaryFileInDir(const FilePath& dir, + FilePath* temp_file) { wchar_t temp_name[MAX_PATH + 1]; - if (!GetTempFileName(dir.c_str(), L"", 0, temp_name)) + if (!GetTempFileName(dir.value().c_str(), L"", 0, temp_name)) return false; // fail! DWORD path_len = GetLongPathName(temp_name, temp_name, MAX_PATH); if (path_len > MAX_PATH + 1 || path_len == 0) return false; // fail! - temp_file->assign(temp_name, path_len); + std::wstring temp_file_str; + temp_file_str.assign(temp_name, path_len); + *temp_file = FilePath(temp_file_str); return true; } |