(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/io_stat.c) |
| |
| 1231 | | | gtk_iostat_init(const char *optarg _U_, void* userdata _U_) |
| 1232 | | | { |
| 1233 | | | io_stat_t *io; |
| 1234 | | | int i=0; |
| 1235 | | | static color_t col[MAX_GRAPHS] = { |
| 1236 | | | {0, 0x0000, 0x0000, 0x0000}, |
| 1237 | | | {0, 0xffff, 0x0000, 0x0000}, |
| 1238 | | | {0, 0x0000, 0xffff, 0x0000}, |
| 1239 | | | {0, 0x0000, 0x0000, 0xffff}, |
| 1240 | | | {0, 0xffff, 0x5000, 0xffff} |
| 1241 | | | }; |
| 1242 | | | GString *error_string; |
| 1243 | | | |
| 1244 | | | io=g_malloc(sizeof(io_stat_t)); |
| 1245 | | | io->needs_redraw=TRUE; |
| 1246 | | | io->interval=1000; |
| 1247 | | | io->window=NULL; |
| 1248 | | | io->draw_area=NULL; |
| 1249 | | | io->pixmap=NULL; |
| 1250 | | | io->scrollbar=NULL; |
| 1251 | | | io->scrollbar_adjustment=NULL; |
| 1252 | | | io->pixmap_width=500; |
| 1253 | | | io->pixmap_height=200; |
| 1254 | | | io->pixels_per_tick=pixels_per_tick[DEFAULT_PIXELS_PER_TICK]; |
| 1255 | | | io->max_y_units=AUTO_MAX_YSCALE; |
| 1256 | | | io->count_type=0; |
| 1257 | | | io->last_interval=0xffffffff; |
| 1258 | | | io->max_interval=0; |
| 1259 | | | io->num_items=0; |
| 1260 | | | io->left_x_border=0; |
| 1261 | | | io->right_x_border=500; |
| 1262 | | | io->view_as_time=FALSE; |
| 1263 | | | io->start_time.secs=0; |
| 1264 | | | io->start_time.nsecs=0; |
| 1265 | | | |
| 1266 | | | for(i=0;i<MAX_GRAPHS;i++){ |
Useless Assignment
This code assigns the variable the same value it already had. |
|
| 1267 | | | io->graphs[i].gc=NULL; |
| 1268 | | | io->graphs[i].color.pixel=col[i].pixel; |
| 1269 | | | io->graphs[i].color.red=col[i].red; |
| 1270 | | | io->graphs[i].color.green=col[i].green; |
| 1271 | | | io->graphs[i].color.blue=col[i].blue; |
| 1272 | | | io->graphs[i].display=0; |
| 1273 | | | io->graphs[i].display_button=NULL; |
| 1274 | | | io->graphs[i].filter_field=NULL; |
| 1275 | | | io->graphs[i].advanced_buttons=NULL; |
| 1276 | | | io->graphs[i].io=io; |
| 1277 | | | |
| 1278 | | | io->graphs[i].args=g_malloc(sizeof(construct_args_t)); |
| 1279 | | | io->graphs[i].args->title = NULL; |
| 1280 | | | io->graphs[i].args->wants_apply_button=TRUE; |
| 1281 | | | io->graphs[i].args->activate_on_ok=TRUE; |
| 1282 | | | io->graphs[i].args->modal_and_transient=FALSE; |
| 1283 | | | |
| 1284 | | | io->graphs[i].filter_bt=NULL; |
| 1285 | | | } |
| 1286 | | | io_stat_reset(io); |
| 1287 | | | |
| 1288 | | | error_string=enable_graph(&io->graphs[0], NULL, NULL); |
| 1289 | | | if(error_string){ |
| 1290 | | | fprintf(stderr, "wireshark: Can't attach io_stat tap: %s\n", |
| 1291 | | | error_string->str); |
| 1292 | | | g_string_free(error_string, TRUE); |
| 1293 | | | io->graphs[0].display=0; |
| 1294 | | | io->graphs[0].display_button=NULL; |
| 1295 | | | io->graphs[0].filter_field=NULL; |
| 1296 | | | io->graphs[0].advanced_buttons=NULL; |
| 1297 | | | exit(10); |
| 1298 | | | } |
| 1299 | | | |
| 1300 | | | |
| 1301 | | | init_io_stat_window(io); |
| 1302 | | | |
| 1303 | | | cf_retap_packets(&cfile, FALSE); |
| 1304 | | | gdk_window_raise(io->window->window); |
| 1305 | | | io_stat_redraw(io); |
| 1306 | | | } |
| |