Merge pull request #383 from RichardHitt/warnings

Correct almost all compiler warning issues
This commit is contained in:
TingPing 2013-01-19 13:10:54 -08:00
commit 8b49f5f787
11 changed files with 27 additions and 27 deletions

View File

@ -170,22 +170,24 @@ dccrecv_cb (char *word[], void *userdata)
int result; int result;
struct stat buffer; /* buffer for storing file info */ struct stat buffer; /* buffer for storing file info */
char sum[65]; /* buffer for checksum */ char sum[65]; /* buffer for checksum */
char *file; const char *file;
char *cfile;
if (hexchat_get_prefs (ph, "dcc_completed_dir", &file, NULL) == 1 && file[0] != 0) if (hexchat_get_prefs (ph, "dcc_completed_dir", &file, NULL) == 1 && file[0] != 0)
{ {
file = g_strconcat (file, G_DIR_SEPARATOR_S, word[1], NULL); cfile = g_strconcat (file, G_DIR_SEPARATOR_S, word[1], NULL);
} }
else else
{ {
file = g_strdup(word[2]); cfile = g_strdup(word[2]);
} }
result = stat (file, &buffer); result = stat (cfile, &buffer);
if (result == 0) /* stat returns 0 on success */ if (result == 0) /* stat returns 0 on success */
{ {
if (buffer.st_size <= (unsigned long long) get_limit () * 1048576) if (buffer.st_size <= (unsigned long long) get_limit () * 1048576)
{ {
sha256_file (file, sum); /* file is the full filename even if completed dir set */ sha256_file (cfile, sum); /* file is the full filename even if completed dir set */
/* try to print the checksum in the privmsg tab of the sender */ /* try to print the checksum in the privmsg tab of the sender */
hexchat_set_context (ph, hexchat_find_context (ph, NULL, word[3])); hexchat_set_context (ph, hexchat_find_context (ph, NULL, word[3]));
hexchat_printf (ph, "SHA-256 checksum for %s (local): %s\n", word[1], sum); hexchat_printf (ph, "SHA-256 checksum for %s (local): %s\n", word[1], sum);
@ -201,7 +203,7 @@ dccrecv_cb (char *word[], void *userdata)
hexchat_printf (ph, "File access error!\n"); hexchat_printf (ph, "File access error!\n");
} }
g_free (file); g_free (cfile);
return HEXCHAT_EAT_NONE; return HEXCHAT_EAT_NONE;
} }

View File

@ -66,6 +66,7 @@
#endif #endif
#include "hexchat-plugin.h" #include "hexchat-plugin.h"
#undef _POSIX_C_SOURCE /* Avoid warning: also in /usr/include/features.hfrom glib.h */
#include "Python.h" #include "Python.h"
#include "structmember.h" #include "structmember.h"
#include "pythread.h" #include "pythread.h"

View File

@ -37,9 +37,13 @@
int xs_parse_cpu(char *model, char *vendor, double *freq, char *cache, unsigned int *count) int xs_parse_cpu(char *model, char *vendor, double *freq, char *cache, unsigned int *count)
{ {
char buffer[bsize], *pos; #if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__alpha__) || defined(__ia64__) || defined(__parisc__) || defined(__sparc__)
char buffer[bsize];
#endif
#if defined(__powerpc__)
char *pos = NULL;
#endif
FILE *fp = fopen("/proc/cpuinfo", "r"); FILE *fp = fopen("/proc/cpuinfo", "r");
pos = NULL;
if(fp == NULL) if(fp == NULL)
return 1; return 1;
if(count != NULL) *count = 0; if(count != NULL) *count = 0;

View File

@ -1257,7 +1257,7 @@ cmd_menu (struct session *sess, char *tbuf, char *word[], char *word_eol[])
int idx = 2; int idx = 2;
int len; int len;
int pos = 0xffff; int pos = 0xffff;
int state; int state = 0;
int toggle = FALSE; int toggle = FALSE;
int enable = TRUE; int enable = TRUE;
int markup = FALSE; int markup = FALSE;

View File

@ -1626,6 +1626,7 @@ hexchat_pluginpref_set_str_real (hexchat_plugin *pl, const char *var, const char
char *buffer; char *buffer;
char *buffer_tmp; char *buffer_tmp;
char line_buffer[512]; /* the same as in cfg_put_str */ char line_buffer[512]; /* the same as in cfg_put_str */
char *line_bufp = line_buffer;
char *canon; char *canon;
canon = g_strdup (pl->name); canon = g_strdup (pl->name);
@ -1687,7 +1688,7 @@ hexchat_pluginpref_set_str_real (hexchat_plugin *pl, const char *var, const char
{ {
prevSetting = 0; prevSetting = 0;
while (fscanf (fpIn, " %[^\n]", &line_buffer) != EOF) /* read whole lines including whitespaces */ while (fscanf (fpIn, " %[^\n]", line_bufp) != EOF) /* read whole lines including whitespaces */
{ {
buffer_tmp = g_strdup_printf ("%s ", var); /* add one space, this way it works against var - var2 checks too */ buffer_tmp = g_strdup_printf ("%s ", var); /* add one space, this way it works against var - var2 checks too */
@ -1844,6 +1845,7 @@ hexchat_pluginpref_list (hexchat_plugin *pl, char* dest)
FILE *fpIn; FILE *fpIn;
char confname[64]; char confname[64];
char buffer[512]; /* the same as in cfg_put_str */ char buffer[512]; /* the same as in cfg_put_str */
char *bufp = buffer;
char *token; char *token;
token = g_strdup (pl->name); token = g_strdup (pl->name);
@ -1860,7 +1862,7 @@ hexchat_pluginpref_list (hexchat_plugin *pl, char* dest)
else /* existing config file, get list of settings */ else /* existing config file, get list of settings */
{ {
strcpy (dest, ""); /* clean up garbage */ strcpy (dest, ""); /* clean up garbage */
while (fscanf (fpIn, " %[^\n]", &buffer) != EOF) /* read whole lines including whitespaces */ while (fscanf (fpIn, " %[^\n]", bufp) != EOF) /* read whole lines including whitespaces */
{ {
token = strtok (buffer, "="); token = strtok (buffer, "=");
strncat (dest, token, strlen (token) - 1); strncat (dest, token, strlen (token) - 1);

View File

@ -136,7 +136,7 @@ scrollback_shrink (session *sess)
int fh; int fh;
int lines; int lines;
int line; int line;
int len; gsize len;
char *p; char *p;
scrollback_close (sess); scrollback_close (sess);

View File

@ -990,9 +990,9 @@ fe_set_inputbox_contents (session *sess, char *text)
#ifndef WIN32 #ifndef WIN32
static gboolean static gboolean
try_browser (const char *browser, const char *arg, const char *url) try_browser (const char *browser, char *arg, const char *url)
{ {
const char *argv[4]; char *argv[4];
char *path; char *path;
path = g_find_program_in_path (browser); path = g_find_program_in_path (browser);
@ -1000,12 +1000,12 @@ try_browser (const char *browser, const char *arg, const char *url)
return 0; return 0;
argv[0] = path; argv[0] = path;
argv[1] = url; argv[1] = (char *)url;
argv[2] = NULL; argv[2] = NULL;
if (arg) if (arg)
{ {
argv[1] = arg; argv[1] = arg;
argv[2] = url; argv[2] = (char *)url;
argv[3] = NULL; argv[3] = NULL;
} }
hexchat_execv (argv); hexchat_execv (argv);

View File

@ -388,7 +388,7 @@ fe_get_str (char *msg, char *def, void *callback, void *userdata)
NULL); NULL);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->vbox), TRUE); gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->vbox), TRUE);
if ((int) userdata == 1) /* nick box is usually on the very bottom, make it centered */ if (userdata == (void *)1) /* nick box is usually on the very bottom, make it centered */
{ {
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER); gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
} }

View File

@ -881,14 +881,11 @@ static int ul_tag = 0;
static gboolean static gboolean
mg_populate_userlist (session *sess) mg_populate_userlist (session *sess)
{ {
session_gui *gui;
if (!sess) if (!sess)
sess = current_tab; sess = current_tab;
if (is_session (sess)) if (is_session (sess))
{ {
gui = sess->gui;
if (sess->type == SESS_DIALOG) if (sess->type == SESS_DIALOG)
mg_set_access_icon (sess->gui, NULL, sess->server->is_away); mg_set_access_icon (sess->gui, NULL, sess->server->is_away);
else else

View File

@ -191,7 +191,6 @@ sexy_spell_entry_class_init(SexySpellEntryClass *klass)
GObjectClass *gobject_class; GObjectClass *gobject_class;
GtkObjectClass *object_class; GtkObjectClass *object_class;
GtkWidgetClass *widget_class; GtkWidgetClass *widget_class;
GtkEntryClass *entry_class;
initialize_enchant(); initialize_enchant();
@ -200,7 +199,6 @@ sexy_spell_entry_class_init(SexySpellEntryClass *klass)
gobject_class = G_OBJECT_CLASS(klass); gobject_class = G_OBJECT_CLASS(klass);
object_class = GTK_OBJECT_CLASS(klass); object_class = GTK_OBJECT_CLASS(klass);
widget_class = GTK_WIDGET_CLASS(klass); widget_class = GTK_WIDGET_CLASS(klass);
entry_class = GTK_ENTRY_CLASS(klass);
if (have_enchant) if (have_enchant)
klass->word_check = default_word_check; klass->word_check = default_word_check;
@ -695,10 +693,6 @@ sexy_spell_entry_finalize(GObject *obj)
static void static void
sexy_spell_entry_destroy(GtkObject *obj) sexy_spell_entry_destroy(GtkObject *obj)
{ {
SexySpellEntry *entry;
entry = SEXY_SPELL_ENTRY(obj);
if (GTK_OBJECT_CLASS(parent_class)->destroy) if (GTK_OBJECT_CLASS(parent_class)->destroy)
GTK_OBJECT_CLASS(parent_class)->destroy(obj); GTK_OBJECT_CLASS(parent_class)->destroy(obj);
} }

View File

@ -3729,13 +3729,13 @@ static void
shade_image (GdkVisual *visual, void *data, int bpl, int bpp, int w, int h, shade_image (GdkVisual *visual, void *data, int bpl, int bpp, int w, int h,
int rm, int gm, int bm, int bg, int depth) int rm, int gm, int bm, int bg, int depth)
{ {
#ifdef USE_MMX
int bg_r, bg_g, bg_b; int bg_r, bg_g, bg_b;
bg_r = bg & visual->red_mask; bg_r = bg & visual->red_mask;
bg_g = bg & visual->green_mask; bg_g = bg & visual->green_mask;
bg_b = bg & visual->blue_mask; bg_b = bg & visual->blue_mask;
#ifdef USE_MMX
/* the MMX routines are about 50% faster at 16-bit. */ /* the MMX routines are about 50% faster at 16-bit. */
/* only use MMX routines with a pure black background */ /* only use MMX routines with a pure black background */
if (bg_r == 0 && bg_g == 0 && bg_b == 0 && have_mmx ()) /* do a runtime check too! */ if (bg_r == 0 && bg_g == 0 && bg_b == 0 && have_mmx ()) /* do a runtime check too! */