X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=rfc2047.c;h=bed0353d52b2fe993b7ab82710eafe5571ae22b5;hp=d8e4a5d3ac22926c62ee31e334125cc767c6c3d5;hb=d0dc8fb657cff90709c15d4b106415b868857f6a;hpb=2a06362a155582cd59ae2ef6f0df71694a7eede3 diff --git a/rfc2047.c b/rfc2047.c index d8e4a5d..bed0353 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -1,3 +1,22 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * Copyright © 2006 Pierre Habouzit + */ + /* * Copyright notice from original mutt: * Copyright (C) 1996-2000 Michael R. Elkins @@ -20,10 +39,8 @@ #include "mutt.h" #include "charset.h" -#include "rfc2047.h" #include "thread.h" - #include #include #include @@ -46,8 +63,6 @@ #define CONTINUATION_BYTE(c) (((c) & 0xc0) == 0x80) -extern char RFC822Specials[]; - typedef size_t (*encoder_t) (char *, const char *, size_t, const char *); @@ -535,9 +550,9 @@ void _rfc2047_encode_string (char **pd, int encode_specials, int col) *pd = e; } -void rfc2047_encode_adrlist (ADDRESS * addr, const char *tag) +void rfc2047_encode_adrlist (address_t * addr, const char *tag) { - ADDRESS *ptr = addr; + address_t *ptr = addr; int col = tag ? m_strlen(tag) + 2 : 32; while (ptr) { @@ -583,9 +598,7 @@ static int rfc2047_decode_word (char *d, const char *s, size_t len) for (; pp < pp1; pp++) { if (*pp == '_') *pd++ = ' '; - else if (*pp == '=' && - (!(pp[1] & ~127) && hexval (pp[1]) != -1) && - (!(pp[2] & ~127) && hexval (pp[2]) != -1)) { + else if (*pp == '=' && hexval(pp[1]) >= 0 && hexval(pp[2]) >= 0) { *pd++ = (hexval (pp[1]) << 4) | hexval (pp[2]); pp += 2; } @@ -789,7 +802,7 @@ void rfc2047_decode (char **pd) str_adjust (pd); } -void rfc2047_decode_adrlist (ADDRESS * a) +void rfc2047_decode_adrlist (address_t * a) { while (a) { if (a->personal)