Skip to content
Snippets Groups Projects
Commit 270c54fc authored by WAUTELET Philippe's avatar WAUTELET Philippe
Browse files

Philippe 24/112016: lfi2cdf: bug correction: size of buffer was too small when...

Philippe 24/112016: lfi2cdf: bug correction: size of buffer was too small when doing cdf2lfi (length of comment was not taken into account)
parent b7e585ca
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ MODULE mode_util ...@@ -10,6 +10,7 @@ MODULE mode_util
INTEGER,PARAMETER :: MAXRAW=10 INTEGER,PARAMETER :: MAXRAW=10
INTEGER,PARAMETER :: MAXLEN=512 INTEGER,PARAMETER :: MAXLEN=512
INTEGER,PARAMETER :: MAXFILES=100 INTEGER,PARAMETER :: MAXFILES=100
INTEGER,PARAMETER :: MAXLFICOMMENTLENGTH=100
INTEGER,PARAMETER :: UNDEFINED = -1, READING = 1, WRITING = 2 INTEGER,PARAMETER :: UNDEFINED = -1, READING = 1, WRITING = 2
INTEGER,PARAMETER :: UNKNOWN_FORMAT = -1, NETCDF_FORMAT = 1, LFI_FORMAT = 2 INTEGER,PARAMETER :: UNKNOWN_FORMAT = -1, NETCDF_FORMAT = 1, LFI_FORMAT = 2
...@@ -275,6 +276,8 @@ CONTAINS ...@@ -275,6 +276,8 @@ CONTAINS
END DO END DO
END IF END IF
END IF END IF
!Add maximum comment size (necessary when writing LFI files because the comment is stored with the field)
ileng = ileng + MAXLFICOMMENTLENGTH
END IF END IF
IF (.NOT.tpreclist(ji)%found) THEN IF (.NOT.tpreclist(ji)%found) THEN
...@@ -347,6 +350,8 @@ END DO ...@@ -347,6 +350,8 @@ END DO
END IF END IF
IF (leng > sizemax) sizemax = leng IF (leng > sizemax) sizemax = leng
END DO END DO
!Add maximum comment size (necessary when writing LFI files because the comment is stored with the field)
sizemax = sizemax + MAXLFICOMMENTLENGTH
END IF END IF
maxvar = nbvar_infile maxvar = nbvar_infile
...@@ -1034,6 +1039,10 @@ END DO ...@@ -1034,6 +1039,10 @@ END DO
DO ivar=1,SIZE(tpreclist) DO ivar=1,SIZE(tpreclist)
icomlen = LEN(tpreclist(ivar)%comment) icomlen = LEN(tpreclist(ivar)%comment)
IF (icomlen > MAXLFICOMMENTLENGTH) THEN
PRINT *,'ERROR: comment length is too big. Please increase MAXLFICOMMENTLENGTH'
STOP
END IF
! traitement Grille et Commentaire ! traitement Grille et Commentaire
iwork(1) = tpreclist(ivar)%grid iwork(1) = tpreclist(ivar)%grid
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment