From: fredrik Date: Tue, 1 May 2007 00:07:34 +0000 (+0000) Subject: Use GINT_TO_POINTER. X-Git-Tag: 0.4~87 X-Git-Url: http://git.dolda2000.com/gitweb/?p=doldaconnect.git;a=commitdiff_plain;h=a2f77326ce99e5eb08b90cee1ee9f14a50d0f181 Use GINT_TO_POINTER. Add format attribute to msgbox. Fix argument shortage in pubhubxmlhandler. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/doldaconnect@983 959494ce-11ee-0310-bf91-de5d638817bd --- diff --git a/clients/gtk2/main.c b/clients/gtk2/main.c index 880c641..d74e192 100644 --- a/clients/gtk2/main.c +++ b/clients/gtk2/main.c @@ -363,7 +363,7 @@ void percentagefunc(GtkTreeViewColumn *col, GtkCellRenderer *rend, GtkTreeModel float val; char buf[64]; - colnum = (int)data; + colnum = GPOINTER_TO_INT(data); gtk_tree_model_get(model, iter, colnum, &val, -1); snprintf(buf, 64, "%.2f%%", (double)(val * 100.0)); g_object_set(rend, "text", buf, NULL); @@ -374,7 +374,7 @@ void transnicebytefunc(GtkTreeViewColumn *col, GtkCellRenderer *rend, GtkTreeMod int colnum, val; char buf[64]; - colnum = (int)data; + colnum = GPOINTER_TO_INT(data); gtk_tree_model_get(model, iter, colnum, &val, -1); if(val >= 0) snprintf(buf, 64, "%'i", val); @@ -389,7 +389,7 @@ void transnicebytefunc2(GtkTreeViewColumn *col, GtkCellRenderer *rend, GtkTreeMo long long val; char buf[64]; - colnum = (int)data; + colnum = GPOINTER_TO_INT(data); gtk_tree_model_get(model, iter, colnum, &val, -1); if(val >= 0) strcpy(buf, bytes2si(val)); @@ -403,7 +403,7 @@ void hidezerofunc(GtkTreeViewColumn *col, GtkCellRenderer *rend, GtkTreeModel *m int colnum, val; char buf[64]; - colnum = (int)data; + colnum = GPOINTER_TO_INT(data); gtk_tree_model_get(model, iter, colnum, &val, -1); if(val > 0) snprintf(buf, 64, "%i", val); @@ -695,6 +695,12 @@ char *inputbox(char *title, char *prompt, char *def, int echo) } int msgbox(int type, int buttons, char *format, ...) +#if defined(__GNUC__) + __attribute__ ((format (printf, 3, 4))) +#endif +; + +int msgbox(int type, int buttons, char *format, ...) { GtkWidget *swnd; va_list args; @@ -1464,7 +1470,7 @@ void setpubhubmodel(GtkTreeModel *model, int sortcol, int numcols, int *cols, ch gtk_tree_view_column_set_title(col, names[i]); rnd = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start(col, rnd, TRUE); - gtk_tree_view_column_set_cell_data_func(col, rnd, transnicebytefunc2, (gpointer)cols[i], NULL); + gtk_tree_view_column_set_cell_data_func(col, rnd, transnicebytefunc2, GINT_TO_POINTER(cols[i]), NULL); } else { col = gtk_tree_view_column_new_with_attributes(names[i], gtk_cell_renderer_text_new(), "text", cols[i], NULL); } @@ -1587,7 +1593,7 @@ int pubhubxmlhandler(int op, char *buf, size_t *len) } if(i == numcols) { - msgbox(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, _("The hub list at %s did not contain the address to any hubs")); + msgbox(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, _("The hub list at %s did not contain the address to any hubs"), pubhubaddr); break; } model = gtk_list_store_newv(numcols, types);