summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Windows/Path.inc
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2013-10-06 20:44:34 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2013-10-06 20:44:34 +0000
commitf636cf422ee44138eed48dfc9dc05d20b6ae113c (patch)
tree012eeb09b116552d1471569c8080f6b58ac751f4 /llvm/lib/Support/Windows/Path.inc
parent80bea0c3153775b6be44db0fdae356345afe9d0f (diff)
downloadbcm5719-llvm-f636cf422ee44138eed48dfc9dc05d20b6ae113c.tar.gz
bcm5719-llvm-f636cf422ee44138eed48dfc9dc05d20b6ae113c.zip
Revert "Windows: Add support for unicode command lines"
This is causing MinGW bots to fail. This reverts commit r192069. llvm-svn: 192070
Diffstat (limited to 'llvm/lib/Support/Windows/Path.inc')
-rw-r--r--llvm/lib/Support/Windows/Path.inc29
1 files changed, 14 insertions, 15 deletions
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc
index 998ec422ec6..94a501b39ac 100644
--- a/llvm/lib/Support/Windows/Path.inc
+++ b/llvm/lib/Support/Windows/Path.inc
@@ -128,7 +128,7 @@ retry_random_path:
BYTE val = 0;
if (!::CryptGenRandom(CryptoProvider, 1, &val))
return windows_error(::GetLastError());
- random_path_utf16.push_back(L"0123456789abcdef"[val & 15]);
+ random_path_utf16.push_back("0123456789abcdef"[val & 15]);
}
else
random_path_utf16.push_back(*i);
@@ -241,23 +241,22 @@ TimeValue file_status::getLastModificationTime() const {
}
error_code current_path(SmallVectorImpl<char> &result) {
- SmallVector<wchar_t, MAX_PATH> cur_path;
- DWORD len = MAX_PATH;
+ SmallVector<wchar_t, 128> cur_path;
+ cur_path.reserve(128);
+retry_cur_dir:
+ DWORD len = ::GetCurrentDirectoryW(cur_path.capacity(), cur_path.data());
- do {
- cur_path.reserve(len);
- len = ::GetCurrentDirectoryW(cur_path.capacity(), cur_path.data());
-
- // A zero return value indicates a failure other than insufficient space.
- if (len == 0)
- return windows_error(::GetLastError());
+ // A zero return value indicates a failure other than insufficient space.
+ if (len == 0)
+ return windows_error(::GetLastError());
- // If there's insufficient space, the len returned is larger than the len
- // given.
- } while (len > cur_path.capacity());
+ // If there's insufficient space, the len returned is larger than the len
+ // given.
+ if (len > cur_path.capacity()) {
+ cur_path.reserve(len);
+ goto retry_cur_dir;
+ }
- // On success, GetCurrentDirectoryW returns the number of characters not
- // including the null-terminator.
cur_path.set_size(len);
return UTF16ToUTF8(cur_path.begin(), cur_path.size(), result);
}
OpenPOWER on IntegriCloud