Skip to content

Commit a9ba491

Browse files
Update generated error files (#5895)
Add H5E_RTREE error type for R-Tree spatial index errors and update related error handling.
1 parent ac5d525 commit a9ba491

File tree

6 files changed

+25
-16
lines changed

6 files changed

+25
-16
lines changed

src/H5Edefin.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ hid_t H5E_PLUGIN_g = H5I_INVALID_HID; /* Plugin for dynamically loa
4949
hid_t H5E_REFERENCE_g = H5I_INVALID_HID; /* References */
5050
hid_t H5E_RESOURCE_g = H5I_INVALID_HID; /* Resource unavailable */
5151
hid_t H5E_RS_g = H5I_INVALID_HID; /* Reference Counted Strings */
52+
hid_t H5E_RTREE_g = H5I_INVALID_HID; /* R-Tree spatial index */
5253
hid_t H5E_SLIST_g = H5I_INVALID_HID; /* Skip Lists */
5354
hid_t H5E_SOHM_g = H5I_INVALID_HID; /* Shared Object Header Messages */
5455
hid_t H5E_STORAGE_g = H5I_INVALID_HID; /* Data storage */
@@ -59,7 +60,7 @@ hid_t H5E_VFL_g = H5I_INVALID_HID; /* Virtual File Layer */
5960
hid_t H5E_VOL_g = H5I_INVALID_HID; /* Virtual Object Layer */
6061

6162
/* Number of major error messages */
62-
#define H5E_NUM_MAJ_ERRORS 40
63+
#define H5E_NUM_MAJ_ERRORS 41
6364

6465
/* Minor error IDs */
6566

src/H5Einit.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ if((H5E_RESOURCE_g = H5I_register(H5I_ERROR_MSG, &H5E_RESOURCE_msg_s, false)) <
153153
assert(H5I_INVALID_HID == H5E_RS_g);
154154
if((H5E_RS_g = H5I_register(H5I_ERROR_MSG, &H5E_RS_msg_s, false)) < 0)
155155
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message");
156+
/* H5E_RTREE */
157+
assert(H5I_INVALID_HID == H5E_RTREE_g);
158+
if((H5E_RTREE_g = H5I_register(H5I_ERROR_MSG, &H5E_RTREE_msg_s, false)) < 0)
159+
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message");
156160
/* H5E_SLIST */
157161
assert(H5I_INVALID_HID == H5E_SLIST_g);
158162
if((H5E_SLIST_g = H5I_register(H5I_ERROR_MSG, &H5E_SLIST_msg_s, false)) < 0)

src/H5Emajdef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ static const H5E_msg_t H5E_PLUGIN_msg_s = {false, "Plugin for dynamically loaded
5353
static const H5E_msg_t H5E_REFERENCE_msg_s = {false, "References", H5E_MAJOR, &H5E_err_cls_s};
5454
static const H5E_msg_t H5E_RESOURCE_msg_s = {false, "Resource unavailable", H5E_MAJOR, &H5E_err_cls_s};
5555
static const H5E_msg_t H5E_RS_msg_s = {false, "Reference Counted Strings", H5E_MAJOR, &H5E_err_cls_s};
56+
static const H5E_msg_t H5E_RTREE_msg_s = {false, "R-Tree spatial index", H5E_MAJOR, &H5E_err_cls_s};
5657
static const H5E_msg_t H5E_SLIST_msg_s = {false, "Skip Lists", H5E_MAJOR, &H5E_err_cls_s};
5758
static const H5E_msg_t H5E_SOHM_msg_s = {false, "Shared Object Header Messages", H5E_MAJOR, &H5E_err_cls_s};
5859
static const H5E_msg_t H5E_STORAGE_msg_s = {false, "Data storage", H5E_MAJOR, &H5E_err_cls_s};

src/H5Epubgen.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ extern "C" {
5656
#define H5E_REFERENCE (H5OPEN H5E_REFERENCE_g)
5757
#define H5E_RESOURCE (H5OPEN H5E_RESOURCE_g)
5858
#define H5E_RS (H5OPEN H5E_RS_g)
59+
#define H5E_RTREE (H5OPEN H5E_RTREE_g)
5960
#define H5E_SLIST (H5OPEN H5E_SLIST_g)
6061
#define H5E_SOHM (H5OPEN H5E_SOHM_g)
6162
#define H5E_STORAGE (H5OPEN H5E_STORAGE_g)
@@ -96,6 +97,7 @@ H5_DLLVAR hid_t H5E_PLUGIN_g; /* Plugin for dynamically loaded library */
9697
H5_DLLVAR hid_t H5E_REFERENCE_g; /* References */
9798
H5_DLLVAR hid_t H5E_RESOURCE_g; /* Resource unavailable */
9899
H5_DLLVAR hid_t H5E_RS_g; /* Reference Counted Strings */
100+
H5_DLLVAR hid_t H5E_RTREE_g; /* R-Tree spatial index */
99101
H5_DLLVAR hid_t H5E_SLIST_g; /* Skip Lists */
100102
H5_DLLVAR hid_t H5E_SOHM_g; /* Shared Object Header Messages */
101103
H5_DLLVAR hid_t H5E_STORAGE_g; /* Data storage */

src/H5Eterm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
H5E_REFERENCE_g =
5050
H5E_RESOURCE_g =
5151
H5E_RS_g =
52+
H5E_RTREE_g =
5253
H5E_SLIST_g =
5354
H5E_SOHM_g =
5455
H5E_STORAGE_g =

src/H5RT.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ H5RT_leaf_init(H5RT_leaf_t *leaf, int rank, void *record)
8383
done:
8484
if (ret_value < 0 && leaf) {
8585
if (H5RT_leaf_cleanup(leaf) < 0)
86-
HDONE_ERROR(H5E_INTERNAL, H5E_CANTRELEASE, FAIL, "failed to clean up leaf on error");
86+
HDONE_ERROR(H5E_RTREE, H5E_CANTRELEASE, FAIL, "failed to clean up leaf on error");
8787
}
8888

8989
FUNC_LEAVE_NOAPI(ret_value)
@@ -196,14 +196,14 @@ H5RT__compute_slabs(size_t node_capacity, size_t leaf_count, size_t *slab_count_
196196
slab_size_d = ceil((double)leaf_count / (double)node_capacity);
197197

198198
if (slab_size_d > (double)SIZE_MAX)
199-
HGOTO_ERROR(H5E_INTERNAL, H5E_OVERFLOW, FAIL, "slab size overflows size_t");
199+
HGOTO_ERROR(H5E_RTREE, H5E_OVERFLOW, FAIL, "slab size overflows size_t");
200200
assert(slab_size_d > 0.0);
201201
slab_size = (size_t)slab_size_d;
202202
assert(slab_size > 0);
203203

204204
num_slabs_d = ceil((double)leaf_count / (double)slab_size);
205205
if (num_slabs_d > (double)SIZE_MAX)
206-
HGOTO_ERROR(H5E_INTERNAL, H5E_OVERFLOW, FAIL, "number of slabs overflows size_t");
206+
HGOTO_ERROR(H5E_RTREE, H5E_OVERFLOW, FAIL, "number of slabs overflows size_t");
207207
assert(num_slabs_d > 0.0);
208208
num_slabs = (size_t)num_slabs_d;
209209
}
@@ -277,7 +277,7 @@ H5RT__result_set_grow(H5RT_result_set_t *result_set)
277277

278278
/* Overflow check */
279279
if (new_capacity < result_set->capacity || new_capacity > (SIZE_MAX / sizeof(H5RT_leaf_t *)))
280-
HGOTO_ERROR(H5E_INTERNAL, H5E_OVERFLOW, FAIL, "result buffer capacity overflow");
280+
HGOTO_ERROR(H5E_RTREE, H5E_OVERFLOW, FAIL, "result buffer capacity overflow");
281281

282282
/* Reallocate the buffer */
283283
new_results = (H5RT_leaf_t **)realloc(result_set->results, new_capacity * sizeof(H5RT_leaf_t *));
@@ -313,7 +313,7 @@ H5RT__result_set_add(H5RT_result_set_t *result_set, H5RT_leaf_t *leaf)
313313
/* Grow buffer if full */
314314
if (result_set->count >= result_set->capacity) {
315315
if (H5RT__result_set_grow(result_set) < 0)
316-
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTALLOC, FAIL, "failed to grow result buffer");
316+
HGOTO_ERROR(H5E_RTREE, H5E_CANTALLOC, FAIL, "failed to grow result buffer");
317317
}
318318

319319
/* Add the new result */
@@ -427,7 +427,7 @@ H5RT__bulk_load(H5RT_node_t *node, int rank, H5RT_leaf_t *leaves, size_t count,
427427
* 'child_leaf_count' */
428428
if (H5RT__bulk_load(node->children.nodes[i], rank, child_leaf_start, child_leaf_count, sort_dim) <
429429
0)
430-
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "failed to fill R-tree");
430+
HGOTO_ERROR(H5E_RTREE, H5E_CANTINIT, FAIL, "failed to fill R-tree");
431431

432432
/* The next 'child_leaf_count' leaves are now assigned */
433433
child_leaf_start += child_leaf_count;
@@ -488,7 +488,7 @@ H5RT_create(int rank, H5RT_leaf_t *leaves, size_t count)
488488

489489
/* Populate the r-tree with nodes containing the provided leaves */
490490
if (H5RT__bulk_load(&rtree->root, rank, rtree->leaves, count, -1) < 0)
491-
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, NULL, "failed to fill R-tree");
491+
HGOTO_ERROR(H5E_RTREE, H5E_CANTINIT, NULL, "failed to fill R-tree");
492492

493493
ret_value = rtree;
494494

@@ -540,7 +540,7 @@ H5RT__search_recurse(H5RT_node_t *node, int rank, hsize_t min[], hsize_t max[],
540540
if (H5RT__leaves_intersect(rank, min, max, curr_min, curr_max)) {
541541
/* We found an intersecting leaf, add it to the result set */
542542
if (H5RT__result_set_add(result_set, curr_leaf) < 0)
543-
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTALLOC, FAIL, "failed to add result to result set");
543+
HGOTO_ERROR(H5E_RTREE, H5E_CANTALLOC, FAIL, "failed to add result to result set");
544544
}
545545
}
546546
else {
@@ -553,7 +553,7 @@ H5RT__search_recurse(H5RT_node_t *node, int rank, hsize_t min[], hsize_t max[],
553553
if (H5RT__leaves_intersect(rank, min, max, curr_min, curr_max)) {
554554
/* We found an intersecting internal node, recurse into it */
555555
if (H5RT__search_recurse(curr_node, rank, min, max, result_set) < 0)
556-
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "recursive search failed");
556+
HGOTO_ERROR(H5E_RTREE, H5E_CANTGET, FAIL, "recursive search failed");
557557
}
558558
}
559559

@@ -597,11 +597,11 @@ H5RT_search(H5RT_t *rtree, hsize_t min[], hsize_t max[], H5RT_result_set_t **res
597597
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "failed to allocate result set");
598598

599599
if (H5RT__result_set_init(result_set) < 0)
600-
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "failed to initialize result buffer");
600+
HGOTO_ERROR(H5E_RTREE, H5E_CANTINIT, FAIL, "failed to initialize result buffer");
601601

602602
/* Perform the actual search */
603603
if (H5RT__search_recurse(&rtree->root, rtree->rank, min, max, result_set) < 0)
604-
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "search failed");
604+
HGOTO_ERROR(H5E_RTREE, H5E_CANTGET, FAIL, "search failed");
605605

606606
/* Don't cleanup result set on success - caller owns it now */
607607
*results_out = result_set;
@@ -610,7 +610,7 @@ H5RT_search(H5RT_t *rtree, hsize_t min[], hsize_t max[], H5RT_result_set_t **res
610610
if (ret_value < 0) {
611611
/* Clean up buffer on failure */
612612
if (H5RT_free_results(result_set) < 0)
613-
HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "unable to free result set on error");
613+
HDONE_ERROR(H5E_RTREE, H5E_CANTFREE, FAIL, "unable to free result set on error");
614614
*results_out = NULL;
615615
}
616616
FUNC_LEAVE_NOAPI(ret_value)
@@ -695,7 +695,7 @@ H5RT__node_copy(H5RT_node_t *dest_node, const H5RT_node_t *src_node, const H5RT_
695695
/* Recursively copy the child */
696696
if (H5RT__node_copy(dest_node->children.nodes[i], src_node->children.nodes[i], old_leaves_base,
697697
new_leaves_base) < 0)
698-
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "failed to copy child node");
698+
HGOTO_ERROR(H5E_RTREE, H5E_CANTCOPY, FAIL, "failed to copy child node");
699699
}
700700
}
701701

@@ -846,15 +846,15 @@ H5RT_copy(const H5RT_t *rtree)
846846

847847
/* Deep copy the root node structure */
848848
if (H5RT__node_copy(&new_tree->root, &rtree->root, rtree->leaves, new_leaves) < 0)
849-
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "failed to copy r-tree structure");
849+
HGOTO_ERROR(H5E_RTREE, H5E_CANTCOPY, NULL, "failed to copy r-tree structure");
850850

851851
ret_value = new_tree;
852852

853853
done:
854854
if (!ret_value) {
855855
if (new_tree) {
856856
if (H5RT_free(new_tree) < 0)
857-
HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, NULL, "unable to free partially copied r-tree");
857+
HDONE_ERROR(H5E_RTREE, H5E_CANTFREE, NULL, "unable to free partially copied r-tree");
858858
}
859859
else if (new_leaves) {
860860
/* Free copied leaves and their coordinates */

0 commit comments

Comments
 (0)