Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
e92a6643
Commit
e92a6643
authored
Jan 09, 2015
by
Uwe Schulzweida
Browse files
cdi_create_records: the contents of unused records must not be interpreted (bug fix)
parent
a2b3e0b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
e92a6643
2015-01-
08
Uwe Schulzweida
2015-01-
22
Uwe Schulzweida
* Version 1.6.8 released
2015-01-09 Uwe Schulzweida
* cdi_create_records: the contents of unused records must not be interpreted (bug fix) [patch from Nathanael Huebbe]
2014-12-19 Uwe Schulzweida
* netCDF: renamed coordinate bounds dimension from nv2 to bnds
...
...
src/stream_record.c
View file @
e92a6643
...
...
@@ -82,7 +82,6 @@ int recordNewEntry(stream_t *streamptr, int tsID)
records
[
i
].
used
=
CDI_UNDEFID
;
}
recordInitEntry
(
&
records
[
recordID
]);
records
[
recordID
].
used
=
1
;
...
...
@@ -439,7 +438,10 @@ void cdi_create_records(stream_t *streamptr, int tsID)
unsigned
nrecords
,
maxrecords
;
record_t
*
records
;
if
(
streamptr
->
tsteps
[
tsID
].
records
)
return
;
tsteps_t
*
sourceTstep
=
streamptr
->
tsteps
;
tsteps_t
*
destTstep
=
sourceTstep
+
tsID
;
if
(
destTstep
->
records
)
return
;
int
vlistID
=
streamptr
->
vlistID
;
...
...
@@ -451,7 +453,9 @@ void cdi_create_records(stream_t *streamptr, int tsID)
maxrecords
+=
(
unsigned
)
streamptr
->
vars
[
varID
].
nlevs
;
}
else
maxrecords
=
(
unsigned
)
streamptr
->
tsteps
[
0
].
recordSize
;
{
maxrecords
=
(
unsigned
)
sourceTstep
->
recordSize
;
}
if
(
tsID
==
0
)
{
...
...
@@ -460,48 +464,52 @@ void cdi_create_records(stream_t *streamptr, int tsID)
else
if
(
tsID
==
1
)
{
nrecords
=
0
;
maxrecords
=
(
unsigned
)
s
treamptr
->
tsteps
[
0
].
recordSize
;
for
(
unsigned
recID
=
0
;
recID
<
maxrecords
;
recID
++
)
maxrecords
=
(
unsigned
)
s
ourceTstep
->
recordSize
;
for
(
unsigned
recID
=
0
;
recID
<
maxrecords
;
recID
++
)
{
int
varID
=
s
treamptr
->
tsteps
[
0
].
records
[
recID
].
varID
;
nrecords
+=
(
varID
==
-
1
/* varID = -1 for write mode !!! */
||
vlistInqVarTsteptype
(
vlistID
,
varID
)
!=
TSTEP_CONSTANT
);
int
varID
=
s
ourceTstep
->
records
[
recID
].
varID
;
nrecords
+=
(
varID
==
CDI_UNDEFID
/* varID = CDI_UNDEFID for write mode !!! */
||
vlistInqVarTsteptype
(
vlistID
,
varID
)
!=
TSTEP_CONSTANT
);
//
printf("varID nrecords %d %d %d \n", varID, nrecords,
vlistInqVarTsteptype(vlistID, varID));
}
}
else
nrecords
=
(
unsigned
)
streamptr
->
tsteps
[
1
].
nallrecs
;
{
nrecords
=
(
unsigned
)
streamptr
->
tsteps
[
1
].
nallrecs
;
}
// printf("tsID, nrecords %d %d\n", tsID, nrecords);
if
(
maxrecords
>
0
)
records
=
(
record_t
*
)
malloc
(
maxrecords
*
sizeof
(
record_t
));
else
records
=
NULL
;
streamptr
->
tsteps
[
tsID
].
records
=
records
;
streamptr
->
tsteps
[
tsID
].
recordSize
=
(
int
)
maxrecords
;
streamptr
->
tsteps
[
tsID
].
nallrecs
=
(
int
)
nrecords
;
destTstep
->
records
=
records
;
destTstep
->
recordSize
=
(
int
)
maxrecords
;
destTstep
->
nallrecs
=
(
int
)
nrecords
;
if
(
tsID
==
0
)
{
for
(
unsigned
recID
=
0
;
recID
<
maxrecords
;
recID
++
)
recordInitEntry
(
&
streamptr
->
tsteps
[
tsID
].
records
[
recID
]);
recordInitEntry
(
&
destTstep
->
records
[
recID
]);
}
else
{
memcpy
(
streamptr
->
tsteps
[
tsID
].
records
,
streamptr
->
tsteps
[
0
].
records
,
(
size_t
)
maxrecords
*
sizeof
(
record_t
));
memcpy
(
destTstep
->
records
,
sourceTstep
->
records
,
(
size_t
)
maxrecords
*
sizeof
(
record_t
));
for
(
unsigned
recID
=
0
;
recID
<
maxrecords
;
recID
++
)
{
int
varID
=
streamptr
->
tsteps
[
0
].
records
[
recID
].
varID
;
if
(
varID
!=
-
1
)
/* varID = -1 for write mode !!! */
if
(
vlistInqVarTsteptype
(
vlistID
,
varID
)
!=
TSTEP_CONSTANT
)
{
streamptr
->
tsteps
[
tsID
].
records
[
recID
].
position
=
CDI_UNDEFID
;
streamptr
->
tsteps
[
tsID
].
records
[
recID
].
size
=
0
;
streamptr
->
tsteps
[
tsID
].
records
[
recID
].
used
=
FALSE
;
}
record_t
*
curRecord
=
&
sourceTstep
->
records
[
recID
];
destTstep
->
records
[
recID
].
used
=
curRecord
->
used
;
if
(
curRecord
->
used
!=
CDI_UNDEFID
&&
curRecord
->
varID
!=
-
1
)
/* curRecord->varID = -1 for write mode !!! */
{
if
(
vlistInqVarTsteptype
(
vlistID
,
curRecord
->
varID
)
!=
TSTEP_CONSTANT
)
{
destTstep
->
records
[
recID
].
position
=
CDI_UNDEFID
;
destTstep
->
records
[
recID
].
size
=
0
;
destTstep
->
records
[
recID
].
used
=
FALSE
;
}
}
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment