Skip to content

Commit

Permalink
Fix formatting, compiler warnings and build error
Browse files Browse the repository at this point in the history
  • Loading branch information
beutlich committed Nov 18, 2024
1 parent 0af4944 commit 2f18385
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions Modelica/Resources/C-Sources/ModelicaMatIO.c
Original file line number Diff line number Diff line change
Expand Up @@ -5169,7 +5169,7 @@ Mat_VarReadNextInfoPredicate(mat_t *mat, mat_iter_pred_t pred, const void *user_
return matvar;
}

#if HAVE_HDF5
#if defined(MAT73) && MAT73
static int
Mat_IteratorNameAcceptor(const char *name, const void *user_data)
{
Expand Down Expand Up @@ -6606,14 +6606,16 @@ Mat_VarReadNextInfo4(mat_t *mat)

/* FIXME: Implement Unicode support */

/* clang-format off */
/** Get type from tag */
#define TYPE_FROM_TAG(a) \
(((a) & 0x000000ff) <= MAT_T_FUNCTION) ? (enum matio_types)((a) & 0x000000ff) : MAT_T_UNKNOWN
(((a)&0x000000ff) <= MAT_T_FUNCTION) ? (enum matio_types)((a)&0x000000ff) : MAT_T_UNKNOWN
/** Get class from array flag */
#define CLASS_FROM_ARRAY_FLAGS(a) \
(((a) & 0x000000ff) <= MAT_C_OPAQUE) ? ((enum matio_classes)((a) & 0x000000ff)) : MAT_C_EMPTY
(((a)&0x000000ff) <= MAT_C_OPAQUE) ? ((enum matio_classes)((a)&0x000000ff)) : MAT_C_EMPTY
/** Class type mask */
#define CLASS_TYPE_MASK 0x000000ff
/* clang-format on */

#if !defined(MAX_READ_SIZE_WITHOUT_EOF_CHECK)
/* Maximal number of bytes to read without EOF check */
Expand Down Expand Up @@ -14763,15 +14765,13 @@ static int
Mat_VarRead73(mat_t *mat, matvar_t *matvar)
{
int err = MATIO_E_NO_ERROR;
hid_t fid, dset_id, ref_id;
hid_t dset_id, ref_id;

if ( NULL == mat || NULL == matvar )
return MATIO_E_BAD_ARGUMENT;
else if ( matvar->internal->id < 0 )
return MATIO_E_FAIL_TO_IDENTIFY;

fid = *(hid_t *)mat->fp;

switch ( matvar->class_type ) {
case MAT_C_DOUBLE:
case MAT_C_SINGLE:
Expand Down Expand Up @@ -15073,7 +15073,7 @@ Mat_VarReadData73(mat_t *mat, matvar_t *matvar, void *data, const int *start, co
const int *edge)
{
int err = MATIO_E_NO_ERROR, k;
hid_t fid, dset_id, ref_id, dset_space, mem_space;
hid_t dset_id, ref_id, dset_space, mem_space;
hsize_t *dset_start_stride_edge;
hsize_t *dset_start, *dset_stride, *dset_edge;

Expand All @@ -15083,8 +15083,6 @@ Mat_VarReadData73(mat_t *mat, matvar_t *matvar, void *data, const int *start, co
else if ( matvar->internal->id < 0 )
return MATIO_E_FAIL_TO_IDENTIFY;

fid = *(hid_t *)mat->fp;

dset_start_stride_edge = (hsize_t *)malloc(matvar->rank * 3 * sizeof(hsize_t));
if ( NULL == dset_start_stride_edge ) {
return MATIO_E_OUT_OF_MEMORY;
Expand Down Expand Up @@ -15160,16 +15158,14 @@ static int
Mat_VarReadDataLinear73(mat_t *mat, matvar_t *matvar, void *data, int start, int stride, int edge)
{
int err = MATIO_E_NO_ERROR, k;
hid_t fid, dset_id, dset_space, mem_space;
hid_t dset_id, dset_space, mem_space;
hsize_t *points, dset_edge, *dimp;

if ( NULL == mat || NULL == matvar || NULL == data )
return MATIO_E_BAD_ARGUMENT;
else if ( matvar->internal->id < 0 )
return MATIO_E_FAIL_TO_IDENTIFY;

fid = *(hid_t *)mat->fp;

dset_edge = edge;
mem_space = H5Screate_simple(1, &dset_edge, NULL);

Expand Down

0 comments on commit 2f18385

Please sign in to comment.