Skip to content

Commit 6cf7fe4

Browse files
committed
Revert "[flang][runtime] Support all non-ASCII characters in temporary path on Windows"
This reverts commit fd0d846. It seems to have broken various flang unit tests on AArch64 Windows platform. https://lab.llvm.org/buildbot/#/builders/65/builds/9856 https://lab.llvm.org/buildbot/#/builders/120/builds/4883 Differential Revision: https://reviews.llvm.org/D151571
1 parent d093111 commit 6cf7fe4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

flang/runtime/file.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,19 @@ void OpenFile::set_path(OwningPtr<char> &&path, std::size_t bytes) {
3333
static int openfile_mkstemp(IoErrorHandler &handler) {
3434
#ifdef _WIN32
3535
const unsigned int uUnique{0};
36-
// GetTempFileNameW needs a directory name < MAX_PATH-14 characters in length.
37-
// https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettempfilenamew
38-
wchar_t tempDirName[MAX_PATH - 14];
39-
wchar_t tempFileName[MAX_PATH];
36+
// GetTempFileNameA needs a directory name < MAX_PATH-14 characters in length.
37+
// https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettempfilenamea
38+
char tempDirName[MAX_PATH - 14];
39+
char tempFileName[MAX_PATH];
4040
unsigned long nBufferLength{sizeof(tempDirName)};
41-
nBufferLength = ::GetTempPathW(nBufferLength, tempDirName);
41+
nBufferLength = ::GetTempPathA(nBufferLength, tempDirName);
4242
if (nBufferLength > sizeof(tempDirName) || nBufferLength == 0) {
4343
return -1;
4444
}
45-
if (::GetTempFileNameW(tempDirName, L"Fortran", uUnique, tempFileName) == 0) {
45+
if (::GetTempFileNameA(tempDirName, "Fortran", uUnique, tempFileName) == 0) {
4646
return -1;
4747
}
48-
int fd{::_wopen(tempFileName, _O_CREAT | _O_BINARY | _O_TEMPORARY | _O_RDWR,
48+
int fd{::_open(tempFileName, _O_CREAT | _O_BINARY | _O_TEMPORARY | _O_RDWR,
4949
_S_IREAD | _S_IWRITE)};
5050
#else
5151
char path[]{"/tmp/Fortran-Scratch-XXXXXX"};

0 commit comments

Comments
 (0)