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

Minor warnings #59

Closed
polluks opened this issue May 23, 2023 · 3 comments
Closed

Minor warnings #59

polluks opened this issue May 23, 2023 · 3 comments

Comments

@polluks
Copy link
Contributor

polluks commented May 23, 2023

cc -c -Wall -O2 vi.c
vi.c: In function 'vi_motion':
vi.c:546:32: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size 254 [-Wformat-truncation=]
   snprintf(kw, sizeof(kw), "\\<%s\\>", cw);
                                ^~      ~~
vi.c:546:3: note: 'snprintf' output between 5 and 260 bytes into a destination of size 256
   snprintf(kw, sizeof(kw), "\\<%s\\>", cw);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vi.c: In function 'vc_gotopath':
vi.c:1112:30: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size 254 [-Wformat-truncation=]
  snprintf(ex, sizeof(ex), "e %s", cw);
                              ^~   ~~
vi.c:1112:2: note: 'snprintf' output between 3 and 258 bytes into a destination of size 256
  snprintf(ex, sizeof(ex), "e %s", cw);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@aligrudi
Copy link
Owner

aligrudi commented May 23, 2023 via email

@polluks
Copy link
Contributor Author

polluks commented May 27, 2023

A new one

cc -c -Wall -O2 vi.c
vi.c:1315:10: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]
                                        if (!vi_curword(xb, cw, sizeof(cw), xrow, xoff, "-/.") != 0) {
                                            ^                                                  ~~
vi.c:1315:10: note: add parentheses after the '!' to evaluate the comparison first
                                        if (!vi_curword(xb, cw, sizeof(cw), xrow, xoff, "-/.") != 0) {
                                            ^
                                             (                                                     )
vi.c:1315:10: note: add parentheses around left hand side expression to silence this warning
                                        if (!vi_curword(xb, cw, sizeof(cw), xrow, xoff, "-/.") != 0) {
                                            ^
                                            (                                                 )
1 warning generated.

@aligrudi
Copy link
Owner

aligrudi commented May 27, 2023 via email

@polluks polluks closed this as completed May 27, 2023
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

No branches or pull requests

2 participants