aboutsummaryrefslogtreecommitdiff
path: root/src/UpdateArchive.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-29 21:11:04 +0100
committerMax Kellermann <max@duempel.org>2013-01-29 21:11:04 +0100
commita42f9fd4e2ccb164c0634571da9903e6a2aa507a (patch)
tree104cd2ac6598f1529f03e18c8f77135998b1a55d /src/UpdateArchive.cxx
parente66005563efb24cdeb0c034a680f6a5556265c09 (diff)
ArchivePlugin: scan_next() returns const string
Diffstat (limited to 'src/UpdateArchive.cxx')
-rw-r--r--src/UpdateArchive.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/UpdateArchive.cxx b/src/UpdateArchive.cxx
index 3088e942..5da212e9 100644
--- a/src/UpdateArchive.cxx
+++ b/src/UpdateArchive.cxx
@@ -33,17 +33,19 @@
#include <string.h>
static void
-update_archive_tree(Directory *directory, char *name)
+update_archive_tree(Directory *directory, const char *name)
{
- char *tmp = strchr(name, '/');
+ const char *tmp = strchr(name, '/');
if (tmp) {
- *tmp = 0;
+ char *child_name = g_strndup(name, tmp - name);
//add dir is not there already
db_lock();
Directory *subdir =
- directory->MakeChild(name);
+ directory->MakeChild(child_name);
subdir->device = DEVICE_INARCHIVE;
db_unlock();
+ g_free(child_name);
+
//create directories first
update_archive_tree(subdir, tmp+1);
} else {
@@ -122,7 +124,7 @@ update_archive_file2(Directory *parent, const char *name,
archive_file_scan_reset(file);
- char *filepath;
+ const char *filepath;
while ((filepath = archive_file_scan_next(file)) != NULL) {
/* split name into directory and file */
g_debug("adding archive file: %s", filepath);