Skip to content

Commit

Permalink
Merge branch 'develop' into feature/bmauer/fixes-#3210
Browse files Browse the repository at this point in the history
  • Loading branch information
bena-nasa authored Dec 3, 2024
2 parents 5ad02a1 + d4ff7d1 commit baf3109
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Deprecated

## [2.50.3] - 2024-12-02

### Fixed

- Fixed bug where c null character is not removed from end of string when reading netcdf attribute in NetCDF4\_FileFormatter.F90

## [2.50.2] - 2024-10-30

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif ()

project (
MAPL
VERSION 2.50.2
VERSION 2.50.3
LANGUAGES Fortran CXX C) # Note - CXX is required for ESMF

# Set the possible values of build type for cmake-gui
Expand Down
7 changes: 7 additions & 0 deletions pfio/NetCDF4_FileFormatter.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module pFIO_NetCDF4_FileFormatterMod
use pfio_NetCDF_Supplement
use netcdf
use mpi
use, intrinsic :: iso_c_binding, only: C_NULL_CHAR
implicit none
private

Expand Down Expand Up @@ -992,6 +993,9 @@ subroutine inq_attributes(this, cf, varid, unusable, rc)
status = nf90_get_att(this%ncid, varid, trim(attr_name), str)
!$omp end critical
_VERIFY(status)
if (len > 0) then
if (str(len:len) == C_NULL_CHAR) str = str(1:len-1)
end if
call cf%add_attribute(trim(attr_name), str)
deallocate(str)
case (NF90_STRING)
Expand Down Expand Up @@ -1088,6 +1092,9 @@ subroutine inq_var_attributes(this, var, varid, unusable, rc)
status = nf90_get_att(this%ncid, varid, trim(attr_name), str)
!$omp end critical
_VERIFY(status)
if (len > 0) then
if (str(len:len) == C_NULL_CHAR) str = str(1:len-1)
end if
call var%add_attribute(trim(attr_name), str)
deallocate(str)
case (NF90_STRING)
Expand Down

0 comments on commit baf3109

Please sign in to comment.