unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu <luangruo@yahoo.com>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: Wrong pointer comparison in w32fns.c
Date: Sun, 30 Oct 2022 08:57:17 +0800	[thread overview]
Message-ID: <87eduqjfgy.fsf@yahoo.com> (raw)
In-Reply-To: <CAAeL0STrMMp-g4HhuRy020QJf5T6uAZOnMMHfMfMsG9YfxQ8aA@mail.gmail.com> (Juanma Barranquero's message of "Sun, 30 Oct 2022 00:36:20 +0200")

Juanma Barranquero <lekktu@gmail.com> writes:

> 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])

Does this function support Windows 9x?
http://winapi.freetechsecrets.com/ole/OLEStringFromGUID2.htm says
nothing about that.




  reply	other threads:[~2022-10-30  0:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-29 22:36 Wrong pointer comparison in w32fns.c Juanma Barranquero
2022-10-30  0:57 ` Po Lu [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eduqjfgy.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=emacs-devel@gnu.org \
    --cc=lekktu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).