mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Fixed one error and several warnings with GLIB 2.0
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2663 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
ec168a4009
commit
bd00ff54c2
@ -257,6 +257,8 @@ static void server_connect_callback_readpipe(SERVER_REC *server)
|
|||||||
/* initializes server record but doesn't start connecting */
|
/* initializes server record but doesn't start connecting */
|
||||||
void server_connect_init(SERVER_REC *server)
|
void server_connect_init(SERVER_REC *server)
|
||||||
{
|
{
|
||||||
|
const char *str;
|
||||||
|
|
||||||
g_return_if_fail(server != NULL);
|
g_return_if_fail(server != NULL);
|
||||||
|
|
||||||
MODULE_DATA_INIT(server);
|
MODULE_DATA_INIT(server);
|
||||||
@ -267,16 +269,16 @@ void server_connect_init(SERVER_REC *server)
|
|||||||
if (server->connrec->username == NULL || *server->connrec->username == '\0') {
|
if (server->connrec->username == NULL || *server->connrec->username == '\0') {
|
||||||
g_free_not_null(server->connrec->username);
|
g_free_not_null(server->connrec->username);
|
||||||
|
|
||||||
server->connrec->username = g_get_user_name();
|
str = g_get_user_name();
|
||||||
if (*server->connrec->username == '\0') server->connrec->username = "-";
|
if (*str == '\0') str = "-";
|
||||||
server->connrec->username = g_strdup(server->connrec->username);
|
server->connrec->username = g_strdup(str);
|
||||||
}
|
}
|
||||||
if (server->connrec->realname == NULL || *server->connrec->realname == '\0') {
|
if (server->connrec->realname == NULL || *server->connrec->realname == '\0') {
|
||||||
g_free_not_null(server->connrec->realname);
|
g_free_not_null(server->connrec->realname);
|
||||||
|
|
||||||
server->connrec->realname = g_get_real_name();
|
str = g_get_real_name();
|
||||||
if (*server->connrec->realname == '\0') server->connrec->realname = "-";
|
if (*str == '\0') str = "-";
|
||||||
server->connrec->realname = g_strdup(server->connrec->realname);
|
server->connrec->realname = g_strdup(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
server->tag = server_create_tag(server->connrec);
|
server->tag = server_create_tag(server->connrec);
|
||||||
|
@ -39,6 +39,7 @@ static char **session_args;
|
|||||||
|
|
||||||
void session_set_binary(const char *path)
|
void session_set_binary(const char *path)
|
||||||
{
|
{
|
||||||
|
const char *envpath;
|
||||||
char **paths, **tmp;
|
char **paths, **tmp;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
@ -59,10 +60,10 @@ void session_set_binary(const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* we'll need to find it from path. */
|
/* we'll need to find it from path. */
|
||||||
str = g_getenv("PATH");
|
envpath = g_getenv("PATH");
|
||||||
if (str == NULL) return;
|
if (envpath == NULL) return;
|
||||||
|
|
||||||
paths = g_strsplit(str, ":", -1);
|
paths = g_strsplit(envpath, ":", -1);
|
||||||
for (tmp = paths; *tmp != NULL; tmp++) {
|
for (tmp = paths; *tmp != NULL; tmp++) {
|
||||||
str = g_strconcat(*tmp, G_DIR_SEPARATOR_S, path, NULL);
|
str = g_strconcat(*tmp, G_DIR_SEPARATOR_S, path, NULL);
|
||||||
if (access(str, X_OK) == 0) {
|
if (access(str, X_OK) == 0) {
|
||||||
|
@ -106,7 +106,7 @@ static char *get_long_variable_value(const char *key, SERVER_REC *server,
|
|||||||
void *item, int *free_ret)
|
void *item, int *free_ret)
|
||||||
{
|
{
|
||||||
EXPANDO_FUNC func;
|
EXPANDO_FUNC func;
|
||||||
char *ret;
|
const char *ret;
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
*free_ret = FALSE;
|
*free_ret = FALSE;
|
||||||
@ -124,7 +124,7 @@ static char *get_long_variable_value(const char *key, SERVER_REC *server,
|
|||||||
/* environment variable? */
|
/* environment variable? */
|
||||||
ret = g_getenv(key);
|
ret = g_getenv(key);
|
||||||
if (ret != NULL)
|
if (ret != NULL)
|
||||||
return ret;
|
return (char *) ret;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,8 @@ GList *filename_complete(const char *path, const char *default_path)
|
|||||||
GList *list;
|
GList *list;
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
char *realpath, *dir, *basename, *name;
|
const char *basename;
|
||||||
|
char *realpath, *dir, *name;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
g_return_val_if_fail(path != NULL, NULL);
|
g_return_val_if_fail(path != NULL, NULL);
|
||||||
|
@ -563,8 +563,11 @@ int key_pressed(KEYBOARD_REC *keyboard, const char *key)
|
|||||||
g_strconcat(keyboard->key_state, "-", key, NULL);
|
g_strconcat(keyboard->key_state, "-", key, NULL);
|
||||||
g_free_and_null(keyboard->key_state);
|
g_free_and_null(keyboard->key_state);
|
||||||
|
|
||||||
|
#if GLIB_MAJOR_VERSION == 2
|
||||||
|
# define GSearchFunc GCompareFunc
|
||||||
|
#endif
|
||||||
rec = g_tree_search(key_states,
|
rec = g_tree_search(key_states,
|
||||||
(GSearchFunc) key_states_search,
|
(GCompareFunc) key_states_search,
|
||||||
combo);
|
combo);
|
||||||
if (rec == NULL) {
|
if (rec == NULL) {
|
||||||
/* unknown key combo, eat the invalid key
|
/* unknown key combo, eat the invalid key
|
||||||
|
@ -83,8 +83,7 @@ static void sig_server_setup_fill_chatnet(IRC_SERVER_CONNECT_REC *conn,
|
|||||||
|
|
||||||
static void init_userinfo(void)
|
static void init_userinfo(void)
|
||||||
{
|
{
|
||||||
const char *set, *nick, *user_name;
|
const char *set, *nick, *user_name, *str;
|
||||||
char *str;
|
|
||||||
|
|
||||||
/* check if nick/username/realname wasn't read from setup.. */
|
/* check if nick/username/realname wasn't read from setup.. */
|
||||||
set = settings_get_str("real_name");
|
set = settings_get_str("real_name");
|
||||||
|
@ -168,7 +168,8 @@ static char *dcc_send_get_file(const char *fname)
|
|||||||
static void cmd_dcc_send(const char *data, IRC_SERVER_REC *server,
|
static void cmd_dcc_send(const char *data, IRC_SERVER_REC *server,
|
||||||
WI_ITEM_REC *item)
|
WI_ITEM_REC *item)
|
||||||
{
|
{
|
||||||
char *target, *fname, *str;
|
const char *fname;
|
||||||
|
char *target, *str;
|
||||||
void *free_arg;
|
void *free_arg;
|
||||||
char host[MAX_IP_LEN];
|
char host[MAX_IP_LEN];
|
||||||
int hfile, port;
|
int hfile, port;
|
||||||
|
Loading…
Reference in New Issue
Block a user