Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
S
src
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Code Review
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
H5hut
src
Commits
90c6032c
Commit
90c6032c
authored
Jan 11, 2010
by
Marc Howison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed type id leaks found by Allen
parent
f40afd96
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
22 deletions
+34
-22
src/H5Part.c
src/H5Part.c
+27
-21
src/H5PartPrivate.h
src/H5PartPrivate.h
+7
-1
No files found.
src/H5Part.c
View file @
90c6032c
...
...
@@ -992,21 +992,22 @@ H5PartWriteDataInt32 (
@{
*/
h
id
_t
h
5part_int64
_t
_H5Part_make_string_type
(
hid_t
*
stype
,
int
size
)
{
hid_t
stype
=
H5Tcopy
(
H5T_C_S1
);
if
(
stype
<
0
)
return
HANDLE_H5T_STRING_ERR
;
herr_t
herr
=
H5Tset_size
(
stype
,
size
);
if
(
herr
<
0
)
return
HANDLE_H5T_STRING_ERR
;
return
stype
;
*
stype
=
H5Tcopy
(
H5T_C_S1
);
if
(
*
stype
<
0
)
return
HANDLE_H5T_STRING_ERR
;
herr_t
herr
=
H5Tset_size
(
*
stype
,
size
);
if
(
herr
<
0
)
return
HANDLE_H5T_STRING_ERR
;
return
H5PART_SUCCESS
;
}
/*!
Normalize HDF5 type
*/
h
id
_t
h
5part_int64
_t
_H5Part_normalize_h5_type
(
hid_t
type
)
{
...
...
@@ -1016,22 +1017,22 @@ _H5Part_normalize_h5_type (
switch
(
tclass
){
case
H5T_INTEGER
:
if
(
size
==
8
)
{
return
H5
T_NATIVE
_INT64
;
return
H5
PART
_INT64
;
}
else
if
(
size
==
1
)
{
return
H5
T_NATIVE
_CHAR
;
return
H5
PART
_CHAR
;
}
break
;
case
H5T_FLOAT
:
if
(
size
==
8
)
{
return
H5
T_NATIVE_DOUBLE
;
return
H5
PART_FLOAT64
;
}
else
if
(
size
==
4
)
{
return
H5
T_NATIVE_FLOAT
;
return
H5
PART_FLOAT32
;
}
break
;
case
H5T_STRING
:
return
_H5Part_make_string_type
(
size
)
;
return
H5PART_STRING
;
default:
;
/* NOP */
}
...
...
@@ -1048,6 +1049,7 @@ _H5Part_read_attrib (
)
{
herr_t
herr
;
h5part_int64_t
h5err
;
hid_t
attrib_id
;
hid_t
space_id
;
hid_t
type_id
;
...
...
@@ -1064,7 +1066,7 @@ _H5Part_read_attrib (
#endif
if
(
attrib_id
<=
0
)
return
HANDLE_H5A_OPEN_NAME_ERR
(
attrib_name
);
mytype
=
H5Aget_type
(
attrib_id
);
type_id
=
H5Aget_type
(
attrib_id
);
if
(
mytype
<
0
)
return
HANDLE_H5A_GET_TYPE_ERR
;
space_id
=
H5Aget_space
(
attrib_id
);
...
...
@@ -1073,15 +1075,13 @@ _H5Part_read_attrib (
nelem
=
H5Sget_simple_extent_npoints
(
space_id
);
if
(
nelem
<
0
)
return
HANDLE_H5S_GET_SIMPLE_EXTENT_NPOINTS_ERR
;
type_id
=
_H5Part_normalize_h5_type
(
mytype
);
herr
=
H5Aread
(
attrib_id
,
type_id
,
attrib_value
);
herr
=
H5Aread
(
attrib_id
,
type_id
,
attrib_value
);
if
(
herr
<
0
)
return
HANDLE_H5A_READ_ERR
;
herr
=
H5Sclose
(
space_id
);
if
(
herr
<
0
)
return
HANDLE_H5S_CLOSE_ERR
;
herr
=
H5Tclose
(
mytype
);
herr
=
H5Tclose
(
type_id
);
if
(
herr
<
0
)
return
HANDLE_H5T_CLOSE_ERR
;
herr
=
H5Aclose
(
attrib_id
);
...
...
@@ -1100,12 +1100,14 @@ _H5Part_write_attrib (
)
{
herr_t
herr
;
h5part_int64_t
h5err
;
hid_t
space_id
;
hid_t
attrib_id
;
hid_t
type
=
attrib_type
;
if
(
type
==
H5T_STRING
)
{
type
=
_H5Part_make_string_type
(
attrib_nelem
);
if
(
attrib_type
==
H5T_STRING
)
{
h5err
=
_H5Part_make_string_type
(
&
type
,
attrib_nelem
);
if
(
h5err
<
0
)
return
h5err
;
space_id
=
H5Screate
(
H5S_SCALAR
);
if
(
space_id
<
0
)
return
HANDLE_H5S_CREATE_SCALAR_ERR
;
...
...
@@ -1143,6 +1145,11 @@ _H5Part_write_attrib (
herr
=
H5Sclose
(
space_id
);
if
(
herr
<
0
)
return
HANDLE_H5S_CLOSE_ERR
;
if
(
attrib_type
==
H5T_STRING
)
{
herr
=
H5Tclose
(
type
);
if
(
herr
<
0
)
return
HANDLE_H5T_CLOSE_ERR
;
}
return
H5PART_SUCCESS
;
}
...
...
@@ -2144,8 +2151,7 @@ H5PartGetDatasetInfo (
mytype
=
H5Dget_type
(
dataset_id
);
if
(
mytype
<
0
)
HANDLE_H5D_GET_TYPE_ERR
;
if
(
type
)
*
type
=
(
h5part_int64_t
)
_H5Part_normalize_h5_type
(
mytype
);
if
(
type
)
*
type
=
_H5Part_normalize_h5_type
(
mytype
);
herr
=
H5Tclose
(
mytype
);
if
(
herr
<
0
)
HANDLE_H5T_CLOSE_ERR
;
...
...
src/H5PartPrivate.h
View file @
90c6032c
...
...
@@ -60,7 +60,13 @@ _H5Part_get_funcname (
#define SET_FNAME( fname ) _H5Part_set_funcname( fname );
hid_t
h5part_int64_t
_H5Part_make_string_type
(
hid_t
*
type
,
int
size
);
h5part_int64_t
_H5Part_normalize_h5_type
(
hid_t
type
);
...
...
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