File tree Expand file tree Collapse file tree 2 files changed +15
-15
lines changed Expand file tree Collapse file tree 2 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -143,13 +143,13 @@ void RTNAME(Sleep)(std::int64_t seconds) {
143
143
#ifndef _WIN32
144
144
std::int64_t FORTRAN_PROCEDURE_NAME (access)(const char *name,
145
145
std::int64_t nameLength, const char *mode, std::int64_t modeLength) {
146
- std::int64_t ret = - 1 ;
146
+ std::int64_t ret{- 1 } ;
147
147
if (nameLength <= 0 || modeLength <= 0 || !name || !mode) {
148
148
return ret;
149
149
}
150
150
151
151
// ensure name is null terminated
152
- char *newName = nullptr ;
152
+ char *newName{ nullptr } ;
153
153
if (name[nameLength - 1 ] != ' \0 ' ) {
154
154
newName = static_cast <char *>(std::malloc (nameLength + 1 ));
155
155
std::memcpy (newName, name, nameLength);
@@ -158,11 +158,11 @@ std::int64_t FORTRAN_PROCEDURE_NAME(access)(const char *name,
158
158
}
159
159
160
160
// calculate mode
161
- bool read = false ;
162
- bool write = false ;
163
- bool execute = false ;
164
- bool exists = false ;
165
- int imode = 0 ;
161
+ bool read{ false } ;
162
+ bool write{ false } ;
163
+ bool execute{ false } ;
164
+ bool exists{ false } ;
165
+ int imode{ 0 } ;
166
166
167
167
for (std::int64_t i = 0 ; i < modeLength; ++i) {
168
168
switch (mode[i]) {
Original file line number Diff line number Diff line change @@ -24,10 +24,10 @@ namespace {
24
24
struct AccessTests : public CrashHandlerFixture {};
25
25
26
26
struct AccessType {
27
- bool read = false ;
28
- bool write = false ;
29
- bool execute = false ;
30
- bool exists = false ;
27
+ bool read{ false } ;
28
+ bool write{ false } ;
29
+ bool execute{ false } ;
30
+ bool exists{ false } ;
31
31
};
32
32
33
33
} // namespace
@@ -44,15 +44,15 @@ static std::string addPIDSuffix(const char *name) {
44
44
45
45
static std::filesystem::path createTemporaryFile (
46
46
const char *name, const AccessType &accessType) {
47
- std::filesystem::path path =
48
- std::filesystem::temp_directory_path () / addPIDSuffix (name);
47
+ std::filesystem::path path{
48
+ std::filesystem::temp_directory_path () / addPIDSuffix (name)} ;
49
49
50
50
// O_CREAT | O_EXCL enforces that this file is newly created by this call.
51
51
// This feels risky. If we don't have permission to create files in the
52
52
// temporary directory or if the files already exist, the test will fail.
53
53
// But we can't use std::tmpfile() because we need a path to the file and
54
54
// to control the filesystem permissions
55
- mode_t mode = 0 ;
55
+ mode_t mode{ 0 } ;
56
56
if (accessType.read ) {
57
57
mode |= S_IRUSR;
58
58
}
@@ -75,7 +75,7 @@ static std::filesystem::path createTemporaryFile(
75
75
76
76
static std::int64_t callAccess (
77
77
const std::filesystem::path &path, const AccessType &accessType) {
78
- const char *cpath = path.c_str ();
78
+ const char *cpath{ path.c_str ()} ;
79
79
std::int64_t pathlen = std::strlen (cpath);
80
80
81
81
std::string mode;
You can’t perform that action at this time.
0 commit comments