diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2009-11-26 22:34:08 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2009-11-26 22:34:08 +0000 |
commit | d7d3bc248f53c504c591850ce955d899c6ab4c2d (patch) | |
tree | d1f70499c019cc61cdddeaea862f902470154236 | |
parent | 7ccff054ff7531cdbacdf912649e31d55c73ca8b (diff) | |
download | rockbox-d7d3bc248f53c504c591850ce955d899c6ab4c2d.tar.gz rockbox-d7d3bc248f53c504c591850ce955d899c6ab4c2d.zip |
Move strip_volume() to filefuncs.c and set properties.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23767 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/bookmark.c | 1 | ||||
-rw-r--r-- | firmware/SOURCES | 2 | ||||
-rw-r--r-- | firmware/common/dir_uncached.c | 1 | ||||
-rw-r--r-- | firmware/common/file.c | 1 | ||||
-rw-r--r-- | firmware/common/filefuncs.c | 52 | ||||
-rw-r--r-- | firmware/export/filefuncs.h | 31 |
6 files changed, 87 insertions, 1 deletions
diff --git a/apps/bookmark.c b/apps/bookmark.c index cee9abdfa8..7d29c4f8f9 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include "plugin.h" | 42 | #include "plugin.h" |
43 | #include "backdrop.h" | 43 | #include "backdrop.h" |
44 | #include "file.h" | 44 | #include "file.h" |
45 | #include "filefuncs.h" | ||
45 | 46 | ||
46 | #define MAX_BOOKMARKS 10 | 47 | #define MAX_BOOKMARKS 10 |
47 | #define MAX_BOOKMARK_SIZE 350 | 48 | #define MAX_BOOKMARK_SIZE 350 |
diff --git a/firmware/SOURCES b/firmware/SOURCES index baba51ca20..061c6323c8 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -39,9 +39,9 @@ common/disk.c | |||
39 | #if !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__) | 39 | #if !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__) |
40 | common/errno.c | 40 | common/errno.c |
41 | #endif /* !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__) */ | 41 | #endif /* !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__) */ |
42 | common/filefuncs.c | ||
42 | common/memcmp.c | 43 | common/memcmp.c |
43 | common/memchr.c | 44 | common/memchr.c |
44 | common/misc.c | ||
45 | common/qsort.c | 45 | common/qsort.c |
46 | common/random.c | 46 | common/random.c |
47 | common/sprintf.c | 47 | common/sprintf.c |
diff --git a/firmware/common/dir_uncached.c b/firmware/common/dir_uncached.c index ef9ce6f0af..5ec5c7fb41 100644 --- a/firmware/common/dir_uncached.c +++ b/firmware/common/dir_uncached.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include "fat.h" | 26 | #include "fat.h" |
27 | #include "dir.h" | 27 | #include "dir.h" |
28 | #include "debug.h" | 28 | #include "debug.h" |
29 | #include "filefuncs.h" | ||
29 | 30 | ||
30 | #if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) | 31 | #if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) |
31 | #define MAX_OPEN_DIRS 12 | 32 | #define MAX_OPEN_DIRS 12 |
diff --git a/firmware/common/file.c b/firmware/common/file.c index b7bcbaba46..a7facc3d32 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include "dir_uncached.h" | 26 | #include "dir_uncached.h" |
27 | #include "debug.h" | 27 | #include "debug.h" |
28 | #include "dircache.h" | 28 | #include "dircache.h" |
29 | #include "filefuncs.h" | ||
29 | #include "system.h" | 30 | #include "system.h" |
30 | 31 | ||
31 | /* | 32 | /* |
diff --git a/firmware/common/filefuncs.c b/firmware/common/filefuncs.c new file mode 100644 index 0000000000..ca9113250a --- /dev/null +++ b/firmware/common/filefuncs.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Björn Stenberg | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "config.h" | ||
22 | #include "dir.h" | ||
23 | #include "stdlib.h" | ||
24 | #include "string.h" | ||
25 | |||
26 | #ifdef HAVE_MULTIVOLUME | ||
27 | /* returns on which volume this is, and copies the reduced name | ||
28 | (sortof a preprocessor for volume-decorated pathnames) */ | ||
29 | int strip_volume(const char* name, char* namecopy) | ||
30 | { | ||
31 | int volume = 0; | ||
32 | const char *temp = name; | ||
33 | |||
34 | while (*temp == '/') /* skip all leading slashes */ | ||
35 | ++temp; | ||
36 | |||
37 | if (*temp && !strncmp(temp, VOL_NAMES, VOL_ENUM_POS)) | ||
38 | { | ||
39 | temp += VOL_ENUM_POS; /* behind special name */ | ||
40 | volume = atoi(temp); /* number is following */ | ||
41 | temp = strchr(temp, '/'); /* search for slash behind */ | ||
42 | if (temp != NULL) | ||
43 | name = temp; /* use the part behind the volume */ | ||
44 | else | ||
45 | name = "/"; /* else this must be the root dir */ | ||
46 | } | ||
47 | |||
48 | strlcpy(namecopy, name, MAX_PATH); | ||
49 | |||
50 | return volume; | ||
51 | } | ||
52 | #endif /* #ifdef HAVE_MULTIVOLUME */ | ||
diff --git a/firmware/export/filefuncs.h b/firmware/export/filefuncs.h new file mode 100644 index 0000000000..130c5ff4be --- /dev/null +++ b/firmware/export/filefuncs.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Maurus Cuelenaere | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #ifndef __INCLUDE_FILEFUNCS_H_ | ||
23 | #define __INCLUDE_FILEFUNCS_H_ | ||
24 | |||
25 | #include "config.h" | ||
26 | |||
27 | #ifdef HAVE_MULTIVOLUME | ||
28 | int strip_volume(const char* name, char* namecopy); | ||
29 | #endif | ||
30 | |||
31 | #endif /* __INCLUDE_FILEFUNCS_H_ */ | ||