SCTP: Fix warning found by PVS Studio
Change-Id: I713eb6eff3681573baf77274847a32a4cc6b9ee0 Reviewed-on: https://code.wireshark.org/review/12408 Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
9a9b1c9bba
commit
d8bbd232cd
|
@ -1017,8 +1017,8 @@ on_button_release_event (GtkWidget *widget _U_, GdkEventButton *event, gpointer
|
|||
GtkAllocation widget_alloc;
|
||||
cairo_t *cr;
|
||||
|
||||
g_snprintf(label_string, 15, "%d", 0);
|
||||
memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15);
|
||||
g_snprintf(label_string, sizeof(label_string), "%d", 0);
|
||||
memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), sizeof(label_string));
|
||||
layout = gtk_widget_create_pango_layout(u_data->io->draw_area, label_string);
|
||||
pango_layout_get_pixel_size(layout, &label_width, &label_height);
|
||||
|
||||
|
@ -1197,7 +1197,7 @@ on_button_release_event (GtkWidget *widget _U_, GdkEventButton *event, gpointer
|
|||
else
|
||||
position = event->x + 5;
|
||||
|
||||
memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15);
|
||||
memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), sizeof(label_string));
|
||||
pango_layout_set_text(layout, label_string, -1);
|
||||
pango_layout_get_pixel_size(layout, &lwidth, NULL);
|
||||
|
||||
|
|
|
@ -481,18 +481,6 @@ chunk_dlg_destroy(GObject *object _U_, gpointer user_data)
|
|||
g_free(u_data);
|
||||
}
|
||||
|
||||
static void
|
||||
on_destroy(GObject *object _U_, gpointer user_data)
|
||||
{
|
||||
struct sctp_udata *u_data = (struct sctp_udata*)user_data;
|
||||
|
||||
decrease_childcount(u_data->parent);
|
||||
remove_child(u_data, u_data->parent);
|
||||
g_free(u_data->io);
|
||||
g_free(u_data);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
add_to_clist(sctp_addr_chunk* sac)
|
||||
{
|
||||
|
@ -578,17 +566,6 @@ sctp_chunk_stat_on_close (GtkButton *button _U_, gpointer user_data)
|
|||
gtk_widget_destroy(udata->io->window);
|
||||
}
|
||||
|
||||
static void
|
||||
on_close_dlg (GtkButton *button _U_, gpointer user_data)
|
||||
{
|
||||
struct sctp_udata *udata;
|
||||
|
||||
udata = (struct sctp_udata *)user_data;
|
||||
gtk_grab_remove(udata->io->window);
|
||||
gtk_widget_destroy(udata->io->window);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
path_window_set_title(struct sctp_udata *u_data, unsigned int direction)
|
||||
{
|
||||
|
@ -692,7 +669,7 @@ sctp_chunk_dlg(struct sctp_udata *u_data)
|
|||
u_data->io->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_position (GTK_WINDOW (u_data->io->window), GTK_WIN_POS_CENTER);
|
||||
gtk_widget_set_size_request(u_data->io->window, 500, 650);
|
||||
g_signal_connect(u_data->io->window, "destroy", G_CALLBACK(on_destroy), u_data);
|
||||
g_signal_connect(u_data->io->window, "destroy", G_CALLBACK(chunk_dlg_destroy), u_data);
|
||||
|
||||
/* Container for each row of widgets */
|
||||
main_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 12, FALSE);
|
||||
|
@ -778,7 +755,7 @@ sctp_chunk_dlg(struct sctp_udata *u_data)
|
|||
close_bt = ws_gtk_button_new_from_stock(GTK_STOCK_CLOSE);
|
||||
gtk_box_pack_start(GTK_BOX(h_button_box), close_bt, FALSE, FALSE, 0);
|
||||
gtk_widget_show(close_bt);
|
||||
g_signal_connect(close_bt, "clicked", G_CALLBACK(on_close_dlg), u_data);
|
||||
g_signal_connect(close_bt, "clicked", G_CALLBACK(sctp_chunk_stat_on_close), u_data);
|
||||
|
||||
gtk_widget_show_all(u_data->io->window);
|
||||
chunk_window_set_title(u_data);
|
||||
|
|
|
@ -1416,8 +1416,8 @@ on_button_release_event (GtkWidget *widget _U_, GdkEventButton *event, gpointer
|
|||
PangoLayout *layout;
|
||||
cairo_t *cr;
|
||||
|
||||
g_snprintf(label_string, 15, "%d", 0);
|
||||
memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15);
|
||||
g_snprintf(label_string, sizeof(label_string), "%d", 0);
|
||||
memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), sizeof(label_string));
|
||||
layout = gtk_widget_create_pango_layout(u_data->io->draw_area, label_string);
|
||||
pango_layout_get_pixel_size(layout, &label_width, &label_height);
|
||||
|
||||
|
@ -1542,7 +1542,7 @@ on_button_release_event (GtkWidget *widget _U_, GdkEventButton *event, gpointer
|
|||
sacklist = u_data->assoc->sort_sack2;
|
||||
s_size = u_data->assoc->n_sack_chunks_ep2;
|
||||
}
|
||||
x_tolerance = (gdouble)((u_data->io->tmp_width / u_data->io->axis_width*1.0))*5/1000000.0;
|
||||
x_tolerance = (gdouble)(u_data->io->tmp_width / u_data->io->axis_width*1.0)*5/1000000.0;
|
||||
y_tolerance = (guint32)(((u_data->io->max_y - u_data->io->min_y) / (u_data->io->surface_height-TOP_BORDER-BOTTOM_BORDER-u_data->io->offset)) * 2.0);
|
||||
if (y_tolerance==0)
|
||||
y_tolerance = 2;
|
||||
|
@ -1623,7 +1623,7 @@ on_button_release_event (GtkWidget *widget _U_, GdkEventButton *event, gpointer
|
|||
position = event->x + 5;
|
||||
|
||||
|
||||
memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15);
|
||||
memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), sizeof(label_string));
|
||||
pango_layout_set_text(layout, label_string, -1);
|
||||
pango_layout_get_pixel_size(layout, &lwidth, NULL);
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@ SCTPAllAssocsDialog::~SCTPAllAssocsDialog()
|
|||
|
||||
void SCTPAllAssocsDialog::fillTable()
|
||||
{
|
||||
QString output;
|
||||
GList *list;
|
||||
sctp_assoc_info_t* assinfo;
|
||||
int numAssocs;
|
||||
|
|
|
@ -235,9 +235,11 @@ void SCTPChunkStatisticsDialog::on_pushButton_clicked()
|
|||
|
||||
fprintf(fp,"# This file is automatically generated, DO NOT MODIFY.\n");
|
||||
char str[40];
|
||||
struct chunkTypes tempChunk;
|
||||
|
||||
for (int i = 0; i < chunks.size(); i++) {
|
||||
g_snprintf(str, sizeof str, "\"%d\",\"%s\",\"%s\"\n", chunks.value(i).id, chunks.value(i).name, (chunks.value(i).hide==0?"Show":"Hide"));
|
||||
tempChunk = chunks.value(i);
|
||||
g_snprintf(str, sizeof str, "\"%d\",\"%s\",\"%s\"\n", tempChunk.id, tempChunk.name, tempChunk.hide==0?"Show":"Hide");
|
||||
fputs(str, fp);
|
||||
void *rec = g_malloc0(uat->record_size);
|
||||
uat_add_record(uat, rec, TRUE);
|
||||
|
|
|
@ -72,7 +72,7 @@ void SCTPGraphByteDialog::drawBytesGraph()
|
|||
tsn_t *tsn;
|
||||
guint8 type;
|
||||
guint32 maxBytes;
|
||||
long sumBytes = 0;
|
||||
guint64 sumBytes = 0;
|
||||
|
||||
if (direction == 1) {
|
||||
maxBytes = selected_assoc->n_data_bytes_ep1;
|
||||
|
|
|
@ -181,7 +181,8 @@ calc_checksum(const struct _sctp_info *check_data, sctp_assoc_info_t *data)
|
|||
{
|
||||
if ((float)(data->n_adler32_correct*1.0/data->n_adler32_calculated) > 0.5)
|
||||
{
|
||||
g_strlcpy(data->checksum_type,"ADLER32",8);
|
||||
char str[] = "ADLER32";
|
||||
g_strlcpy(data->checksum_type, str, strlen(str));
|
||||
data->n_checksum_errors=(data->n_adler32_calculated-data->n_adler32_correct);
|
||||
ok = TRUE;
|
||||
}
|
||||
|
@ -191,7 +192,8 @@ calc_checksum(const struct _sctp_info *check_data, sctp_assoc_info_t *data)
|
|||
{
|
||||
if ((float)(data->n_crc32c_correct*1.0/data->n_crc32c_calculated) > 0.5)
|
||||
{
|
||||
g_strlcpy(data->checksum_type,"CRC32C",8);
|
||||
char str[] = "CRC32C";
|
||||
g_strlcpy(data->checksum_type, str, strlen(str));
|
||||
data->n_checksum_errors=data->n_crc32c_calculated-data->n_crc32c_correct;
|
||||
ok = TRUE;
|
||||
}
|
||||
|
@ -199,7 +201,8 @@ calc_checksum(const struct _sctp_info *check_data, sctp_assoc_info_t *data)
|
|||
|
||||
if (!ok)
|
||||
{
|
||||
g_strlcpy(data->checksum_type,"UNKNOWN",8);
|
||||
char str[] = "UNKNOWN";
|
||||
g_strlcpy(data->checksum_type, str, strlen(str));
|
||||
data->n_checksum_errors=0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue