mirror of
https://github.com/chatmail/core.git
synced 2026-05-01 20:36:31 +03:00
dc_mimeparser_parse: accept input as slice, not as pointer + length
This commit is contained in:
committed by
Floris Bruynooghe
parent
d3048aa06f
commit
21976b14a6
@@ -659,11 +659,9 @@ fn test_dc_mimeparser_with_context() {
|
||||
let context = create_test_context();
|
||||
|
||||
let mut mimeparser = dc_mimeparser_new(&context.ctx);
|
||||
let raw: *const libc::c_char =
|
||||
b"Content-Type: multipart/mixed; boundary=\"==break==\";\nSubject: outer-subject\nX-Special-A: special-a\nFoo: Bar\nChat-Version: 0.0\n\n--==break==\nContent-Type: text/plain; protected-headers=\"v1\";\nSubject: inner-subject\nX-Special-B: special-b\nFoo: Xy\nChat-Version: 1.0\n\ntest1\n\n--==break==--\n\n\x00"
|
||||
as *const u8 as *const libc::c_char;
|
||||
let raw = b"Content-Type: multipart/mixed; boundary=\"==break==\";\nSubject: outer-subject\nX-Special-A: special-a\nFoo: Bar\nChat-Version: 0.0\n\n--==break==\nContent-Type: text/plain; protected-headers=\"v1\";\nSubject: inner-subject\nX-Special-B: special-b\nFoo: Xy\nChat-Version: 1.0\n\ntest1\n\n--==break==--\n\n\x00";
|
||||
|
||||
dc_mimeparser_parse(&mut mimeparser, raw, strlen(raw));
|
||||
dc_mimeparser_parse(&mut mimeparser, &raw[..]);
|
||||
assert_eq!(
|
||||
as_str(mimeparser.subject as *const libc::c_char),
|
||||
"inner-subject",
|
||||
|
||||
Reference in New Issue
Block a user