From 9660ddd38561758694488c7110a7edbeacb1b305 Mon Sep 17 00:00:00 2001 From: "phajdan.jr@chromium.org" Date: Fri, 30 Jan 2009 19:33:53 +0000 Subject: Correct sqlite wrapper behavior on systems where wchar_t is UTF-32, for example Linux. The problem was that old code assumed wstring is UTF-16, which resulted in string corruption on Linux. I actually tested it on browser/history unit tests, see http://codereview.chromium.org/18758. Review URL: http://codereview.chromium.org/18805 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8977 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/webdata/web_database.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'chrome/browser/webdata/web_database.cc') diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc index 7d5b524..7ee4f79 100755 --- a/chrome/browser/webdata/web_database.cc +++ b/chrome/browser/webdata/web_database.cc @@ -541,23 +541,23 @@ bool WebDatabase::GetKeywords(std::vector* urls) { std::wstring tmp; template_url->set_id(s.column_int64(0)); - s.column_string16(1, &tmp); + s.column_wstring(1, &tmp); DCHECK(!tmp.empty()); template_url->set_short_name(tmp); - s.column_string16(2, &tmp); + s.column_wstring(2, &tmp); template_url->set_keyword(tmp); - s.column_string16(3, &tmp); + s.column_wstring(3, &tmp); if (!tmp.empty()) template_url->SetFavIconURL(GURL(WideToUTF8(tmp))); - s.column_string16(4, &tmp); + s.column_wstring(4, &tmp); template_url->SetURL(tmp, 0, 0); template_url->set_safe_for_autoreplace(s.column_int(5) == 1); - s.column_string16(6, &tmp); + s.column_wstring(6, &tmp); if (!tmp.empty()) template_url->set_originating_url(GURL(WideToUTF8(tmp))); @@ -571,7 +571,7 @@ bool WebDatabase::GetKeywords(std::vector* urls) { template_url->set_show_in_default_list(s.column_int(10) == 1); - s.column_string16(11, &tmp); + s.column_wstring(11, &tmp); template_url->SetSuggestionsURL(tmp, 0, 0); template_url->set_prepopulate_id(s.column_int(12)); @@ -761,12 +761,12 @@ static void InitPasswordFormFromStatement(PasswordForm* form, form->origin = GURL(tmp); s->column_string(1, &tmp); form->action = GURL(tmp); - s->column_string16(2, &form->username_element); - s->column_string16(3, &form->username_value); - s->column_string16(4, &form->password_element); + s->column_wstring(2, &form->username_element); + s->column_wstring(3, &form->username_value); + s->column_wstring(4, &form->password_element); s->column_blob_as_string(5, &encrypted_password); Encryptor::DecryptWideString(encrypted_password, &form->password_value); - s->column_string16(6, &form->submit_element); + s->column_wstring(6, &form->submit_element); s->column_string(7, &tmp); form->signon_realm = tmp; form->ssl_valid = (s->column_int(8) > 0); @@ -1020,7 +1020,7 @@ bool WebDatabase::GetFormValuesForElementName(const std::wstring& name, values->clear(); int result; while ((result = s.step()) == SQLITE_ROW) - values->push_back(s.column_string16(0)); + values->push_back(s.column_wstring(0)); return result == SQLITE_DONE; } -- cgit v1.1