summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2005-01-01 14:27:28 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2005-01-01 14:27:28 +0000
commit6dda40124d32ab3d8247e57f13685d332d1598cb (patch)
treed0476e10d70176627db657a22b1fe2244c72ccdd /firmware
parent83f883b3bb2bf039693aea457703c6f1dce86d4c (diff)
downloadrockbox-6dda40124d32ab3d8247e57f13685d332d1598cb.tar.gz
rockbox-6dda40124d32ab3d8247e57f13685d332d1598cb.tar.bz2
rockbox-6dda40124d32ab3d8247e57f13685d332d1598cb.zip
volume names look better in sharp brackets, code slightly more compact
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5523 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/common/dir.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/firmware/common/dir.c b/firmware/common/dir.c
index 5fa5f9db6e..9f5f082b56 100644
--- a/firmware/common/dir.c
+++ b/firmware/common/dir.c
@@ -34,9 +34,11 @@ static DIR opendirs[MAX_OPEN_DIRS];
/* how to name volumes, first char must be outside of legal file names,
a number gets appended to enumerate, if applicable */
#ifdef HAVE_MMC
-static const char* vol_names = ":MMC";
+static const char* vol_names = "<MMC%d>";
+#define VOL_ENUM_POS 4 /* position of %d, to avoid runtime calculation */
#else
-static const char* vol_names = ":HD";
+static const char* vol_names = "<HD%d>";
+#define VOL_ENUM_POS 3
#endif
/* returns on which volume this is, and copies the reduced name
@@ -45,10 +47,10 @@ static int strip_volume(const char* name, char* namecopy)
{
int volume = 0;
- if (name[1] == vol_names[0] ) /* a colon identifies our volumes */
+ if (name[1] == vol_names[0] ) /* a '<' quickly identifies our volumes */
{
const char* temp;
- temp = name + 1 + strlen(vol_names); /* behind special name */
+ temp = name + 1 + VOL_ENUM_POS; /* behind '/' and special name */
volume = atoi(temp); /* number is following */
temp = strchr(temp, '/'); /* search for slash behind */
if (temp != NULL)
@@ -167,7 +169,7 @@ struct dirent* readdir(DIR* dir)
memset(theent, 0, sizeof(*theent));
theent->attribute = FAT_ATTR_DIRECTORY | FAT_ATTR_VOLUME;
snprintf(theent->d_name, sizeof(theent->d_name),
- "%s%d", vol_names, dir->volumecounter);
+ vol_names, dir->volumecounter);
return theent;
}
}