archive/Lookup: pass const pointer
This commit is contained in:
@@ -25,30 +25,22 @@
|
||||
#include "../InputStream.hxx"
|
||||
#include "fs/Path.hxx"
|
||||
#include "Log.hxx"
|
||||
#include "util/ScopeExit.hxx"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
InputStreamPtr
|
||||
OpenArchiveInputStream(Path path, Mutex &mutex)
|
||||
{
|
||||
const ArchivePlugin *arplug;
|
||||
|
||||
char *pname = strdup(path.c_str());
|
||||
AtScopeExit(pname) {
|
||||
free(pname);
|
||||
};
|
||||
|
||||
// archive_lookup will modify pname when true is returned
|
||||
ArchiveLookupResult l;
|
||||
try {
|
||||
l = archive_lookup(pname);
|
||||
l = archive_lookup(path.c_str());
|
||||
if (l.archive.IsNull()) {
|
||||
return nullptr;
|
||||
}
|
||||
} catch (...) {
|
||||
LogFormat(LogLevel::DEBUG, std::current_exception(),
|
||||
"not an archive, lookup %s failed", pname);
|
||||
"not an archive, lookup %s failed", path.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user