Fix compiler warnings in gtk-stats

This commit is contained in:
rdb 2014-10-29 13:19:08 +00:00
parent 52a4278b80
commit 457714d86d
2 changed files with 26 additions and 26 deletions

View File

@ -67,7 +67,7 @@ main(int argc, char *argv[]) {
// application by closing the main window. // application by closing the main window.
g_signal_connect(G_OBJECT(main_window), "delete_event", g_signal_connect(G_OBJECT(main_window), "delete_event",
G_CALLBACK(delete_event), NULL); G_CALLBACK(delete_event), NULL);
g_signal_connect(G_OBJECT(main_window), "destroy", g_signal_connect(G_OBJECT(main_window), "destroy",
G_CALLBACK(destroy), NULL); G_CALLBACK(destroy), NULL);
@ -82,18 +82,18 @@ main(int argc, char *argv[]) {
server = new GtkStatsServer; server = new GtkStatsServer;
if (!server->listen()) { if (!server->listen()) {
ostringstream stream; ostringstream stream;
stream stream
<< "Unable to open port " << pstats_port << "Unable to open port " << pstats_port
<< ". Try specifying a different\n" << ". Try specifying a different\n"
<< "port number using pstats-port in your Config file."; << "port number using pstats-port in your Config file.";
string str = stream.str(); string str = stream.str();
GtkWidget *dialog = GtkWidget *dialog =
gtk_message_dialog_new(GTK_WINDOW(main_window), gtk_message_dialog_new(GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE, GTK_BUTTONS_CLOSE,
str.c_str()); "%s", str.c_str());
gtk_dialog_run(GTK_DIALOG(dialog)); gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
exit(1); exit(1);

View File

@ -26,21 +26,21 @@
typedef void vc(); typedef void vc();
GtkItemFactoryEntry GtkStatsMonitor::menu_entries[] = { GtkItemFactoryEntry GtkStatsMonitor::menu_entries[] = {
{ "/Options", NULL, NULL, 0, "<Branch>" }, { (gchar *)"/Options", NULL, NULL, 0, (gchar *)"<Branch>" },
{ "/Options/Units", NULL, NULL, 0, "<Branch>" }, { (gchar *)"/Options/Units", NULL, NULL, 0, (gchar *)"<Branch>" },
{ "/Options/Units/ms", NULL, (vc *)&handle_menu_command, MI_time_ms, "<RadioItem>" }, { (gchar *)"/Options/Units/ms", NULL, (vc *)&handle_menu_command, MI_time_ms, (gchar *)"<RadioItem>" },
{ "/Options/Units/Hz", NULL, (vc *)&handle_menu_command, MI_time_hz, "/Options/Units/ms" }, { (gchar *)"/Options/Units/Hz", NULL, (vc *)&handle_menu_command, MI_time_hz, (gchar *)"/Options/Units/ms" },
{ "/Speed", NULL, NULL, 0, "<Branch>" }, { (gchar *)"/Speed", NULL, NULL, 0, (gchar *)"<Branch>" },
{ "/Speed/1", NULL, (vc *)&handle_menu_command, MI_speed_1, "<RadioItem>" }, { (gchar *)"/Speed/1", NULL, (vc *)&handle_menu_command, MI_speed_1, (gchar *)"<RadioItem>" },
{ "/Speed/2", NULL, (vc *)&handle_menu_command, MI_speed_2, "/Speed/1" }, { (gchar *)"/Speed/2", NULL, (vc *)&handle_menu_command, MI_speed_2, (gchar *)"/Speed/1" },
{ "/Speed/3", NULL, (vc *)&handle_menu_command, MI_speed_3, "/Speed/1" }, { (gchar *)"/Speed/3", NULL, (vc *)&handle_menu_command, MI_speed_3, (gchar *)"/Speed/1" },
{ "/Speed/6", NULL, (vc *)&handle_menu_command, MI_speed_6, "/Speed/1" }, { (gchar *)"/Speed/6", NULL, (vc *)&handle_menu_command, MI_speed_6, (gchar *)"/Speed/1" },
{ "/Speed/12", NULL, (vc *)&handle_menu_command, MI_speed_12, "/Speed/1" }, { (gchar *)"/Speed/12", NULL, (vc *)&handle_menu_command, MI_speed_12, (gchar *)"/Speed/1" },
{ "/Speed/sep", NULL, NULL, 0, "<Separator>" }, { (gchar *)"/Speed/sep", NULL, NULL, 0, (gchar *)"<Separator>" },
{ "/Speed/pause", NULL, (vc *)&handle_menu_command, MI_pause, "<CheckItem>" }, { (gchar *)"/Speed/pause", NULL, (vc *)&handle_menu_command, MI_pause, (gchar *)"<CheckItem>" },
}; };
int GtkStatsMonitor::num_menu_entries = sizeof(menu_entries) / sizeof(GtkItemFactoryEntry);
int GtkStatsMonitor::num_menu_entries = sizeof(menu_entries) / sizeof(GtkItemFactoryEntry);
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: GtkStatsMonitor::Constructor // Function: GtkStatsMonitor::Constructor
@ -122,9 +122,9 @@ void GtkStatsMonitor::
got_bad_version(int client_major, int client_minor, got_bad_version(int client_major, int client_minor,
int server_major, int server_minor) { int server_major, int server_minor) {
ostringstream str; ostringstream str;
str << "Unable to honor connection attempt from " str << "Unable to honor connection attempt from "
<< get_client_progname() << " on " << get_client_hostname() << get_client_progname() << " on " << get_client_hostname()
<< ": unsupported PStats version " << ": unsupported PStats version "
<< client_major << "." << client_minor; << client_major << "." << client_minor;
if (server_minor == 0) { if (server_minor == 0) {
@ -134,14 +134,14 @@ got_bad_version(int client_major, int client_minor,
str << " (server understands versions " << server_major str << " (server understands versions " << server_major
<< ".0 through " << server_major << "." << server_minor << ")."; << ".0 through " << server_major << "." << server_minor << ").";
} }
string message = str.str(); string message = str.str();
GtkWidget *dialog = GtkWidget *dialog =
gtk_message_dialog_new(GTK_WINDOW(main_window), gtk_message_dialog_new(GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE, GTK_BUTTONS_CLOSE,
message.c_str()); "%s", message.c_str());
gtk_dialog_run(GTK_DIALOG(dialog)); gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
} }