aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-08-10 18:02:04 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2020-08-10 18:02:04 -0400
commit7b8f2ab32f66d8f3ce48a5e9685c05b25d31f2bb (patch)
tree64e548693c90b65da6ee400cf9476af4b8aa9c16
parent48fad229ae1f033e694a7eb663945a6a3f1f4cb2 (diff)
downloadLR-87-7b8f2ab32f66d8f3ce48a5e9685c05b25d31f2bb.tar.gz
LR-87-7b8f2ab32f66d8f3ce48a5e9685c05b25d31f2bb.zip
Fixed favorite loading that caused string filling and pointer crashes. Now calls win32 CreateDirectory on Windows. Fixed Fave button on Windows.
-rw-r--r--ag_render.f901
-rw-r--r--favorites.f9022
-rw-r--r--gemini-windows.prj11
-rw-r--r--main.F902
-rw-r--r--platform.F9020
5 files changed, 41 insertions, 15 deletions
diff --git a/ag_render.f90 b/ag_render.f90
index 383be04..18f4014 100644
--- a/ag_render.f90
+++ b/ag_render.f90
@@ -375,6 +375,7 @@ contains
self%address_id = -1
self%go_button_id = -1
self%back_button_id = -1
+ self%fave_button_id = -1
self%scroll_id = -1
call draw_address_bar(self)
diff --git a/favorites.f90 b/favorites.f90
index f83d026..a1e0a6b 100644
--- a/favorites.f90
+++ b/favorites.f90
@@ -8,7 +8,7 @@ implicit none
type :: favorite
- character(80)::name
+ character(1024)::name
character(1024)::link
integer::added
@@ -155,6 +155,7 @@ contains
do while(c /= ' ' .and. c /= char(9))
res%link(i:i) = c
read(unit_number, '(A1)', advance='no') c
+ i = i + 1
end do
! Separating spaces...
@@ -165,9 +166,11 @@ contains
! Name...
res%name = " "
ios = 0
- do while(c /= ' ' .and. c /= char(9))
+ i = 1
+ do while(ios == 0)
res%name(i:i) = c
read(unit_number, '(A1)', advance='no', iostat=ios) c
+ i = i + 1
end do
! The date should be at the end of the link
@@ -190,24 +193,27 @@ contains
type(favorite), dimension(:), pointer::faves
character(80)::temp
- integer::n, i
+ integer::n, i, ios
! Title
read(unit_number, *) temp
! Blank
- read(unit_number, *) temp
+ !read(unit_number, *) temp
! Count
read(unit_number, *) n
! Blank
- read(unit_number, *) temp
+ !read(unit_number, *) temp
allocate(faves(n))
do i = 1, n
- read(unit_number, '(A2)', advance='no') temp
+ ios = 1
+ do while(ios /= 0)
+ read(unit_number, '(A2)', advance='no', iostat=ios) temp
+ end do
faves(i) = read_favorite(unit_number)
end do
@@ -219,8 +225,8 @@ contains
integer, intent(in)::unit_number
type(favorite), intent(in)::f
- write(unit_number, '(A3)', advance='no') "=> "
- write(unit_number, *) trim(f%link)//" "//f%name
+ write(unit_number, '(A2)', advance='no') "=>"
+ write(unit_number, *) trim(f%link)//" "//trim(f%name)
end subroutine write_favorite
diff --git a/gemini-windows.prj b/gemini-windows.prj
index 8e32881..e7141c5 100644
--- a/gemini-windows.prj
+++ b/gemini-windows.prj
@@ -91,7 +91,7 @@
"Architecture":1,
"Type":0,
"Revision":2,
- "Windows GUI":1,
+ "Windows GUI":0,
"File Options":{
"Library Directories":["Default Add-On Directory","../../Workspace/git/libvncserver/openssl-1.1.1f-win64-mingw/lib"],
"Build Directory":"build",
@@ -103,8 +103,9 @@
"Use C Preprocessor":"false",
"Runtime Diagnostics":"false",
"Cray Pointers":"false",
- "Enable OpenMP":"false",
"Enable Coarrays":"false",
+ "Enable OpenMP":"false",
+ "Initialize Variables to Zero":"true",
"Default Double for Real":"false"
},
"Code Generation Options":{
@@ -113,17 +114,17 @@
"Aggressive Loops":"false",
"Debugging":"true",
"Optimization Mode":0,
+ "Floating Point Trap":"false",
"Profiling":"false"
},
"Build Dependencies":1,
"Launch Options":{
- "Build Before Launch":"true",
"Working Directory":"",
"Launch Using MPI":"false",
"Keep Console":"true",
- "Executable":"",
+ "External Console":"false",
"Command Line Arguments":"",
- "External Console":"false"
+ "Build Before Launch":"true"
},
"Build Options":{
"Makefile":"Makefile",
diff --git a/main.F90 b/main.F90
index 7236a2e..d06131b 100644
--- a/main.F90
+++ b/main.F90
@@ -313,7 +313,7 @@ contains
open(newunit=loadunit, file=filename, status='old', action='read', iostat=ios)
if(ios == 0) then
- faves = read_favorites(loadunit)
+ faves => read_favorites(loadunit)
close(loadunit)
else
diff --git a/platform.F90 b/platform.F90
index 7fbe389..7c864b1 100644
--- a/platform.F90
+++ b/platform.F90
@@ -12,12 +12,30 @@ implicit none
contains
subroutine make_directory(dir)
+ use iso_c_binding
implicit none
character(*), intent(in)::dir
#ifdef WINDOWS
- call execute_command_line('mkdir "'//trim(dir)//'"')
+ character(kind=c_char, len=:), allocatable, target::passdir
+ interface
+ function CreateDirectory(dir, ignored) bind(c, name="CreateDirectoryA")
+ use iso_c_binding
+ type(c_ptr), value::dir
+ type(c_ptr), value::ignored
+ integer(kind=c_int)::CreateDirectory
+ end function CreateDirectory
+ end interface
+
+ allocate(character(len=(len_trim(dir)+1)) :: passdir)
+ passdir = trim(dir)//c_null_char
+ if(CreateDirectory(c_loc(passdir), c_null_ptr) == 0) then
+ print *, "Could not create directory, maybe exists?"
+ end if
+ deallocate(passdir)
+
+ !call execute_command_line('mkdir "'//trim(dir)//'"')
#else
call execute_command_line('mkdir -p "'//trim(dir)//'"')
#endif