Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Issue 1625 - Option for Windows-compatible filenames - trim trailing …
…spaces and dots, fixes #1625
  • Loading branch information
dgolda authored and perexg committed Jan 12, 2015
1 parent 028826b commit 0196790
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/dvr/dvr_rec.c
Expand Up @@ -134,7 +134,7 @@ dvr_rec_unsubscribe(dvr_entry_t *de, int stopcode)
static char *
cleanup_filename(char *s, dvr_config_t *cfg)
{
int i, len = strlen(s);
int i, len = strlen(s), len2;
char *s1;

s1 = intlconv_utf8safestr(cfg->dvr_charset_id, s, len * 2);
Expand All @@ -151,7 +151,7 @@ cleanup_filename(char *s, dvr_config_t *cfg)
if (s[0] == '.')
s[0] = '_';

int len2 = strlen(s);
len2 = strlen(s);
for (i = 0; i < len2; i++) {

if(s[i] == '/')
Expand All @@ -171,14 +171,11 @@ cleanup_filename(char *s, dvr_config_t *cfg)
}

if(cfg->dvr_windows_compatible_filenames) {
//trim trailing spaces and dots
// trim trailing spaces and dots
for (i = len2 - 1; i >= 0; i--) {
if((s[i] == ' ') || (s[i] == '.')) {
s[i] = '\0';
}
else {
break;
}
if((s[i] != ' ') && (s[i] != '.'))
break;
s[i] = '\0';
}
}

Expand Down

0 comments on commit 0196790

Please sign in to comment.