From 74da2c7de98bd723c856ff045d4b1f160ce58315 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Thu, 4 May 2017 11:54:45 +0200 Subject: [PATCH] src: fixes for FilePath refactoring on clang --- src/lib/data/PersistentStorage.cpp | 6 +++--- src/lib_gui/platform_includes/includesMac.h | 8 ++++---- src/test/FileSystemTestSuite.h | 4 ++-- src/test/SqliteBookmarkStorageTestSuite.h | 13 ++++++------- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/lib/data/PersistentStorage.cpp b/src/lib/data/PersistentStorage.cpp index 4b7483ca..80cf49cb 100644 --- a/src/lib/data/PersistentStorage.cpp +++ b/src/lib/data/PersistentStorage.cpp @@ -2074,9 +2074,9 @@ void PersistentStorage::buildFilePathMaps() for (StorageFile file: m_sqliteIndexStorage.getAll()) { - m_fileNodeIds.emplace(file.filePath, file.id); - m_fileNodePaths.emplace(file.id, file.filePath); - m_fileNodeComplete.emplace(file.filePath, file.complete); + m_fileNodeIds.emplace(FilePath(file.filePath), file.id); + m_fileNodePaths.emplace(file.id, FilePath(file.filePath)); + m_fileNodeComplete.emplace(FilePath(file.filePath), file.complete); } } diff --git a/src/lib_gui/platform_includes/includesMac.h b/src/lib_gui/platform_includes/includesMac.h index fc775d93..eb0f713f 100644 --- a/src/lib_gui/platform_includes/includesMac.h +++ b/src/lib_gui/platform_includes/includesMac.h @@ -56,7 +56,7 @@ void setupPlatform(int argc, char *argv[]) // ---------------------------------------------------------------------------- // Makes the mac bundle copy the user files to the Application Support folder QString dataPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation); - QString oldDataPath = QString::fromStdString(ResourcePaths::getFallbackPath()); + QString oldDataPath = QString::fromStdString(ResourcePaths::getFallbackPath().str()); QDir dataDir(dataPath); if (!dataDir.exists()) @@ -78,7 +78,7 @@ void setupPlatform(int argc, char *argv[]) utility::copyNewFilesFromDirectory(oldDataPath, dataPath); - UserPaths::setUserDataPath(dataPath.toStdString() + "/"); + UserPaths::setUserDataPath(FilePath(dataPath.toStdString() + "/")); // ---------------------------------------------------------------------------- appIsMacBundle = true; @@ -91,11 +91,11 @@ void setupApp(int argc, char *argv[]) if (!appIsMacBundle) { - UserPaths::setUserDataPath(path.absolute().str() + "/user/"); + UserPaths::setUserDataPath(FilePath(path.absolute().str() + "/user/")); } else { - UserPaths::setSampleProjectsPath(path.absolute().str() + "/data/"); + UserPaths::setSampleProjectsPath(FilePath(path.absolute().str() + "/data/")); } } diff --git a/src/test/FileSystemTestSuite.h b/src/test/FileSystemTestSuite.h index 0e06d85a..00714060 100644 --- a/src/test/FileSystemTestSuite.h +++ b/src/test/FileSystemTestSuite.h @@ -61,7 +61,7 @@ public: extensions.push_back(".cpp"); std::vector directoryPaths; - directoryPaths.push_back("./data/FileSystemTestSuite/src"); + directoryPaths.push_back(FilePath("./data/FileSystemTestSuite/src")); std::vector files = FileSystem::getFileInfosFromPaths(directoryPaths, extensions, false); @@ -80,7 +80,7 @@ public: extensions.push_back(".cpp"); std::vector directoryPaths; - directoryPaths.push_back("./data/FileSystemTestSuite/src"); + directoryPaths.push_back(FilePath("./data/FileSystemTestSuite/src")); std::vector files = FileSystem::getFileInfosFromPaths(directoryPaths, extensions, true); diff --git a/src/test/SqliteBookmarkStorageTestSuite.h b/src/test/SqliteBookmarkStorageTestSuite.h index 2c552de7..8dee687d 100644 --- a/src/test/SqliteBookmarkStorageTestSuite.h +++ b/src/test/SqliteBookmarkStorageTestSuite.h @@ -12,14 +12,14 @@ public: void test_add_bookmarks() { FilePath databasePath("data/SQLiteTestSuite/bookmarkTest.sqlite"); - int bookmarkCount = 4; + size_t bookmarkCount = 4; int result = -1; { boost::filesystem::remove(databasePath.path()); SqliteBookmarkStorage storage(databasePath); storage.setup(); - for (unsigned int i = 0; i < bookmarkCount; i++) + for (size_t i = 0; i < bookmarkCount; i++) { const Id categoryId = storage.addBookmarkCategory("test category"); storage.addBookmark("test bookmark", "test comment", TimePoint::now().toString(), categoryId); @@ -36,7 +36,7 @@ public: void test_add_bookmarked_node() { FilePath databasePath("data/SQLiteTestSuite/bookmarkTest.sqlite"); - int bookmarkCount = 4; + size_t bookmarkCount = 4; int result = -1; { boost::filesystem::remove(databasePath.path()); @@ -46,7 +46,7 @@ public: const Id categoryId = storage.addBookmarkCategory("test category"); const Id bookmarkId = storage.addBookmark("test bookmark", "test comment", TimePoint::now().toString(), categoryId); - for (unsigned int i = 0; i < bookmarkCount; i++) + for (size_t i = 0; i < bookmarkCount; i++) { storage.addBookmarkedNode(bookmarkId, "test name"); } @@ -62,7 +62,6 @@ public: void test_remove_bookmark_also_removes_bookmarked_node() { FilePath databasePath("data/SQLiteTestSuite/bookmarkTest.sqlite"); - int bookmarkCount = 4; int result = -1; { boost::filesystem::remove(databasePath.path()); @@ -71,7 +70,7 @@ public: const Id categoryId = storage.addBookmarkCategory("test category"); const Id bookmarkId = storage.addBookmark("test bookmark", "test comment", TimePoint::now().toString(), categoryId); - const Id bookmarkedNodeId = storage.addBookmarkedNode(bookmarkId, "test name"); + storage.addBookmarkedNode(bookmarkId, "test name"); storage.removeBookmark(bookmarkId); @@ -98,7 +97,7 @@ public: const Id categoryId = storage.addBookmarkCategory("test category"); const Id bookmarkId = storage.addBookmark("test bookmark", "test comment", TimePoint::now().toString(), categoryId); - const Id bookmarkedNodeId = storage.addBookmarkedNode(bookmarkId, "test name"); + storage.addBookmarkedNode(bookmarkId, "test name"); storage.updateBookmark(bookmarkId, updatedName, updatedComment, categoryId);