diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2012-02-17 14:02:13 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2012-02-17 14:02:13 +0100 |
commit | 882691e32f4b2488aa23e0844cc6185cd89e3301 (patch) | |
tree | cc790e849dea3586c4d959919d8a6731995c03f4 /themes.c | |
parent | f1eecdeb1c10e51a85a33ed41aacd34a9e2353f0 (diff) | |
download | vdr-882691e32f4b2488aa23e0844cc6185cd89e3301.tar.gz vdr-882691e32f4b2488aa23e0844cc6185cd89e3301.tar.bz2 |
cReadDir::Next() now skips directory entries "." and ".."
Diffstat (limited to 'themes.c')
-rw-r--r-- | themes.c | 60 |
1 files changed, 29 insertions, 31 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: themes.c 2.1 2011/02/25 14:45:18 kls Exp $ + * $Id: themes.c 2.2 2012/02/17 13:57:32 kls Exp $ */ #include "themes.h" @@ -243,37 +243,35 @@ bool cThemes::Load(const char *SkinName) cReadDir d(themesDirectory); struct dirent *e; while ((e = d.Next()) != NULL) { - if (strcmp(e->d_name, ".") && strcmp(e->d_name, "..")) { - if (strstr(e->d_name, SkinName) == e->d_name && e->d_name[strlen(SkinName)] == '-') { - cString FileName = AddDirectory(themesDirectory, e->d_name); - cTheme Theme; - if (Theme.Load(*FileName, true)) { - if (char **NewBuffer = (char **)realloc(names, (numThemes + 1) * sizeof(char *))) { - names = NewBuffer; - names[numThemes] = strdup(Theme.Name()); - } - else { - esyslog("ERROR: out of memory"); - break; - } - if (char **NewBuffer = (char **)realloc(fileNames, (numThemes + 1) * sizeof(char *))) { - fileNames = NewBuffer; - fileNames[numThemes] = strdup(*FileName); - } - else { - esyslog("ERROR: out of memory"); - break; - } - if (char **NewBuffer = (char **)realloc(descriptions, (numThemes + 1) * sizeof(char *))) { - descriptions = NewBuffer; - descriptions[numThemes] = strdup(Theme.Description()); - } - else { - esyslog("ERROR: out of memory"); - break; - } - numThemes++; + if (strstr(e->d_name, SkinName) == e->d_name && e->d_name[strlen(SkinName)] == '-') { + cString FileName = AddDirectory(themesDirectory, e->d_name); + cTheme Theme; + if (Theme.Load(*FileName, true)) { + if (char **NewBuffer = (char **)realloc(names, (numThemes + 1) * sizeof(char *))) { + names = NewBuffer; + names[numThemes] = strdup(Theme.Name()); + } + else { + esyslog("ERROR: out of memory"); + break; + } + if (char **NewBuffer = (char **)realloc(fileNames, (numThemes + 1) * sizeof(char *))) { + fileNames = NewBuffer; + fileNames[numThemes] = strdup(*FileName); + } + else { + esyslog("ERROR: out of memory"); + break; + } + if (char **NewBuffer = (char **)realloc(descriptions, (numThemes + 1) * sizeof(char *))) { + descriptions = NewBuffer; + descriptions[numThemes] = strdup(Theme.Description()); + } + else { + esyslog("ERROR: out of memory"); + break; } + numThemes++; } } } |