mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
Remove dc_location_t
dc_location_t is an incomplete copy of _dc_location The difference is that it lacks `int independent` field. As a result, calloc did not allocate memory for this field. deltachat-core (C version) has only one dc_location_t, that includes the last field.
This commit is contained in:
committed by
holger krekel
parent
a5553f98af
commit
cb75ac3842
@@ -111,22 +111,6 @@ pub struct SmtpState {
|
|||||||
pub probe_network: i32,
|
pub probe_network: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
// location handling
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
#[repr(C)]
|
|
||||||
pub struct _dc_location {
|
|
||||||
pub location_id: uint32_t,
|
|
||||||
pub latitude: libc::c_double,
|
|
||||||
pub longitude: libc::c_double,
|
|
||||||
pub accuracy: libc::c_double,
|
|
||||||
pub timestamp: i64,
|
|
||||||
pub contact_id: uint32_t,
|
|
||||||
pub msg_id: uint32_t,
|
|
||||||
pub chat_id: uint32_t,
|
|
||||||
pub marker: *mut libc::c_char,
|
|
||||||
pub independent: uint32_t,
|
|
||||||
}
|
|
||||||
|
|
||||||
// create/open/config/information
|
// create/open/config/information
|
||||||
pub fn dc_context_new(
|
pub fn dc_context_new(
|
||||||
cb: Option<dc_callback_t>,
|
cb: Option<dc_callback_t>,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use crate::context::*;
|
use crate::dc_location::_dc_location;
|
||||||
use crate::dc_tools::*;
|
use crate::dc_tools::*;
|
||||||
use crate::types::*;
|
use crate::types::*;
|
||||||
use crate::x::*;
|
use crate::x::*;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ use crate::x::*;
|
|||||||
// location handling
|
// location handling
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct dc_location_t {
|
pub struct _dc_location {
|
||||||
pub location_id: uint32_t,
|
pub location_id: uint32_t,
|
||||||
pub latitude: libc::c_double,
|
pub latitude: libc::c_double,
|
||||||
pub longitude: libc::c_double,
|
pub longitude: libc::c_double,
|
||||||
@@ -25,6 +25,7 @@ pub struct dc_location_t {
|
|||||||
pub msg_id: uint32_t,
|
pub msg_id: uint32_t,
|
||||||
pub chat_id: uint32_t,
|
pub chat_id: uint32_t,
|
||||||
pub marker: *mut libc::c_char,
|
pub marker: *mut libc::c_char,
|
||||||
|
pub independent: uint32_t,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
@@ -33,7 +34,7 @@ pub struct dc_kml_t {
|
|||||||
pub addr: *mut libc::c_char,
|
pub addr: *mut libc::c_char,
|
||||||
pub locations: *mut dc_array_t,
|
pub locations: *mut dc_array_t,
|
||||||
pub tag: libc::c_int,
|
pub tag: libc::c_int,
|
||||||
pub curr: dc_location_t,
|
pub curr: _dc_location,
|
||||||
}
|
}
|
||||||
|
|
||||||
// location streaming
|
// location streaming
|
||||||
@@ -412,7 +413,7 @@ pub unsafe fn dc_save_locations(
|
|||||||
let mut newest_location_id = 0;
|
let mut newest_location_id = 0;
|
||||||
|
|
||||||
for i in 0..dc_array_get_cnt(locations) {
|
for i in 0..dc_array_get_cnt(locations) {
|
||||||
let location = dc_array_get_ptr(locations, i as size_t) as *mut dc_location_t;
|
let location = dc_array_get_ptr(locations, i as size_t) as *mut _dc_location;
|
||||||
|
|
||||||
let exists =
|
let exists =
|
||||||
stmt_test.exists(params![(*location).timestamp, contact_id as i32])?;
|
stmt_test.exists(params![(*location).timestamp, contact_id as i32])?;
|
||||||
@@ -552,8 +553,8 @@ unsafe fn kml_endtag_cb(userdata: *mut libc::c_void, tag: *const libc::c_char) {
|
|||||||
&& 0. != (*kml).curr.latitude
|
&& 0. != (*kml).curr.latitude
|
||||||
&& 0. != (*kml).curr.longitude
|
&& 0. != (*kml).curr.longitude
|
||||||
{
|
{
|
||||||
let location: *mut dc_location_t =
|
let location: *mut _dc_location =
|
||||||
calloc(1, ::std::mem::size_of::<dc_location_t>()) as *mut dc_location_t;
|
calloc(1, ::std::mem::size_of::<_dc_location>()) as *mut _dc_location;
|
||||||
*location = (*kml).curr;
|
*location = (*kml).curr;
|
||||||
dc_array_add_ptr((*kml).locations, location as *mut libc::c_void);
|
dc_array_add_ptr((*kml).locations, location as *mut libc::c_void);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user