Changeset 140517913b5dce1fa54cb23ff6c37b526d904b76
- Timestamp:
- 19/11/07 13:58:21
(1 year ago)
- Author:
- Rafaël Carré <funman@videolan.org>
- git-committer:
- Rafaël Carré <funman@videolan.org> 1195477101 +0000
- git-parent:
[55287bbffd7ddce57a05316560b225f9701550a4]
- git-author:
- Rafaël Carré <funman@videolan.org> 1195477101 +0000
- Message:
ncurses: display the input's title if it's present instead of the name. Use asprintf()
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r55287bb |
r1405179 |
|
| 1905 | 1905 | intf_sys_t *p_sys = p_intf->p_sys; |
|---|
| 1906 | 1906 | playlist_item_t *p_child; |
|---|
| 1907 | | char *psz_tmp; |
|---|
| 1908 | 1907 | int k; |
|---|
| 1909 | 1908 | |
|---|
| 1910 | | psz_tmp = (char *)malloc( strlen( c ) + 4 ); |
|---|
| 1911 | | if( psz_tmp == NULL ) return; |
|---|
| 1912 | 1909 | for( k = 0; k < p_node->i_children; k++ ) |
|---|
| 1913 | 1910 | { |
|---|
| 1914 | | struct pl_item_t *p_pl_item; |
|---|
| 1915 | | char *buff; |
|---|
| 1916 | | int i_size; |
|---|
| 1917 | | |
|---|
| | 1911 | char *psz_display; |
|---|
| 1918 | 1912 | p_child = p_node->pp_children[k]; |
|---|
| 1919 | | i_size = strlen( c ) + strlen( p_child->p_input->psz_name ) + 4; |
|---|
| 1920 | | buff = (char *)malloc( sizeof( char ) * i_size ); |
|---|
| 1921 | | p_pl_item = (struct pl_item_t *)malloc( sizeof( struct pl_item_t ) ); |
|---|
| 1922 | | if( p_pl_item == NULL || buff == NULL ) return; |
|---|
| 1923 | | |
|---|
| 1924 | | if( strlen( c ) ) |
|---|
| 1925 | | { |
|---|
| 1926 | | sprintf( buff, "%s%c-%s", c, k == p_node->i_children - 1 ? |
|---|
| 1927 | | '`' : '|', p_child->p_input->psz_name ); |
|---|
| | 1913 | char *psz_name = input_item_GetTitle( p_child->p_input ); |
|---|
| | 1914 | if( !psz_name || !*psz_name ) |
|---|
| | 1915 | { |
|---|
| | 1916 | free( psz_name ); |
|---|
| | 1917 | psz_name = input_item_GetName( p_child->p_input ); |
|---|
| | 1918 | } |
|---|
| | 1919 | |
|---|
| | 1920 | if( c && *c ) |
|---|
| | 1921 | { |
|---|
| | 1922 | if( asprintf( &psz_display, "%s%c-%s", c, |
|---|
| | 1923 | k == p_node->i_children - 1 ? '`' : '|', psz_name ) == -1 ) |
|---|
| | 1924 | return; |
|---|
| 1928 | 1925 | } |
|---|
| 1929 | 1926 | else |
|---|
| 1930 | 1927 | { |
|---|
| 1931 | | sprintf( buff, " %s", p_child->p_input->psz_name ); |
|---|
| 1932 | | } |
|---|
| 1933 | | p_pl_item->psz_display = strdup( buff ); |
|---|
| | 1928 | if( asprintf( &psz_display, " %s", psz_name ) == -1 ) |
|---|
| | 1929 | return; |
|---|
| | 1930 | } |
|---|
| | 1931 | free( psz_name ); |
|---|
| | 1932 | struct pl_item_t *p_pl_item = malloc( sizeof( struct pl_item_t ) ); |
|---|
| | 1933 | if( !p_pl_item ) |
|---|
| | 1934 | return; |
|---|
| | 1935 | p_pl_item->psz_display = psz_display; |
|---|
| 1934 | 1936 | p_pl_item->p_item = p_child; |
|---|
| 1935 | 1937 | INSERT_ELEM( p_sys->pp_plist, p_sys->i_plist_entries, |
|---|
| 1936 | 1938 | p_sys->i_plist_entries, p_pl_item ); |
|---|
| 1937 | | free( buff ); |
|---|
| 1938 | 1939 | i++; |
|---|
| 1939 | 1940 | |
|---|
| 1940 | 1941 | if( p_child->i_children > 0 ) |
|---|
| 1941 | 1942 | { |
|---|
| 1942 | | sprintf( psz_tmp, "%s%c ", c, |
|---|
| 1943 | | k == p_node->i_children - 1 ? ' ' : '|' ); |
|---|
| | 1943 | char *psz_tmp; |
|---|
| | 1944 | if( asprintf( &psz_tmp, "%s%c ", c, |
|---|
| | 1945 | k == p_node->i_children - 1 ? ' ' : '|' ) == -1 ) |
|---|
| | 1946 | return; |
|---|
| 1944 | 1947 | PlaylistAddNode( p_intf, p_child, i, |
|---|
| 1945 | 1948 | strlen( c ) ? psz_tmp : " " ); |
|---|
| 1946 | | } |
|---|
| 1947 | | } |
|---|
| 1948 | | free( psz_tmp ); |
|---|
| | 1949 | free( psz_tmp ); |
|---|
| | 1950 | } |
|---|
| | 1951 | } |
|---|
| 1949 | 1952 | } |
|---|
| 1950 | 1953 | |
|---|