summaryrefslogtreecommitdiff
path: root/tools.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2007-06-17 11:12:46 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2007-06-17 11:12:46 +0200
commit79b1c68ffbe11ada50d8e288efc0255eba268185 (patch)
tree1ef8d5b8f3e6c6c993660742060fd47d92926cdc /tools.c
parentb1e0df2b27d8944dbe9f735a2bc09411490d5345 (diff)
downloadvdr-79b1c68ffbe11ada50d8e288efc0255eba268185.tar.gz
vdr-79b1c68ffbe11ada50d8e288efc0255eba268185.tar.bz2
Now using 'fontconfig' to determine which fonts to use
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/tools.c b/tools.c
index 0faf1ea2..dd2395ad 100644
--- a/tools.c
+++ b/tools.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.c 1.128 2007/06/16 09:22:40 kls Exp $
+ * $Id: tools.c 1.129 2007/06/17 11:02:34 kls Exp $
*/
#include "tools.h"
@@ -1136,21 +1136,39 @@ struct dirent *cReadDir::Next(void)
return directory && readdir_r(directory, &u.d, &result) == 0 ? result : NULL;
}
-// --- cFileNameList ---------------------------------------------------------
+// --- cStringList -----------------------------------------------------------
-cFileNameList::cFileNameList(const char *Directory)
+cStringList::~cStringList()
{
- Load(Directory);
+ Clear();
}
-cFileNameList::~cFileNameList()
+int cStringList::Find(const char *s) const
+{
+ for (int i = 0; i < Size(); i++) {
+ if (!strcmp(s, At(i)))
+ return i;
+ }
+ return -1;
+}
+
+void cStringList::Clear(void)
{
for (int i = 0; i < Size(); i++)
free(At(i));
}
+// --- cFileNameList ---------------------------------------------------------
+
+// TODO better GetFileNames(const char *Directory, cStringList *List)?
+cFileNameList::cFileNameList(const char *Directory)
+{
+ Load(Directory);
+}
+
bool cFileNameList::Load(const char *Directory)
{
+ Clear();
if (Directory) {
cReadDir d(Directory);
struct dirent *e;
@@ -1159,7 +1177,7 @@ bool cFileNameList::Load(const char *Directory)
if (strcmp(e->d_name, ".") && strcmp(e->d_name, ".."))
Append(strdup(e->d_name));
}
- Sort(CompareStrings);
+ Sort();
return true;
}
else
@@ -1168,15 +1186,6 @@ bool cFileNameList::Load(const char *Directory)
return false;
}
-int cFileNameList::Find(const char *FileName)
-{
- for (int i = 0; i < Size(); i++) {
- if (!strcmp(FileName, At(i)))
- return i;
- }
- return -1;
-}
-
// --- cFile -----------------------------------------------------------------
bool cFile::files[FD_SETSIZE] = { false };