mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Fixed const related warnings.
This commit is contained in:
parent
6d4fdb3597
commit
c4f0650ae3
|
@ -294,7 +294,7 @@ END_TEST
|
||||||
static int response_callback_good;
|
static int response_callback_good;
|
||||||
static uint8_t response_callback_connection_id;
|
static uint8_t response_callback_connection_id;
|
||||||
static uint8_t response_callback_public_key[crypto_box_PUBLICKEYBYTES];
|
static uint8_t response_callback_public_key[crypto_box_PUBLICKEYBYTES];
|
||||||
static int response_callback(void *object, uint8_t connection_id, uint8_t *public_key)
|
static int response_callback(void *object, uint8_t connection_id, const uint8_t *public_key)
|
||||||
{
|
{
|
||||||
if (set_tcp_connection_number(object - 2, connection_id, 7) != 0)
|
if (set_tcp_connection_number(object - 2, connection_id, 7) != 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -321,7 +321,7 @@ static int status_callback(void *object, uint32_t number, uint8_t connection_id,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int data_callback_good;
|
static int data_callback_good;
|
||||||
static int data_callback(void *object, uint32_t number, uint8_t connection_id, uint8_t *data, uint16_t length)
|
static int data_callback(void *object, uint32_t number, uint8_t connection_id, const uint8_t *data, uint16_t length)
|
||||||
{
|
{
|
||||||
if (object != (void *)3)
|
if (object != (void *)3)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -342,7 +342,7 @@ static int data_callback(void *object, uint32_t number, uint8_t connection_id, u
|
||||||
|
|
||||||
static int oob_data_callback_good;
|
static int oob_data_callback_good;
|
||||||
static uint8_t oob_pubkey[crypto_box_PUBLICKEYBYTES];
|
static uint8_t oob_pubkey[crypto_box_PUBLICKEYBYTES];
|
||||||
static int oob_data_callback(void *object, uint8_t *public_key, uint8_t *data, uint16_t length)
|
static int oob_data_callback(void *object, const uint8_t *public_key, const uint8_t *data, uint16_t length)
|
||||||
{
|
{
|
||||||
if (object != (void *)4)
|
if (object != (void *)4)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -30,7 +30,7 @@ void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *dat
|
||||||
}
|
}
|
||||||
uint32_t messages_received;
|
uint32_t messages_received;
|
||||||
|
|
||||||
void print_message(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
void print_message(Tox *m, int friendnumber, const uint8_t *string, uint16_t length, void *userdata)
|
||||||
{
|
{
|
||||||
if (*((uint32_t *)userdata) != 974536)
|
if (*((uint32_t *)userdata) != 974536)
|
||||||
return;
|
return;
|
||||||
|
@ -44,7 +44,7 @@ void print_message(Tox *m, int friendnumber, uint8_t *string, uint16_t length, v
|
||||||
|
|
||||||
uint32_t name_changes;
|
uint32_t name_changes;
|
||||||
|
|
||||||
void print_nickchange(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
void print_nickchange(Tox *m, int friendnumber, const uint8_t *string, uint16_t length, void *userdata)
|
||||||
{
|
{
|
||||||
if (*((uint32_t *)userdata) != 974536)
|
if (*((uint32_t *)userdata) != 974536)
|
||||||
return;
|
return;
|
||||||
|
@ -69,7 +69,7 @@ void print_typingchange(Tox *m, int friendnumber, uint8_t typing, void *userdata
|
||||||
uint8_t filenum;
|
uint8_t filenum;
|
||||||
uint32_t file_accepted;
|
uint32_t file_accepted;
|
||||||
uint64_t file_size;
|
uint64_t file_size;
|
||||||
void file_request_accept(Tox *m, int friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename,
|
void file_request_accept(Tox *m, int friendnumber, uint8_t filenumber, uint64_t filesize, const uint8_t *filename,
|
||||||
uint16_t filename_length, void *userdata)
|
uint16_t filename_length, void *userdata)
|
||||||
{
|
{
|
||||||
if (*((uint32_t *)userdata) != 974536)
|
if (*((uint32_t *)userdata) != 974536)
|
||||||
|
@ -85,7 +85,7 @@ void file_request_accept(Tox *m, int friendnumber, uint8_t filenumber, uint64_t
|
||||||
uint32_t file_sent;
|
uint32_t file_sent;
|
||||||
uint32_t sendf_ok;
|
uint32_t sendf_ok;
|
||||||
void file_print_control(Tox *m, int friendnumber, uint8_t send_recieve, uint8_t filenumber, uint8_t control_type,
|
void file_print_control(Tox *m, int friendnumber, uint8_t send_recieve, uint8_t filenumber, uint8_t control_type,
|
||||||
uint8_t *data, uint16_t length, void *userdata)
|
const uint8_t *data, uint16_t length, void *userdata)
|
||||||
{
|
{
|
||||||
if (*((uint32_t *)userdata) != 974536)
|
if (*((uint32_t *)userdata) != 974536)
|
||||||
return;
|
return;
|
||||||
|
@ -100,7 +100,7 @@ void file_print_control(Tox *m, int friendnumber, uint8_t send_recieve, uint8_t
|
||||||
|
|
||||||
uint64_t size_recv;
|
uint64_t size_recv;
|
||||||
uint8_t num;
|
uint8_t num;
|
||||||
void write_file(Tox *m, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata)
|
void write_file(Tox *m, int friendnumber, uint8_t filenumber, const uint8_t *data, uint16_t length, void *userdata)
|
||||||
{
|
{
|
||||||
if (*((uint32_t *)userdata) != 974536)
|
if (*((uint32_t *)userdata) != 974536)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -876,14 +876,16 @@ void print_request(Tox *m, const uint8_t *public_key, const uint8_t *data, uint1
|
||||||
do_refresh();
|
do_refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_message(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
void print_message(Tox *m, int friendnumber, const uint8_t *string, uint16_t length, void *userdata)
|
||||||
{
|
{
|
||||||
/* ensure null termination */
|
/* ensure null termination */
|
||||||
string[length - 1] = 0;
|
uint8_t null_string[length + 1];
|
||||||
print_formatted_message(m, (char *)string, friendnumber, 0);
|
memcpy(null_string, string, length);
|
||||||
|
null_string[length] = 0;
|
||||||
|
print_formatted_message(m, (char *)null_string, friendnumber, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_nickchange(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
void print_nickchange(Tox *m, int friendnumber, const uint8_t *string, uint16_t length, void *userdata)
|
||||||
{
|
{
|
||||||
char name[TOX_MAX_NAME_LENGTH + 1];
|
char name[TOX_MAX_NAME_LENGTH + 1];
|
||||||
|
|
||||||
|
@ -899,7 +901,7 @@ void print_nickchange(Tox *m, int friendnumber, uint8_t *string, uint16_t length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_statuschange(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
void print_statuschange(Tox *m, int friendnumber, const uint8_t *string, uint16_t length, void *userdata)
|
||||||
{
|
{
|
||||||
char name[TOX_MAX_NAME_LENGTH + 1];
|
char name[TOX_MAX_NAME_LENGTH + 1];
|
||||||
|
|
||||||
|
@ -999,7 +1001,7 @@ void print_help(char *prog_name)
|
||||||
puts(" -f keyfile [Optional] Specify a keyfile to read from and write to.");
|
puts(" -f keyfile [Optional] Specify a keyfile to read from and write to.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_invite(Tox *m, int friendnumber, uint8_t *group_public_key, void *userdata)
|
void print_invite(Tox *m, int friendnumber, const uint8_t *group_public_key, void *userdata)
|
||||||
{
|
{
|
||||||
char msg[256];
|
char msg[256];
|
||||||
sprintf(msg, "[i] received group chat invite from: %u, auto accepting and joining. group number: %u", friendnumber,
|
sprintf(msg, "[i] received group chat invite from: %u, auto accepting and joining. group number: %u", friendnumber,
|
||||||
|
@ -1055,7 +1057,8 @@ void print_groupchatpeers(Tox *m, int groupnumber)
|
||||||
new_lines_mark(msg, 1);
|
new_lines_mark(msg, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_groupmessage(Tox *m, int groupnumber, int peernumber, uint8_t *message, uint16_t length, void *userdata)
|
void print_groupmessage(Tox *m, int groupnumber, int peernumber, const uint8_t *message, uint16_t length,
|
||||||
|
void *userdata)
|
||||||
{
|
{
|
||||||
char msg[256 + length];
|
char msg[256 + length];
|
||||||
uint8_t name[TOX_MAX_NAME_LENGTH] = {0};
|
uint8_t name[TOX_MAX_NAME_LENGTH] = {0};
|
||||||
|
@ -1116,7 +1119,7 @@ void print_groupnamelistchange(Tox *m, int groupnumber, int peernumber, uint8_t
|
||||||
print_groupchatpeers(m, groupnumber);
|
print_groupchatpeers(m, groupnumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void file_request_accept(Tox *m, int friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename,
|
void file_request_accept(Tox *m, int friendnumber, uint8_t filenumber, uint64_t filesize, const uint8_t *filename,
|
||||||
uint16_t filename_length, void *userdata)
|
uint16_t filename_length, void *userdata)
|
||||||
{
|
{
|
||||||
char msg[512];
|
char msg[512];
|
||||||
|
@ -1131,8 +1134,7 @@ void file_request_accept(Tox *m, int friendnumber, uint8_t filenumber, uint64_t
|
||||||
}
|
}
|
||||||
|
|
||||||
void file_print_control(Tox *m, int friendnumber, uint8_t send_recieve, uint8_t filenumber, uint8_t control_type,
|
void file_print_control(Tox *m, int friendnumber, uint8_t send_recieve, uint8_t filenumber, uint8_t control_type,
|
||||||
uint8_t *data,
|
const uint8_t *data, uint16_t length, void *userdata)
|
||||||
uint16_t length, void *userdata)
|
|
||||||
{
|
{
|
||||||
char msg[512] = {0};
|
char msg[512] = {0};
|
||||||
|
|
||||||
|
@ -1146,7 +1148,7 @@ void file_print_control(Tox *m, int friendnumber, uint8_t send_recieve, uint8_t
|
||||||
new_lines(msg);
|
new_lines(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_file(Tox *m, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata)
|
void write_file(Tox *m, int friendnumber, uint8_t filenumber, const uint8_t *data, uint16_t length, void *userdata)
|
||||||
{
|
{
|
||||||
char filename[256];
|
char filename[256];
|
||||||
sprintf(filename, "%u.%u.bin", friendnumber, filenumber);
|
sprintf(filename, "%u.%u.bin", friendnumber, filenumber);
|
||||||
|
|
|
@ -1240,7 +1240,7 @@ int handle_recv_error ( MSISession *session, MSICall *call, MSIMessage *msg )
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void msi_handle_packet ( Messenger *messenger, int source, uint8_t *data, uint16_t length, void *object )
|
void msi_handle_packet ( Messenger *messenger, int source, const uint8_t *data, uint16_t length, void *object )
|
||||||
{
|
{
|
||||||
LOGGER_DEBUG("Got msi message");
|
LOGGER_DEBUG("Got msi message");
|
||||||
/* Unused */
|
/* Unused */
|
||||||
|
|
|
@ -386,7 +386,7 @@ RTPMessage *msg_parse ( const uint8_t *data, int length )
|
||||||
* @retval -1 Error occurred.
|
* @retval -1 Error occurred.
|
||||||
* @retval 0 Success.
|
* @retval 0 Success.
|
||||||
*/
|
*/
|
||||||
int rtp_handle_packet ( void *object, uint8_t *data, uint32_t length )
|
int rtp_handle_packet ( void *object, const uint8_t *data, uint32_t length )
|
||||||
{
|
{
|
||||||
RTPSession *_session = object;
|
RTPSession *_session = object;
|
||||||
RTPMessage *_msg;
|
RTPMessage *_msg;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user