From 4e89fbb13deb8233e6f1234c223b5b9d091c6ef8 Mon Sep 17 00:00:00 2001 From: ketmar Date: Thu, 12 Sep 2013 18:28:21 +0300 Subject: [PATCH] removed alot of warnings --- src/about.c | 1 + src/account.c | 1 + src/checkfriends-gtk.c | 7 +++++-- src/checkfriends.c | 1 + src/cmdline.c | 23 +++++++++-------------- src/datesel.c | 1 + src/docklet.c | 2 +- src/draftstore.c | 1 + src/friendedit.c | 1 + src/friendgroupedit.c | 1 + src/history_recent.c | 1 + src/host.c | 1 + src/html_markup.h | 2 +- src/imagelink.c | 1 + src/jam.c | 1 + src/jamdoc.c | 34 +++++++++++++++++----------------- src/jamdoc.h | 1 + src/jamview.c | 2 +- src/link-journal.c | 1 + src/link.c | 1 + src/livejournal.c | 1 + src/manager.c | 1 + src/menu.c | 1 - src/offline.c | 18 +++++++----------- src/pollcreator.c | 1 + src/preview.c | 1 + src/security.c | 1 + src/settings.c | 3 +++ src/spawn.c | 1 + src/sync.c | 9 +-------- src/tie.c | 1 + src/tools.c | 6 ++---- src/util-gtk.c | 13 +++++++------ 33 files changed, 75 insertions(+), 66 deletions(-) diff --git a/src/about.c b/src/about.c index ca48d47..29308e3 100644 --- a/src/about.c +++ b/src/about.c @@ -5,6 +5,7 @@ */ #include "gtk-all.h" +#include "util-gtk.h" #include diff --git a/src/account.c b/src/account.c index 2b5e7a4..addc96f 100644 --- a/src/account.c +++ b/src/account.c @@ -9,6 +9,7 @@ #include "conf_xml.h" #include "jam_xml.h" #include "account.h" +#include "util.h" static GObjectClass *jam_account_parent_class = NULL; diff --git a/src/checkfriends-gtk.c b/src/checkfriends-gtk.c index 3c20c48..2954483 100644 --- a/src/checkfriends-gtk.c +++ b/src/checkfriends-gtk.c @@ -5,6 +5,7 @@ */ #include "gtk-all.h" +#include "util-gtk.h" #include "conf.h" #include "jam.h" @@ -252,7 +253,7 @@ cf_float_destroyed_cb(GtkWidget *widget, CFFloat *cff) { static void cf_float_destroy(CFFloat *cff) { - CFMgr *cfm = cff->cfmgr; + /*CFMgr *cfm = cff->cfmgr;*/ if (GTK_IS_WIDGET(cff->win)) gtk_widget_destroy(cff->win); @@ -274,7 +275,7 @@ cf_app_update_float(void) { #ifdef USE_DOCK static void cf_dock_destroy(CFFloat *cff) { - CFMgr *cfm = cff->cfmgr; + /*CFMgr *cfm = cff->cfmgr;*/ g_signal_handlers_disconnect_by_func(G_OBJECT(cff->win), G_CALLBACK(cf_dock_destroyed_cb), NULL); @@ -288,6 +289,7 @@ cf_dock_destroyed_cb(GtkWidget *widget, CFFloat *cff) { app.docklet = NULL; } +/* static void cf_dock_setup(CFFloat *ind) { GtkWidget *docklet = app.docklet; @@ -300,6 +302,7 @@ cf_dock_setup(CFFloat *ind) { ind->win = docklet; } +*/ #endif /* USE_DOCK */ void cf_float_decorate_refresh(void) { diff --git a/src/checkfriends.c b/src/checkfriends.c index 120d177..385c0d5 100644 --- a/src/checkfriends.c +++ b/src/checkfriends.c @@ -21,6 +21,7 @@ #include "account.h" #include "conf.h" #include "network.h" +#include "util.h" enum { ACCOUNT_CHANGED, diff --git a/src/cmdline.c b/src/cmdline.c index 4a30d63..f2dcaf0 100644 --- a/src/cmdline.c +++ b/src/cmdline.c @@ -228,11 +228,11 @@ do_console(Cmdline *cmdline, JamAccount *acc, gint argc, gchar *argv[]) { static void do_post(Cmdline *cmdline, JamAccount *acc, gint argc, gchar *argv[]) { - gboolean use_editor = FALSE; + /*gboolean use_editor = FALSE;*/ GETOPT_LOOP(POST) case 'e': - use_editor = TRUE; + /*use_editor = TRUE;*/ break; GETOPT_LOOP_END @@ -661,25 +661,20 @@ cmdline_load_file(JamDoc *doc, char *filename, GError **err) { } } -static void -command_dispatch(Cmdline *cmdline, Command *commands, const char *help, int argc, gchar *argv[]) { - JamAccount *acc; + +static void command_dispatch (Cmdline *cmdline, Command *commands, const char *help, int argc, gchar *argv[]) { + JamAccount *acc = NULL; Command *command = NULL; char *cmdname; - int i; - argc -= optind; argv += optind; cmdname = argv[0]; - - if (argc <= 0) - return; - + if (argc <= 0) return; if (g_ascii_strcasecmp(cmdname, "help") == 0) { g_print(help); exit(EXIT_SUCCESS); } - for (i = 0; commands && commands[i].cmdname; i++) { + for (int i = 0; commands && commands[i].cmdname; ++i) { if (g_ascii_strcasecmp(cmdname, commands[i].cmdname) == 0) { command = &commands[i]; break; @@ -691,8 +686,7 @@ command_dispatch(Cmdline *cmdline, Command *commands, const char *help, int argc } cmdline->curcmd = command; if (command->requireuser) { - acc = cmdline_load_account(cmdline, - command->existinguser, command->needpw); + acc = cmdline_load_account(cmdline, command->existinguser, command->needpw); if (!acc) { g_printerr(_("Error: Must specify account.\n")); exit(EXIT_FAILURE); @@ -704,6 +698,7 @@ command_dispatch(Cmdline *cmdline, Command *commands, const char *help, int argc g_error("not reached"); } + void cmdline_parse(JamDoc *doc, int argc, char *argv[]) { Cmdline cmdline_real = { .doc = doc }; diff --git a/src/datesel.c b/src/datesel.c index e099be1..fbe9183 100644 --- a/src/datesel.c +++ b/src/datesel.c @@ -5,6 +5,7 @@ */ #include "gtk-all.h" +#include "util-gtk.h" #include #include #include "liblj/livejournal.h" diff --git a/src/docklet.c b/src/docklet.c index acc14fe..d169b7e 100644 --- a/src/docklet.c +++ b/src/docklet.c @@ -22,7 +22,7 @@ void menu_friends_manager(JamWin *jw); static void docklet_menu(GtkWidget *win) { static GtkWidget *menu = NULL; - GtkWidget *entry; + /*GtkWidget *entry;*/ GtkWidget *menuitem; GtkWidget *image; diff --git a/src/draftstore.c b/src/draftstore.c index cb195e2..3e0df5f 100644 --- a/src/draftstore.c +++ b/src/draftstore.c @@ -21,6 +21,7 @@ #include "draftstore.h" #include "conf.h" +#include "util.h" struct _DraftStore { char *path; diff --git a/src/friendedit.c b/src/friendedit.c index 51ebfad..d1405ed 100644 --- a/src/friendedit.c +++ b/src/friendedit.c @@ -18,6 +18,7 @@ #include "account.h" #include "friendedit.h" +#include "util.h" typedef struct { GtkWidget *win; diff --git a/src/friendgroupedit.c b/src/friendgroupedit.c index 69080e5..39b49e9 100644 --- a/src/friendgroupedit.c +++ b/src/friendgroupedit.c @@ -16,6 +16,7 @@ #include "friendgroupedit.h" #include "network.h" #include "util-gtk.h" +#include "util.h" typedef struct { GtkWidget *win; diff --git a/src/history_recent.c b/src/history_recent.c index 8688156..404e0a8 100644 --- a/src/history_recent.c +++ b/src/history_recent.c @@ -12,6 +12,7 @@ #include "util-gtk.h" #include "history.h" #include "network.h" +#include "util.h" /* how many entries to load each time "load more..." is clicked. */ #define HISTORY_LOAD_BATCH 20 diff --git a/src/host.c b/src/host.c index ad3930e..1ae00c5 100644 --- a/src/host.c +++ b/src/host.c @@ -11,6 +11,7 @@ #include "account.h" #include "jam_xml.h" #include "conf_xml.h" +#include "util.h" const char* jam_host_get_stock_icon(JamHost *host) { diff --git a/src/html_markup.h b/src/html_markup.h index 9aeea0f..d6a9c4e 100644 --- a/src/html_markup.h +++ b/src/html_markup.h @@ -19,7 +19,7 @@ void html_mark_blockquote (JamDoc *doc); void html_mark_big (JamDoc *doc); void html_mark_small (JamDoc *doc); void html_mark_superscript (JamDoc *doc); -void html_mark_sbuscript (JamDoc *doc); +void html_mark_subscript (JamDoc *doc); void html_mark_ulist (JamDoc *doc); void html_mark_olist (JamDoc *doc); void html_mark_listitem (JamDoc *doc); diff --git a/src/imagelink.c b/src/imagelink.c index 12be70d..26c44b6 100644 --- a/src/imagelink.c +++ b/src/imagelink.c @@ -8,6 +8,7 @@ #include "util-gtk.h" #include "conf.h" #include "jamdoc.h" +#include "util.h" typedef struct { GtkWidget *dlg; diff --git a/src/jam.c b/src/jam.c index ca8395f..af742f3 100644 --- a/src/jam.c +++ b/src/jam.c @@ -38,6 +38,7 @@ #include "remote.h" #include "usejournal.h" #include "userlabel.h" +#include "sync.h" #undef USE_STRUCTUREDTEXT diff --git a/src/jamdoc.c b/src/jamdoc.c index e789e01..709487b 100644 --- a/src/jamdoc.c +++ b/src/jamdoc.c @@ -12,6 +12,7 @@ #include "jamdoc.h" #include "account.h" #include "conf.h" +#include "util.h" #ifdef HAVE_GTK #include "get_cmd_out.h" @@ -523,24 +524,23 @@ jam_doc_get_entry(JamDoc *doc) { #ifdef HAVE_GTK gboolean jam_doc_append_text (JamDoc *doc, const char *text, const char *encoding) { - GError *err = NULL; - gsize len; - - GtkTextIter pos; - gtk_text_buffer_get_end_iter(doc->buffer, &pos); - gtk_text_buffer_insert(doc->buffer, &pos, text, -1); - - if (strcmp(encoding, "UTF-8") == 0) { - const gchar *end; - if (!g_utf8_validate(text, len, &end)) return FALSE; + if (text != NULL) { + GError *err = NULL; + GtkTextIter pos; + gtk_text_buffer_get_end_iter(doc->buffer, &pos); gtk_text_buffer_insert(doc->buffer, &pos, text, -1); - } else { - char *newtext; - newtext = g_convert(text, -1, "UTF-8", encoding, NULL, NULL, &err); - if (err) g_free(err); - if (!newtext) return FALSE; - gtk_text_buffer_insert(doc->buffer, &pos, newtext, -1); - g_free(newtext); + if (strcmp(encoding, "UTF-8") == 0) { + const gchar *end; + if (!g_utf8_validate(text, strlen(text), &end)) return FALSE; + gtk_text_buffer_insert(doc->buffer, &pos, text, -1); + } else { + char *newtext; + newtext = g_convert(text, -1, "UTF-8", encoding, NULL, NULL, &err); + if (err) g_free(err); + if (!newtext) return FALSE; + gtk_text_buffer_insert(doc->buffer, &pos, newtext, -1); + g_free(newtext); + } } return TRUE; } diff --git a/src/jamdoc.h b/src/jamdoc.h index 7d05635..c8c9f19 100644 --- a/src/jamdoc.h +++ b/src/jamdoc.h @@ -35,6 +35,7 @@ gboolean jam_doc_insert_command_output(JamDoc *doc, const char *command, #endif const char * jam_doc_get_location (JamDoc *doc); +void jam_doc_set_location(JamDoc *doc, const char *location); char * jam_doc_get_title (JamDoc *doc); LJEntry* jam_doc_get_entry (JamDoc *doc); diff --git a/src/jamview.c b/src/jamview.c index 075a270..c0a6a7a 100644 --- a/src/jamview.c +++ b/src/jamview.c @@ -617,7 +617,7 @@ screening_visible(JamView *view) { } static void screening_load(JamView *view) { - LJCommentsType type = jam_doc_get_screening(view->doc); + LJScreeningType type = jam_doc_get_screening(view->doc); if (type != LJ_SCREENING_DEFAULT) show_meta(view, JAM_VIEW_SCREENING); if (screening_visible(view)) diff --git a/src/link-journal.c b/src/link-journal.c index 68bb301..3f61476 100644 --- a/src/link-journal.c +++ b/src/link-journal.c @@ -7,6 +7,7 @@ #include "gtk-all.h" #include "jamdoc.h" #include "util-gtk.h" +#include "util.h" static GtkWidget* add_menu_item(GtkMenuShell *ms, const gchar *id, const gchar *text) { diff --git a/src/link.c b/src/link.c index fc22c17..1833d30 100644 --- a/src/link.c +++ b/src/link.c @@ -11,6 +11,7 @@ #include "util-gtk.h" #include "conf.h" #include "jamdoc.h" +#include "util.h" typedef struct { GtkWidget *dlg; diff --git a/src/livejournal.c b/src/livejournal.c index 882a39d..fd8a1cb 100644 --- a/src/livejournal.c +++ b/src/livejournal.c @@ -12,6 +12,7 @@ #include "jam_xml.h" #include "conf_xml.h" #include "network.h" +#include "util.h" struct _JamHostLJ { JamHost host; diff --git a/src/manager.c b/src/manager.c index e2e9cbb..0e7a581 100644 --- a/src/manager.c +++ b/src/manager.c @@ -14,6 +14,7 @@ #include "checkfriends.h" #include "security.h" #include "groupedbox.h" +#include "util.h" /* manager: * - host diff --git a/src/menu.c b/src/menu.c index 15fd3f0..8f5d1e2 100644 --- a/src/menu.c +++ b/src/menu.c @@ -515,7 +515,6 @@ static GtkItemFactoryEntry menu_items[] = { }; int itemcount = sizeof(menu_items) / sizeof(menu_items[0]); - int i; JamView *view; accelgroup = gtk_accel_group_new(); diff --git a/src/offline.c b/src/offline.c index 07ca1fc..9b74819 100644 --- a/src/offline.c +++ b/src/offline.c @@ -247,26 +247,22 @@ select_entry(OfflineUI *oui, int itemid) { * selection need not be an actual entry. */ static void move_relative(OfflineUI *oui, int dir) { - time_t etime; gboolean found = FALSE; int itemid = get_selected_itemid(oui); - - if (itemid) { /* selection exists */ - found = journal_store_find_relative(oui->journalstore, itemid, - &itemid, dir, NULL); - } else { /* some more cajoling necessary */ + if (itemid) { + /* selection exists */ + found = journal_store_find_relative(oui->journalstore, itemid, &itemid, dir, NULL); + } else { + /* some more cajoling necessary */ guint year, month, day; struct tm when_tm = {0}; gtk_calendar_get_date(GTK_CALENDAR(oui->cal), &year, &month, &day); when_tm.tm_year = year-1900; when_tm.tm_mon = month; when_tm.tm_mday = day; - - found = journal_store_find_relative_by_time(oui->journalstore, - lj_timegm(&when_tm), &itemid, dir, NULL); + found = journal_store_find_relative_by_time(oui->journalstore, lj_timegm(&when_tm), &itemid, dir, NULL); } - if (found) - select_entry(oui, itemid); + if (found) select_entry(oui, itemid); } static void diff --git a/src/pollcreator.c b/src/pollcreator.c index 44dbd1a..3f4e821 100644 --- a/src/pollcreator.c +++ b/src/pollcreator.c @@ -12,6 +12,7 @@ #include "poll.h" #include "pollcreator.h" #include "util-gtk.h" +#include "util.h" typedef struct _PollDlg PollDlg; diff --git a/src/preview.c b/src/preview.c index 1a76bf1..9fd7c46 100644 --- a/src/preview.c +++ b/src/preview.c @@ -6,6 +6,7 @@ #ifdef HAVE_GTKHTML330 #include "gtk-all.h" +#include "util-gtk.h" #include #include diff --git a/src/security.c b/src/security.c index 6c4b1e8..591615e 100644 --- a/src/security.c +++ b/src/security.c @@ -5,6 +5,7 @@ */ #include "gtk-all.h" +#include "util-gtk.h" #include diff --git a/src/settings.c b/src/settings.c index d707911..61eae70 100644 --- a/src/settings.c +++ b/src/settings.c @@ -22,6 +22,7 @@ #include "tie.h" #include "account.h" #include "jamview.h" +#include "util.h" /* what's this? all of these funny structures in the settings box? * well, instead of creating and tearing down all of these widgets, i @@ -774,9 +775,11 @@ settings_cf_run(CFMgr *cfm) { void settings_run(JamWin *jw) { +/* #ifdef HAVE_GTKSPELL gboolean hadspell = conf.options.usespellcheck; #endif +*/ gboolean hadautosave = conf.options.autosave; gboolean hadquotes = conf.options.smartquotes; diff --git a/src/spawn.c b/src/spawn.c index cb1f149..1303942 100644 --- a/src/spawn.c +++ b/src/spawn.c @@ -5,6 +5,7 @@ */ #include "glib-all.h" +#include "util-gtk.h" #include #ifndef G_OS_WIN32 diff --git a/src/sync.c b/src/sync.c index f19fa51..383f874 100644 --- a/src/sync.c +++ b/src/sync.c @@ -74,9 +74,6 @@ show_status_stage(SyncStatus *status) { static void sync_init_gtk(SyncStatus *status, gpointer parent) { - char *id; - char *caption; - status->progresswin = progress_window_new(GTK_WINDOW(parent), _("Synchronizing Journal")); status->label = gtk_label_new(""); @@ -272,11 +269,7 @@ put_lastsync(gpointer data, const char *lastsync, GError **err) { static gboolean put_entries(gpointer data, LJEntry **entries, int count, GError **err) { SyncStatus *status = data; - int i; - - if (!journal_store_put_group(status->js, entries, count, err)) - return FALSE; - + if (!journal_store_put_group(status->js, entries, count, err)) return FALSE; return TRUE; } diff --git a/src/tie.c b/src/tie.c index 512089e..27e06a8 100644 --- a/src/tie.c +++ b/src/tie.c @@ -6,6 +6,7 @@ #include "gtk-all.h" #include "util-gtk.h" +#include "util.h" static void tie_toggle_cb(GtkToggleButton *toggle, gboolean *data) { diff --git a/src/tools.c b/src/tools.c index b3ee6f5..1bc28e0 100644 --- a/src/tools.c +++ b/src/tools.c @@ -10,6 +10,7 @@ #include "tools.h" #include "util-gtk.h" +#include "util.h" typedef struct { gunichar c; @@ -213,12 +214,9 @@ tools_insert_command_output(GtkWindow *win, JamDoc *doc) { while (gtk_dialog_run(GTK_DIALOG(cmd_dlg)) == GTK_RESPONSE_OK) { const gchar *command; - const gchar *encoding; GError *err = NULL; - command = gtk_entry_get_text(GTK_ENTRY(entry)); - if (!jam_doc_insert_command_output(doc, - command, encoding, &err, win) && (err)) { + if (!jam_doc_insert_command_output(doc, command, NULL, &err, win) && (err)) { jam_warning(GTK_WINDOW(cmd_dlg), _("Error getting command output: %s"), err->message); diff --git a/src/util-gtk.c b/src/util-gtk.c index 269ad23..aac20be 100644 --- a/src/util-gtk.c +++ b/src/util-gtk.c @@ -262,7 +262,7 @@ jam_message_va(GtkWindow *parent, MessageType type, gboolean forgettable, GtkWidget *forget_check; gint msgtype = 0, buttontype = 0; const gchar *mtitle = NULL; - gint res; + /*gint res;*/ gboolean forget_state; gchar ourhash[120]; @@ -286,29 +286,30 @@ jam_message_va(GtkWindow *parent, MessageType type, gboolean forgettable, if (g_slist_find_custom(app.quiet_dlgs, ourhash, _str_equal)) return; + mtitle = (const gchar *)title; switch (type) { case JAM_MSG_INFO: msgtype = GTK_MESSAGE_INFO; buttontype = GTK_BUTTONS_OK; - mtitle = (gchar*)title; break; case JAM_MSG_WARNING: msgtype = GTK_MESSAGE_WARNING; buttontype = GTK_BUTTONS_CLOSE; - mtitle = title ? (gchar*)title : _("Warning"); + if (!title) mtitle = _("Warning"); break; case JAM_MSG_ERROR: msgtype = GTK_MESSAGE_ERROR; buttontype = GTK_BUTTONS_CLOSE; - mtitle = title ? (gchar*)title : _("Error"); + if (!title) mtitle = _("Error"); break; } + if (mtitle == NULL) mtitle = _("WTF?!"); /* TODO: switch to jam_dialogs, which are prettier */ dlg = gtk_message_dialog_new(parent, 0, msgtype, buttontype, fullmsg); - gtk_window_set_title(GTK_WINDOW(dlg), title); + gtk_window_set_title(GTK_WINDOW(dlg), mtitle); gtk_window_set_transient_for(GTK_WINDOW(dlg), GTK_WINDOW(parent)); if (forgettable) { @@ -335,7 +336,7 @@ jam_message_va(GtkWindow *parent, MessageType type, gboolean forgettable, gtk_widget_show_all(GTK_DIALOG(dlg)->action_area); } - res = gtk_dialog_run(GTK_DIALOG(dlg)); + /*res =*/ gtk_dialog_run(GTK_DIALOG(dlg)); /* flag this dialog for oblivion if the user didn't like it */ if (forgettable && forget_state) -- 2.11.4.GIT