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

sprintf -> snprintf #2691

Merged
merged 2 commits into from
Dec 11, 2023
Merged

sprintf -> snprintf #2691

merged 2 commits into from
Dec 11, 2023

Conversation

seanm
Copy link
Contributor

@seanm seanm commented May 1, 2023

The last commit needs discussion of how to deprecate an API and replace it with another, and to choose its name...

@seanm seanm marked this pull request as draft May 1, 2023 15:30
Copy link
Collaborator

@DennisHeimbigner DennisHeimbigner left a comment

Choose a reason for hiding this comment

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

This is in principle a good change, but it involves too many files in one PR.
I would suggest breaking it up to do one directory at a time, E,g, for libdap4, libhdf5, etc.

@seanm
Copy link
Contributor Author

seanm commented May 1, 2023

I would suggest breaking it up to do one directory at a time, E,g, for libdap4, libhdf5, etc.

Breaking what up? The big commit? By my count that would be 17 commits.

Is this to make bisecting possible regressions easier? (Trying to understand why...)

@WardF WardF self-assigned this May 1, 2023
@WardF WardF added this to the 4.9.3 milestone May 1, 2023
@WardF
Copy link
Member

WardF commented May 1, 2023

Agreed this is a lot of files, but given the consistent nature of the change, it is something I can commit to spending some time going through. The main issue will be if there are any strings which should not be NULL terminated but now are. I can't think of any instance off the top of my head, but it's still part of the job XD. Also, the Appveyor CI indicates a failure compiling w/ Visual Studio; I haven't looked at that more closely, but we'd want to fix that too.

@seanm
Copy link
Contributor Author

seanm commented May 1, 2023

Also the last commit is a WIP... A public API needs to change to be given the length of a buffer... I used a stupid placeholder name for the new function... What would you like to call it?

@seanm
Copy link
Contributor Author

seanm commented May 25, 2023

@WardF @edwardhartnett @DennisHeimbigner I'd like to fix up the last of the commits in this PR...

How does NetCDF deal with deprecating and replacing APIs? i.e. for this part:

-extern void cdRel2Iso(cdCalenType timetype, char* relunits, int separator, double reltime, char* chartime);
+extern void cdRel2IsoNew(cdCalenType timetype, char* relunits, int separator, double reltime, char* chartime, size_t chartime_size);
+extern void cdRel2Iso(cdCalenType timetype, char* relunits, int separator, double reltime, char* chartime); // deprecated
  1. what shall we call the new API?
  2. do you have a deprecation macro that does similar to C23's [[deprecated]]?

Thanks.

@seanm seanm marked this pull request as ready for review September 2, 2023 01:04
@seanm
Copy link
Contributor Author

seanm commented Sep 2, 2023

In the hopes of actually getting this merged, I moved the WIP part to a new PR: #2743

This one is now ready to merge, after review.

@seanm
Copy link
Contributor Author

seanm commented Nov 15, 2023

Merged conflicts fixed.

@WardF @DennisHeimbigner this one is ready to merge IMHO, pending your reviews.

@WardF
Copy link
Member

WardF commented Nov 15, 2023

Testing on Windows for completeness sake; our current CI builds but doesn't run the tests, due to hangs on the underlying systems. It's been a while, I need to double-check that again, we really need to get Windows CI running again (not just building).

@seanm
Copy link
Contributor Author

seanm commented Dec 5, 2023

@WardF did your Windows test pass?

@edwardhartnett are you good with these changes now?

@WardF
Copy link
Member

WardF commented Dec 6, 2023

@seanm I will take a look at this; given the size of the merge, it will take a little bit (also combined with the backlog I need to go through, and the deadline to submit my pre-recorded talk to AGU on Friday) but this and others will be reviewed before the upcoming 4.9.3. Thanks!

In all these cases the size of the buffer can be computed with sizeof.
…ng size

One case required slightly complicated accounting of how much space is left in the buffer.
@WardF WardF merged commit 002e286 into Unidata:main Dec 11, 2023
99 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants