@@ -23,14 +23,14 @@ struct mailinfo {
23
23
const char * metainfo_charset ;
24
24
25
25
char * message_id ;
26
+ enum {
27
+ TE_DONTCARE , TE_QP , TE_BASE64
28
+ } transfer_encoding ;
26
29
int patch_lines ;
27
30
int filter_stage ; /* still reading log or are we copying patch? */
28
31
int header_stage ; /* still checking in-body headers? */
29
32
};
30
33
31
- static enum {
32
- TE_DONTCARE , TE_QP , TE_BASE64
33
- } transfer_encoding ;
34
34
35
35
static struct strbuf charset = STRBUF_INIT ;
36
36
static struct strbuf * * p_hdr_data , * * s_hdr_data ;
@@ -221,14 +221,15 @@ static void handle_message_id(struct mailinfo *mi, const struct strbuf *line)
221
221
mi -> message_id = strdup (line -> buf );
222
222
}
223
223
224
- static void handle_content_transfer_encoding (const struct strbuf * line )
224
+ static void handle_content_transfer_encoding (struct mailinfo * mi ,
225
+ const struct strbuf * line )
225
226
{
226
227
if (strcasestr (line -> buf , "base64" ))
227
- transfer_encoding = TE_BASE64 ;
228
+ mi -> transfer_encoding = TE_BASE64 ;
228
229
else if (strcasestr (line -> buf , "quoted-printable" ))
229
- transfer_encoding = TE_QP ;
230
+ mi -> transfer_encoding = TE_QP ;
230
231
else
231
- transfer_encoding = TE_DONTCARE ;
232
+ mi -> transfer_encoding = TE_DONTCARE ;
232
233
}
233
234
234
235
static int is_multipart_boundary (const struct strbuf * line )
@@ -511,7 +512,7 @@ static int check_header(struct mailinfo *mi,
511
512
len = strlen ("Content-Transfer-Encoding: " );
512
513
strbuf_add (& sb , line -> buf + len , line -> len - len );
513
514
decode_header (mi , & sb );
514
- handle_content_transfer_encoding (& sb );
515
+ handle_content_transfer_encoding (mi , & sb );
515
516
ret = 1 ;
516
517
goto check_header_out ;
517
518
}
@@ -544,11 +545,11 @@ static int check_header(struct mailinfo *mi,
544
545
return ret ;
545
546
}
546
547
547
- static void decode_transfer_encoding (struct strbuf * line )
548
+ static void decode_transfer_encoding (struct mailinfo * mi , struct strbuf * line )
548
549
{
549
550
struct strbuf * ret ;
550
551
551
- switch (transfer_encoding ) {
552
+ switch (mi -> transfer_encoding ) {
552
553
case TE_QP :
553
554
ret = decode_q_segment (line , 0 );
554
555
break ;
@@ -835,7 +836,7 @@ static int handle_boundary(struct mailinfo *mi, struct strbuf *line)
835
836
}
836
837
837
838
/* set some defaults */
838
- transfer_encoding = TE_DONTCARE ;
839
+ mi -> transfer_encoding = TE_DONTCARE ;
839
840
strbuf_reset (& charset );
840
841
841
842
/* slurp in this section's info */
@@ -873,9 +874,9 @@ static void handle_body(struct mailinfo *mi, struct strbuf *line)
873
874
}
874
875
875
876
/* Unwrap transfer encoding */
876
- decode_transfer_encoding (line );
877
+ decode_transfer_encoding (mi , line );
877
878
878
- switch (transfer_encoding ) {
879
+ switch (mi -> transfer_encoding ) {
879
880
case TE_BASE64 :
880
881
case TE_QP :
881
882
{
0 commit comments