diff --git a/plugins/mpcinfo/functions.c b/plugins/mpcinfo/functions.c index ff2d563e..de2e8a40 100644 --- a/plugins/mpcinfo/functions.c +++ b/plugins/mpcinfo/functions.c @@ -14,54 +14,25 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -/* -typedef int (*MYPROC)(HWND,HWND,char*,char*,BOOL,BOOL); - -int dllProc(char *name, char *data){ - HINSTANCE hinstLib; - hinstLib = LoadLibrary("mpcinfo"); - //MYPROC proc; - int res; - if (hinstLib != NULL){ - //proc = ; - if ((MYPROC) GetProcAddress(hinstLib, name)!=NULL){ - res=(MYPROC)(NULL,NULL,data,NULL,TRUE,TRUE); - } - else{fprintf(stderr,"can't get proc: %s\n",name);res=-2;} - } - else{fprintf(stderr,"can't access dll\n");return -1;} - FreeLibrary(hinstLib); - return res; -} -*/ - -/* -int dllProc(char *name, char *data) +char *split(char *text, char separator) { - static HMODULE lib = NULL; - if (!lib) + int pos = -1; + size_t i; + for (i = 0; i < strlen(text); i++) { - lib = LoadLibraryA ("mpcinfo"); - if (!lib) - { - return FALSE; + if (text[i] == separator) { + pos = i; + i = strlen(text) + 1; } - FreeLibrary (lib); } - return TRUE; -} -*/ + if (pos == -1) + { + return text; + } -char *split(char *text, char seperator){ - //if (DEBUG==1) putlog("splitting"); - int i;int pos=-1; - for (i=0;i57)||(text[strlen(text)-i]<48)){ - hexchat_printf(ph,"invalid char in string: %i",text[strlen(text)-i]); - return 255; - } - ret+=((int)text[strlen(text)-i]-48)*iPow(10,i-1); - } - //hexchat_printf(ph, "str2int(%s)=%i",text,ret); - //if (DEBUG==1) putlog("int converted"); - return ret; -} -/* -static int getSize(char *file){ - //if (DEBUG==1) putlog("reading filesize"); - struct stat info; - if (stat(file,&info)!=0) return -1; - return info.st_size; -}*/ -/* -int inStr(char *s1, int sl1, char *s2){ - //if (DEBUG==1) putlog("checking instr"); - int i;int j; - for(i=0;i 57) || (text[strlen(text) - i] < 48)) + { + hexchat_printf(ph, "invalid char in string: %i", (int) text[strlen(text) - i]); + return 255; + } + + ret += ((int) text[strlen(text) - i] - 48)*iPow(10, i - 1); } - if (spcKill==1){ - for (i=length-1;i>=0;i--){ - if (ret[i]==32) ret[i]=0; - else i=-1; - } - } - //if (DEBUG==1) putlog("substring created"); + return ret; } -static char *substring(char *text, int first, int length){return subString(text,first,length,0);} //1 -*/ - static char *tagExtract(char *tag, int tagLen, char* info){ //if (DEBUG==1) putlog("extracting tag"); int pos, len, i; @@ -204,23 +167,28 @@ struct tagInfo readID3V1(char *file){ return ret; } -char *extractID3Genre(char *tag){ - //if (DEBUG==1) putlog("extracting id3 genre"); - if (tag[strlen(tag)-1]==')'){ - tag[strlen(tag)-1]=0; - tag=&tag[1]; - return GENRES[str2int(tag)]; - //return tag; - } - else{ - int i; - //hexchat_print(ph, "Using 2 criteria"); - for (i=0;iconnected && serv->end_of_motd) { lag = now - serv->ping_recv; - if (prefs.hex_net_ping_timeout && lag > prefs.hex_net_ping_timeout && lag > 0) + if (prefs.hex_net_ping_timeout != 0 && lag > prefs.hex_net_ping_timeout && lag > 0) { - sprintf (tbuf, "%d", lag); + sprintf (tbuf, "%" G_GINT64_FORMAT, (gint64) lag); EMIT_SIGNAL (XP_TE_PINGTIMEOUT, serv->server_session, tbuf, NULL, NULL, NULL, 0); if (prefs.hex_net_auto_reconnect) serv->auto_reconnect (serv, FALSE, -1); - } else + } + else { snprintf (tbuf, sizeof (tbuf), "LAG%lu", tim); serv->p_ping (serv, "", tbuf); @@ -396,7 +397,6 @@ irc_init (session *sess) { static int done_init = FALSE; char *buf; - int i; if (done_init) return; @@ -431,7 +431,8 @@ irc_init (session *sess) if (arg_urls != NULL) { - for (i = 0; i < g_strv_length(arg_urls); i++) + guint i; + for (i = 0; i < g_strv_length (arg_urls); i++) { buf = g_strdup_printf ("%s %s", i==0? "server" : "newserver", arg_urls[i]); handle_command (sess, buf, FALSE); @@ -1012,7 +1013,7 @@ main (int argc, char *argv[]) int i; int ret; - srand (time (0)); /* CL: do this only once! */ + srand ((unsigned int) time (NULL)); /* CL: do this only once! */ /* We must check for the config dir parameter, otherwise load_config() will behave incorrectly. * load_config() must come before fe_args() because fe_args() calls gtk_init() which needs to diff --git a/src/common/inbound.c b/src/common/inbound.c index b80553b3..f7232ce4 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -682,7 +682,8 @@ inbound_nameslist (server *serv, char *chan, char *names, char **name_list; char *host, *nopre_name; char name[NICKLEN]; - int i, offset; + int i; + size_t offset; sess = find_channel (serv, chan); if (!sess) diff --git a/src/common/modes.c b/src/common/modes.c index b7cd471f..23f75b1d 100644 --- a/src/common/modes.c +++ b/src/common/modes.c @@ -677,10 +677,10 @@ handle_mode (server * serv, char *word[], char *word_eol[], char *argstr; char sign; int len; - int arg; - int i, num_args; + size_t arg; + size_t i, num_args; int num_modes; - int offset = 3; + size_t offset = 3; int all_modes_have_args = FALSE; int using_front_tab = FALSE; mode_run mr; @@ -762,7 +762,7 @@ handle_mode (server * serv, char *word[], char *word_eol[], break; default: argstr = ""; - if ((all_modes_have_args || mode_has_arg (serv, sign, *modes)) && arg < (num_args+1)) + if ((all_modes_have_args || mode_has_arg (serv, sign, *modes)) && arg < (num_args + 1)) { arg++; argstr = word[arg + offset]; diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 34b4ece1..2bfcb393 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -1355,8 +1355,8 @@ process_named_servermsg (session *sess, char *buf, char *rawname, char *word_eol /* Returns the timezone offset. This should be the same as the variable * "timezone" in time.h, but *BSD doesn't have it. */ -static int -get_timezone(void) +static time_t +get_timezone (void) { struct tm tm_utc, tm_local; time_t t, time_utc, time_local; diff --git a/src/fe-gtk/chanview-tabs.c b/src/fe-gtk/chanview-tabs.c index 32039d6d..5681f9d6 100644 --- a/src/fe-gtk/chanview-tabs.c +++ b/src/fe-gtk/chanview-tabs.c @@ -142,7 +142,7 @@ tab_scroll_left_up_clicked (GtkWidget *widget, chanview *cv) gfloat new_value; GtkWidget *inner; GdkWindow *parent_win; - gfloat i; + gdouble i; inner = ((tabview *)cv)->inner; parent_win = gtk_widget_get_window (gtk_widget_get_parent (inner)); @@ -191,7 +191,7 @@ tab_scroll_right_down_clicked (GtkWidget *widget, chanview *cv) gfloat new_value; GtkWidget *inner; GdkWindow *parent_win; - gfloat i; + gdouble i; inner = ((tabview *)cv)->inner; parent_win = gtk_widget_get_window (gtk_widget_get_parent (inner)); diff --git a/src/fe-gtk/custom-list.c b/src/fe-gtk/custom-list.c index a954b4a0..f67c3c07 100644 --- a/src/fe-gtk/custom-list.c +++ b/src/fe-gtk/custom-list.c @@ -336,7 +336,7 @@ custom_list_get_iter (GtkTreeModel * tree_model, gint n; n = gtk_tree_path_get_indices (path)[0]; - if (n >= custom_list->num_rows || n < 0) + if (n < 0 || (guint) n >= custom_list->num_rows) return FALSE; record = custom_list->rows[n]; @@ -533,7 +533,7 @@ custom_list_iter_nth_child (GtkTreeModel * tree_model, return FALSE; /* special case: if parent == NULL, set iter to n-th top-level row */ - if (n >= custom_list->num_rows) + if (n < 0 || (guint) n >= custom_list->num_rows) return FALSE; iter->user_data = custom_list->rows[n]; diff --git a/src/fe-gtk/custom-list.h b/src/fe-gtk/custom-list.h index 64f0535f..30a73919 100644 --- a/src/fe-gtk/custom-list.h +++ b/src/fe-gtk/custom-list.h @@ -77,10 +77,10 @@ struct _CustomList { GObject parent; - guint num_rows; /* number of rows that we have used */ - guint num_alloc; /* number of rows allocated */ - chanlistrow **rows; /* a dynamically allocated array of pointers to the - * CustomRecord structure for each row */ + guint num_rows; /* number of rows that we have used */ + guint num_alloc; /* number of rows allocated */ + chanlistrow **rows; /* a dynamically allocated array of pointers to the + * CustomRecord structure for each row */ gint n_columns; GType column_types[CUSTOM_LIST_N_COLUMNS]; diff --git a/src/fe-gtk/fe-gtk.h b/src/fe-gtk/fe-gtk.h index 17d1ab4d..4801a56e 100644 --- a/src/fe-gtk/fe-gtk.h +++ b/src/fe-gtk/fe-gtk.h @@ -92,9 +92,9 @@ struct server_gui guint chanlist_channels_shown_count; /* total number of displayed channels */ - int chanlist_maxusers; - int chanlist_minusers; - int chanlist_minusers_downloaded; /* used by LIST IRC command */ + guint32 chanlist_maxusers; + guint32 chanlist_minusers; + guint32 chanlist_minusers_downloaded; /* used by LIST IRC command */ int chanlist_search_type; /* 0=simple 1=pattern/wildcard 2=regexp */ gboolean chanlist_caption_is_stale; }; diff --git a/src/fe-gtk/fkeys.c b/src/fe-gtk/fkeys.c index 59086a5e..7dc57c67 100644 --- a/src/fe-gtk/fkeys.c +++ b/src/fe-gtk/fkeys.c @@ -1600,7 +1600,7 @@ key_action_tab_comp (GtkWidget *t, GdkEventKey *entry, char *d1, char *d2, old_gcomp.elen = elen; /* Get the first nick and put out the data for future nickcompletes */ - if (prefs.hex_completion_amount && g_list_length (list) <= prefs.hex_completion_amount) + if (prefs.hex_completion_amount > 0 && g_list_length (list) <= (guint) prefs.hex_completion_amount) { g_free(result); result = (char*)list->data; diff --git a/src/fe-gtk/joind.c b/src/fe-gtk/joind.c index 61ce8828..6dacd385 100644 --- a/src/fe-gtk/joind.c +++ b/src/fe-gtk/joind.c @@ -151,7 +151,7 @@ joind_show_dialog (server *serv) image1 = gtk_image_new_from_stock (GTK_STOCK_NETWORK, GTK_ICON_SIZE_LARGE_TOOLBAR); gtk_widget_show (image1); gtk_box_pack_start (GTK_BOX (hbox1), image1, FALSE, TRUE, 24); - gtk_misc_set_alignment (GTK_MISC (image1), 0.5, 0.06); + gtk_misc_set_alignment (GTK_MISC (image1), 0.5f, 0.06f); vbox2 = gtk_vbox_new (FALSE, 10); gtk_container_set_border_width (GTK_CONTAINER (vbox2), 6); diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index 2d50a98c..d8a538ed 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -557,7 +557,7 @@ static int mg_progressbar_update (GtkWidget *bar) { static int type = 0; - static float pos = 0; + static gdouble pos = 0; pos += 0.05; if (pos >= 0.99) diff --git a/src/fe-gtk/rawlog.c b/src/fe-gtk/rawlog.c index 24ebf041..4d036c19 100644 --- a/src/fe-gtk/rawlog.c +++ b/src/fe-gtk/rawlog.c @@ -146,7 +146,7 @@ fe_add_rawlog (server *serv, char *text, int len, int outbound) { char **split_text; char *new_text; - int i; + size_t i; if (!serv->gui->rawlog_window) return;