From 6dda40124d32ab3d8247e57f13685d332d1598cb Mon Sep 17 00:00:00 2001 From: Jörg Hohensohn Date: Sat, 1 Jan 2005 14:27:28 +0000 Subject: 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 --- firmware/common/dir.c | 12 +++++++----- 1 file 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 = ""; +#define VOL_ENUM_POS 4 /* position of %d, to avoid runtime calculation */ #else -static const char* vol_names = ":HD"; +static const char* vol_names = ""; +#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; } } -- cgit