Minor warnings
polluks opened this issue · comments
Stefan commented
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);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ali Gholami Rudi commented
Stefan ***@***.***> wrote:
```
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);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks, fixed.
Ali
Stefan commented
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.
Ali Gholami Rudi commented
Stefan ***@***.***> wrote:
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) {
^ ~~
Fixed. Thanks.
Ali