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

Silenced old compilation warnings #562

Merged
merged 1 commit into from
Nov 2, 2024
Merged

Silenced old compilation warnings #562

merged 1 commit into from
Nov 2, 2024

Conversation

tsujan
Copy link
Member

@tsujan tsujan commented Nov 1, 2024

Consulted Konsole's code fo char command[40];. Previously, this warning was shown:

…/qtermwidget/lib/Vt102Emulation.cpp: In member function ‘virtual void Konsole::Vt102Emulation::sendMouseEvent(int, int, int, int)’:
…/qtermwidget/lib/Vt102Emulation.cpp:949:56: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size between 7 and 26 [-Wformat-truncation=]
  949 |         snprintf(command, sizeof(command), "\033[%d;%d;%dM", cb + 0x20, cx, cy);
      |                                                        ^~
…/qtermwidget/lib/Vt102Emulation.cpp:949:44: note: directive argument in the range [1, 2147483647]
  949 |         snprintf(command, sizeof(command), "\033[%d;%d;%dM", cb + 0x20, cx, cy);
      |                                            ^~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:970,
                 from /usr/include/c++/14.2.1/cstdio:42,
                 from …/qtermwidget/lib/Vt102Emulation.h:27,
                 from …/qtermwidget/lib/Vt102Emulation.cpp:24:
In function ‘int snprintf(char*, size_t, const char*, ...)’,
    inlined from ‘virtual void Konsole::Vt102Emulation::sendMouseEvent(int, int, int, int)’ at …/qtermwidget/lib/Vt102Emulation.cpp:949:17:
/usr/include/bits/stdio2.h:68:35: note: ‘__builtin___snprintf_chk’ output between 9 and 37 bytes into a destination of size 32
   68 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   69 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   70 |                                    __va_arg_pack ());

Consulted Konsole's code fo `char command[40];`. Previously, this warning was shown:

```
…/qtermwidget/lib/Vt102Emulation.cpp: In member function ‘virtual void Konsole::Vt102Emulation::sendMouseEvent(int, int, int, int)’:
…/qtermwidget/lib/Vt102Emulation.cpp:949:56: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size between 7 and 26 [-Wformat-truncation=]
  949 |         snprintf(command, sizeof(command), "\033[%d;%d;%dM", cb + 0x20, cx, cy);
      |                                                        ^~
…/qtermwidget/lib/Vt102Emulation.cpp:949:44: note: directive argument in the range [1, 2147483647]
  949 |         snprintf(command, sizeof(command), "\033[%d;%d;%dM", cb + 0x20, cx, cy);
      |                                            ^~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:970,
                 from /usr/include/c++/14.2.1/cstdio:42,
                 from …/qtermwidget/lib/Vt102Emulation.h:27,
                 from …/qtermwidget/lib/Vt102Emulation.cpp:24:
In function ‘int snprintf(char*, size_t, const char*, ...)’,
    inlined from ‘virtual void Konsole::Vt102Emulation::sendMouseEvent(int, int, int, int)’ at …/qtermwidget/lib/Vt102Emulation.cpp:949:17:
/usr/include/bits/stdio2.h:68:35: note: ‘__builtin___snprintf_chk’ output between 9 and 37 bytes into a destination of size 32
   68 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   69 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   70 |                                    __va_arg_pack ());
```
@tsujan
Copy link
Member Author

tsujan commented Nov 1, 2024

@yan12125
Could you take a quick look at it? It's small.

@yan12125
Copy link
Member

yan12125 commented Nov 2, 2024

Looks good, thanks!

@yan12125 yan12125 merged commit bfd18dd into master Nov 2, 2024
2 checks passed
@yan12125 yan12125 deleted the compilation_warnings branch November 2, 2024 09:54
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.

2 participants