Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
ff4b4fc9
Commit
ff4b4fc9
authored
Mar 16, 2018
by
Uwe Schulzweida
Browse files
gribapiGetKeys: check result of grib_get_size(gh, section2Padding, &size).
parent
b85e3ac0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/stream_gribapi.c
View file @
ff4b4fc9
...
...
@@ -456,17 +456,17 @@ void gribapiGetKeys(grib_handle *gh, int varID)
{
long
grib2LocalSectionNumber
;
grib_get_long
(
gh
,
"grib2LocalSectionNumber"
,
&
grib2LocalSectionNumber
);
size_t
size
;
grib_get_size
(
gh
,
"section2Padding"
,
&
size
)
;
if
(
size
>
0
)
{
varDefKeyInt
(
varID
,
CDI_KEY_GRIB2LOCALSECTIONNUMBER
,
(
int
)
grib2LocalSectionNumber
);
varDefKeyInt
(
varID
,
CDI_KEY_SECTION2PADDINGLENGTH
,
(
int
)
size
);
unsigned
char
*
section2Padding
=
(
unsigned
char
*
)
Malloc
(
size
);
grib_get_bytes
(
gh
,
"section2Padding"
,
section2Padding
,
&
size
);
varDefKeyBytes
(
varID
,
CDI_KEY_SECTION2PADDING
,
section2Padding
,
(
int
)
size
);
Free
(
section2Padding
);
}
size_t
size
=
0
;
if
(
grib_get_size
(
gh
,
"section2Padding"
,
&
size
)
==
0
)
if
(
size
>
0
)
{
varDefKeyInt
(
varID
,
CDI_KEY_GRIB2LOCALSECTIONNUMBER
,
(
int
)
grib2LocalSectionNumber
);
varDefKeyInt
(
varID
,
CDI_KEY_SECTION2PADDINGLENGTH
,
(
int
)
size
);
unsigned
char
*
section2Padding
=
(
unsigned
char
*
)
Malloc
(
size
);
grib_get_bytes
(
gh
,
"section2Padding"
,
section2Padding
,
&
size
);
varDefKeyBytes
(
varID
,
CDI_KEY_SECTION2PADDING
,
section2Padding
,
(
int
)
size
);
Free
(
section2Padding
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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