-
Notifications
You must be signed in to change notification settings - Fork 65
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
Cleanup / modernization - general code audit #17
Comments
This work was influenced by conversations around libtiff. e.g.
|
There was clearly an attempt to make shapelib compile well as C++. It certainly would be pretty easy to switch the internals of shapelib to C++ without altering the external API keeping C linkage style for all exposed functions. I would certainly be fine with that. It would a bit of extra type safety and remove noise in the code. e.g.
I would rate this as low priority |
If I run Is a .clang-format file missing in the repo? |
There has never been a a .clang-format and pre-commit has not been setup for shapelib. When @rouault did fe315ba, I'd guess that he used https://github.com/OSGeo/gdal/blob/master/.clang-format |
CONTRIBUTING.md mentions the pre-commit setup for shapelib.
Thanks for the hint to the missing .clang-format config. It's added by #65. |
I'm taking a look at what it might look like to cleanup shapelib and move it to C99 or newer. I know that opinions vary as to if these are good changes or not, so I'm doing this in a separate repo without worrying out making PRs:
https://github.com/schwehr/shapelib-experimental
I used debian testing with
-Wall -Wextra
and cppcheck to keep an eye on issues.The changes are not always fully implemented. The goal is evaluate what the library might look like. There is not currently enough testing in shapelib to be sure that nothing has broken. I'm hoping to find some time to add more test coverage. I did put the core files into my local copy of GDAL and my shape tests pass.
So far, the changes I've made are roughly:
This has already reduced the number of lines of source files:
There are a lot more things I'd like to try out including:
Some of the issues I've found so far:
may be used uninitialized
The text was updated successfully, but these errors were encountered: