Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
07be38a0
...
07be38a0eec5c9ea00a74a023bc3e8e98d98d715
authored
2016-12-09 16:25:20 +0200
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fix minor inconsistencies
1 parent
81973969
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
10 deletions
imap4d/fetch.c
libmailutils/base/ctparse.c
imap4d/fetch.c
View file @
07be38a
...
...
@@ -335,7 +335,7 @@ get_content_type (mu_header_t hdr, mu_content_type_t *ctp, char const *dfl)
int
rc
;
char
*
buffer
=
NULL
;
rc
=
mu_header_aget_value
(
hdr
,
MU_HEADER_CONTENT_TYPE
,
&
buffer
);
rc
=
mu_header_aget_value
_unfold
(
hdr
,
MU_HEADER_CONTENT_TYPE
,
&
buffer
);
if
(
rc
==
0
)
{
rc
=
mu_content_type_parse
(
buffer
,
ctp
);
...
...
libmailutils/base/ctparse.c
View file @
07be38a
/* Content-Type (RFC 2045) parser for GNU Mailutils
Copyright (C) 2016 Free Software Foundation, Inc.
GNU Mailutils 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 3, or (at your option)
any later version.
GNU Mailutils 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 GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
...
...
@@ -53,6 +69,10 @@ parse_type (const char *input, mu_content_type_t ct)
return
parse_subtype
(
input
+
i
+
1
,
ct
);
}
static
char
tspecials
[]
=
"()<>@,;:
\\\"
/[]?="
;
#define ISTOKEN(c) ((unsigned char)(c) > ' ' && !strchr (tspecials, c))
static
int
parse_subtype
(
const
char
*
input
,
mu_content_type_t
ct
)
{
...
...
@@ -60,8 +80,7 @@ parse_subtype (const char *input, mu_content_type_t ct)
for
(
i
=
0
;
!
(
input
[
i
]
==
0
||
input
[
i
]
==
';'
);
i
++
)
{
if
(
input
[
i
]
==
0
||
!
(
mu_isalnum
(
input
[
i
])
||
input
[
i
]
==
'-'
||
input
[
i
]
==
'_'
))
if
(
!
ISTOKEN
(
input
[
i
]))
return
MU_ERR_PARSE
;
}
ct
->
subtype
=
malloc
(
i
);
...
...
@@ -86,7 +105,7 @@ parse_params (const char *input, mu_content_type_t ct)
while
(
*
input
==
';'
)
{
input
=
mu_str_skip_class
(
input
+
1
,
MU_CTYPE_
BLANK
);
input
=
mu_str_skip_class
(
input
+
1
,
MU_CTYPE_
SPACE
);
rc
=
parse_param
(
&
input
,
ct
);
if
(
rc
)
return
rc
;
...
...
@@ -94,7 +113,7 @@ parse_params (const char *input, mu_content_type_t ct)
if
(
*
input
)
{
input
=
mu_str_skip_class
(
input
,
MU_CTYPE_
BLANK
);
input
=
mu_str_skip_class
(
input
,
MU_CTYPE_
SPACE
);
ct
->
trailer
=
strdup
(
input
);
if
(
!
ct
->
trailer
)
return
ENOMEM
;
...
...
@@ -103,10 +122,6 @@ parse_params (const char *input, mu_content_type_t ct)
return
rc
;
}
static
char
tspecials
[]
=
"()<>@,;:
\\\"
/[]?="
;
#define ISTOKEN(c) ((unsigned char)(c) > ' ' && !strchr (tspecials, c))
static
int
parse_param
(
const
char
**
input_ptr
,
mu_content_type_t
ct
)
{
...
...
@@ -205,7 +220,7 @@ mu_content_type_parse (const char *input, mu_content_type_t *retct)
if
(
!
ct
)
return
errno
;
rc
=
parse_type
(
mu_str_skip_class
(
input
,
MU_CTYPE_
BLANK
),
ct
);
rc
=
parse_type
(
mu_str_skip_class
(
input
,
MU_CTYPE_
SPACE
),
ct
);
if
(
rc
)
mu_content_type_destroy
(
&
ct
);
else
...
...
Please
register
or
sign in
to post a comment