1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-06-29 13:27:46 +02:00

Fix typedef enums and potential uninitialised value.

This commit is contained in:
iphydf 2018-01-20 18:30:35 +00:00
parent 846bc4613e
commit b9f9546e2b
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
8 changed files with 14 additions and 10 deletions

View File

@ -56,6 +56,7 @@
#endif #endif
extern FriendsList Friends; extern FriendsList Friends;
struct CallControl CallControl;
#define cbend pthread_exit(NULL) #define cbend pthread_exit(NULL)

View File

@ -79,9 +79,9 @@ struct CallControl {
uint32_t video_bit_rate; uint32_t video_bit_rate;
int32_t video_frame_duration; int32_t video_frame_duration;
} CallControl; };
struct CallControl CallControl; extern struct CallControl CallControl;
/* You will have to pass pointer to first member of 'windows' declared in windows.c */ /* You will have to pass pointer to first member of 'windows' declared in windows.c */
ToxAV *init_audio(ToxWindow *self, Tox *tox); ToxAV *init_audio(ToxWindow *self, Tox *tox);

View File

@ -108,7 +108,10 @@ static struct DHT_Nodes {
/* Determine if a node is offline by comparing the age of the nodeslist /* Determine if a node is offline by comparing the age of the nodeslist
* to the last time the node was successfully pinged. * to the last time the node was successfully pinged.
*/ */
#define NODE_IS_OFFLINE(last_scan, last_ping) ((last_ping + NODE_OFFLINE_TIMOUT) <= (last_ping)) static bool node_is_offline(unsigned long long int last_ping)
{
return last_ping + NODE_OFFLINE_TIMOUT <= last_ping;
}
/* Return true if nodeslist pointed to by fp needs to be updated. /* Return true if nodeslist pointed to by fp needs to be updated.
* This will be the case if the file is empty, has an invalid format, * This will be the case if the file is empty, has an invalid format,
@ -377,7 +380,7 @@ static int extract_node(const char *line, struct Node *node)
long long int last_pinged = extract_val_last_pinged(last_pinged_str + LAST_PING_JSON_KEY_LEN); long long int last_pinged = extract_val_last_pinged(last_pinged_str + LAST_PING_JSON_KEY_LEN);
if (last_pinged <= 0 || NODE_IS_OFFLINE(Nodes.last_scan, last_pinged)) { if (last_pinged <= 0 || node_is_offline(last_pinged)) {
return -3; return -3;
} }

View File

@ -31,7 +31,7 @@
#define MAX_LINE_INFO_QUEUE 1024 #define MAX_LINE_INFO_QUEUE 1024
#define MAX_LINE_INFO_MSG_SIZE MAX_STR_SIZE + TOXIC_MAX_NAME_LENGTH + 32 /* needs extra room for log loading */ #define MAX_LINE_INFO_MSG_SIZE MAX_STR_SIZE + TOXIC_MAX_NAME_LENGTH + 32 /* needs extra room for log loading */
enum { typedef enum {
SYS_MSG, SYS_MSG,
IN_MSG, IN_MSG,
OUT_MSG, OUT_MSG,

View File

@ -30,7 +30,7 @@ struct chatlog {
bool log_on; /* specific to current chat window */ bool log_on; /* specific to current chat window */
}; };
enum { typedef enum {
LOG_GROUP, LOG_GROUP,
LOG_PROMPT, LOG_PROMPT,
LOG_CHAT, LOG_CHAT,

View File

@ -67,7 +67,7 @@ static PyObject *python_api_get_nick(PyObject *self, PyObject *args)
static PyObject *python_api_get_status(PyObject *self, PyObject *args) static PyObject *python_api_get_status(PyObject *self, PyObject *args)
{ {
PyObject *ret; PyObject *ret = NULL;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ""))
return NULL; return NULL;

View File

@ -88,7 +88,7 @@ struct user_settings {
#endif #endif
}; };
enum { enum settings_values {
AUTOLOG_OFF = 0, AUTOLOG_OFF = 0,
AUTOLOG_ON = 1, AUTOLOG_ON = 1,
@ -114,7 +114,7 @@ enum {
MPLEX_OFF = 0, MPLEX_OFF = 0,
MPLEX_ON = 1, MPLEX_ON = 1,
} settings_values; };
#define LINE_JOIN "-->" #define LINE_JOIN "-->"
#define LINE_QUIT "<--" #define LINE_QUIT "<--"

View File

@ -42,7 +42,7 @@
#define CHATBOX_HEIGHT 2 #define CHATBOX_HEIGHT 2
/* Curses foreground colours (background is black) */ /* Curses foreground colours (background is black) */
enum { typedef enum {
WHITE, WHITE,
GREEN, GREEN,
CYAN, CYAN,