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 compiler warnings, part 12 #1406

Merged
merged 1 commit into from
Aug 24, 2021
Merged

Conversation

nilason
Copy link
Contributor

@nilason nilason commented Feb 26, 2021

Fixes compiler warnings:

  • -Wformat-overflow=

Twelfth part addressing #1247.

Modules / code parts directly affected:

  • lib/db/dbmi_base
  • lib/imagery
  • lib/symbol
  • lib/vector/Vlib
  • d.linegraph
  • d.vect
  • d.vect.thematic
  • i.maxlik
  • i.rectify
  • ps.map
  • r.li.daemon
  • r.viewshed
  • v.info
  • v.lidar.correction
  • v.lidar.edgedetection
  • v.lidar.growing
  • v.lidar.growing
  • v.outlier
  • v.surf.bspline
  • v.to.db

@nilason nilason mentioned this pull request Feb 27, 2021
27 tasks
display/d.linegraph/main.c Outdated Show resolved Hide resolved
imagery/i.maxlik/main.c Outdated Show resolved Hide resolved
lib/imagery/list_gp.c Outdated Show resolved Hide resolved
lib/imagery/list_gp.c Outdated Show resolved Hide resolved
lib/imagery/list_subgp.c Outdated Show resolved Hide resolved
lib/imagery/list_subgp.c Outdated Show resolved Hide resolved
lib/symbol/read.c Outdated Show resolved Hide resolved
lib/symbol/read.c Outdated Show resolved Hide resolved
lib/vector/Vlib/field.c Outdated Show resolved Hide resolved
lib/vector/Vlib/map.c Outdated Show resolved Hide resolved
@nilason
Copy link
Contributor Author

nilason commented Mar 16, 2021

Any idea how to avoid the below warning about "Uncontrolled format string" ?

I found the cause of that problem and addressed it with e673ee7. See: Code Scanning Results

I closed the issues (as resolved) where I updated with your suggestions. There remain some open, which need another round.

@metzm
Copy link
Contributor

metzm commented Mar 16, 2021

Any idea how to avoid the below warning about "Uncontrolled format string" ?

I found the cause of that problem and addressed it with e673ee7. See: Code Scanning Results

Nice catch, obvious now that I see it, not obvious to find, great!

nilason added a commit to nilason/grass that referenced this pull request Mar 21, 2021
nilason added a commit to nilason/grass that referenced this pull request Mar 21, 2021
Addresses -Wformat-overflow= warnings.
nilason added a commit to nilason/grass that referenced this pull request Mar 21, 2021
Addresses failure to list files with long names and
-Wformat-overflow= warnings.
@nilason
Copy link
Contributor Author

nilason commented Mar 21, 2021

Updated with forced push for cleaner commit history.
Changes:

  • added database table buffer size to GNAME_MAX + 64.
  • using only snprintf, may use this as testing ground for eventually updating/removing G_snprintf
  • closed conversation on using GNAME_MAX + GNAME_MAX for cases of concatenate [dirname]/[dirname] (please reopen if you disagree with my explanation)

@nilason nilason marked this pull request as ready for review March 21, 2021 14:32
@nilason nilason added this to the 8.0.0 milestone May 31, 2021
nilason added a commit to nilason/grass that referenced this pull request Aug 17, 2021
nilason added a commit to nilason/grass that referenced this pull request Aug 17, 2021
Addresses -Wformat-overflow= warnings.
nilason added a commit to nilason/grass that referenced this pull request Aug 17, 2021
Addresses failure to list files with long names and
-Wformat-overflow= warnings.
nilason added a commit to nilason/grass that referenced this pull request Aug 17, 2021
Addresses failure to list files with long names and
-Wformat-overflow= warnings.
nilason added a commit to nilason/grass that referenced this pull request Aug 17, 2021
Fixes -Wformat compiler warning:
<format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘pdal::Dimension::Id’>
@nilason
Copy link
Contributor Author

nilason commented Aug 17, 2021

Any further thoughts on this PR? There are some (still open) discussions which I personally believe to be resolved.
Would be good to merge/address this for G8.

@nilason
Copy link
Contributor Author

nilason commented Aug 19, 2021

@wenzeslaus It would be preferable to keep the commits of this PR separate, as I did with previous similar PRs (cherry pick to local master and push), as they are not really related (only grouped together to simplify review). Do you have any suggestion as to how to proceed?

lib/imagery/list_subgp.c Outdated Show resolved Hide resolved
lib/imagery/list_subgp.c Outdated Show resolved Hide resolved
lib/imagery/list_gp.c Outdated Show resolved Hide resolved
@wenzeslaus
Copy link
Member

It would be preferable to keep the commits of this PR separate, as I did with previous similar PRs

The first and last commit are so small that they could be one commit if needed. The overflow part in the two middle ones seems related to each other to me, so putting these two together would be okay. However, the i.group name ellipses changes seem to require a separate PR for the i.group commit.

(cherry pick to local master and push)

Direct pushes to the master branch are no longer possible without changing the settings. I have disabled those to avoid accidental pushes when people (with write access) confuse their remotes. (This is now set for both this and addons repo.)

as they are not really related (only grouped together to simplify review).

Whatever were the reasons to start with one PR...

Do you have any suggestion as to how to proceed?

...splitting this into multiple PRs seems to be the most straightforward way of going forward. No special merging procedures needed in that case.

Likely you know about it already, but if you are seeking a simple way for doing PRs, consider GitHub CLI (gh pr create -f).

nilason added a commit to nilason/grass that referenced this pull request Aug 23, 2021
nilason added a commit to nilason/grass that referenced this pull request Aug 23, 2021
Addresses -Wformat-overflow= warnings.
nilason added a commit to nilason/grass that referenced this pull request Aug 23, 2021
Fixes -Wformat compiler warning:
<format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘pdal::Dimension::Id’>
nilason added a commit to nilason/grass that referenced this pull request Aug 23, 2021
Addresses failure to list files with long names and
-Wformat-overflow= warnings.
@nilason
Copy link
Contributor Author

nilason commented Aug 23, 2021

@wenzeslaus If you are good with latest changes I will commit them through separate PRs.

@wenzeslaus
Copy link
Member

If you are good with latest changes I will commit them through separate PRs.

Yes, that sounds great!

nilason added a commit to nilason/grass that referenced this pull request Aug 24, 2021
Addresses failure to list files with long names and
-Wformat-overflow= warnings.
nilason added a commit to nilason/grass that referenced this pull request Aug 24, 2021
Fixes -Wformat compiler warning:
<format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘pdal::Dimension::Id’>
nilason added a commit to nilason/grass that referenced this pull request Aug 24, 2021
nilason added a commit to nilason/grass that referenced this pull request Aug 24, 2021
Addresses -Wformat-overflow= warnings.
Addresses -Wformat-overflow= warnings.
@nilason nilason merged commit 17f047a into OSGeo:main Aug 24, 2021
@nilason nilason deleted the fix-compiler-warnings-12 branch August 24, 2021 19:42
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Oct 26, 2022
Addresses -Wformat-overflow= warnings.
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Feb 17, 2023
Addresses -Wformat-overflow= warnings.
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