Use DC_PARAM_* constants everywhere

Also document each type they store.  This makes existing code a little
more readable and gives some hints towards refactoring this.
This commit is contained in:
Floris Bruynooghe
2019-07-21 20:25:52 +02:00
parent 3dfd623db7
commit 7774052911
12 changed files with 318 additions and 184 deletions

View File

@@ -323,7 +323,7 @@ pub unsafe fn dc_mimeparser_parse(
while i_1 < icnt_0 {
let part_2: *mut dc_mimepart_t =
carray_get((*mimeparser).parts, i_1 as libc::c_uint) as *mut dc_mimepart_t;
dc_param_set_int((*part_2).param, 'a' as i32, 1i32);
dc_param_set_int((*part_2).param, DC_PARAM_FORWARDED as i32, 1);
i_1 += 1
}
}
@@ -348,7 +348,7 @@ pub unsafe fn dc_mimeparser_parse(
if !field_0.is_null() {
let duration_ms: libc::c_int = dc_atoi_null_is_0((*field_0).fld_value);
if duration_ms > 0i32 && duration_ms < 24i32 * 60i32 * 60i32 * 1000i32 {
dc_param_set_int((*part_3).param, 'd' as i32, duration_ms);
dc_param_set_int((*part_3).param, DC_PARAM_DURATION as i32, duration_ms);
}
}
}
@@ -385,7 +385,11 @@ pub unsafe fn dc_mimeparser_parse(
let part_4: *mut dc_mimepart_t =
dc_mimeparser_get_last_nonmeta(mimeparser);
if !part_4.is_null() {
dc_param_set_int((*part_4).param, 'r' as i32, 1i32);
dc_param_set_int(
(*part_4).param,
DC_PARAM_WANTS_MDN as i32,
1,
);
}
}
free(from_addr as *mut libc::c_void);
@@ -1486,8 +1490,8 @@ unsafe fn do_add_single_file_part(
(*part).type_0 = msg_type;
(*part).int_mimetype = mime_type;
(*part).bytes = decoded_data_bytes as libc::c_int;
dc_param_set((*part).param, 'f' as i32, pathNfilename);
dc_param_set((*part).param, 'm' as i32, raw_mime);
dc_param_set((*part).param, DC_PARAM_FILE as i32, pathNfilename);
dc_param_set((*part).param, DC_PARAM_MIMETYPE as i32, raw_mime);
if mime_type == 80i32 {
let mut w: uint32_t = 0i32 as uint32_t;
let mut h: uint32_t = 0i32 as uint32_t;
@@ -1497,8 +1501,8 @@ unsafe fn do_add_single_file_part(
&mut w,
&mut h,
) {
dc_param_set_int((*part).param, 'w' as i32, w as int32_t);
dc_param_set_int((*part).param, 'h' as i32, h as int32_t);
dc_param_set_int((*part).param, DC_PARAM_WIDTH as i32, w as int32_t);
dc_param_set_int((*part).param, DC_PARAM_HEIGHT as i32, h as int32_t);
}
}
do_add_single_part(parser, part);
@@ -1511,9 +1515,9 @@ unsafe fn do_add_single_file_part(
unsafe fn do_add_single_part(parser: &dc_mimeparser_t, part: *mut dc_mimepart_t) {
if 0 != (*parser).e2ee_helper.encrypted && (*parser).e2ee_helper.signatures.len() > 0 {
dc_param_set_int((*part).param, 'c' as i32, 1i32);
dc_param_set_int((*part).param, DC_PARAM_GUARANTEE_E2EE as i32, 1);
} else if 0 != (*parser).e2ee_helper.encrypted {
dc_param_set_int((*part).param, 'e' as i32, 0x2i32);
dc_param_set_int((*part).param, DC_PARAM_ERRONEOUS_E2EE as i32, 0x2);
}
carray_add(
(*parser).parts,