Text   |  XML   |  ReML   |   Visible Warnings:

Unused Value  at hostlist_table.c:1260

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

add_hostlist_table_data

(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/hostlist_table.c)expand/collapse
Show more  
 1236  add_hostlist_table_data(hostlist_table *hl, const address *addr, guint32 port, gboolean sender, int num_frames, int num_bytes, SAT_E sat, int port_type)
 1237  {
 1238      hostlist_talker_t *talker=NULL;
 1239      int talker_idx=0;
 1240      gboolean new_talker;
 1241   
 1242      new_talker=FALSE;
 1243      /* XXX should be optimized to allocate n extra entries at a time
 1244         instead of just one */
 1245      /* if we dont have any entries at all yet */
 1246      if(hl->hosts==NULL){
 1247          hl->hosts=g_malloc(sizeof(hostlist_talker_t));
 1248          hl->num_hosts=1;
 1249          talker=&hl->hosts[0];
 1250          talker_idx=0;
 1251          new_talker=TRUE;
 1252      }
 1253   
 1254      /* try to find it among the existing known hosts */
 1255      if(talker==NULL){
 1256          guint32 i;
 1257          for(i=0;i<hl->num_hosts;i++){
 1258              if(  (!CMP_ADDRESS(&hl->hosts[i].address, addr))&&(hl->hosts[i].port==port) ){
 1259                  talker=&hl->hosts[i];
 1260                  talker_idx=i;
 1261                  break;
 1262              }
 1263          }
 1264      }
 1265   
 1266      /* if we still dont know what talker this is it has to be a new one
 1267         and we have to allocate it and append it to the end of the list */
 1268      if(talker==NULL){
 1269          new_talker=TRUE;
 1270          hl->num_hosts++;
 1271          hl->hosts=g_realloc(hl->hosts, hl->num_hosts*sizeof(hostlist_talker_t));
 1272          talker=&hl->hosts[hl->num_hosts-1];
 1273          talker_idx=hl->num_hosts-1;
 1274      }
 1275   
 1276      /* if this is a new talker we need to initialize the struct */
 1277      if(new_talker){
 1278          COPY_ADDRESS(&talker->address, addr);
 1279          talker->sat=sat;
 1280          talker->port_type=port_type;
 1281          talker->port=port;
 1282          talker->rx_frames=0;
 1283          talker->tx_frames=0;
 1284          talker->rx_bytes=0;
 1285          talker->tx_bytes=0;
 1286      }
 1287   
 1288      /* update the talker struct */
 1289      if( sender ){
 1290          talker->tx_frames+=num_frames;
 1291          talker->tx_bytes+=num_bytes;
 1292      } else {
 1293          talker->rx_frames+=num_frames;
 1294          talker->rx_bytes+=num_bytes;
 1295      }
 1296   
 1297      /* if this was a new talker we have to create a clist row for it */
 1298      if(new_talker){
 1299          char *entries[NUM_HOSTLIST_COLS];
 1300          char frames[COL_STR_LEN], bytes[COL_STR_LEN], txframes[COL_STR_LEN];
 1301          char txbytes[COL_STR_LEN], rxframes[COL_STR_LEN], rxbytes[COL_STR_LEN];
 1302  #ifdef HAVE_GEOIP 
 1303          char geoip[NUM_GEOIP_COLS][COL_STR_LEN];
 1304          guint i;
 1305  #endif /* HAVE_GEOIP */
 1306   
 1307          /* these values will be filled by call to draw_hostlist_table_addresses() below */
 1308          entries[0]="";
 1309          entries[1]="";
 1310   
 1311          g_snprintf(frames, COL_STR_LEN, "%" G_GINT64_MODIFIER "u", talker->tx_frames+talker->rx_frames);
 1312          entries[2]=frames;
 1313          g_snprintf(bytes, COL_STR_LEN, "%" G_GINT64_MODIFIER "u", talker->tx_bytes+talker->rx_bytes);
 1314          entries[3]=bytes;
 1315   
 1316          g_snprintf(txframes, COL_STR_LEN, "%" G_GINT64_MODIFIER "u", talker->tx_frames);
 1317          entries[4]=txframes;
 1318          g_snprintf(txbytes, COL_STR_LEN, "%" G_GINT64_MODIFIER "u", talker->tx_bytes);
 1319          entries[5]=txbytes;
 1320   
 1321          g_snprintf(rxframes, COL_STR_LEN, "%" G_GINT64_MODIFIER "u", talker->rx_frames);
 1322          entries[6]=rxframes;
 1323          g_snprintf(rxbytes, COL_STR_LEN, "%" G_GINT64_MODIFIER "u", talker->rx_bytes);
 1324          entries[7]=rxbytes;
 1325   
 1326  #ifdef HAVE_GEOIP 
 1327          /* Filled in from the GeoIP config, if any */
 1328          for (i = 0; i < NUM_GEOIP_COLS; i++) {
 1329              if (i < geoip_db_num_dbs() && talker->address.type == AT_IPv4) {
 1330                  const guchar *name = geoip_db_lookup_ipv4(i, pntohl(talker->address.data), "-");
 1331                  g_snprintf(geoip[i], COL_STR_LEN, "%s", format_text (name, strlen(name)));
 1332                  entries[NUM_BUILTIN_COLS + i] = geoip[i];
 1333                  gtk_clist_set_column_visibility(hl->table, NUM_BUILTIN_COLS + i, TRUE);
 1334              } else {
 1335                  entries[NUM_BUILTIN_COLS + i] = "";
 1336              }
 1337          }
 1338  #endif /* HAVE_GEOIP */
 1339   
 1340          gtk_clist_insert(hl->table, talker_idx, entries);
 1341          gtk_clist_set_row_data(hl->table, talker_idx, (gpointer)(long) talker_idx);
 1342   
 1343          draw_hostlist_table_address(hl, talker_idx);
 1344      }
 1345  }
Show more  




Change Warning 4125.30948 : Unused Value

Priority:
State:
Finding:
Owner:
Note: