aboutsummaryrefslogtreecommitdiff
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
parentbbc986be5425c6abdddb6eaab6dca1b5054c43e0 (diff)
downloadlevitating-2381665eddef0159296cf60abe4edcd3c9be7b70.tar.gz
levitating-2381665eddef0159296cf60abe4edcd3c9be7b70.zip
Fixed temp filename creation on Windows caused by bad strlen call.
-rw-r--r--common/utilities.F9011
-rw-r--r--player/levitating-player-windows.prj6
2 files changed, 10 insertions, 7 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
diff --git a/player/levitating-player-windows.prj b/player/levitating-player-windows.prj
index 5b0e5e0..79915c7 100644
--- a/player/levitating-player-windows.prj
+++ b/player/levitating-player-windows.prj
@@ -16,7 +16,7 @@
"filename":"..\\common\\request.f90",
"enabled":"1"
},{
- "filename":".\\common\\utilities.F90",
+ "filename":"..\\common\\utilities.F90",
"enabled":"1"
},{
"filename":"..\\common\\wsa.f90",
@@ -86,7 +86,7 @@
"Launch Using MPI":"false",
"Keep Console":"true",
"External Console":"false",
- "Command Line Arguments":"",
+ "Command Line Arguments":"-i windows-1 -w . rpi",
"Build Before Launch":"true"
},
"Build Options":{
@@ -99,4 +99,4 @@
"Link LAPACK":0
}
}
-}
+} \ No newline at end of file