fixes for 32bit

This commit is contained in:
Green Sky 2024-10-20 16:35:55 +02:00
parent 4360b65309
commit c3c2d0f133
No known key found for this signature in database
2 changed files with 26 additions and 26 deletions

View File

@ -122,7 +122,7 @@ void NGCFT1::updateSendTransfer(float time_delta, uint32_t group_number, uint32_
size_t chunk_size = std::min<size_t>({ size_t chunk_size = std::min<size_t>({
peer.cca->MAXIMUM_SEGMENT_DATA_SIZE, peer.cca->MAXIMUM_SEGMENT_DATA_SIZE,
static_cast<size_t>(can_packet_size), static_cast<size_t>(can_packet_size),
tf.file_size - tf.file_size_current static_cast<size_t>(tf.file_size - tf.file_size_current),
}); });
if (chunk_size == 0) { if (chunk_size == 0) {
tf.state = State::FINISHING; tf.state = State::FINISHING;
@ -139,7 +139,7 @@ void NGCFT1::updateSendTransfer(float time_delta, uint32_t group_number, uint32_
group_number, peer_number, group_number, peer_number,
static_cast<uint8_t>(idx), static_cast<uint8_t>(idx),
tf.file_size_current, tf.file_size_current,
new_data.data(), new_data.size(), new_data.data(), static_cast<uint32_t>(new_data.size()),
} }
); );
@ -306,7 +306,7 @@ float NGCFT1::iterate(float time_delta) {
void NGCFT1::NGC_FT1_send_request_private( void NGCFT1::NGC_FT1_send_request_private(
uint32_t group_number, uint32_t peer_number, uint32_t group_number, uint32_t peer_number,
uint32_t file_kind, uint32_t file_kind,
const uint8_t* file_id, size_t file_id_size const uint8_t* file_id, uint32_t file_id_size
) { ) {
// TODO: error check // TODO: error check
_neep.send_ft1_request(group_number, peer_number, file_kind, file_id, file_id_size); _neep.send_ft1_request(group_number, peer_number, file_kind, file_id, file_id_size);
@ -315,8 +315,8 @@ void NGCFT1::NGC_FT1_send_request_private(
bool NGCFT1::NGC_FT1_send_init_private( bool NGCFT1::NGC_FT1_send_init_private(
uint32_t group_number, uint32_t peer_number, uint32_t group_number, uint32_t peer_number,
uint32_t file_kind, uint32_t file_kind,
const uint8_t* file_id, size_t file_id_size, const uint8_t* file_id, uint32_t file_id_size,
size_t file_size, uint64_t file_size,
uint8_t* transfer_id uint8_t* transfer_id
) { ) {
if (std::get<0>(_t.toxGroupPeerGetConnectionStatus(group_number, peer_number)).value_or(TOX_CONNECTION_NONE) == TOX_CONNECTION_NONE) { if (std::get<0>(_t.toxGroupPeerGetConnectionStatus(group_number, peer_number)).value_or(TOX_CONNECTION_NONE) == TOX_CONNECTION_NONE) {
@ -374,7 +374,7 @@ bool NGCFT1::NGC_FT1_send_message_public(
uint32_t group_number, uint32_t group_number,
uint32_t& message_id, uint32_t& message_id,
uint32_t file_kind, uint32_t file_kind,
const uint8_t* file_id, size_t file_id_size const uint8_t* file_id, uint32_t file_id_size
) { ) {
// create msg_id // create msg_id
message_id = randombytes_random(); message_id = randombytes_random();
@ -441,7 +441,7 @@ bool NGCFT1::onEvent(const Events::NGCEXT_ft1_request& e) {
Events::NGCFT1_recv_request{ Events::NGCFT1_recv_request{
e.group_number, e.peer_number, e.group_number, e.peer_number,
static_cast<NGCFT1_file_kind>(e.file_kind), static_cast<NGCFT1_file_kind>(e.file_kind),
e.file_id.data(), e.file_id.size() e.file_id.data(), static_cast<uint32_t>(e.file_id.size())
} }
); );
} }
@ -457,7 +457,7 @@ bool NGCFT1::onEvent(const Events::NGCEXT_ft1_init& e) {
Events::NGCFT1_recv_init{ Events::NGCFT1_recv_init{
e.group_number, e.peer_number, e.group_number, e.peer_number,
static_cast<NGCFT1_file_kind>(e.file_kind), static_cast<NGCFT1_file_kind>(e.file_kind),
e.file_id.data(), e.file_id.size(), e.file_id.data(), static_cast<uint32_t>(e.file_id.size()),
e.transfer_id, e.transfer_id,
e.file_size, e.file_size,
accept accept
@ -578,7 +578,7 @@ bool NGCFT1::onEvent(const Events::NGCEXT_ft1_data& e) {
e.group_number, e.peer_number, e.group_number, e.peer_number,
e.transfer_id, e.transfer_id,
transfer.file_size_current, transfer.file_size_current,
data.data(), data.size() data.data(), static_cast<uint32_t>(data.size())
} }
); );
@ -672,7 +672,7 @@ bool NGCFT1::onEvent(const Events::NGCEXT_ft1_message& e) {
e.group_number, e.peer_number, e.group_number, e.peer_number,
e.message_id, e.message_id,
static_cast<NGCFT1_file_kind>(e.file_kind), static_cast<NGCFT1_file_kind>(e.file_kind),
e.file_id.data(), e.file_id.size() e.file_id.data(), static_cast<uint32_t>(e.file_id.size())
} }
); );
} }

View File

@ -29,7 +29,7 @@ namespace Events {
NGCFT1_file_kind file_kind; NGCFT1_file_kind file_kind;
const uint8_t* file_id; const uint8_t* file_id;
size_t file_id_size; uint32_t file_id_size;
}; };
struct NGCFT1_recv_init { struct NGCFT1_recv_init {
@ -39,10 +39,10 @@ namespace Events {
NGCFT1_file_kind file_kind; NGCFT1_file_kind file_kind;
const uint8_t* file_id; const uint8_t* file_id;
size_t file_id_size; uint32_t file_id_size;
const uint8_t transfer_id; const uint8_t transfer_id;
const size_t file_size; const uint64_t file_size;
// return true to accept, false to deny // return true to accept, false to deny
bool& accept; bool& accept;
@ -54,9 +54,9 @@ namespace Events {
uint8_t transfer_id; uint8_t transfer_id;
size_t data_offset; uint64_t data_offset;
const uint8_t* data; const uint8_t* data;
size_t data_size; uint32_t data_size;
}; };
// request to fill data_size bytes into data // request to fill data_size bytes into data
@ -66,9 +66,9 @@ namespace Events {
uint8_t transfer_id; uint8_t transfer_id;
size_t data_offset; uint64_t data_offset;
uint8_t* data; uint8_t* data;
size_t data_size; uint32_t data_size;
}; };
struct NGCFT1_recv_done { struct NGCFT1_recv_done {
@ -96,7 +96,7 @@ namespace Events {
NGCFT1_file_kind file_kind; NGCFT1_file_kind file_kind;
const uint8_t* file_id; const uint8_t* file_id;
size_t file_id_size; uint32_t file_id_size;
}; };
} // Events } // Events
@ -159,8 +159,8 @@ class NGCFT1 : public ToxEventI, public NGCEXTEventI, public NGCFT1EventProvider
FINISHING, // got all the data, but we wait for 2*delay, since its likely there is data still arriving FINISHING, // got all the data, but we wait for 2*delay, since its likely there is data still arriving
} state; } state;
size_t file_size {0}; uint64_t file_size {0};
size_t file_size_current {0}; uint64_t file_size_current {0};
// if state FINISHING and it reaches 0, delete // if state FINISHING and it reaches 0, delete
float finishing_timer {0.f}; float finishing_timer {0.f};
@ -188,8 +188,8 @@ class NGCFT1 : public ToxEventI, public NGCEXTEventI, public NGCFT1EventProvider
size_t inits_sent {1}; // is sent when creating size_t inits_sent {1}; // is sent when creating
float time_since_activity {0.f}; float time_since_activity {0.f};
size_t file_size {0}; uint64_t file_size {0};
size_t file_size_current {0}; uint64_t file_size_current {0};
// sequence array // sequence array
// list of sent but not acked seq_ids // list of sent but not acked seq_ids
@ -224,15 +224,15 @@ class NGCFT1 : public ToxEventI, public NGCEXTEventI, public NGCFT1EventProvider
void NGC_FT1_send_request_private( void NGC_FT1_send_request_private(
uint32_t group_number, uint32_t peer_number, uint32_t group_number, uint32_t peer_number,
uint32_t file_kind, uint32_t file_kind,
const uint8_t* file_id, size_t file_id_size const uint8_t* file_id, uint32_t file_id_size
); );
// public does not make sense here // public does not make sense here
bool NGC_FT1_send_init_private( bool NGC_FT1_send_init_private(
uint32_t group_number, uint32_t peer_number, uint32_t group_number, uint32_t peer_number,
uint32_t file_kind, uint32_t file_kind,
const uint8_t* file_id, size_t file_id_size, const uint8_t* file_id, uint32_t file_id_size,
size_t file_size, uint64_t file_size,
uint8_t* transfer_id uint8_t* transfer_id
); );
@ -241,7 +241,7 @@ class NGCFT1 : public ToxEventI, public NGCEXTEventI, public NGCFT1EventProvider
uint32_t group_number, uint32_t group_number,
uint32_t& message_id, uint32_t& message_id,
uint32_t file_kind, uint32_t file_kind,
const uint8_t* file_id, size_t file_id_size const uint8_t* file_id, uint32_t file_id_size
); );
public: // cca stuff public: // cca stuff