diff options
Diffstat (limited to 'src/H5Torder.c')
-rw-r--r-- | src/H5Torder.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/H5Torder.c b/src/H5Torder.c index 877316d..d687d03 100644 --- a/src/H5Torder.c +++ b/src/H5Torder.c @@ -199,7 +199,7 @@ done: herr_t H5Tset_order(hid_t type_id, H5T_order_t order) { - H5T_t *dt; /* Datatype to modify */ + H5T_t *dt = NULL; /* Datatype to modify */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -207,15 +207,17 @@ H5Tset_order(hid_t type_id, H5T_order_t order) /* Check args */ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") if(order < H5T_ORDER_LE || order > H5T_ORDER_NONE || order == H5T_ORDER_MIXED) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order") + if(NULL != dt->vol_obj) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") if(H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype is read-only") /* Call internal routine to set the order */ if(H5T_set_order(dt, order) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't set order") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't set order") done: FUNC_LEAVE_API(ret_value) |