diff --git a/plugins/python/python.c b/plugins/python/python.c index 1904a3e9..0ce6ad6e 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -414,6 +414,9 @@ Util_BuildEOLList(char *word[]) PyObject *list; int listsize = 31; int i; + char *accum = NULL; + char *last = NULL; + /* Find the last valid array member; there may be intermediate NULLs that * would otherwise cause us to drop some members. */ while (listsize > 0 && @@ -424,10 +427,9 @@ Util_BuildEOLList(char *word[]) PyErr_Print(); return NULL; } - char *accum = NULL; - char *last = NULL; for (i = listsize; i > 0; i--) { char *part = word[i]; + PyObject *uni_part; if (accum == NULL) { accum = g_strdup (part); } else if (part != NULL && part[0] != 0) { @@ -443,7 +445,7 @@ Util_BuildEOLList(char *word[]) return NULL; } } - PyObject *uni_part = PyUnicode_FromString(accum); + uni_part = PyUnicode_FromString(accum); PyList_SetItem(list, i - 1, uni_part); } diff --git a/plugins/sysinfo/hwmon.c b/plugins/sysinfo/hwmon.c index 389244ac..e562458f 100644 --- a/plugins/sysinfo/hwmon.c +++ b/plugins/sysinfo/hwmon.c @@ -53,8 +53,9 @@ void get_hwmon_chip_name(char *name) void get_hwmon_temp(unsigned int *value, unsigned int *sensor) { char buffer[bsize]; + FILE *fp; snprintf(buffer, bsize, "/sys/class/hwmon/hwmon0/device/temp%i_input", *sensor); - FILE *fp = fopen(buffer, "r"); + fp = fopen(buffer, "r"); if(fp != NULL) { if(fgets(buffer, bsize, fp) != NULL) *value = atoi(buffer); diff --git a/plugins/sysinfo/match.c b/plugins/sysinfo/match.c index adfbff1b..f8a8cf96 100644 --- a/plugins/sysinfo/match.c +++ b/plugins/sysinfo/match.c @@ -32,12 +32,12 @@ float percentage(unsigned long long *free, unsigned long long *total) char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned long long *total_k) { - char *result, **quantity; + char *quantities[] = { "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB", 0 }; + char *result, **quantity; double free_space, total_space; free_space = *free_k; total_space = *total_k; result = malloc(bsize * sizeof(char)); - char *quantities[] = { "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB", 0 }; if (total_space == 0) { snprintf(result, bsize, "%s: none", desc); diff --git a/plugins/sysinfo/parse.c b/plugins/sysinfo/parse.c index 4c15897a..3f1ad6c5 100644 --- a/plugins/sysinfo/parse.c +++ b/plugins/sysinfo/parse.c @@ -34,6 +34,7 @@ #include "match.h" #include "hwmon.h" #include "xsys.h" +#include "parse.h" int xs_parse_cpu(char *model, char *vendor, double *freq, char *cache, unsigned int *count) { diff --git a/plugins/sysinfo/pci.c b/plugins/sysinfo/pci.c index bc8fb11f..9946c446 100644 --- a/plugins/sysinfo/pci.c +++ b/plugins/sysinfo/pci.c @@ -115,9 +115,10 @@ void pci_find_fullname(char *fullname, char *vendor, char *device) char devicename[bsize/2] = ""; char *position; int cardfound = 0; + FILE *fp; sysinfo_get_pciids (buffer); - FILE *fp = fopen (buffer, "r"); + fp = fopen (buffer, "r"); if(fp == NULL) { snprintf(fullname, bsize, "%s:%s", vendor, device); diff --git a/plugins/sysinfo/xsys.c b/plugins/sysinfo/xsys.c index 4ab6e873..79abcea1 100644 --- a/plugins/sysinfo/xsys.c +++ b/plugins/sysinfo/xsys.c @@ -878,11 +878,11 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata) int hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) { + char buffer[bsize]; ph = plugin_handle; *plugin_name = name; *plugin_desc = desc; *plugin_version = version; - char buffer[bsize]; hexchat_hook_command (ph, "SYSINFO", HEXCHAT_PRI_NORM, sysinfo_cb, sysinfo_help, NULL); hexchat_hook_command (ph, "NETDATA", HEXCHAT_PRI_NORM, netdata_cb, NULL, NULL); diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 71a5bf96..735bbfe2 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -1311,7 +1311,7 @@ cmd_set (struct session *sess, char *tbuf, char *word[], char *word_eol[]) } int -hexchat_open_file (char *file, int flags, int mode, int xof_flags) +hexchat_open_file (const char *file, int flags, int mode, int xof_flags) { char *buf; int fd; diff --git a/src/common/cfgfiles.h b/src/common/cfgfiles.h index 8b996ca0..c460ce60 100644 --- a/src/common/cfgfiles.h +++ b/src/common/cfgfiles.h @@ -48,7 +48,7 @@ void list_loadconf (char *file, GSList ** list, char *defaultconf); int list_delentry (GSList ** list, char *name); void list_addentry (GSList ** list, char *cmd, char *name); int cmd_set (session *sess, char *tbuf, char *word[], char *word_eol[]); -int hexchat_open_file (char *file, int flags, int mode, int xof_flags); +int hexchat_open_file (const char *file, int flags, int mode, int xof_flags); FILE *hexchat_fopen_file (const char *file, const char *mode, int xof_flags); #define XOF_DOMODE 1 diff --git a/src/common/dbus/dbus-plugin.c b/src/common/dbus/dbus-plugin.c index ee8accfe..bb9fb5e1 100644 --- a/src/common/dbus/dbus-plugin.c +++ b/src/common/dbus/dbus-plugin.c @@ -26,6 +26,7 @@ #include #include #include "hexchat-plugin.h" +#include "dbus-plugin.h" #define PNAME _("remote access") #define PDESC _("plugin for remote access using DBUS") diff --git a/src/common/dbus/example.c b/src/common/dbus/example.c index c3ad4ff3..0228b884 100644 --- a/src/common/dbus/example.c +++ b/src/common/dbus/example.c @@ -33,7 +33,7 @@ guint command_id; guint server_id; static void -write_error (char *message, +write_error (const char *message, GError **error) { if (error == NULL || *error == NULL) { diff --git a/src/common/make-te.c b/src/common/make-te.c index 309eec2f..5eceb5f0 100644 --- a/src/common/make-te.c +++ b/src/common/make-te.c @@ -42,7 +42,7 @@ #include #include -int main() +int main(void) { char name[512]; char num[512]; diff --git a/src/common/url.c b/src/common/url.c index 1321374f..5fbeb6c8 100644 --- a/src/common/url.c +++ b/src/common/url.c @@ -429,7 +429,7 @@ regex_match (const GRegex *re, const char *word, int *start, int *end) #define OPT_PORT "(" PORT ")?" static GRegex * -make_re (char *grist) +make_re (const char *grist) { GRegex *ret; GError *err = NULL; diff --git a/src/common/util.c b/src/common/util.c index b5ee1af2..a6c4fad8 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1526,7 +1526,7 @@ canonalize_key (char *key) } int -portable_mode () +portable_mode (void) { #ifdef WIN32 if ((_access( "portable-mode", 0 )) != -1) @@ -1543,7 +1543,7 @@ portable_mode () } int -unity_mode () +unity_mode (void) { #ifdef G_OS_UNIX const char *env = g_getenv("XDG_CURRENT_DESKTOP"); diff --git a/src/common/util.h b/src/common/util.h index 5231e56d..8b2762fb 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -73,8 +73,8 @@ guint32 str_hash (const char *key); guint32 str_ihash (const unsigned char *key); void safe_strcpy (char *dest, const char *src, int bytes_left); void canonalize_key (char *key); -int portable_mode (); -int unity_mode (); +int portable_mode (void); +int unity_mode (void); char *encode_sasl_pass_plain (char *user, char *pass); char *encode_sasl_pass_blowfish (char *user, char *pass, char *data); char *encode_sasl_pass_aes (char *user, char *pass, char *data); diff --git a/src/fe-gtk/chanview-tabs.c b/src/fe-gtk/chanview-tabs.c index 8f940c24..32039d6d 100644 --- a/src/fe-gtk/chanview-tabs.c +++ b/src/fe-gtk/chanview-tabs.c @@ -62,12 +62,13 @@ cv_tabs_sizerequest (GtkWidget *viewport, GtkRequisition *requisition, chanview static void cv_tabs_sizealloc (GtkWidget *widget, GtkAllocation *allocation, chanview *cv) { + GdkWindow *parent_win; GtkAdjustment *adj; GtkWidget *inner; gint viewport_size; inner = ((tabview *)cv)->inner; - GdkWindow *parent_win = gtk_widget_get_window (gtk_widget_get_parent (inner)); + parent_win = gtk_widget_get_window (gtk_widget_get_parent (inner)); if (cv->vertical) { diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c index b3e34c0a..3cd6502d 100644 --- a/src/fe-gtk/plugin-tray.c +++ b/src/fe-gtk/plugin-tray.c @@ -186,9 +186,10 @@ fe_tray_set_balloon (const char *title, const char *text) if (!notify_is_initted()) { + GList* server_caps; notify_init(PACKAGE_NAME); - GList* server_caps = notify_get_server_caps (); + server_caps = notify_get_server_caps (); if (g_list_find_custom (server_caps, "body-markup", (GCompareFunc)strcmp)) { notify_text_strip_flags |= STRIP_ESCMARKUP; diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c index 7b0e64c6..63b87ce8 100644 --- a/src/fe-gtk/xtext.c +++ b/src/fe-gtk/xtext.c @@ -3257,7 +3257,7 @@ gtk_xtext_render_stamp (GtkXText * xtext, textentry * ent, { textentry tmp_ent; int jo, ji, hs; - int xsize, y; + int xsize, y, emphasis; /* trashing ent here, so make a backup first */ memcpy (&tmp_ent, ent, sizeof (tmp_ent)); @@ -3267,7 +3267,7 @@ gtk_xtext_render_stamp (GtkXText * xtext, textentry * ent, xtext->jump_out_offset = 0; xtext->jump_in_offset = 0; xtext->hilight_start = 0xffff; /* temp disable */ - int emphasis = 0; + emphasis = 0; if (xtext->mark_stamp) {