@@ -301,7 +301,7 @@ module json_module
301
301
! DESCRIPTION
302
302
! If Unicode is not enabled, then
303
303
! JSON files are opened using access='STREAM' and
304
- ! form='UNFORMATTED'. This allows the file to
304
+ ! form='UNFORMATTED'. This allows the file to
305
305
! be read faster.
306
306
!
307
307
! SEE ALSO
@@ -325,7 +325,7 @@ module json_module
325
325
! DESCRIPTION
326
326
! If Unicode is not enabled, then
327
327
! JSON files are opened using access='STREAM' and
328
- ! form='UNFORMATTED'. This allows the file to
328
+ ! form='UNFORMATTED'. This allows the file to
329
329
! be read faster.
330
330
!
331
331
! SEE ALSO
@@ -349,7 +349,7 @@ module json_module
349
349
! DESCRIPTION
350
350
! If Unicode is not enabled, then
351
351
! JSON files are opened using access='STREAM' and
352
- ! form='UNFORMATTED'. This allows the file to
352
+ ! form='UNFORMATTED'. This allows the file to
353
353
! be read faster.
354
354
!
355
355
! SEE ALSO
@@ -4810,6 +4810,8 @@ function string_to_integer(str) result(ival)
4810
4810
' string cannot be converted to an integer: ' // trim (str))
4811
4811
end if
4812
4812
4813
+ else
4814
+ ival = 0
4813
4815
end if
4814
4816
4815
4817
end function string_to_integer
@@ -6363,6 +6365,7 @@ subroutine annotate_invalid_json(iunit,str)
6363
6365
! get the current line from the string:
6364
6366
! [this is done by counting the newline characters]
6365
6367
i_nl_prev = 0 ! index of previous newline character
6368
+ i_nl = 2 ! just in case line_count = 0
6366
6369
do i= 1 ,line_count
6367
6370
i_nl = index (str(i_nl_prev+1 :),newline)
6368
6371
if (i_nl== 0 ) then ! last line - no newline character
@@ -6466,12 +6469,12 @@ subroutine get_current_line_from_file_stream(iunit,line)
6466
6469
integer (IK) :: istart,iend,ios
6467
6470
character (kind= CK,len= 1 ) :: c
6468
6471
6469
- ! ....update for the new STREAM version.....
6470
-
6472
+ ! ....update for the new STREAM version.....
6473
+
6471
6474
! !!! !!!! not quite right for EXAMPLE 6 case 2 ..... DOUBLE CHECK THIS...
6472
6475
6473
6476
istart = ipos
6474
- do
6477
+ do
6475
6478
if (istart<= 1 ) then
6476
6479
istart = 1
6477
6480
exit
@@ -7576,15 +7579,16 @@ subroutine parse_string(unit, str, string)
7576
7579
7577
7580
end do
7578
7581
7579
- end if
7580
7582
7581
- ! trim the string if necessary:
7582
- if (ip< len (string)+ 1 ) then
7583
- if (ip== 1 ) then
7584
- string = ' '
7585
- else
7586
- string = string (1 :ip-1 )
7583
+ ! trim the string if necessary:
7584
+ if (ip< len (string)+ 1 ) then
7585
+ if (ip== 1 ) then
7586
+ string = ' '
7587
+ else
7588
+ string = string (1 :ip-1 )
7589
+ end if
7587
7590
end if
7591
+
7588
7592
end if
7589
7593
7590
7594
end subroutine parse_string
@@ -7840,7 +7844,7 @@ recursive function pop_char(unit, str, eof, skip_ws) result(popped)
7840
7844
ipos = ipos + 1
7841
7845
7842
7846
! ....note: maybe try read the file in chunks...
7843
- ! .... or use asynchronous read with double buffering
7847
+ ! .... or use asynchronous read with double buffering
7844
7848
! (see Modern Fortran: Style and Usage)
7845
7849
7846
7850
else ! read from the string
0 commit comments