aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2021-05-17 11:54:07 -0400
committerJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2021-05-17 11:54:07 -0400
commit2381665eddef0159296cf60abe4edcd3c9be7b70 (patch)
tree37f51ca3aee57fd4eaadf53853731dc545c15dca /common
parentbbc986be5425c6abdddb6eaab6dca1b5054c43e0 (diff)
downloadlevitating-2381665eddef0159296cf60abe4edcd3c9be7b70.tar.gz
levitating-2381665eddef0159296cf60abe4edcd3c9be7b70.zip
Fixed temp filename creation on Windows caused by bad strlen call.
Diffstat (limited to 'common')
-rw-r--r--common/utilities.F9011
1 files changed, 7 insertions, 4 deletions
diff --git a/common/utilities.F90 b/common/utilities.F90
index 4c0c13f..abf6bc1 100644
--- a/common/utilities.F90
+++ b/common/utilities.F90
@@ -187,7 +187,7 @@ contains
function c_strlen(p) bind(c, name='strlen')
use iso_c_binding
type(c_ptr), value::p
- integer(kind=c_size_t)::strlen
+ integer(kind=c_size_t)::c_strlen
end function c_strlen
function c_malloc(x) bind(c, name='malloc')
@@ -220,8 +220,9 @@ contains
end function GetTempFileName
end interface
- type(c_ptr)::tmp_path
+ type(c_ptr)::tmp_path, tmp_prefix
integer::res
+ character(len=4, kind=c_char), target::prefix
tmp_path = c_malloc(int(1024, kind=c_size_t))
if(.not. associated(temporary_directory)) then
@@ -230,8 +231,11 @@ contains
tmp_path = c_loc(temporary_directory)
end if
+ Print *, res
+
tmp_name = c_malloc(int(1024, kind=c_size_t))
- res = GetTempFileName(tmp_path, c_null_ptr, 0, tmp_name)
+ prefix = "lev"//c_null_char
+ res = GetTempFileName(tmp_path, c_loc(prefix), 0, tmp_name)
if(.not.associated(temporary_directory)) then
call c_free(tmp_path)
@@ -429,7 +433,6 @@ contains
end function get_directories_in_directory
function get_files_in_directory(directory) result(res)
- use logging
implicit none
character(*), intent(in)::directory