Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all maybe-uninitialized warnings #492

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

derobins
Copy link
Member

@derobins derobins commented Feb 4, 2024

No description provided.

@derobins derobins added Component - C Library Core C library issues Component - Tools Command-line tools like dumper and hdiff Type - Improvement Improvements that don't add a new feature or functionality Priority - 2. Medium ⏹ It would be nice to have this in the next release labels Feb 4, 2024
@@ -664,8 +664,7 @@ putElement(char *file, uint16 tag, uint16 ref, char *data, int32 len)
int
writeGrp(char *file)
{
int i;
uint16 ref;
uint16 ref = DFREF_NONE;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not initialized (DFREF_NONE is the best "bad" value)

@@ -892,39 +892,41 @@ do_list(intn curr_arg, intn argc, char *argv[], intn help)
int32 an_id = FAIL; /* annotation interface handle */
intn ret_value = SUCCEED;

/* Do this early, to avoid uninitialized warnings in cleanup code */
init_list_opts(&list_opts);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was initialized after some goto done calls, so the compiler complains about the string in list_opts not always being initialized.

@@ -2501,7 +2501,7 @@ pixrep(struct Input *in, struct Raster *im)
static int32
create_SDS(int32 sd_id, int32 nt, struct Input *in)
{
int32 sds_id;
int32 sds_id = FAIL;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uninitialized. FAIL is the "bad" value.

@@ -2712,7 +2712,8 @@ process(struct Options *opt)
int32 len;
FILE *strm = NULL;
int32 hdf;
int32 sd_id, sds_id;
int32 sd_id = FAIL;
int32 sds_id = FAIL;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uninitialized. FAIL is the "bad" value.

@@ -88,7 +88,8 @@ test_dim1_SDS1(void)
float32 sds1_data[] = {0.1, 2.3, 4.5, 6.7, 8.9};
float32 out_data[5];
int32 dimsize[1];
int32 sds_id, file_id, dim_id, index;
int32 sds_id, file_id, dim_id;
int32 index = FAIL;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uninitialized. FAIL is the "bad" value.

@derobins derobins merged commit fce1de3 into HDFGroup:master Feb 5, 2024
33 checks passed
@derobins derobins deleted the maybe_uninitialized branch March 3, 2024 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - C Library Core C library issues Component - Tools Command-line tools like dumper and hdiff Priority - 2. Medium ⏹ It would be nice to have this in the next release Type - Improvement Improvements that don't add a new feature or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants