summaryrefslogtreecommitdiff
path: root/drivers/windows
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/windows')
-rw-r--r--drivers/windows/dir_access_windows.cpp18
-rw-r--r--drivers/windows/file_access_windows.cpp12
-rw-r--r--drivers/windows/thread_windows.cpp4
3 files changed, 20 insertions, 14 deletions
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index cf09f79832..a8618b05d7 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -67,7 +67,7 @@ Error DirAccessWindows::list_dir_begin() {
_cishidden = false;
list_dir_end();
- p->h = FindFirstFileExW((current_dir + "\\*").c_str(), FindExInfoStandard, &p->fu, FindExSearchNameMatch, NULL, 0);
+ p->h = FindFirstFileExW((current_dir + "\\*").c_str(), FindExInfoStandard, &p->fu, FindExSearchNameMatch, nullptr, 0);
return (p->h == INVALID_HANDLE_VALUE) ? ERR_CANT_OPEN : OK;
}
@@ -175,7 +175,7 @@ Error DirAccessWindows::make_dir(String p_dir) {
p_dir = "\\\\?\\" + p_dir; //done according to
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa363855(v=vs.85).aspx
- success = CreateDirectoryW(p_dir.c_str(), NULL);
+ success = CreateDirectoryW(p_dir.c_str(), nullptr);
err = GetLastError();
if (success) {
@@ -206,7 +206,13 @@ String DirAccessWindows::get_current_dir(bool p_include_drive) {
if (p_include_drive) {
return current_dir;
} else {
- return current_dir.right(current_dir.find(":") + 1);
+ if (_get_root_string() == "") {
+ int p = current_dir.find(":");
+ if (p != -1) {
+ return current_dir.right(p + 1);
+ }
+ }
+ return current_dir;
}
}
@@ -269,11 +275,11 @@ Error DirAccessWindows::rename(String p_path, String p_new_path) {
if (p_path.to_lower() == p_new_path.to_lower()) {
WCHAR tmpfile[MAX_PATH];
- if (!GetTempFileNameW(fix_path(get_current_dir()).c_str(), NULL, 0, tmpfile)) {
+ if (!GetTempFileNameW(fix_path(get_current_dir()).c_str(), nullptr, 0, tmpfile)) {
return FAILED;
}
- if (!::ReplaceFileW(tmpfile, p_path.c_str(), NULL, 0, NULL, NULL)) {
+ if (!::ReplaceFileW(tmpfile, p_path.c_str(), nullptr, 0, nullptr, nullptr)) {
DeleteFileW(tmpfile);
return FAILED;
}
@@ -343,7 +349,7 @@ FileType DirAccessWindows::get_file_type(const String& p_file) const {
size_t DirAccessWindows::get_space_left() {
uint64_t bytes = 0;
- if (!GetDiskFreeSpaceEx(NULL, (PULARGE_INTEGER)&bytes, NULL, NULL))
+ if (!GetDiskFreeSpaceEx(nullptr, (PULARGE_INTEGER)&bytes, nullptr, nullptr))
return 0;
//this is either 0 or a value in bytes.
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index 01d2b8716f..69078b3326 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -117,7 +117,7 @@ Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) {
errno_t errcode = _wfopen_s(&f, path.c_str(), mode_string);
- if (f == NULL) {
+ if (f == nullptr) {
switch (errcode) {
case ENOENT: {
last_error = ERR_FILE_NOT_FOUND;
@@ -140,7 +140,7 @@ void FileAccessWindows::close() {
return;
fclose(f);
- f = NULL;
+ f = nullptr;
if (save_path != "") {
@@ -164,7 +164,7 @@ void FileAccessWindows::close() {
rename_error = _wrename((save_path + ".tmp").c_str(), save_path.c_str()) != 0;
} else {
//atomic replace for existing file
- rename_error = !ReplaceFileW(save_path.c_str(), (save_path + ".tmp").c_str(), NULL, 2 | 4, NULL, NULL);
+ rename_error = !ReplaceFileW(save_path.c_str(), (save_path + ".tmp").c_str(), nullptr, 2 | 4, nullptr, nullptr);
}
if (rename_error) {
attempts--;
@@ -196,7 +196,7 @@ String FileAccessWindows::get_path_absolute() const {
bool FileAccessWindows::is_open() const {
- return (f != NULL);
+ return (f != nullptr);
}
void FileAccessWindows::seek(size_t p_position) {
@@ -318,7 +318,7 @@ bool FileAccessWindows::file_exists(const String &p_name) {
//printf("opening file %s\n", p_fname.c_str());
String filename = fix_path(p_name);
_wfopen_s(&g, filename.c_str(), L"rb");
- if (g == NULL) {
+ if (g == nullptr) {
return false;
} else {
@@ -354,7 +354,7 @@ Error FileAccessWindows::_set_unix_permissions(const String &p_file, uint32_t p_
}
FileAccessWindows::FileAccessWindows() :
- f(NULL),
+ f(nullptr),
flags(0),
prev_op(0),
last_error(OK) {
diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp
index a7f34b64ca..aea2db2603 100644
--- a/drivers/windows/thread_windows.cpp
+++ b/drivers/windows/thread_windows.cpp
@@ -64,7 +64,7 @@ Thread *ThreadWindows::create_func_windows(ThreadCreateCallback p_callback, void
ThreadWindows *tr = memnew(ThreadWindows);
tr->callback = p_callback;
tr->user = p_user;
- tr->handle = CreateEvent(NULL, TRUE, FALSE, NULL);
+ tr->handle = CreateEvent(nullptr, TRUE, FALSE, nullptr);
QueueUserWorkItem(thread_callback, tr, WT_EXECUTELONGFUNCTION);
@@ -91,7 +91,7 @@ void ThreadWindows::make_default() {
}
ThreadWindows::ThreadWindows() :
- handle(NULL) {
+ handle(nullptr) {
}
ThreadWindows::~ThreadWindows() {