diff options
-rwxr-xr-x | chrome/browser/sync/engine/conflict_resolver.cc | 1 | ||||
-rwxr-xr-x | chrome/browser/sync/engine/syncer_util.cc | 1 | ||||
-rwxr-xr-x | chrome/browser/sync/engine/syncer_util.h | 1 | ||||
-rwxr-xr-x | chrome/browser/sync/syncable/directory_backing_store.cc | 1 | ||||
-rw-r--r-- | chrome/browser/sync/syncable/directory_manager.cc | 1 | ||||
-rwxr-xr-x | chrome/browser/sync/syncable/syncable.cc | 1 | ||||
-rwxr-xr-x | chrome/browser/sync/syncable/syncable.h | 1 | ||||
-rwxr-xr-x | chrome/browser/sync/syncable/syncable_unittest.cc | 1 | ||||
-rw-r--r-- | chrome/browser/sync/util/path_helpers.cc | 7 | ||||
-rw-r--r-- | chrome/browser/sync/util/path_helpers_linux.cc | 10 | ||||
-rw-r--r-- | chrome/browser/sync/util/path_helpers_mac.cc | 10 | ||||
-rw-r--r-- | chrome/browser/sync/util/path_helpers_posix.cc | 22 | ||||
-rw-r--r-- | chrome/browser/sync/util/path_helpers_unittest.cc | 81 | ||||
-rw-r--r-- | chrome/browser/sync/util/path_helpers_win.cc | 85 | ||||
-rw-r--r-- | chrome/browser/sync/util/user_settings.cc | 1 | ||||
-rwxr-xr-x | chrome/chrome.gyp | 7 |
16 files changed, 0 insertions, 231 deletions
diff --git a/chrome/browser/sync/engine/conflict_resolver.cc b/chrome/browser/sync/engine/conflict_resolver.cc index 11aeff2..106ecf0c 100755 --- a/chrome/browser/sync/engine/conflict_resolver.cc +++ b/chrome/browser/sync/engine/conflict_resolver.cc @@ -15,7 +15,6 @@ #include "chrome/browser/sync/syncable/syncable.h" #include "chrome/browser/sync/util/character_set_converters.h" #include "chrome/browser/sync/util/event_sys-inl.h" -#include "chrome/browser/sync/util/path_helpers.h" using std::map; using std::set; diff --git a/chrome/browser/sync/engine/syncer_util.cc b/chrome/browser/sync/engine/syncer_util.cc index e3ac42e..d0e9cb3 100755 --- a/chrome/browser/sync/engine/syncer_util.cc +++ b/chrome/browser/sync/engine/syncer_util.cc @@ -15,7 +15,6 @@ #include "chrome/browser/sync/syncable/directory_manager.h" #include "chrome/browser/sync/syncable/syncable.h" #include "chrome/browser/sync/syncable/syncable_changes_version.h" -#include "chrome/browser/sync/util/path_helpers.h" #include "chrome/browser/sync/util/sync_types.h" using syncable::BASE_VERSION; diff --git a/chrome/browser/sync/engine/syncer_util.h b/chrome/browser/sync/engine/syncer_util.h index de0222a..015c0b0 100755 --- a/chrome/browser/sync/engine/syncer_util.h +++ b/chrome/browser/sync/engine/syncer_util.h @@ -17,7 +17,6 @@ #include "chrome/browser/sync/engine/syncer_types.h" #include "chrome/browser/sync/syncable/syncable.h" #include "chrome/browser/sync/syncable/syncable_id.h" -#include "chrome/browser/sync/util/path_helpers.h" #include "chrome/browser/sync/util/sync_types.h" namespace browser_sync { diff --git a/chrome/browser/sync/syncable/directory_backing_store.cc b/chrome/browser/sync/syncable/directory_backing_store.cc index a223e84..7093043 100755 --- a/chrome/browser/sync/syncable/directory_backing_store.cc +++ b/chrome/browser/sync/syncable/directory_backing_store.cc @@ -16,7 +16,6 @@ #include "chrome/browser/sync/syncable/syncable-inl.h" #include "chrome/browser/sync/syncable/syncable_columns.h" #include "chrome/browser/sync/util/crypto_helpers.h" -#include "chrome/browser/sync/util/path_helpers.h" #include "chrome/browser/sync/util/query_helpers.h" #include "third_party/sqlite/preprocessed/sqlite3.h" diff --git a/chrome/browser/sync/syncable/directory_manager.cc b/chrome/browser/sync/syncable/directory_manager.cc index be3ed0a..ec0d520 100644 --- a/chrome/browser/sync/syncable/directory_manager.cc +++ b/chrome/browser/sync/syncable/directory_manager.cc @@ -13,7 +13,6 @@ #include "base/scoped_ptr.h" #include "chrome/browser/sync/syncable/syncable.h" #include "chrome/browser/sync/util/event_sys-inl.h" -#include "chrome/browser/sync/util/path_helpers.h" namespace syncable { diff --git a/chrome/browser/sync/syncable/syncable.cc b/chrome/browser/sync/syncable/syncable.cc index 960f0fa..179437e 100755 --- a/chrome/browser/sync/syncable/syncable.cc +++ b/chrome/browser/sync/syncable/syncable.cc @@ -44,7 +44,6 @@ #include "chrome/browser/sync/util/crypto_helpers.h" #include "chrome/browser/sync/util/event_sys-inl.h" #include "chrome/browser/sync/util/fast_dump.h" -#include "chrome/browser/sync/util/path_helpers.h" namespace { enum InvariantCheckLevel { diff --git a/chrome/browser/sync/syncable/syncable.h b/chrome/browser/sync/syncable/syncable.h index db3f62c..ed71971 100755 --- a/chrome/browser/sync/syncable/syncable.h +++ b/chrome/browser/sync/syncable/syncable.h @@ -25,7 +25,6 @@ #include "chrome/browser/sync/syncable/syncable_id.h" #include "chrome/browser/sync/util/dbgq.h" #include "chrome/browser/sync/util/event_sys.h" -#include "chrome/browser/sync/util/path_helpers.h" #include "chrome/browser/sync/util/row_iterator.h" #include "chrome/browser/sync/util/sync_types.h" diff --git a/chrome/browser/sync/syncable/syncable_unittest.cc b/chrome/browser/sync/syncable/syncable_unittest.cc index e5fe998..8b33c96 100755 --- a/chrome/browser/sync/syncable/syncable_unittest.cc +++ b/chrome/browser/sync/syncable/syncable_unittest.cc @@ -39,7 +39,6 @@ #include "chrome/browser/sync/syncable/directory_manager.h" #include "chrome/browser/sync/util/closure.h" #include "chrome/browser/sync/util/event_sys-inl.h" -#include "chrome/browser/sync/util/path_helpers.h" #include "chrome/browser/sync/util/query_helpers.h" #include "chrome/test/sync/engine/test_id_factory.h" #include "chrome/test/sync/engine/test_syncable_utils.h" diff --git a/chrome/browser/sync/util/path_helpers.cc b/chrome/browser/sync/util/path_helpers.cc index e947e21..e69de29 100644 --- a/chrome/browser/sync/util/path_helpers.cc +++ b/chrome/browser/sync/util/path_helpers.cc @@ -1,7 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/sync/util/path_helpers.h" - -const char kPathSeparator[] = "/"; diff --git a/chrome/browser/sync/util/path_helpers_linux.cc b/chrome/browser/sync/util/path_helpers_linux.cc index c256d5c..e69de29 100644 --- a/chrome/browser/sync/util/path_helpers_linux.cc +++ b/chrome/browser/sync/util/path_helpers_linux.cc @@ -1,10 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/port.h" -#include "chrome/browser/sync/util/path_helpers.h" - -#ifndef OS_LINUX -#error Compile this file on Linux only. -#endif diff --git a/chrome/browser/sync/util/path_helpers_mac.cc b/chrome/browser/sync/util/path_helpers_mac.cc index d4f84c8..e69de29 100644 --- a/chrome/browser/sync/util/path_helpers_mac.cc +++ b/chrome/browser/sync/util/path_helpers_mac.cc @@ -1,10 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/port.h" -#include "chrome/browser/sync/util/path_helpers.h" - -#ifndef OS_MACOSX -#error Compile this file on Mac only. -#endif diff --git a/chrome/browser/sync/util/path_helpers_posix.cc b/chrome/browser/sync/util/path_helpers_posix.cc index db6100b..e69de29 100644 --- a/chrome/browser/sync/util/path_helpers_posix.cc +++ b/chrome/browser/sync/util/path_helpers_posix.cc @@ -1,22 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/sync/util/path_helpers.h" - -#include "build/build_config.h" - -#if ((!defined(OS_LINUX)) && (!defined(OS_MACOSX))) -#error Compile this file on Mac OS X or Linux only. -#endif - -using std::string; - -// Convert /s to :s. -string MakePathComponentOSLegal(const string& component) { - if (string::npos == component.find("/")) - return ""; - string new_name(component); - std::replace(new_name.begin(), new_name.end(), '/', ':'); - return new_name; -} diff --git a/chrome/browser/sync/util/path_helpers_unittest.cc b/chrome/browser/sync/util/path_helpers_unittest.cc index e38a5a0..e69de29 100644 --- a/chrome/browser/sync/util/path_helpers_unittest.cc +++ b/chrome/browser/sync/util/path_helpers_unittest.cc @@ -1,81 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/logging.h" -#include "base/port.h" -#include "build/build_config.h" -#include "chrome/browser/sync/syncable/path_name_cmp.h" -#include "chrome/browser/sync/util/path_helpers.h" -#include "chrome/browser/sync/util/sync_types.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace syncable { - -class PathHelpersTest : public testing::Test { -}; - -TEST(PathHelpersTest, SanitizePathComponent) { -#if defined(OS_WIN) - EXPECT_EQ(MakePathComponentOSLegal("bar"), ""); - EXPECT_EQ(MakePathComponentOSLegal("bar <"), "bar"); - EXPECT_EQ(MakePathComponentOSLegal("bar.<"), "bar"); - EXPECT_EQ(MakePathComponentOSLegal("prn"), "prn~1"); - EXPECT_EQ(MakePathComponentOSLegal("pr>n"), "prn~1"); - EXPECT_EQ(MakePathComponentOSLegal("ab:c"), "abc"); - EXPECT_EQ(MakePathComponentOSLegal("a|bc"), "abc"); - EXPECT_EQ(MakePathComponentOSLegal("baz~9"), ""); - EXPECT_EQ(MakePathComponentOSLegal("\007"), "~1"); - EXPECT_EQ(MakePathComponentOSLegal("com1.txt.bat"), "com1~1.txt.bat"); - EXPECT_EQ(MakePathComponentOSLegal("foo.com1.bat"), ""); - EXPECT_EQ(MakePathComponentOSLegal("\010gg"), "gg"); - EXPECT_EQ(MakePathComponentOSLegal("<"), "~1"); - EXPECT_EQ(MakePathComponentOSLegal("col:on"), "colon"); - EXPECT_EQ(MakePathComponentOSLegal("q\""), "q"); - EXPECT_EQ(MakePathComponentOSLegal("back\\slAsh"), "backslAsh"); - EXPECT_EQ(MakePathComponentOSLegal("sla/sh "), "slash"); - EXPECT_EQ(MakePathComponentOSLegal("s|laSh"), "slaSh"); - EXPECT_EQ(MakePathComponentOSLegal("CON"), "CON~1"); - EXPECT_EQ(MakePathComponentOSLegal("PRN"), "PRN~1"); - EXPECT_EQ(MakePathComponentOSLegal("AUX"), "AUX~1"); - EXPECT_EQ(MakePathComponentOSLegal("NUL"), "NUL~1"); - EXPECT_EQ(MakePathComponentOSLegal("COM1"), "COM1~1"); - EXPECT_EQ(MakePathComponentOSLegal("COM2"), "COM2~1"); - EXPECT_EQ(MakePathComponentOSLegal("COM3"), "COM3~1"); - EXPECT_EQ(MakePathComponentOSLegal("COM4"), "COM4~1"); - EXPECT_EQ(MakePathComponentOSLegal("COM5"), "COM5~1"); - EXPECT_EQ(MakePathComponentOSLegal("COM6"), "COM6~1"); - EXPECT_EQ(MakePathComponentOSLegal("COM7"), "COM7~1"); - EXPECT_EQ(MakePathComponentOSLegal("COM8"), "COM8~1"); - EXPECT_EQ(MakePathComponentOSLegal("COM9"), "COM9~1"); - EXPECT_EQ(MakePathComponentOSLegal("LPT1"), "LPT1~1"); - EXPECT_EQ(MakePathComponentOSLegal("LPT2"), "LPT2~1"); - EXPECT_EQ(MakePathComponentOSLegal("LPT3"), "LPT3~1"); - EXPECT_EQ(MakePathComponentOSLegal("LPT4"), "LPT4~1"); - EXPECT_EQ(MakePathComponentOSLegal("LPT5"), "LPT5~1"); - EXPECT_EQ(MakePathComponentOSLegal("LPT6"), "LPT6~1"); - EXPECT_EQ(MakePathComponentOSLegal("LPT7"), "LPT7~1"); - EXPECT_EQ(MakePathComponentOSLegal("LPT8"), "LPT8~1"); - EXPECT_EQ(MakePathComponentOSLegal("LPT9"), "LPT9~1"); - EXPECT_EQ(MakePathComponentOSLegal("bar~bar"), ""); - EXPECT_EQ(MakePathComponentOSLegal("adlr~-3"), ""); - EXPECT_EQ(MakePathComponentOSLegal("tilde~"), ""); - EXPECT_EQ(MakePathComponentOSLegal("mytext.txt"), ""); - EXPECT_EQ(MakePathComponentOSLegal("mytext|.txt"), "mytext.txt"); - EXPECT_EQ(MakePathComponentOSLegal("okay.com1.txt"), ""); - EXPECT_EQ(MakePathComponentOSLegal("software-3.tar.gz"), ""); - EXPECT_EQ(MakePathComponentOSLegal("<"), "~1"); - EXPECT_EQ(MakePathComponentOSLegal("<.<"), "~1"); - EXPECT_EQ(MakePathComponentOSLegal("<.<txt"), ".txt"); - EXPECT_EQ(MakePathComponentOSLegal("txt<.<"), "txt"); -#else // !defined(OS_WIN) - EXPECT_EQ(MakePathComponentOSLegal("bar"), ""); - EXPECT_EQ(MakePathComponentOSLegal("b"), ""); - EXPECT_EQ(MakePathComponentOSLegal("A"), ""); - EXPECT_EQ(MakePathComponentOSLegal("<'|"), ""); - EXPECT_EQ(MakePathComponentOSLegal("/"), ":"); - EXPECT_EQ(MakePathComponentOSLegal(":"), ""); -#endif // defined(OS_WIN) -} - -} // namespace syncable diff --git a/chrome/browser/sync/util/path_helpers_win.cc b/chrome/browser/sync/util/path_helpers_win.cc index 94bfb84..e69de29 100644 --- a/chrome/browser/sync/util/path_helpers_win.cc +++ b/chrome/browser/sync/util/path_helpers_win.cc @@ -1,85 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/sync/util/path_helpers.h" - -#include <Shlwapi.h> -#include <stdlib.h> - -#include "base/logging.h" -#include "base/port.h" -#include "build/build_config.h" -#include "chrome/browser/sync/syncable/syncable.h" - -#ifndef OS_WIN -#error Compile this file on Windows only. -#endif - -using std::string; - -namespace { -const string kWindowsIllegalBaseFilenames[] = { - "CON", "PRN", "AUX", "NUL", "COM1", "COM2", - "COM3", "COM4", "COM5", "COM6", "COM7", - "COM8", "COM9", "LPT1", "LPT2", "LPT3", - "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", - "LPT9" }; -} - -// See: http://msdn.microsoft.com/library/default.asp?url=/library/ -// en-us/fileio/fs/naming_a_file.asp -// note that * and ? are not listed on the page as illegal characters, -// but they are. -string MakePathComponentOSLegal(const string& component) { - CHECK(!component.empty()); - string mutable_component = component; - - // Remove illegal characters. - for (string::iterator i = mutable_component.begin(); - i != mutable_component.end();) { - if ((string::npos != string("<>:\"/\\|*?").find(*i)) || - ((static_cast<unsigned short>(*i) >= 0) && - (static_cast<unsigned short>(*i) <= 31))) { - mutable_component.erase(i); - } else { - ++i; - } - } - - // Remove trailing spaces or periods. - while (mutable_component.size() && - ((mutable_component.at(mutable_component.size() - 1) == ' ') || - (mutable_component.at(mutable_component.size() - 1) == '.'))) - mutable_component.resize(mutable_component.size() - 1, ' '); - - // Remove a bunch of forbidden names. windows only seems to mind if - // a forbidden name matches our name exactly (e.g. "prn") or if the name is - // the forbidden name, followed by a dot, followed by anything - // (e.g., "prn.anything.foo.bar") - - // From this point out, we break mutable_component into two strings, and use - // them this way: we save anything after and including the first dot (usually - // the extension) and only mess with stuff before the first dot. - string::size_type first_dot = mutable_component.find_first_of('.'); - if (string::npos == first_dot) - first_dot = mutable_component.size(); - string sub = mutable_component.substr(0, first_dot); - string postsub = mutable_component.substr(first_dot); - CHECK(sub + postsub == mutable_component); - for (int i = 0; i < ARRAYSIZE(kWindowsIllegalBaseFilenames); i++) { - // ComparePathNames(a, b) == 0 -> same - if (syncable::ComparePathNames(kWindowsIllegalBaseFilenames[i], sub) == 0) { - sub.append("~1"); - break; - } - } - if (("" == sub) && ("" == postsub)) { - sub = "~1"; - } - - // Return the new name, only if it differs from the original. - if ((sub + postsub) == component) - return ""; - return (sub + postsub); -} diff --git a/chrome/browser/sync/util/user_settings.cc b/chrome/browser/sync/util/user_settings.cc index e215c9b..763eed9 100644 --- a/chrome/browser/sync/util/user_settings.cc +++ b/chrome/browser/sync/util/user_settings.cc @@ -22,7 +22,6 @@ #include "chrome/browser/sync/syncable/directory_manager.h" // For migration. #include "chrome/browser/sync/util/crypto_helpers.h" #include "chrome/browser/sync/util/data_encryption.h" -#include "chrome/browser/sync/util/path_helpers.h" #include "chrome/browser/sync/util/query_helpers.h" using std::numeric_limits; diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index f4dc3c6..b2ab988 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -5521,7 +5521,6 @@ 'browser/sync/util/crypto_helpers_unittest.cc', 'browser/sync/util/event_sys_unittest.cc', 'browser/sync/util/extensions_activity_monitor_unittest.cc', - 'browser/sync/util/path_helpers_unittest.cc', 'browser/sync/util/query_helpers_unittest.cc', 'browser/sync/util/user_settings_unittest.cc', 'test/file_test_utils.cc', @@ -5682,12 +5681,6 @@ 'browser/sync/util/extensions_activity_monitor.cc', 'browser/sync/util/extensions_activity_monitor.h', 'browser/sync/util/fast_dump.h', - 'browser/sync/util/path_helpers.cc', - 'browser/sync/util/path_helpers.h', - 'browser/sync/util/path_helpers_linux.cc', - 'browser/sync/util/path_helpers_mac.cc', - 'browser/sync/util/path_helpers_posix.cc', - 'browser/sync/util/path_helpers_win.cc', 'browser/sync/util/query_helpers.cc', 'browser/sync/util/query_helpers.h', 'browser/sync/util/row_iterator.h', |