ArchiveLookup: return const strings

This commit is contained in:
Max Kellermann
2013-10-17 00:35:58 +02:00
parent e132d10aec
commit 1b8a1d4140
4 changed files with 12 additions and 8 deletions

View File

@@ -29,7 +29,9 @@
#include <unistd.h>
#include <errno.h>
bool archive_lookup(char *pathname, char **archive, char **inpath, char **suffix)
bool
archive_lookup(char *pathname, const char **archive,
const char **inpath, const char **suffix)
{
char *pathdupe;
int len, idx;

View File

@@ -37,7 +37,9 @@
* inarchive pathname: Talco - Combat Circus/12 - A la pachenka.mp3
* and suffix: zip
*/
bool archive_lookup(char *pathname, char **archive, char **inpath, char **suffix);
bool
archive_lookup(char *pathname, const char **archive,
const char **inpath, const char **suffix);
#endif

View File

@@ -45,14 +45,14 @@ input_archive_open(const char *pathname,
Error &error)
{
const struct archive_plugin *arplug;
char *archive, *filename, *suffix, *pname;
struct input_stream *is;
if (!Path::IsAbsoluteFS(pathname))
return NULL;
pname = g_strdup(pathname);
char *pname = g_strdup(pathname);
// archive_lookup will modify pname when true is returned
const char *archive, *filename, *suffix;
if (!archive_lookup(pname, &archive, &filename, &suffix)) {
FormatDebug(archive_domain,
"not an archive, lookup %s failed", pname);