forked from osmocom/wireshark
From Jakub Zawadzki:
Use non-formatting functions when appropriate. svn path=/trunk/; revision=27709
This commit is contained in:
parent
07b7603849
commit
18c5caa3d4
|
@ -2142,11 +2142,11 @@ display_airpcap_advanced_cb(GtkWidget *w, gpointer data)
|
|||
if (airpcap_if_selected != NULL)
|
||||
{
|
||||
if (airpcap_if_selected->linkType == AIRPCAP_LT_802_11){
|
||||
capture_s = g_strdup_printf("%s",AIRPCAP_LINK_TYPE_NAME_802_11_ONLY);
|
||||
capture_s = g_strdup(AIRPCAP_LINK_TYPE_NAME_802_11_ONLY);
|
||||
}else if (airpcap_if_selected->linkType == AIRPCAP_LT_802_11_PLUS_RADIO){
|
||||
capture_s = g_strdup_printf("%s",AIRPCAP_LINK_TYPE_NAME_802_11_PLUS_RADIO);
|
||||
capture_s = g_strdup(AIRPCAP_LINK_TYPE_NAME_802_11_PLUS_RADIO);
|
||||
}else if (airpcap_if_selected->linkType == AIRPCAP_LT_802_11_PLUS_PPI){
|
||||
capture_s = g_strdup_printf("%s",AIRPCAP_LINK_TYPE_NAME_802_11_PLUS_PPI);
|
||||
capture_s = g_strdup(AIRPCAP_LINK_TYPE_NAME_802_11_PLUS_PPI);
|
||||
}
|
||||
|
||||
if (capture_s != NULL) gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(capture_type_cm)->entry), capture_s);
|
||||
|
|
|
@ -187,7 +187,7 @@ preview_set_filename(GtkWidget *prev, const gchar *cf_name)
|
|||
gtk_label_set_text(GTK_LABEL(label), string_buff);
|
||||
|
||||
/* type */
|
||||
g_snprintf(string_buff, PREVIEW_STR_MAX, "%s", wtap_file_type_string(wtap_file_type(wth)));
|
||||
g_strlcpy(string_buff, wtap_file_type_string(wtap_file_type(wth)), PREVIEW_STR_MAX);
|
||||
label = g_object_get_data(G_OBJECT(prev), PREVIEW_FORMAT_KEY);
|
||||
gtk_label_set_text(GTK_LABEL(label), string_buff);
|
||||
|
||||
|
|
|
@ -164,12 +164,12 @@ error_select_filter_cb(GtkWidget *widget _U_, gpointer callback_data, guint call
|
|||
case ACTYPE_SELECTED:
|
||||
/* if no expert item was passed */
|
||||
if (err->procedures[selection].fvalue_value==NULL) {
|
||||
g_snprintf(str, 255, "%s", err->procedures[selection].entries[2]);
|
||||
g_strlcpy(str, err->procedures[selection].entries[2], 256);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* expert item exists. Use it. */
|
||||
g_snprintf(str, 255, "%s", err->procedures[selection].fvalue_value);
|
||||
g_strlcpy(str, err->procedures[selection].fvalue_value, 256);
|
||||
}
|
||||
break;
|
||||
case ACTYPE_NOT_SELECTED:
|
||||
|
@ -186,13 +186,13 @@ error_select_filter_cb(GtkWidget *widget _U_, gpointer callback_data, guint call
|
|||
/* the remaining cases will only exist if the expert item exists so no need to check */
|
||||
case ACTYPE_AND_SELECTED:
|
||||
if ((!current_filter) || (0 == strlen(current_filter)))
|
||||
g_snprintf(str, 255, "%s", err->procedures[selection].fvalue_value);
|
||||
g_strlcpy(str, err->procedures[selection].fvalue_value, 256);
|
||||
else
|
||||
g_snprintf(str, 255, "(%s) && (%s)", current_filter, err->procedures[selection].fvalue_value);
|
||||
break;
|
||||
case ACTYPE_OR_SELECTED:
|
||||
if ((!current_filter) || (0 == strlen(current_filter)))
|
||||
g_snprintf(str, 255, "%s", err->procedures[selection].fvalue_value);
|
||||
g_strlcpy(str, err->procedures[selection].fvalue_value, 256);
|
||||
else
|
||||
g_snprintf(str, 255, "(%s) || (%s)", current_filter, err->procedures[selection].fvalue_value);
|
||||
break;
|
||||
|
|
|
@ -810,8 +810,7 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
for (i=0; i<user_data->num_nodes; i++){
|
||||
/* print the node identifiers */
|
||||
/* XXX we assign 5 pixels per character in the node identity */
|
||||
g_snprintf(label_string, NODE_WIDTH/5, "%s",
|
||||
get_addr_name(&(user_data->nodes[i])));
|
||||
g_strlcpy(label_string, get_addr_name(&(user_data->nodes[i])), NODE_WIDTH/5);
|
||||
pango_layout_set_text(layout, label_string, -1);
|
||||
pango_layout_get_pixel_size(layout, &label_width, &label_height);
|
||||
if (GDK_IS_DRAWABLE(user_data->dlg.pixmap)) {
|
||||
|
|
12
gtk/main.c
12
gtk/main.c
|
@ -290,7 +290,7 @@ match_selected_cb_do(gpointer data, int action, gchar *text)
|
|||
/* Don't change the current display filter if we only want to copy the filter */
|
||||
if (action&MATCH_SELECTED_COPY_ONLY) {
|
||||
GString *gtk_text_str = g_string_new("");
|
||||
g_string_append_printf(gtk_text_str, "%s", new_filter);
|
||||
g_string_append(gtk_text_str, new_filter);
|
||||
copy_to_clipboard(gtk_text_str);
|
||||
g_string_free(gtk_text_str, TRUE);
|
||||
} else {
|
||||
|
@ -531,13 +531,13 @@ copy_selected_plist_cb(GtkWidget *w _U_, gpointer data _U_)
|
|||
char *stringpointer = labelstring;
|
||||
|
||||
if (cfile.finfo_selected->rep->representation != 0) {
|
||||
g_string_append_printf(gtk_text_str, "%s", cfile.finfo_selected->rep->representation); /* Get the represented data */
|
||||
g_string_append(gtk_text_str, cfile.finfo_selected->rep->representation); /* Get the represented data */
|
||||
}
|
||||
if (gtk_text_str->len == 0) { /* If no representation then... */
|
||||
proto_item_fill_label(cfile.finfo_selected, stringpointer); /* Try to read the value */
|
||||
g_string_append_printf(gtk_text_str, "%s", stringpointer);
|
||||
if (gtk_text_str->len == 0) { /* If no representation then... */
|
||||
proto_item_fill_label(cfile.finfo_selected, stringpointer); /* Try to read the value */
|
||||
g_string_append(gtk_text_str, stringpointer);
|
||||
}
|
||||
if (gtk_text_str->len == 0) { /* Could not get item so display error msg */
|
||||
if (gtk_text_str->len == 0) { /* Could not get item so display error msg */
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not acquire information to copy, try expanding or choosing another item");
|
||||
}
|
||||
else
|
||||
|
|
|
@ -740,7 +740,7 @@ welcome_new(void)
|
|||
GTK_SIGNAL_FUNC(capture_if_cb), NULL);
|
||||
gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
|
||||
|
||||
label_text = g_strdup_printf("<span foreground=\"black\">Start capture on interface:</span>");
|
||||
label_text = g_strdup("<span foreground=\"black\">Start capture on interface:</span>");
|
||||
w = gtk_label_new(label_text);
|
||||
gtk_label_set_markup(GTK_LABEL(w), label_text);
|
||||
g_free (label_text);
|
||||
|
@ -779,7 +779,7 @@ welcome_new(void)
|
|||
GTK_SIGNAL_FUNC(topic_menu_cb), GINT_TO_POINTER(ONLINEPAGE_NETWORK_MEDIA));
|
||||
gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
|
||||
#else
|
||||
label_text = g_strdup_printf("<span foreground=\"black\">Capturing is not compiled into this version of Wireshark!</span>");
|
||||
label_text = g_strdup("<span foreground=\"black\">Capturing is not compiled into this version of Wireshark!</span>");
|
||||
w = gtk_label_new(label_text);
|
||||
gtk_label_set_markup(GTK_LABEL(w), label_text);
|
||||
g_free (label_text);
|
||||
|
@ -804,7 +804,7 @@ welcome_new(void)
|
|||
gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
|
||||
|
||||
/* prepare list of recent files (will be filled in later) */
|
||||
label_text = g_strdup_printf("<span foreground=\"black\">Open Recent:</span>");
|
||||
label_text = g_strdup("<span foreground=\"black\">Open Recent:</span>");
|
||||
w = gtk_label_new(label_text);
|
||||
gtk_label_set_markup(GTK_LABEL(w), label_text);
|
||||
g_free (label_text);
|
||||
|
@ -864,7 +864,7 @@ welcome_new(void)
|
|||
topic_vb = welcome_topic_new("Updates", &topic_to_fill);
|
||||
gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0);
|
||||
|
||||
label_text = g_strdup_printf("<span foreground=\"black\">No updates available!</span>");
|
||||
label_text = g_strdup("<span foreground=\"black\">No updates available!</span>");
|
||||
w = gtk_label_new(label_text);
|
||||
gtk_label_set_markup(GTK_LABEL(w), label_text);
|
||||
g_free (label_text);
|
||||
|
|
|
@ -2910,7 +2910,7 @@ rtp_boolean_data_func (GtkTreeViewColumn *column _U_,
|
|||
|
||||
switch(bool_col){
|
||||
case MARKER_COLUMN:
|
||||
g_snprintf(buf, sizeof(buf), "%s", bool_val? "SET" : "");
|
||||
g_strlcpy(buf, bool_val ? "SET" : "", sizeof(buf));
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
|
|
|
@ -942,7 +942,7 @@ SIPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
|
|||
|
||||
if (pi->request_method == NULL){
|
||||
frame_label = g_strdup_printf("%u %s", pi->response_code, pi->reason_phrase );
|
||||
comment = g_strdup_printf("SIP Status");
|
||||
comment = g_strdup("SIP Status");
|
||||
|
||||
if ((tmp_sipinfo && pi->tap_cseq_number == tmp_sipinfo->invite_cseq)&&(ADDRESSES_EQUAL(&tmp_dst,&(callsinfo->initial_speaker)))){
|
||||
if ((pi->response_code > 199) && (pi->response_code<300) && (tmp_sipinfo->sip_state == SIP_INVITE_SENT)){
|
||||
|
@ -967,20 +967,20 @@ SIPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
|
|||
&&(ADDRESSES_EQUAL(&tmp_src,&(callsinfo->initial_speaker)))&&(tmp_sipinfo->sip_state==SIP_200_REC)
|
||||
&&(callsinfo->call_state == VOIP_CALL_SETUP)){
|
||||
callsinfo->call_state = VOIP_IN_CALL;
|
||||
comment = g_strdup_printf("SIP Request");
|
||||
comment = g_strdup("SIP Request");
|
||||
}
|
||||
else if (strcmp(pi->request_method,"BYE")==0){
|
||||
callsinfo->call_state = VOIP_COMPLETED;
|
||||
tapinfo->completed_calls++;
|
||||
comment = g_strdup_printf("SIP Request");
|
||||
comment = g_strdup("SIP Request");
|
||||
}
|
||||
else if ((strcmp(pi->request_method,"CANCEL")==0)&&(pi->tap_cseq_number == tmp_sipinfo->invite_cseq)
|
||||
&&(ADDRESSES_EQUAL(&tmp_src,&(callsinfo->initial_speaker)))&&(callsinfo->call_state==VOIP_CALL_SETUP)){
|
||||
callsinfo->call_state = VOIP_CANCELLED;
|
||||
tmp_sipinfo->sip_state = SIP_CANCEL_SENT;
|
||||
comment = g_strdup_printf("SIP Request");
|
||||
comment = g_strdup("SIP Request");
|
||||
} else {
|
||||
comment = g_strdup_printf("SIP Request");
|
||||
comment = g_strdup("SIP Request");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1176,7 +1176,7 @@ isup_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
|
|||
frame_label = g_strdup(isup_message_type_value_acro[i].strptr);
|
||||
}
|
||||
else{
|
||||
frame_label = g_strdup_printf("Unknown");
|
||||
frame_label = g_strdup("Unknown");
|
||||
}
|
||||
|
||||
if (callsinfo->npackets == 1){ /* this is the first packet, that must be an IAM */
|
||||
|
@ -1919,7 +1919,7 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
|
|||
default:
|
||||
comment = g_strdup("H225 RAS");
|
||||
}
|
||||
frame_label = g_strdup_printf("%s", val_to_str(pi->msg_tag, h225_RasMessage_vals, "<unknown>"));
|
||||
frame_label = g_strdup(val_to_str(pi->msg_tag, h225_RasMessage_vals, "<unknown>"));
|
||||
} else {
|
||||
frame_label = g_strdup("H225: Unknown");
|
||||
comment = NULL;
|
||||
|
@ -2501,7 +2501,7 @@ MGCPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
|
|||
}
|
||||
}
|
||||
|
||||
if (frame_label == NULL) frame_label = g_strdup_printf("%s",pi->code);
|
||||
if (frame_label == NULL) frame_label = g_strdup(pi->code);
|
||||
break;
|
||||
case MGCP_RESPONSE:
|
||||
frame_label = g_strdup_printf("%u (%s)",pi->rspcode, pi->code);
|
||||
|
@ -3146,7 +3146,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
|
|||
callsinfo->call_active_state = VOIP_ACTIVE;
|
||||
callsinfo->call_state = VOIP_CALL_SETUP;
|
||||
callsinfo->from_identity=g_strdup_printf("%x",pi->termid);
|
||||
callsinfo->to_identity=g_strdup_printf("UNKNOWN");
|
||||
callsinfo->to_identity=g_strdup("UNKNOWN");
|
||||
COPY_ADDRESS(&(callsinfo->initial_speaker),&(pinfo->src));
|
||||
callsinfo->first_frame_num=pinfo->fd->num;
|
||||
callsinfo->selected=FALSE;
|
||||
|
@ -3223,9 +3223,9 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
|
|||
|
||||
/* Create new string */
|
||||
if(pi->key_val == 10) {
|
||||
tmp_unistim_info->key_buffer = g_strdup_printf("*");
|
||||
tmp_unistim_info->key_buffer = g_strdup("*");
|
||||
} else if(pi->key_val == 11) {
|
||||
tmp_unistim_info->key_buffer = g_strdup_printf("#");
|
||||
tmp_unistim_info->key_buffer = g_strdup("#");
|
||||
} else {
|
||||
tmp_unistim_info->key_buffer = g_strdup_printf("%d",pi->key_val);
|
||||
}
|
||||
|
@ -3258,7 +3258,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
|
|||
g_string_truncate(g_tmp,g_tmp->len-1);
|
||||
|
||||
/* Insert new data */
|
||||
tmp_unistim_info->key_buffer = g_strdup_printf("%s",g_tmp->str);
|
||||
tmp_unistim_info->key_buffer = g_strdup(g_tmp->str);
|
||||
}
|
||||
|
||||
/* Set label and comment for graph */
|
||||
|
@ -3281,7 +3281,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
|
|||
g_string_truncate(g_tmp,g_tmp->len-1);
|
||||
|
||||
/* Insert new data */
|
||||
tmp_unistim_info->key_buffer = g_strdup_printf("%s",g_tmp->str);
|
||||
tmp_unistim_info->key_buffer = g_strdup(g_tmp->str);
|
||||
}
|
||||
|
||||
/* add label and comment */
|
||||
|
@ -3293,7 +3293,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
|
|||
/* User pressed the soft key 3 */
|
||||
/* Cancel on cs2k so clear buffer */
|
||||
/* On mcs its config which will clear the buffer too */
|
||||
tmp_unistim_info->key_buffer = g_strdup_printf("\n");
|
||||
tmp_unistim_info->key_buffer = g_strdup("\n");
|
||||
|
||||
/* User pressed something, set labels*/
|
||||
comment = g_strdup_printf("Key Input Sent: S3 (%d)", pi->sequence);
|
||||
|
@ -3397,8 +3397,8 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
|
|||
callsinfo = g_malloc0(sizeof(voip_calls_info_t));
|
||||
callsinfo->call_active_state = VOIP_ACTIVE;
|
||||
callsinfo->call_state = VOIP_CALL_SETUP;
|
||||
callsinfo->from_identity=g_strdup_printf("UNKNOWN");
|
||||
callsinfo->to_identity=g_strdup_printf("UNKNOWN");
|
||||
callsinfo->from_identity=g_strdup("UNKNOWN");
|
||||
callsinfo->to_identity=g_strdup("UNKNOWN");
|
||||
COPY_ADDRESS(&(callsinfo->initial_speaker),&(pinfo->src));
|
||||
callsinfo->first_frame_num=pinfo->fd->num;
|
||||
callsinfo->selected=FALSE;
|
||||
|
|
|
@ -493,14 +493,14 @@ wlanstat_details(wlanstat_t *hs, wlan_ep_t *wlan_ep, gboolean clear)
|
|||
}
|
||||
|
||||
if (hs->resolve_names) {
|
||||
g_snprintf (address, sizeof(address), "%s", get_addr_name(&tmp->address));
|
||||
g_strlcpy (address, get_addr_name(&tmp->address), sizeof(address));
|
||||
} else {
|
||||
g_snprintf (address, sizeof(address), "%s", address_to_str(&tmp->address));
|
||||
g_strlcpy (address, address_to_str(&tmp->address), sizeof(address));
|
||||
}
|
||||
if (basestation) {
|
||||
g_snprintf (comment, sizeof(comment), "Base station");
|
||||
g_strlcpy (comment, "Base station", sizeof(comment));
|
||||
} else {
|
||||
g_snprintf (comment, sizeof(comment), " ");
|
||||
g_strlcpy (comment, " ", sizeof(comment));
|
||||
}
|
||||
g_snprintf (percent, sizeof(percent), "%.2f %%", f);
|
||||
|
||||
|
@ -562,9 +562,9 @@ wlanstat_draw(void *phs)
|
|||
f = (float)(((float)tmp->number_of_packets * 100.0) / hs->number_of_packets);
|
||||
|
||||
if (hs->resolve_names) {
|
||||
g_snprintf (bssid, sizeof(bssid), "%s", get_addr_name(&tmp->bssid));
|
||||
g_strlcpy (bssid, get_addr_name(&tmp->bssid), sizeof(bssid));
|
||||
} else {
|
||||
g_snprintf (bssid, sizeof(bssid), "%s", address_to_str(&tmp->bssid));
|
||||
g_strlcpy (bssid, address_to_str(&tmp->bssid), sizeof(bssid));
|
||||
}
|
||||
if (tmp->stats.channel) {
|
||||
g_snprintf (channel, sizeof(channel), "%u", tmp->stats.channel);
|
||||
|
@ -572,11 +572,11 @@ wlanstat_draw(void *phs)
|
|||
channel[0] = '\0';
|
||||
}
|
||||
if (tmp->stats.ssid_len == 0) {
|
||||
g_snprintf (ssid, sizeof(ssid), "<Broadcast>");
|
||||
g_strlcpy (ssid, "<Broadcast>", sizeof(ssid));
|
||||
} else if (tmp->stats.ssid_len == 1 && tmp->stats.ssid[0] == 0) {
|
||||
g_snprintf (ssid, sizeof(ssid), "<Hidden>");
|
||||
g_strlcpy (ssid, "<Hidden>", sizeof(ssid));
|
||||
} else {
|
||||
g_snprintf (ssid, sizeof(ssid), "%s", format_text(tmp->stats.ssid, tmp->stats.ssid_len));
|
||||
g_strlcpy (ssid, format_text(tmp->stats.ssid, tmp->stats.ssid_len), sizeof(ssid));
|
||||
}
|
||||
g_snprintf (percent, sizeof(percent), "%.2f %%", f);
|
||||
|
||||
|
|
Loading…
Reference in New Issue