g2_node_drop(const char *routine, gnutella_node_t *n, const g2_tree_t *t, const char *fmt, ...) { if (GNET_PROPERTY(g2_debug) || GNET_PROPERTY(log_dropped_g2)) { va_list args; char buf[256]; va_start(args, fmt); if (fmt != NULL) str_vbprintf(ARYLEN(buf), fmt, args); else buf[0] = '\0'; g_debug("%s(): dropping /%s from %s%s%s", routine, g2_tree_name(t), node_infostr(n), NULL == fmt ? "" : ": ", buf); va_end(args); } gnet_stats_count_dropped(n, MSG_DROP_G2_UNEXPECTED); if (GNET_PROPERTY(log_dropped_g2)) { g2_tfmt_tree_dump(t, stderr, G2FMT_O_PAYLEN); } }
/** * Put a message on the statusbar. The message will be displayed for * the number of seconds given by timeout. If timeout is 0 the message * will not be automatically removed. * * @returns message id of the added message */ statusbar_msgid_t statusbar_gui_push_v(sb_types_t type, guint scid, guint timeout, const gchar *format, va_list args) { static gchar buf[1024]; statusbar_msgid_t id = zero_msgid; if (format != NULL) { switch (type) { case SB_WARNING: gdk_beep(); /* FALL THRU */ case SB_MESSAGE: str_vbprintf(buf, sizeof(buf), format, args); break; } } else { buf[0] = '\0'; } id.scid = scid; id.msgid = gtk_statusbar_push(statusbar_get(), scid, buf); if (timeout != 0) statusbar_gui_add_timeout(id, timeout); return id; }
/** * Log dropped message. */ static void g2_msg_log_dropped(const void *data, size_t len, const char *fmt, va_list args) { char rbuf[256]; if (fmt != NULL) { rbuf[0] = ':'; rbuf[1] = ' '; str_vbprintf(&rbuf[2], sizeof rbuf - 2, fmt, args); va_end(args); } else { rbuf[0] = '\0'; } g_debug("DROP G2 %s%s", g2_msg_infostr(data, len), rbuf); }
/** * printf into a GtkLabel. */ void gtk_label_printf(GtkLabel *label, const gchar *format, ...) { static gchar buf[1024]; va_list args; g_assert(label != NULL); va_start(args, format); if (format != NULL) str_vbprintf(buf, sizeof(buf), format, args); else buf[0] = '\0'; gtk_label_set_text(label, buf); va_end(args); }
void statusbar_gui_set_default(const char *format, ...) { static gchar buf[1024]; va_list args; va_start(args, format); HFREE_NULL(statbar_botstr_new); if (format != NULL) { str_vbprintf(buf, sizeof(buf), format, args); statbar_botstr_new = h_strdup(buf); } else { statbar_botstr_new = h_strdup(product_get_website()); } va_end(args); }
/** * printf into a gtk_entry. */ void gtk_entry_printf(GtkEntry *entry, const gchar *format, ...) { static gchar buf[1024]; va_list args; g_assert(entry != NULL); va_start(args, format); if (format != NULL) str_vbprintf(buf, sizeof(buf), format, args); else buf[0] = '\0'; gtk_entry_set_text(entry, buf); va_end(args); }
xnode_prop_ns_vprintf(xnode_t *element, const char *uri, const char *name, const char *fmt, va_list args) { char buf[1024]; va_list args2; char *value; bool result; VA_COPY(args2, args); if (str_vbprintf(buf, sizeof buf, fmt, args2) >= sizeof buf - 1) { value = h_strdup_vprintf(fmt, args); } else { value = buf; } va_end(args2); result = xnode_prop_ns_set(element, uri, name, value); if (value != buf) hfree(value); return result; }