From 2381665eddef0159296cf60abe4edcd3c9be7b70 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Mon, 17 May 2021 11:54:07 -0400 Subject: Fixed temp filename creation on Windows caused by bad strlen call. --- common/utilities.F90 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'common/utilities.F90') 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 -- cgit v1.2.3