comparison sub/subreader.c @ 32706:7a79424a81ac

Rename strcpy_strip_ext to strcpy_strip_ext_lower. strcpy_strip_ext is another function I will need.
author cboesch
date Mon, 17 Jan 2011 19:45:40 +0000
parents 98ddd06f0e9b
children 732cd2afae10
comparison
equal deleted inserted replaced
32705:d39425c8fe53 32706:7a79424a81ac
1845 return; 1845 return;
1846 } else { 1846 } else {
1847 strncpy(d, s, tmp-s); 1847 strncpy(d, s, tmp-s);
1848 d[tmp-s] = 0; 1848 d[tmp-s] = 0;
1849 } 1849 }
1850 }
1851
1852 static void strcpy_strip_ext_lower(char *d, const char *s)
1853 {
1854 strcpy_strip_ext(d, s);
1850 while (*d) { 1855 while (*d) {
1851 *d = tolower(*d); 1856 *d = tolower(*d);
1852 d++; 1857 d++;
1853 } 1858 }
1854 } 1859 }
1927 tmp_fname_trim = malloc(len); 1932 tmp_fname_trim = malloc(len);
1928 tmp_fname_ext = malloc(len); 1933 tmp_fname_ext = malloc(len);
1929 1934
1930 tmpresult = malloc(len); 1935 tmpresult = malloc(len);
1931 1936
1932 strcpy_strip_ext(f_fname_noext, f_fname); 1937 strcpy_strip_ext_lower(f_fname_noext, f_fname);
1933 strcpy_trim(f_fname_trim, f_fname_noext); 1938 strcpy_trim(f_fname_trim, f_fname_noext);
1934 1939
1935 tmp_sub_id = NULL; 1940 tmp_sub_id = NULL;
1936 if (dvdsub_lang && !whiteonly(dvdsub_lang)) { 1941 if (dvdsub_lang && !whiteonly(dvdsub_lang)) {
1937 tmp_sub_id = malloc(strlen(dvdsub_lang)+1); 1942 tmp_sub_id = malloc(strlen(dvdsub_lang)+1);
1945 d = opendir(path); 1950 d = opendir(path);
1946 if (d) { 1951 if (d) {
1947 mp_msg(MSGT_SUBREADER, MSGL_INFO, "Load subtitles in %s\n", path); 1952 mp_msg(MSGT_SUBREADER, MSGL_INFO, "Load subtitles in %s\n", path);
1948 while ((de = readdir(d))) { 1953 while ((de = readdir(d))) {
1949 // retrieve various parts of the filename 1954 // retrieve various parts of the filename
1950 strcpy_strip_ext(tmp_fname_noext, de->d_name); 1955 strcpy_strip_ext_lower(tmp_fname_noext, de->d_name);
1951 strcpy_get_ext(tmp_fname_ext, de->d_name); 1956 strcpy_get_ext(tmp_fname_ext, de->d_name);
1952 strcpy_trim(tmp_fname_trim, tmp_fname_noext); 1957 strcpy_trim(tmp_fname_trim, tmp_fname_noext);
1953 1958
1954 // does it end with a subtitle extension? 1959 // does it end with a subtitle extension?
1955 found = 0; 1960 found = 0;