diff options
author | dumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-13 06:37:03 +0000 |
---|---|---|
committer | dumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-13 06:37:03 +0000 |
commit | 60cba79ac19628c205fce7cfdfd7845c1c3b6b60 (patch) | |
tree | 6731697cd5520c0e29818f4ee922e62a56dbddf9 /webkit/database/database_util.cc | |
parent | 0c6fbd6e38d3fc5c04cbc22fe769e766f814253b (diff) | |
download | chromium_src-60cba79ac19628c205fce7cfdfd7845c1c3b6b60.zip chromium_src-60cba79ac19628c205fce7cfdfd7845c1c3b6b60.tar.gz chromium_src-60cba79ac19628c205fce7cfdfd7845c1c3b6b60.tar.bz2 |
Cleans up a bit the DB-related methods.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/394006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31891 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/database/database_util.cc')
-rw-r--r-- | webkit/database/database_util.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/webkit/database/database_util.cc b/webkit/database/database_util.cc index b571a72..b1ba76a 100644 --- a/webkit/database/database_util.cc +++ b/webkit/database/database_util.cc @@ -10,15 +10,15 @@ namespace webkit_database { -bool DatabaseUtil::CrackVfsFilePath(const string16& vfs_file_path, +bool DatabaseUtil::CrackVfsFileName(const string16& vfs_file_name, string16* origin_identifier, string16* database_name, string16* sqlite_suffix) { - // 'vfs_file_path' is of the form <origin_identifier>/<db_name>#<suffix>. + // 'vfs_file_name' is of the form <origin_identifier>/<db_name>#<suffix>. // <suffix> is optional. - DCHECK(!vfs_file_path.empty()); - size_t first_slash_index = vfs_file_path.find('/'); - size_t last_pound_index = vfs_file_path.rfind('#'); + DCHECK(!vfs_file_name.empty()); + size_t first_slash_index = vfs_file_name.find('/'); + size_t last_pound_index = vfs_file_name.rfind('#'); // '/' and '#' must be present in the string. Also, the string cannot start // with a '/' (origin_identifier cannot be empty) and '/' must come before '#' if ((first_slash_index == string16::npos) || @@ -28,20 +28,20 @@ bool DatabaseUtil::CrackVfsFilePath(const string16& vfs_file_path, return false; } - *origin_identifier = vfs_file_path.substr(0, first_slash_index); - *database_name = vfs_file_path.substr( + *origin_identifier = vfs_file_name.substr(0, first_slash_index); + *database_name = vfs_file_name.substr( first_slash_index + 1, last_pound_index - first_slash_index - 1); - *sqlite_suffix = vfs_file_path.substr( - last_pound_index + 1, vfs_file_path.length() - last_pound_index - 1); + *sqlite_suffix = vfs_file_name.substr( + last_pound_index + 1, vfs_file_name.length() - last_pound_index - 1); return true; } FilePath DatabaseUtil::GetFullFilePathForVfsFile( - DatabaseTracker* db_tracker, const string16& vfs_file_path) { + DatabaseTracker* db_tracker, const string16& vfs_file_name) { string16 origin_identifier; string16 database_name; string16 sqlite_suffix; - if (!CrackVfsFilePath(vfs_file_path, &origin_identifier, + if (!CrackVfsFileName(vfs_file_name, &origin_identifier, &database_name, &sqlite_suffix)) { return FilePath(); // invalid vfs_file_name } |