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
9f5c5917
Commit
9f5c5917
authored
Apr 21, 2017
by
Uwe Schulzweida
Browse files
gribapiGetDiskRepresentation: Wrong result with SZIP compressed GRIB records [Bug #7650].
parent
dfd0b4bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
9f5c5917
2017-05-?? Uwe Schulzweida
* Version 1.8.2 released
2017-04-21 Uwe Schulzweida
* gribapiGetDiskRepresentation: Wrong result with SZIP compressed GRIB records [Bug #7650]
2017-04-13 Uwe Schulzweida
* Version 1.8.1 released
...
...
src/stream_gribapi.c
View file @
9f5c5917
...
...
@@ -723,10 +723,26 @@ void ensureBufferSize(size_t requiredSize, size_t *curSize, void **buffer)
static
grib_handle
*
gribapiGetDiskRepresentation
(
size_t
recsize
,
size_t
*
buffersize
,
void
**
gribbuffer
,
int
*
outDatatype
,
int
*
outCompressionType
,
size_t
*
outUnzipsize
)
{
bool
lieee
=
false
;
int
gribversion
=
(
int
)((
char
*
)
*
gribbuffer
)[
7
];
if
(
gribversion
<=
1
)
{
if
(
gribGetZip
(
recsize
,
*
gribbuffer
,
outUnzipsize
)
>
0
)
{
*
outCompressionType
=
CDI_COMPRESS_SZIP
;
ensureBufferSize
(
*
outUnzipsize
+
100
,
buffersize
,
gribbuffer
);
}
else
{
*
outCompressionType
=
CDI_COMPRESS_NONE
;
}
}
grib_handle
*
gh
=
grib_handle_new_from_message
(
NULL
,
*
gribbuffer
,
recsize
);
if
(
gribEditionNumber
(
gh
)
>
1
)
bool
lieee
=
false
;
if
(
gribversion
>
1
)
{
size_t
len
=
256
;
char
typeOfPacking
[
256
];
...
...
@@ -739,18 +755,6 @@ grib_handle *gribapiGetDiskRepresentation(size_t recsize, size_t *buffersize, vo
else
if
(
strncmp
(
typeOfPacking
,
"grid_ieee"
,
len
)
==
0
)
lieee
=
true
;
}
}
else
{
if
(
gribGetZip
(
recsize
,
*
gribbuffer
,
outUnzipsize
)
>
0
)
{
*
outCompressionType
=
CDI_COMPRESS_SZIP
;
ensureBufferSize
(
*
outUnzipsize
+
100
,
buffersize
,
gribbuffer
);
}
else
{
*
outCompressionType
=
CDI_COMPRESS_NONE
;
}
}
if
(
lieee
)
{
...
...
@@ -768,6 +772,7 @@ grib_handle *gribapiGetDiskRepresentation(size_t recsize, size_t *buffersize, vo
if
(
bitsPerValue
>
0
&&
bitsPerValue
<=
32
)
*
outDatatype
=
(
int
)
bitsPerValue
;
}
}
return
gh
;
}
...
...
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