Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: Use explicit 0 instead of PACKET_ID_PADDING. #2593

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions toxcore/net_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ static int send_data_packet_helper(Net_Crypto *c, int crypt_connection_id, uint3
VLA(uint8_t, packet, sizeof(uint32_t) + sizeof(uint32_t) + padding_length + length);
memcpy(packet, &buffer_start, sizeof(uint32_t));
memcpy(packet + sizeof(uint32_t), &num, sizeof(uint32_t));
memset(packet + (sizeof(uint32_t) * 2), PACKET_ID_PADDING, padding_length);
memset(packet + (sizeof(uint32_t) * 2), 0, padding_length);
memcpy(packet + (sizeof(uint32_t) * 2) + padding_length, data, length);

return send_data_packet(c, crypt_connection_id, packet, SIZEOF_VLA(packet));
Expand Down Expand Up @@ -1589,7 +1589,7 @@ static int handle_data_packet_core(Net_Crypto *c, int crypt_connection_id, const
const uint8_t *real_data = data + (sizeof(uint32_t) * 2);
uint16_t real_length = len - (sizeof(uint32_t) * 2);

while (real_data[0] == PACKET_ID_PADDING) { /* Remove Padding */
while (real_data[0] == 0) { /* Remove Padding */
++real_data;
--real_length;

Expand Down
1 change: 0 additions & 1 deletion toxcore/net_crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
/*** Messages. */

typedef enum Packet_Id {
PACKET_ID_PADDING = 0, // Denotes padding
PACKET_ID_REQUEST = 1, // Used to request unreceived packets
PACKET_ID_KILL = 2, // Used to kill connection

Expand Down
Loading