Text   |  XML   |  ReML   |   Visible Warnings:

Unreachable Control Flow  at main_proto_draw.c:823

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

copy_hex_cb

(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/main_proto_draw.c)expand/collapse
Show more  
 756  copy_hex_cb(GtkWidget * w _U_, gpointer data _U_, copy_data_type data_type)
 757  {
 758          GtkWidget *bv;
 759   
 760      guint len = 0;
 761      int bytes_consumed = 0;
 762      int flags;
 763   
 764      const guint8* data_p;
 765   
 766          GString* copy_buffer = g_string_new(""); /* String to copy to clipboard */
 767   
 768          bv = get_notebook_bv_ptr(byte_nb_ptr);
 769          if (bv == NULL) {
 770                  /* shouldn't happen */
 771                  simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not find the corresponding text window!");
 772                  return;
 773          }
 774   
 775          data_p = get_byte_view_data_and_length(bv, &len);
 776          g_assert(data_p != NULL);
 777   
 778      flags = data_type & CD_FLAGSMASK;
 779      data_type = data_type & CD_TYPEMASK;
 780   
 781      if(flags & CD_FLAGS_SELECTEDONLY) {
 782          int start, end;
 783   
 784          /* Get the start and end of the highlighted bytes.
 785           * XXX The keys appear to be REVERSED start <-> end throughout this file!
 786           * Should this be fixed? There is one exception - packet_hex_reprint,
 787           * so can't just change it round without functional change.
 788           */
 789          end = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(bv), E_BYTE_VIEW_START_KEY));
 790          start = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(bv), E_BYTE_VIEW_END_KEY));
 791   
 792          if(start >= 0 && end > start && (end - start <= (int)len)) {
 793              len = end - start;
 794              data_p += start;
 795          }
 796      }
 797   
 798      switch(data_type) {
 799      case(CD_ALLINFO):
 800          /* This is too different from other text formats - handle separately */
 801          copy_hex_all_info(copy_buffer, data_p, len, TRUE);
 802          break;
 803      case(CD_HEXCOLUMNS):
 804          /* This could be done incrementally, but it is easier to mingle with the code for CD_ALLINFO */
 805          copy_hex_all_info(copy_buffer, data_p, len, FALSE);
 806          break;
 807      case(CD_BINARY):
 808          /* Completely different logic to text copies - leave copy buffer alone */
 809          copy_binary_to_clipboard(data_p,len);
 810          break;
 811      default:
 812          /* Incrementally write to text buffer in various formats */
 813              while (len > 0){
 814              switch(data_type) {
 815              case (CD_TEXTONLY):
 816                  bytes_consumed = copy_hex_bytes_text_only(copy_buffer, data_p, len);
 817                  break;
 818              case (CD_HEX):
 819                  bytes_consumed = copy_hex_bytes_hex(copy_buffer, data_p, len);
 820                  break;
 821              default:
 822                  g_assert_not_reached();
 823                  break;
 824              }
 825   
 826              g_assert(bytes_consumed>0);
 827              data_p += bytes_consumed;
 828              len -= bytes_consumed;
 829          }
 830          break;
 831      }
 832   
 833      if(copy_buffer->len > 0) {
 834          copy_to_clipboard(copy_buffer);
 835      }
 836   
 837          g_string_free(copy_buffer, TRUE);
 838  }
Show more  




Change Warning 4186.31440 : Unreachable Control Flow

Priority:
State:
Finding:
Owner:
Note: