git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erik Faye-Lund <kusmabite@googlemail.com>
To: Pat Thoyts <patthoyts@users.sourceforge.net>
Cc: git@vger.kernel.org, msysgit@googlegroups.com
Subject: Re: [PATCH 2/2] Report errors when failing to launch the  html browser in mingw.
Date: Wed, 17 Mar 2010 18:01:07 +0100	[thread overview]
Message-ID: <40aa078e1003171001s2c6a8765ve3bee38dddc2211c@mail.gmail.com> (raw)
In-Reply-To: <87aau7dkon.fsf@fox.patthoyts.tk>

On Wed, Mar 17, 2010 at 4:20 PM, Pat Thoyts
<patthoyts@users.sourceforge.net> wrote:
> The mingw function to launch the system html browser is silent if the
> target file does not exist leaving the user confused. Make it display
> something.
>
> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
> ---
>  compat/mingw.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/compat/mingw.c b/compat/mingw.c
> index 9c10a4c..d6539ef 100644
> --- a/compat/mingw.c
> +++ b/compat/mingw.c
> @@ -1548,6 +1548,7 @@ void mingw_open_html(const char *unixpath)
>                        const char *, const char *, const char *, INT);
>        T ShellExecute;
>        HMODULE shell32;
> +       int r;
>
>        shell32 = LoadLibrary("shell32.dll");
>        if (!shell32)
> @@ -1557,9 +1558,11 @@ void mingw_open_html(const char *unixpath)
>                die("cannot run browser");
>
>        printf("Launching default browser to display HTML ...\n");
> -       ShellExecute(NULL, "open", htmlpath, NULL, "\\", 0);
> -
> +       r = (int)ShellExecute(NULL, "open", htmlpath, NULL, "\\", SW_SHOWNORMAL);
>        FreeLibrary(shell32);
> +       if (r < 33) {

While entirely correct, this looks a little weird to me. How about "if
(r <= 32)" (since 32 is the number MSDN mentions) and a comment?

-- 
Erik "kusma" Faye-Lund

      reply	other threads:[~2010-03-17 17:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-17 15:20 [PATCH 2/2] Report errors when failing to launch the html browser in mingw Pat Thoyts
2010-03-17 17:01 ` Erik Faye-Lund [this message]

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

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

  git send-email \
    --in-reply-to=40aa078e1003171001s2c6a8765ve3bee38dddc2211c@mail.gmail.com \
    --to=kusmabite@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=kusmabite@gmail.com \
    --cc=msysgit@googlegroups.com \
    --cc=patthoyts@users.sourceforge.net \
    /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.
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 NNTP newsgroup(s).