Re: [Bug-wget] [PATCH] remote_to_utf8: cut off part of condition always false

2014-11-21 Thread Jakub Cajka
Hello,
please, note that this change(commit 1553c70961d05ffeb15780d0d1d58f991d9a6c66) 
breaks wget on platforms(arm, ppc, s390...) with unsigned char, as assuming 
that char is signed is wrong(C standard is not specifying sign of char... 
http://stackoverflow.com/questions/2054939/is-char-signed-or-unsigned-by-default).
 This got fixed recently(commit 981c7456ff6d8d583a39d43b78173bd0bdd7ce99)... 
see change log, or my e-mail to this ML with original patch from November 3, 
2014. Please revert commit 1553c70961d05ffeb15780d0d1d58f991d9a6c66.

Best regards,

Jakub Čajka

- Original Message -
From: "Darshit Shah" 
To: "Daniel Stenberg" 
Cc: bug-wget@gnu.org
Sent: Friday, November 21, 2014 9:26:01 AM
Subject: Re: [Bug-wget] [PATCH] remote_to_utf8: cut off part of condition 
always false

On 11/21, Daniel Stenberg wrote:
>Hey
>
>Attached is a tiny patch that fixes a compiler warning as the right 
>part of the condition always evaluates to true when a signed char is 
>checked if it is larger than 127.
>
Some would term this as defensive programming. Though I think if a signed char 
were to exceed 127 for any reason, such checks will be the least of the 
problems 
for Wget.

I pushed this patch after adding the required ChangeLog entry. (Another ancient 
relic, I want to get rid of)


-- 
Thanking You,
Darshit Shah



Re: [Bug-wget] [PATCH] remote_to_utf8: cut off part of condition always false

2014-11-21 Thread Darshit Shah

On 11/21, Daniel Stenberg wrote:

Hey

Attached is a tiny patch that fixes a compiler warning as the right 
part of the condition always evaluates to true when a signed char is 
checked if it is larger than 127.


Some would term this as defensive programming. Though I think if a signed char 
were to exceed 127 for any reason, such checks will be the least of the problems 
for Wget.


I pushed this patch after adding the required ChangeLog entry. (Another ancient 
relic, I want to get rid of)



--
Thanking You,
Darshit Shah


pgpAGk7TA8YjL.pgp
Description: PGP signature


Re: [Bug-wget] [PATCH] remote_to_utf8: cut off part of condition always false

2014-11-21 Thread Daniel Stenberg

On Fri, 21 Nov 2014, Daniel Stenberg wrote:

Attached is a tiny patch that fixes a compiler warning as the right part of 
the condition always evaluates to true when a signed char is checked if it 
is larger than 127.


Silly me, the patch title is correct. It always evaluates to *false*...

--

 / daniel.haxx.se



[Bug-wget] [PATCH] remote_to_utf8: cut off part of condition always false

2014-11-21 Thread Daniel Stenberg

Hey

Attached is a tiny patch that fixes a compiler warning as the right part of 
the condition always evaluates to true when a signed char is checked if it is 
larger than 127.


--

 / daniel.haxx.seFrom 15ef60d11b5444e005414ef513871de564eea18f Mon Sep 17 00:00:00 2001
From: Daniel Stenberg 
Date: Fri, 21 Nov 2014 09:06:37 +0100
Subject: [PATCH] remote_to_utf8: cut off part of condition always false

A signed char is never larger than 127.
---
 src/iri.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/iri.c b/src/iri.c
index d924699..943b039 100644
--- a/src/iri.c
+++ b/src/iri.c
@@ -1,7 +1,7 @@
 /* IRI related functions.
-   Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010, 2011, 2014 Free Software Foundation, Inc.
 
 This file is part of GNU Wget.
 
 GNU Wget is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -279,11 +279,11 @@ remote_to_utf8 (struct iri *iri, const char *str, const char **new)
  function. */
   if (!c_strcasecmp (iri->uri_encoding, "UTF-8"))
 {
   const char *p = str;
   for (p = str; *p; p++)
-if (*p < 0 || *p > 127)
+if (*p < 0)
   {
 *new = strdup (str);
 return true;
   }
   return false;
-- 
2.1.3