dovecot-1.2-sieve: Enotify: mailto: fixed inappropriate return t...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Sun Jan 23 15:42:31 EET 2011


details:   http://hg.rename-it.nl/dovecot-1.2-sieve/rev/5a76887c616c
changeset: 1285:5a76887c616c
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Wed Jan 19 17:37:43 2011 +0100
description:
Enotify: mailto: fixed inappropriate return type in URI parse function, also fixing ARM compiler warning.

diffstat:

 src/lib-sieve/plugins/enotify/mailto/uri-mailto.c |  19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diffs (44 lines):

diff -r f0164d948613 -r 5a76887c616c src/lib-sieve/plugins/enotify/mailto/uri-mailto.c
--- a/src/lib-sieve/plugins/enotify/mailto/uri-mailto.c	Sun Jan 23 14:34:50 2011 +0100
+++ b/src/lib-sieve/plugins/enotify/mailto/uri-mailto.c	Wed Jan 19 17:37:43 2011 +0100
@@ -115,7 +115,7 @@
 	return _qchar_lookup[c];
 }
   
-static inline int _decode_hex_digit(char digit)
+static inline int _decode_hex_digit(unsigned char digit)
 {
 	switch ( digit ) {
 	case '0': case '1': case '2': case '3': case '4': 
@@ -134,20 +134,25 @@
 
 static bool _parse_hex_value(const char **in, char *out)
 {
-	char value;
+	int value, digit;
 		
-	if ( **in == '\0' || (value=_decode_hex_digit(**in)) < 0 )
+	if ( (digit=_decode_hex_digit((unsigned char) **in)) < 0 )
 		return FALSE;
 	
-	*out = value << 4;
+	value = digit << 4;
 	(*in)++;
 	
-	if ( **in == '\0' || (value=_decode_hex_digit(**in)) < 0 )
+	if ( (digit=_decode_hex_digit((unsigned char) **in)) < 0 )
 		return FALSE;	
 
-	*out |= value;
+	value |= digit;
 	(*in)++;
-	return (*out != '\0');	
+
+	if ( value == 0 )
+		return FALSE;
+
+	*out = (char) value;
+	return TRUE;	
 }
 
 /* 


More information about the dovecot-cvs mailing list