Git development
 help / color / mirror / Atom feed
From: Russell Steicke <russellsteicke@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] (tig) Fix signed char comparison where char is unsigned by default.
Date: Tue, 18 Mar 2008 17:47:43 +0900	[thread overview]
Message-ID: <20080318084743.GA16827@maggie.localnet> (raw)

tig uses a char as a flag, and expects that to have three
values: TRUE, FALSE, and -1.  When char is unsigned char (such
as on PPC), this fails with the compiler warning "comparison is
always false due to limited range of data type".

So explicitly make the flag a signed char.

Detecting the int8_t type with the autoconf macro
AC_CREATE_STDINT_H would probably be a better fix.

Signed-off-by: Russell Steicke <russellsteicke@gmail.com>
---
 tig.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tig.c b/tig.c
index 89a4c5d..448ce20 100644
--- a/tig.c
+++ b/tig.c
@@ -434,7 +434,7 @@ static iconv_t opt_iconv		= ICONV_NONE;
 static char opt_search[SIZEOF_STR]	= "";
 static char opt_cdup[SIZEOF_STR]	= "";
 static char opt_git_dir[SIZEOF_STR]	= "";
-static char opt_is_inside_work_tree	= -1; /* set to TRUE or FALSE */
+static signed char opt_is_inside_work_tree	= -1; /* set to TRUE or FALSE */
 static char opt_editor[SIZEOF_STR]	= "";
 
 enum option_type {
-- 
1.5.4.4


-- 
Russell Steicke

-- Fortune says:
Everything I like is either illegal, immoral or fattening.
		-- Alexander Woollcott

                 reply	other threads:[~2008-03-18  8:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20080318084743.GA16827@maggie.localnet \
    --to=russellsteicke@gmail.com \
    --cc=git@vger.kernel.org \
    /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