diff options
author | petersont@google.com <petersont@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-13 20:13:28 +0000 |
---|---|---|
committer | petersont@google.com <petersont@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-13 20:13:28 +0000 |
commit | 92edabb7765613f4027947140d4e93473a7c766d (patch) | |
tree | 209c0b006fb028d5090bcb16a9a52efad49d9d53 /chrome/browser/webdata | |
parent | 327c152b3e808301848da2a1044c16c2d5067ca0 (diff) | |
download | chromium_src-92edabb7765613f4027947140d4e93473a7c766d.zip chromium_src-92edabb7765613f4027947140d4e93473a7c766d.tar.gz chromium_src-92edabb7765613f4027947140d4e93473a7c766d.tar.bz2 |
Reordered some logic to fix a bug which caused the clearing of the database to malfunction.
Review URL: http://codereview.chromium.org/10862
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5365 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/webdata')
-rw-r--r-- | chrome/browser/webdata/web_database.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc index 28e7b08..f17efd1 100644 --- a/chrome/browser/webdata/web_database.cc +++ b/chrome/browser/webdata/web_database.cc @@ -1141,7 +1141,7 @@ bool WebDatabase::RemoveFormElementsAddedBetween(const Time delete_begin, for (std::vector<int64>::iterator itr = pair_ids.begin(); itr != pair_ids.end(); itr++) { - int how_many=0; + int how_many = 0; if (!RemovePairIDAndDate(*itr, delete_begin, delete_end, &how_many)) return false; if (!AddToCountOfFormElement(*itr, -how_many)) @@ -1175,12 +1175,14 @@ bool WebDatabase::RemovePairIDAndDate(int64 pair_id, const Time delete_begin, bool WebDatabase::AddToCountOfFormElement(int64 pair_id, int delta) { int count=0; - if (count+delta == 0 && - !RemoveFormElement(pair_id)) { + + if (!GetCountOfFormElement(pair_id, &count)) return false; - } else { - if (!GetCountOfFormElement(pair_id, &count)) + + if (count + delta == 0) { + if (!RemoveFormElement(pair_id)) return false; + } else { if (!SetCountOfFormElement(pair_id, count + delta)) return false; } |