Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37882155
en ru br
Репозитории ALT
S:3.7.0-alt0.6
4.1: 2.2.9-alt1.1
4.0: 2.2.9-alt1.1
3.0: 1.0.4-alt1
www.altlinux.org/Changes

Группа :: Сети/Почта
Пакет: sylpheed

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: sylpheed-0.8.8-alt-qpfix.patch
Скачать


--- sylpheed-0.8.8/src/quoted-printable.c.qpfix	Thu Dec 12 07:19:18 2002
+++ sylpheed-0.8.8/src/quoted-printable.c	Thu Jan 23 16:37:07 2003
@@ -99,6 +99,28 @@
 	return len;
 }
 
+/**
+ * Check if the character can be represented directly in a Q-encoded word.
+ *
+ * @param	c	Tested character
+ *
+ * @returns	1 if the character can be represented directly, 0 if it must be
+ * 		hex-encoded.
+ *
+ * @warning	The argument is evaluated multiple times.
+ *
+ * @note	This macro uses the most restrictive set of allowed characters
+ * 		(described in RFC 2047, section 5, (3)), so the word encoded
+ * 		according to these rules should be usable in all contexts where
+ * 		an encoded word may appear.
+ */
+#define IS_QP_SAFE_CHAR(c)					\
+	( ((c) >= 'A' && (c) <= 'Z') ||				\
+	  ((c) >= 'a' && (c) <= 'z') ||				\
+	  ((c) >= '0' && (c) <= '9') ||				\
+	  ((c) == '!') || ((c) == '*') || ((c) == '+') ||	\
+	  ((c) == '-') || ((c) == '/') )
+
 void qp_q_encode(gchar *out, const guchar *in)
 {
 	const guchar *inp = in;
@@ -107,13 +129,13 @@
 	while (*inp != '\0') {
 		if (*inp == 0x20)
 			*outp++ = '_';
-		else if (*inp == '=' || *inp == '?' || *inp == '_' ||
-			 *inp < 32 || *inp > 127 || isspace(*inp)) {
+		else if (IS_QP_SAFE_CHAR(*inp))
+			*outp++ = *inp;
+		else {
 			*outp++ = '=';
 			get_hex_str(outp, *inp);
 			outp += 2;
-		} else
-			*outp++ = *inp;
+		}
 
 		inp++;
 	}
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin