Changeset 3cc651e520ccb3106097e3f0167cc8c26f23e36c
- Timestamp:
- 01/07/07 17:13:04
(1 year ago)
- Author:
- Antoine Cellerier <dionoea@videolan.org>
- git-committer:
- Antoine Cellerier <dionoea@videolan.org> 1183302784 +0000
- git-parent:
[63c7e4a5f5c7613a37e34d2e5451db2653e199b0]
- git-author:
- Antoine Cellerier <dionoea@videolan.org> 1183302784 +0000
- Message:
Add option to format strings to prevent displaying dashes if the meta info was unavailable (ie: if time is unavailable, "$T" will display "--:--:--" while "$ T" won't display anything). This is of course completely untested :)
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rcd2892e |
r3cc651e |
|
| 658 | 658 | char *d = dst; |
|---|
| 659 | 659 | int b_is_format = 0; |
|---|
| | 660 | int b_empty_if_na = 0; |
|---|
| 660 | 661 | char buf[10]; |
|---|
| 661 | 662 | int i_size = strlen( string ); |
|---|
| … | … | |
| 730 | 731 | else |
|---|
| 731 | 732 | { |
|---|
| 732 | | lang = strdup( "-" ); |
|---|
| | 733 | lang = strdup( b_empty_if_na ? "" : "-" ); |
|---|
| 733 | 734 | } |
|---|
| 734 | 735 | INSERT_STRING( 1, lang ); |
|---|
| … | … | |
| 756 | 757 | else |
|---|
| 757 | 758 | { |
|---|
| 758 | | sprintf( buf, "-" ); |
|---|
| | 759 | sprintf( buf, b_empty_if_na ? "" : "-" ); |
|---|
| 759 | 760 | } |
|---|
| 760 | 761 | INSERT_STRING( 1, buf ); |
|---|
| … | … | |
| 768 | 769 | else |
|---|
| 769 | 770 | { |
|---|
| 770 | | sprintf( buf, "-" ); |
|---|
| | 771 | sprintf( buf, b_empty_if_na ? "" : "-" ); |
|---|
| 771 | 772 | } |
|---|
| 772 | 773 | INSERT_STRING( 1, buf ); |
|---|
| … | … | |
| 782 | 783 | else |
|---|
| 783 | 784 | { |
|---|
| 784 | | sprintf( buf, "--:--:--" ); |
|---|
| | 785 | sprintf( buf, b_empty_if_na ? "" : "--:--:--" ); |
|---|
| 785 | 786 | } |
|---|
| 786 | 787 | INSERT_STRING( 1, buf ); |
|---|
| … | … | |
| 797 | 798 | else |
|---|
| 798 | 799 | { |
|---|
| 799 | | sprintf( buf, "-" ); |
|---|
| | 800 | sprintf( buf, b_empty_if_na ? "" : "-" ); |
|---|
| 800 | 801 | } |
|---|
| 801 | 802 | INSERT_STRING( 1, buf ); |
|---|
| … | … | |
| 811 | 812 | else |
|---|
| 812 | 813 | { |
|---|
| 813 | | sprintf( buf, "--:--:--" ); |
|---|
| | 814 | sprintf( buf, b_empty_if_na ? "" : "--:--:--" ); |
|---|
| 814 | 815 | } |
|---|
| 815 | 816 | INSERT_STRING( 1, buf ); |
|---|
| … | … | |
| 827 | 828 | else |
|---|
| 828 | 829 | { |
|---|
| 829 | | lang = strdup( "-" ); |
|---|
| | 830 | lang = strdup( b_empty_if_na ? "" : "-" ); |
|---|
| 830 | 831 | } |
|---|
| 831 | 832 | INSERT_STRING( 1, lang ); |
|---|
| … | … | |
| 841 | 842 | else |
|---|
| 842 | 843 | { |
|---|
| 843 | | sprintf( buf, "--.-%%" ); |
|---|
| | 844 | sprintf( buf, b_empty_if_na ? "" : "--.-%%" ); |
|---|
| 844 | 845 | } |
|---|
| 845 | 846 | INSERT_STRING( 1, buf ); |
|---|
| … | … | |
| 853 | 854 | else |
|---|
| 854 | 855 | { |
|---|
| 855 | | sprintf( buf, "-" ); |
|---|
| | 856 | sprintf( buf, b_empty_if_na ? "" : "-" ); |
|---|
| 856 | 857 | } |
|---|
| 857 | 858 | INSERT_STRING( 1, buf ); |
|---|
| … | … | |
| 865 | 866 | else |
|---|
| 866 | 867 | { |
|---|
| 867 | | sprintf( buf, "-" ); |
|---|
| | 868 | sprintf( buf, b_empty_if_na ? "" : "-" ); |
|---|
| 868 | 869 | } |
|---|
| 869 | 870 | INSERT_STRING( 1, buf ); |
|---|
| … | … | |
| 879 | 880 | else |
|---|
| 880 | 881 | { |
|---|
| 881 | | sprintf( buf, "--:--:--" ); |
|---|
| | 882 | sprintf( buf, b_empty_if_na ? "" : "--:--:--" ); |
|---|
| 882 | 883 | } |
|---|
| 883 | 884 | INSERT_STRING( 1, buf ); |
|---|
| … | … | |
| 900 | 901 | break; |
|---|
| 901 | 902 | |
|---|
| | 903 | case ' ': |
|---|
| | 904 | b_empty_if_na = 1; |
|---|
| | 905 | break; |
|---|
| | 906 | |
|---|
| 902 | 907 | default: |
|---|
| 903 | 908 | *d = *s; |
|---|
| … | … | |
| 905 | 910 | break; |
|---|
| 906 | 911 | } |
|---|
| 907 | | b_is_format = 0; |
|---|
| | 912 | if( *s != ' ' ) |
|---|
| | 913 | b_is_format = 0; |
|---|
| 908 | 914 | } |
|---|
| 909 | 915 | else if( *s == '$' ) |
|---|
| 910 | 916 | { |
|---|
| 911 | 917 | b_is_format = 1; |
|---|
| | 918 | b_empty_if_na = 0; |
|---|
| 912 | 919 | } |
|---|
| 913 | 920 | else |
|---|