diff --git a/src/dc_e2ee.rs b/src/dc_e2ee.rs index 979e374a6..f4be27876 100644 --- a/src/dc_e2ee.rs +++ b/src/dc_e2ee.rs @@ -318,11 +318,11 @@ pub unsafe fn dc_e2ee_encrypt( as *mut libc::c_char, ) as *mut libc::c_void, ); - static mut version_content: [libc::c_char; 13] = + static mut VERSION_CONTENT: [libc::c_char; 13] = [86, 101, 114, 115, 105, 111, 110, 58, 32, 49, 13, 10, 0]; let version_mime: *mut mailmime = new_data_part( - version_content.as_mut_ptr() as *mut libc::c_void, - strlen(version_content.as_mut_ptr()), + VERSION_CONTENT.as_mut_ptr() as *mut libc::c_void, + strlen(VERSION_CONTENT.as_mut_ptr()), b"application/pgp-encrypted\x00" as *const u8 as *const libc::c_char as *mut libc::c_char, @@ -491,7 +491,7 @@ unsafe fn load_or_generate_self_public_key( _random_data_mime: *mut mailmime, ) -> Option { /* avoid double creation (we unlock the database during creation) */ - static mut s_in_key_creation: libc::c_int = 0; + static mut S_IN_KEY_CREATION: libc::c_int = 0; let mut key = Key::from_self_public(context, &self_addr, &context.sql); if key.is_some() { @@ -499,11 +499,11 @@ unsafe fn load_or_generate_self_public_key( } /* create the keypair - this may take a moment, however, as this is in a thread, this is no big deal */ - if 0 != s_in_key_creation { + if 0 != S_IN_KEY_CREATION { return None; } let key_creation_here = 1; - s_in_key_creation = 1; + S_IN_KEY_CREATION = 1; let start = clock(); info!( @@ -537,7 +537,7 @@ unsafe fn load_or_generate_self_public_key( } if 0 != key_creation_here { - s_in_key_creation = 0; + S_IN_KEY_CREATION = 0; } key diff --git a/src/dc_mimeparser.rs b/src/dc_mimeparser.rs index 6a7cd3040..0b6435259 100644 --- a/src/dc_mimeparser.rs +++ b/src/dc_mimeparser.rs @@ -62,11 +62,11 @@ pub struct dc_mimeparser_t<'a> { // deprecated pub unsafe fn dc_no_compound_msgs() { - s_generate_compound_msgs = 0i32; + S_GENERATE_COMPOUND_MSGS = 0i32; } // deprecated: flag to switch generation of compound messages on and off. -static mut s_generate_compound_msgs: libc::c_int = 1i32; +static mut S_GENERATE_COMPOUND_MSGS: libc::c_int = 1i32; pub unsafe fn dc_mimeparser_new(context: &Context) -> dc_mimeparser_t { dc_mimeparser_t { @@ -249,7 +249,7 @@ pub unsafe fn dc_mimeparser_parse( } } if 0 != (*mimeparser).is_send_by_messenger - && 0 != s_generate_compound_msgs + && 0 != S_GENERATE_COMPOUND_MSGS && carray_count((*mimeparser).parts) == 2i32 as libc::c_uint { let mut textpart_0: *mut dc_mimepart_t = diff --git a/src/dc_saxparser.rs b/src/dc_saxparser.rs index 1f44960dd..8ff380817 100644 --- a/src/dc_saxparser.rs +++ b/src/dc_saxparser.rs @@ -492,19 +492,19 @@ unsafe fn xml_decode(mut s: *mut libc::c_char, type_0: libc::c_char) -> *mut lib && (type_0 as libc::c_int == '&' as i32 || type_0 as libc::c_int == ' ' as i32) { b = 0; - while !s_ent[b as usize].is_null() + while !S_ENT[b as usize].is_null() && 0 != strncmp( s.offset(1isize), - s_ent[b as usize], - strlen(s_ent[b as usize]), + S_ENT[b as usize], + strlen(S_ENT[b as usize]), ) { b += 2; } let fresh5 = b; b = b + 1; - if !s_ent[fresh5 as usize].is_null() { - c = strlen(s_ent[b as usize]) as isize; + if !S_ENT[fresh5 as usize].is_null() { + c = strlen(S_ENT[b as usize]) as isize; e = strchr(s, ';' as i32); if c - 1 > e.wrapping_offset_from(s) as isize { d = s.wrapping_offset_from(r) as isize; @@ -532,7 +532,7 @@ unsafe fn xml_decode(mut s: *mut libc::c_char, type_0: libc::c_char) -> *mut lib e.offset(1isize) as *const libc::c_void, strlen(e), ); - strncpy(s, s_ent[b as usize], c as usize); + strncpy(s, S_ENT[b as usize], c as usize); } else { s = s.offset(1isize) } @@ -566,7 +566,7 @@ NB: SAX = Simple API for XML */ /* ****************************************************************************** * Decoding text ******************************************************************************/ -static mut s_ent: [*const libc::c_char; 508] = [ +static mut S_ENT: [*const libc::c_char; 508] = [ b"lt;\x00" as *const u8 as *const libc::c_char, b"<\x00" as *const u8 as *const libc::c_char, b"gt;\x00" as *const u8 as *const libc::c_char, diff --git a/src/dc_strencode.rs b/src/dc_strencode.rs index 0af94debd..9bdb5e902 100644 --- a/src/dc_strencode.rs +++ b/src/dc_strencode.rs @@ -64,11 +64,11 @@ pub unsafe fn dc_urlencode(to_encode: *const libc::c_char) -> *mut libc::c_char * URL encoding and decoding, RFC 3986 ******************************************************************************/ unsafe fn int_2_uppercase_hex(code: libc::c_char) -> libc::c_char { - static mut hex: [libc::c_char; 17] = [ + static mut HEX: [libc::c_char; 17] = [ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 0, ]; - hex[(code as libc::c_int & 15i32) as usize] + HEX[(code as libc::c_int & 15i32) as usize] } pub unsafe fn dc_urldecode(to_decode: *const libc::c_char) -> *mut libc::c_char { @@ -378,7 +378,7 @@ pub unsafe fn dc_encode_modified_utf7( if 0 != bitstogo { let fresh8 = dst; dst = dst.offset(1); - *fresh8 = base64chars + *fresh8 = BASE64CHARS [(bitbuf << (6i32 as libc::c_uint).wrapping_sub(bitstogo) & 0x3f) as usize] } let fresh9 = dst; @@ -449,7 +449,7 @@ pub unsafe fn dc_encode_modified_utf7( bitstogo = bitstogo.wrapping_sub(6i32 as libc::c_uint); let fresh14 = dst; dst = dst.offset(1); - *fresh14 = base64chars[(if 0 != bitstogo { + *fresh14 = BASE64CHARS[(if 0 != bitstogo { bitbuf >> bitstogo } else { bitbuf @@ -465,7 +465,7 @@ pub unsafe fn dc_encode_modified_utf7( if 0 != bitstogo { let fresh15 = dst; dst = dst.offset(1); - *fresh15 = base64chars + *fresh15 = BASE64CHARS [(bitbuf << (6i32 as libc::c_uint).wrapping_sub(bitstogo) & 0x3f) as usize] } let fresh16 = dst; @@ -482,7 +482,7 @@ pub unsafe fn dc_encode_modified_utf7( ******************************************************************************/ // UTF7 modified base64 alphabet -static mut base64chars: [libc::c_char; 65] = [ +static mut BASE64CHARS: [libc::c_char; 65] = [ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 44, 0, @@ -517,7 +517,7 @@ pub unsafe fn dc_decode_modified_utf7( ); i = 0i32 as libc::c_uint; while (i as libc::c_ulong) < ::std::mem::size_of::<[libc::c_char; 65]>() as libc::c_ulong { - base64[base64chars[i as usize] as libc::c_uint as usize] = i as libc::c_uchar; + base64[BASE64CHARS[i as usize] as libc::c_uint as usize] = i as libc::c_uchar; i = i.wrapping_add(1) } while *src as libc::c_int != '\u{0}' as i32 { diff --git a/src/dc_tools.rs b/src/dc_tools.rs index ec272932c..f0a6125d0 100644 --- a/src/dc_tools.rs +++ b/src/dc_tools.rs @@ -568,7 +568,7 @@ pub unsafe fn dc_str_to_color(str: *const libc::c_char) -> libc::c_int { - being noticeable on a typical map - harmonize together while being different enough (therefore, we cannot just use random rgb colors :) */ - static mut colors: [uint32_t; 16] = [ + static mut COLORS: [uint32_t; 16] = [ 0xe56555i32 as uint32_t, 0xf28c48i32 as uint32_t, 0x8e85eei32 as uint32_t, @@ -600,7 +600,7 @@ pub unsafe fn dc_str_to_color(str: *const libc::c_char) -> libc::c_int { ) as libc::c_int; free(str_lower as *mut libc::c_void); - colors[color_index as usize] as libc::c_int + COLORS[color_index as usize] as libc::c_int } /* clist tools */ @@ -754,25 +754,25 @@ unsafe fn encode_66bits_as_base64(v1: uint32_t, v2: uint32_t, fill: uint32_t) -> let ret: *mut libc::c_char = malloc(12) as *mut libc::c_char; assert!(!ret.is_null()); - static mut chars: [libc::c_char; 65] = [ + static mut CHARS: [libc::c_char; 65] = [ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 0, ]; - *ret.offset(0isize) = chars[(v1 >> 26i32 & 0x3fi32 as libc::c_uint) as usize]; - *ret.offset(1isize) = chars[(v1 >> 20i32 & 0x3fi32 as libc::c_uint) as usize]; - *ret.offset(2isize) = chars[(v1 >> 14i32 & 0x3fi32 as libc::c_uint) as usize]; - *ret.offset(3isize) = chars[(v1 >> 8i32 & 0x3fi32 as libc::c_uint) as usize]; - *ret.offset(4isize) = chars[(v1 >> 2i32 & 0x3fi32 as libc::c_uint) as usize]; - *ret.offset(5isize) = chars + *ret.offset(0isize) = CHARS[(v1 >> 26i32 & 0x3fi32 as libc::c_uint) as usize]; + *ret.offset(1isize) = CHARS[(v1 >> 20i32 & 0x3fi32 as libc::c_uint) as usize]; + *ret.offset(2isize) = CHARS[(v1 >> 14i32 & 0x3fi32 as libc::c_uint) as usize]; + *ret.offset(3isize) = CHARS[(v1 >> 8i32 & 0x3fi32 as libc::c_uint) as usize]; + *ret.offset(4isize) = CHARS[(v1 >> 2i32 & 0x3fi32 as libc::c_uint) as usize]; + *ret.offset(5isize) = CHARS [(v1 << 4i32 & 0x30i32 as libc::c_uint | v2 >> 28i32 & 0xfi32 as libc::c_uint) as usize]; - *ret.offset(6isize) = chars[(v2 >> 22i32 & 0x3fi32 as libc::c_uint) as usize]; - *ret.offset(7isize) = chars[(v2 >> 16i32 & 0x3fi32 as libc::c_uint) as usize]; - *ret.offset(8isize) = chars[(v2 >> 10i32 & 0x3fi32 as libc::c_uint) as usize]; - *ret.offset(9isize) = chars[(v2 >> 4i32 & 0x3fi32 as libc::c_uint) as usize]; + *ret.offset(6isize) = CHARS[(v2 >> 22i32 & 0x3fi32 as libc::c_uint) as usize]; + *ret.offset(7isize) = CHARS[(v2 >> 16i32 & 0x3fi32 as libc::c_uint) as usize]; + *ret.offset(8isize) = CHARS[(v2 >> 10i32 & 0x3fi32 as libc::c_uint) as usize]; + *ret.offset(9isize) = CHARS[(v2 >> 4i32 & 0x3fi32 as libc::c_uint) as usize]; *ret.offset(10isize) = - chars[(v2 << 2i32 & 0x3ci32 as libc::c_uint | fill & 0x3i32 as libc::c_uint) as usize]; + CHARS[(v2 << 2i32 & 0x3ci32 as libc::c_uint | fill & 0x3i32 as libc::c_uint) as usize]; *ret.offset(11isize) = 0i32 as libc::c_char; ret diff --git a/src/lib.rs b/src/lib.rs index 465577ca1..7c88c1984 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,6 @@ #![allow( non_camel_case_types, non_snake_case, - non_upper_case_globals, - non_upper_case_globals, non_camel_case_types, non_snake_case )]