Text   |  XML   |  ReML   |   Visible Warnings:

Useless Assignment  at find_dlg.c:618

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

find_frame_ok_cb

(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/find_dlg.c)expand/collapse
Show more  
 558  find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w)
 559  {
 560    GtkWidget       *filter_te, *up_rb, *hex_rb, *string_rb, *combo_cb,
 561                    *case_cb, *decode_data_rb, *summary_data_rb;
 562    const gchar     *filter_text, *string_type;
 563    search_charset_t scs_type = SCS_ASCII_AND_UNICODE;
 564    guint8          *bytes = NULL;
 565    size_t           nbytes = 0;
 566    char            *string = NULL;
 567    dfilter_t       *sfcode = NULL;
 568    gboolean        found_packet=FALSE;
 569   
 570    filter_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_FILT_KEY);
 571    up_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_BACKWARD_KEY);
 572    hex_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_HEXDATA_KEY);
 573    string_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_STRINGDATA_KEY);
 574    combo_cb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_STRINGTYPE_KEY);
 575    case_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CASE_SEARCH_KEY);
 576    decode_data_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_SOURCE_DECODE_KEY);
 577    summary_data_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_SOURCE_SUMMARY_KEY);
 578   
 579    filter_text = gtk_entry_get_text(GTK_ENTRY(filter_te));
 580  #if GTK_CHECK_VERSION(2,6,0)
 581    string_type = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo_cb));
 582  #else
 583    string_type = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo_cb)->entry));
 584  #endif
 585    case_type = !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(case_cb));
 586    decode_data = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(decode_data_rb));
 587    summary_data = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(summary_data_rb));
 588   
 589    /*
 590     * Process the search criterion.
 591     */
 592    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (hex_rb))) {
 593      /*
 594       * Hex search - scan the search string to make sure it's valid hex
 595       * and to find out how many bytes there are.
 596       */
 597      bytes = convert_string_to_hex(filter_text, &nbytes);
 598      if (bytes == NULL) {
 599        simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
 600             "You didn't specify a valid hex string.");
 601        return;
 602      }
 603    } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (string_rb))) {
 604      /*
 605       * String search.
 606       * Make sure we're searching for something, first.
 607       */
 608      if (strcmp(filter_text, "") == 0) {
 609        simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
 610             "You didn't specify any text for which to search.");
 611        return;
 612      }
 613   
 614      /*
 615       * We are - get the character set type.
 616       */
 617      if (strcmp(string_type, "ASCII Unicode & Non-Unicode") == 0)
 618        scs_type = SCS_ASCII_AND_UNICODE;
 619      else if (strcmp(string_type, "ASCII Non-Unicode") == 0)
 620        scs_type = SCS_ASCII;
 621      else if (strcmp(string_type, "ASCII Unicode") == 0)
 622        scs_type = SCS_UNICODE;
 623      else {
 624        simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "You didn't choose a valid character set.");
 625        return;
 626      }
 627      string = convert_string_case(filter_text, case_type);
 628    } else {
 629      /*
 630       * Display filter search - try to compile the filter.
 631       */
 632      if (!dfilter_compile(filter_text, &sfcode)) {
 633        /* The attempt failed; report an error. */
 634        bad_dfilter_alert_box(filter_text);
 635        return;
 636      }
 637   
 638      /* Was it empty? */
 639      if (sfcode == NULL) {
 640        /* Yes - complain. */
 641        simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
 642           "You specified a filter that doesn't test anything.");
 643        return;
 644      }
 645    }
 646   
 647    /*
 648     * Remember the search parameters.
 649     */
 650    g_free(cfile.sfilter);
 651    cfile.sfilter = g_strdup(filter_text);
 652    cfile.sbackward = GTK_TOGGLE_BUTTON (up_rb)->active;
 653    cfile.hex = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (hex_rb));
 654    cfile.string = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (string_rb));
 655    cfile.scs_type = scs_type;
 656    cfile.case_type = case_type;
 657    cfile.decode_data = decode_data;
 658    cfile.summary_data = summary_data;
 659   
 660    if (cfile.hex) {
 661      found_packet = cf_find_packet_data(&cfile, bytes, nbytes);
 662      g_free(bytes);
 663      if (!found_packet) {
 664        /* We didn't find a packet */
 665        simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
 666              "%sNo match found!%s\n\n"
 667              "No packet contained those bytes.",
 668              simple_dialog_primary_start(), simple_dialog_primary_end());
 669        return;
 670      }
 671    } else if (cfile.string) {
 672      /* OK, what are we searching? */
 673      if (cfile.decode_data) {
 674        /* The text in the protocol tree */
 675        if(string){
 676          found_packet = cf_find_packet_protocol_tree(&cfile, string);
 677          g_free(string);
 678        }
 679        if (!found_packet) {
 680          /* We didn't find the packet. */
 681          simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
 682              "%sNo match found!%s\n\n"
 683              "No packet contained that string in its dissected display.",
 684              simple_dialog_primary_start(), simple_dialog_primary_end());
 685          return;
 686        }
 687      } else if (cfile.summary_data) {
 688        /* The text in the summary line */
 689        if(string){
 690          found_packet = cf_find_packet_summary_line(&cfile, string);
 691          g_free(string);
 692        }
 693        if (!found_packet) {
 694          /* We didn't find the packet. */
 695          simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
 696              "%sNo match found!%s\n\n"
 697              "No packet contained that string in its Info column.",
 698              simple_dialog_primary_start(), simple_dialog_primary_end());
 699          return;
 700        }
 701      } else {
 702        /* The raw packet data */
 703        if(string){
 704          found_packet = cf_find_packet_data(&cfile, string, strlen(string));
 705          g_free(string);
 706        }
 707        if (!found_packet) {
 708          /* We didn't find the packet. */
 709          simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
 710              "%sNo match found!%s\n\n"
 711              "No packet contained that string in its data.",
 712              simple_dialog_primary_start(), simple_dialog_primary_end());
 713          return;
 714        }
 715      }
 716    } else {
 717      found_packet = cf_find_packet_dfilter(&cfile, sfcode);
 718      dfilter_free(sfcode);
 719      if (!found_packet) {
 720        /* We didn't find a packet */
 721        simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
 722            "%sNo match found!%s\n\n"
 723            "No packet matched that filter.",
 724            simple_dialog_primary_start(), simple_dialog_primary_end());
 725        g_free(bytes);
 726        return;
 727      }
 728    }
 729    window_destroy(GTK_WIDGET(parent_w));
 730  }
Show more  




Change Warning 4074.30816 : Useless Assignment

Priority:
State:
Finding:
Owner:
Note: