From b9d5eb1be151b8d7db5d7b5b18cdc530d7785e93 Mon Sep 17 00:00:00 2001 From: DJDavies2 <david.davies@metoffice.gov.uk> Date: Thu, 2 May 2024 19:27:15 +0100 Subject: [PATCH] Fix strlen calls, also remove flush intrinsic. --- src/fortran/legacy_fortran_api_examples.f90 | 2 +- src/odc/api/odc.f90 | 2 +- tests/f_api/odc_header.f90 | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/fortran/legacy_fortran_api_examples.f90 b/src/fortran/legacy_fortran_api_examples.f90 index 784a9e24..b3d90d37 100644 --- a/src/fortran/legacy_fortran_api_examples.f90 +++ b/src/fortran/legacy_fortran_api_examples.f90 @@ -31,7 +31,7 @@ program example_fortran_api function strlen(s) result(l) bind(c, name='strlen') use, intrinsic :: iso_c_binding character(c_char) :: s - integer(c_int) :: l + integer(c_long) :: l end function end interface diff --git a/src/odc/api/odc.f90 b/src/odc/api/odc.f90 index 161f0961..dba8aece 100644 --- a/src/odc/api/odc.f90 +++ b/src/odc/api/odc.f90 @@ -130,7 +130,7 @@ pure function strlen(str) result(len) bind(c) use, intrinsic :: iso_c_binding implicit none type(c_ptr), intent(in), value :: str - integer(c_int) :: len + integer(c_long) :: len end function end interface diff --git a/tests/f_api/odc_header.f90 b/tests/f_api/odc_header.f90 index df4c6af9..8f39d0fd 100644 --- a/tests/f_api/odc_header.f90 +++ b/tests/f_api/odc_header.f90 @@ -35,7 +35,7 @@ program odc_header call check_call(frame%initialise(reader), 'initialising frame') write(output_unit, '(a,a)') 'File: ', trim(path) - call flush(output_unit) + flush(output_unit) nframe = 1 @@ -50,7 +50,7 @@ program odc_header write(output_unit, '(a,i0,a,i0,a,i0)') ' Frame: ', nframe, ', Row count: ', nrows, & ', Column count: ', ncols - call flush(output_unit) + flush(output_unit) ! Get number of properties encoded in the frame call check_call(frame%properties_count(nproperties), 'getting property count') @@ -75,7 +75,7 @@ program odc_header write(output_unit, '(a,i0,a,a,a,a,a,i0)') ' Column: ', col, ', Name: ', name, & ', Type: ', type_name, ', Size: ', element_size - call flush(output_unit) + flush(output_unit) ! Process bitfields only if (type == ODC_BITFIELD) then @@ -87,14 +87,14 @@ program odc_header write(output_unit, '(a,i0,a,a,a,i0,a,i0)') ' Bitfield: ', bf, ', Name: ', bf_name, & ', Offset: ', bf_offset, ', Nbits: ', bf_size - call flush(output_unit) + flush(output_unit) end do end if end do nframe = nframe + 1 write(output_unit, '(a)') '' - call flush(output_unit) + flush(output_unit) ! Advances to the next frame in the stream in non-aggregated mode err = frame%next()