comparison src/tta/libtta.c @ 1190:ed2d7787779e trunk

more warning elimination.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Thu, 21 Jun 2007 17:33:00 +0900
parents 4bd7e72a6605
children 0d5b0f861bf0
comparison
equal deleted inserted replaced
1189:af5bd4592100 1190:ed2d7787779e
207 // decode PCM_BUFFER_LENGTH samples 207 // decode PCM_BUFFER_LENGTH samples
208 // into the current PCM buffer position 208 // into the current PCM buffer position
209 209
210 while (playing) 210 while (playing)
211 { 211 {
212 while ((read_samples = get_samples (sample_buffer)) > 0) 212 while ((read_samples = get_samples ((unsigned char *)sample_buffer)) > 0)
213 { 213 {
214 214
215 while ((playback->output->buffer_free () < bufsize) 215 while ((playback->output->buffer_free () < bufsize)
216 && seek_position == -1) 216 && seek_position == -1)
217 { 217 {
431 g_free(title); 431 g_free(title);
432 g_free(utf_filename); 432 g_free(utf_filename);
433 433
434 if (open_tta_file (filename, &ttainfo, 0) >= 0) 434 if (open_tta_file (filename, &ttainfo, 0) >= 0)
435 { 435 {
436 gtk_entry_set_text(GTK_ENTRY(title_entry), ttainfo.ID3.title); 436 gtk_entry_set_text(GTK_ENTRY(title_entry), (gchar *)ttainfo.ID3.title);
437 gtk_entry_set_text(GTK_ENTRY(artist_entry), ttainfo.ID3.artist); 437 gtk_entry_set_text(GTK_ENTRY(artist_entry), (gchar *)ttainfo.ID3.artist);
438 gtk_entry_set_text(GTK_ENTRY(album_entry), ttainfo.ID3.album); 438 gtk_entry_set_text(GTK_ENTRY(album_entry), (gchar *)ttainfo.ID3.album);
439 gtk_entry_set_text(GTK_ENTRY(year_entry), ttainfo.ID3.year); 439 gtk_entry_set_text(GTK_ENTRY(year_entry), (gchar *)ttainfo.ID3.year);
440 gtk_entry_set_text(GTK_ENTRY(tracknum_entry), ttainfo.ID3.track); 440 gtk_entry_set_text(GTK_ENTRY(tracknum_entry), (gchar *)ttainfo.ID3.track);
441 gtk_entry_set_text(GTK_ENTRY(comment_entry), ttainfo.ID3.comment); 441 gtk_entry_set_text(GTK_ENTRY(comment_entry), (gchar *)ttainfo.ID3.comment);
442 gtk_entry_set_text(GTK_ENTRY(genre_entry), ttainfo.ID3.genre); 442 gtk_entry_set_text(GTK_ENTRY(genre_entry), (gchar *)ttainfo.ID3.genre);
443 } 443 }
444 close_tta_file (&ttainfo); 444 close_tta_file (&ttainfo);
445 445
446 gtk_widget_set_sensitive(info_frame, TRUE); 446 gtk_widget_set_sensitive(info_frame, TRUE);
447 } 447 }
574 tuple->file_path = g_path_get_dirname(filename); 574 tuple->file_path = g_path_get_dirname(filename);
575 tuple->file_ext = extname(filename); 575 tuple->file_ext = extname(filename);
576 tuple->length = ttainfo->LENGTH * 1000; 576 tuple->length = ttainfo->LENGTH * 1000;
577 577
578 if (ttainfo->ID3.id3has) { 578 if (ttainfo->ID3.id3has) {
579 if(ttainfo->ID3.artist && strlen(ttainfo->ID3.artist)) 579 if(ttainfo->ID3.artist && strlen((char *)ttainfo->ID3.artist))
580 tuple->performer = g_strdup(ttainfo->ID3.artist); 580 tuple->performer = g_strdup((gchar *)ttainfo->ID3.artist);
581 581
582 if(ttainfo->ID3.album && strlen(ttainfo->ID3.album)) 582 if(ttainfo->ID3.album && strlen((char *)ttainfo->ID3.album))
583 tuple->album_name = g_strdup(ttainfo->ID3.album); 583 tuple->album_name = g_strdup((gchar *)ttainfo->ID3.album);
584 584
585 if(ttainfo->ID3.title && strlen(ttainfo->ID3.title)) 585 if(ttainfo->ID3.title && strlen((char *)ttainfo->ID3.title))
586 tuple->track_name = g_strdup(ttainfo->ID3.title); 586 tuple->track_name = g_strdup((gchar *)ttainfo->ID3.title);
587 587
588 if(ttainfo->ID3.year && strlen(ttainfo->ID3.year)) 588 if(ttainfo->ID3.year && strlen((char *)ttainfo->ID3.year))
589 tuple->year = atoi(ttainfo->ID3.year); 589 tuple->year = atoi((char *)ttainfo->ID3.year);
590 590
591 if(ttainfo->ID3.track && strlen(ttainfo->ID3.track)) 591 if(ttainfo->ID3.track && strlen((char *)ttainfo->ID3.track))
592 tuple->track_number = atoi(ttainfo->ID3.track); 592 tuple->track_number = atoi((char *)ttainfo->ID3.track);
593 593
594 if(ttainfo->ID3.genre && strlen(ttainfo->ID3.genre)) 594 if(ttainfo->ID3.genre && strlen((char *)ttainfo->ID3.genre))
595 tuple->genre = g_strdup(ttainfo->ID3.genre); 595 tuple->genre = g_strdup((gchar *)ttainfo->ID3.genre);
596 596
597 if(ttainfo->ID3.comment && strlen(ttainfo->ID3.comment)) 597 if(ttainfo->ID3.comment && strlen((char *)ttainfo->ID3.comment))
598 tuple->comment = g_strdup(ttainfo->ID3.comment); 598 tuple->comment = g_strdup((gchar *)ttainfo->ID3.comment);
599 } 599 }
600 close_tta_file (ttainfo); 600 close_tta_file (ttainfo);
601 } 601 }
602 vfs_fclose(file); 602 vfs_fclose(file);
603 } 603 }
756 756
757 frame = id3_tag_findframe(tag, frame_name, 0); 757 frame = id3_tag_findframe(tag, frame_name, 0);
758 if (!frame) 758 if (!frame)
759 return NULL; 759 return NULL;
760 760
761 if (frame_name == ID3_FRAME_COMMENT) 761 if (!strcmp(frame_name, ID3_FRAME_COMMENT))
762 field = id3_frame_field(frame, 3); 762 field = id3_frame_field(frame, 3);
763 else 763 else
764 field = id3_frame_field(frame, 1); 764 field = id3_frame_field(frame, 1);
765 765
766 if (!field) 766 if (!field)
767 return NULL; 767 return NULL;
768 768
769 if (frame_name == ID3_FRAME_COMMENT) 769 if (!strcmp(frame_name, ID3_FRAME_COMMENT))
770 string_const = id3_field_getfullstring(field); 770 string_const = id3_field_getfullstring(field);
771 else 771 else
772 string_const = id3_field_getstrings(field, 0); 772 string_const = id3_field_getstrings(field, 0);
773 773
774 if (!string_const) 774 if (!string_const)
775 return NULL; 775 return NULL;
776 776
777 string = tta_ucs4dup((id3_ucs4_t *)string_const); 777 string = tta_ucs4dup((id3_ucs4_t *)string_const);
778 778
779 if (frame_name == ID3_FRAME_GENRE) { 779 if (!strcmp(frame_name, ID3_FRAME_GENRE)) {
780 id3_ucs4_t *string2 = NULL; 780 id3_ucs4_t *string2 = NULL;
781 string2 = tta_parse_genre(string); 781 string2 = tta_parse_genre(string);
782 g_free((void *)string); 782 g_free((void *)string);
783 string = string2; 783 string = string2;
784 } 784 }
794 794
795 if (flagutf) { 795 if (flagutf) {
796 #ifdef DEBUG 796 #ifdef DEBUG
797 g_message("aud-tta: flagutf!\n"); 797 g_message("aud-tta: flagutf!\n");
798 #endif 798 #endif
799 rtn = id3_ucs4_utf8duplicate(string); 799 rtn = (gchar *)id3_ucs4_utf8duplicate(string);
800 } 800 }
801 else { 801 else {
802 rtn = id3_ucs4_latin1duplicate(string); 802 rtn = (gchar *)id3_ucs4_latin1duplicate(string);
803 rtn2 = str_to_utf8(rtn); 803 rtn2 = str_to_utf8(rtn);
804 free(rtn); 804 free(rtn);
805 rtn = rtn2; 805 rtn = rtn2;
806 } 806 }
807 g_free(string); 807 g_free(string);
828 if (tag) { 828 if (tag) {
829 ttainfo->ID3.id3has = 1; 829 ttainfo->ID3.id3has = 1;
830 id3v2_size = tag->paddedsize; 830 id3v2_size = tag->paddedsize;
831 831
832 str = tta_input_id3_get_string (tag, ID3_FRAME_ARTIST); 832 str = tta_input_id3_get_string (tag, ID3_FRAME_ARTIST);
833 if(str) strncpy(ttainfo->ID3.artist, str, MAX_LINE); 833 if(str) strncpy((char *)ttainfo->ID3.artist, str, MAX_LINE);
834 free(str); 834 free(str);
835 str = NULL; 835 str = NULL;
836 836
837 str = tta_input_id3_get_string (tag, ID3_FRAME_ALBUM); 837 str = tta_input_id3_get_string (tag, ID3_FRAME_ALBUM);
838 if(str) strncpy(ttainfo->ID3.album, str, MAX_LINE); 838 if(str) strncpy((char *)ttainfo->ID3.album, str, MAX_LINE);
839 free(str); 839 free(str);
840 str = NULL; 840 str = NULL;
841 841
842 str = tta_input_id3_get_string (tag, ID3_FRAME_TITLE); 842 str = tta_input_id3_get_string (tag, ID3_FRAME_TITLE);
843 if(str) strncpy(ttainfo->ID3.title, str, MAX_LINE); 843 if(str) strncpy((char *)ttainfo->ID3.title, str, MAX_LINE);
844 free(str); 844 free(str);
845 str = NULL; 845 str = NULL;
846 846
847 str = tta_input_id3_get_string (tag, ID3_FRAME_YEAR); 847 str = tta_input_id3_get_string (tag, ID3_FRAME_YEAR);
848 if(!str) str = tta_input_id3_get_string (tag, "TYER"); 848 if(!str) str = tta_input_id3_get_string (tag, "TYER");
849 if(str) strncpy(ttainfo->ID3.year, str, MAX_YEAR); 849 if(str) strncpy((char *)ttainfo->ID3.year, str, MAX_YEAR);
850 free(str); 850 free(str);
851 str = NULL; 851 str = NULL;
852 852
853 str = tta_input_id3_get_string (tag, ID3_FRAME_TRACK); 853 str = tta_input_id3_get_string (tag, ID3_FRAME_TRACK);
854 if(str) strncpy(ttainfo->ID3.track, str, MAX_TRACK); 854 if(str) strncpy((char *)ttainfo->ID3.track, str, MAX_TRACK);
855 free(str); 855 free(str);
856 str = NULL; 856 str = NULL;
857 857
858 str = tta_input_id3_get_string (tag, ID3_FRAME_GENRE); 858 str = tta_input_id3_get_string (tag, ID3_FRAME_GENRE);
859 if(str) strncpy(ttainfo->ID3.genre, str, MAX_GENRE); 859 if(str) strncpy((char *)ttainfo->ID3.genre, str, MAX_GENRE);
860 free(str); 860 free(str);
861 str = NULL; 861 str = NULL;
862 862
863 str = tta_input_id3_get_string (tag, ID3_FRAME_COMMENT); 863 str = tta_input_id3_get_string (tag, ID3_FRAME_COMMENT);
864 if(str) strncpy(ttainfo->ID3.comment, str, MAX_LINE); 864 if(str) strncpy((char *)ttainfo->ID3.comment, str, MAX_LINE);
865 free(str); 865 free(str);
866 str = NULL; 866 str = NULL;
867 } 867 }
868 868
869 id3_file_close(id3file); 869 id3_file_close(id3file);