unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Wrong pointer comparison in w32fns.c
@ 2022-10-29 22:36 Juanma Barranquero
  2022-10-30  0:57 ` Po Lu
  2022-10-30  6:24 ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Juanma Barranquero @ 2022-10-29 22:36 UTC (permalink / raw)
  To: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 912 bytes --]

Presumably, this is a bug in rarely used code (affecting NT 4 systems):

  CC       w32fns.o
w32fns.c: In function 'setup_w32_kbdhook':
w32fns.c:2738:24: warning: the comparison will always evaluate as 'true'
for the address of 'newTitle' will never be NULL [-Waddress]
 2738 |           if (newTitle != NULL)
      |                        ^~
w32fns.c:2733:19: note: 'newTitle' declared here
 2733 |           wchar_t newTitle[64];
      |                   ^~~~~~~~

requiring something like this:

diff --git i/src/w32fns.c w/src/w32fns.c
index 5f652ae9e4..46c73f762a 100644
--- i/src/w32fns.c
+++ w/src/w32fns.c
@@ -2734,8 +2734,7 @@ setup_w32_kbdhook (void)
   int i;

   CoCreateGuid (&guid);
-  StringFromGUID2 (&guid, newTitle, 64);
-  if (newTitle != NULL)
+  if (StringFromGUID2 (&guid, newTitle, 64) && newTitle[0])
     {
       GetConsoleTitleW (oldTitle, 1024);
       SetConsoleTitleW (newTitle);

[-- Attachment #2: Type: text/html, Size: 1154 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-10-30 12:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-29 22:36 Wrong pointer comparison in w32fns.c Juanma Barranquero
2022-10-30  0:57 ` Po Lu
2022-10-30  6:47   ` Eli Zaretskii
2022-10-30  6:24 ` Eli Zaretskii
2022-10-30 12:13   ` Juanma Barranquero
2022-10-30 12:47     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).