diff options
Diffstat (limited to 'src/UpdateWalk.cxx')
-rw-r--r-- | src/UpdateWalk.cxx | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/UpdateWalk.cxx b/src/UpdateWalk.cxx index d4586456b..fa3611b1b 100644 --- a/src/UpdateWalk.cxx +++ b/src/UpdateWalk.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 The Music Player Daemon Project + * Copyright (C) 2003-2014 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -38,16 +38,12 @@ #include "fs/Traits.hxx" #include "fs/FileSystem.hxx" #include "fs/DirectoryReader.hxx" +#include "util/Alloc.hxx" #include "util/UriUtil.hxx" #include "Log.hxx" -#include <glib.h> - #include <assert.h> -#include <sys/types.h> #include <sys/stat.h> -#include <unistd.h> -#include <dirent.h> #include <string.h> #include <stdlib.h> #include <errno.h> @@ -294,7 +290,7 @@ skip_symlink(const Directory *directory, const char *utf8_name) const char *target_str = target.c_str(); - if (PathTraits::IsAbsoluteFS(target_str)) { + if (PathTraitsFS::IsAbsolute(target_str)) { /* if the symlink points to an absolute path, see if that path is inside the music directory */ const char *relative = map_to_relative_path(target_str); @@ -305,7 +301,7 @@ skip_symlink(const Directory *directory, const char *utf8_name) const char *p = target_str; while (*p == '.') { - if (p[1] == '.' && PathTraits::IsSeparatorFS(p[2])) { + if (p[1] == '.' && PathTraitsFS::IsSeparator(p[2])) { /* "../" moves to parent directory */ directory = directory->parent; if (directory == nullptr) { @@ -315,7 +311,7 @@ skip_symlink(const Directory *directory, const char *utf8_name) return !follow_outside_symlinks; } p += 3; - } else if (PathTraits::IsSeparatorFS(p[1])) + } else if (PathTraitsFS::IsSeparator(p[1])) /* eliminate "./" */ p += 2; else @@ -430,7 +426,7 @@ static Directory * directory_make_uri_parent_checked(const char *uri) { Directory *directory = db_get_root(); - char *duplicated = g_strdup(uri); + char *duplicated = xstrdup(uri); char *name_utf8 = duplicated, *slash; while ((slash = strchr(name_utf8, '/')) != nullptr) { @@ -447,7 +443,7 @@ directory_make_uri_parent_checked(const char *uri) name_utf8 = slash + 1; } - g_free(duplicated); + free(duplicated); return directory; } @@ -458,7 +454,7 @@ update_uri(const char *uri) if (parent == nullptr) return; - const char *name = PathTraits::GetBaseUTF8(uri); + const char *name = PathTraitsUTF8::GetBase(uri); struct stat st; if (!skip_symlink(parent, name) && |