Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: chrome/browser/history/text_database.cc

Issue 28281: Get rid of wstring variants of StringToFoo. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <limits> 5 #include <limits>
6 #include <set> 6 #include <set>
7 7
8 #include "chrome/browser/history/text_database.h" 8 #include "chrome/browser/history/text_database.h"
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // potentially be the wrong thing to do. Instead, we just look for a suffix. 120 // potentially be the wrong thing to do. Instead, we just look for a suffix.
121 static const size_t kIDStringLength = 7; // Room for "xxxx-xx". 121 static const size_t kIDStringLength = 7; // Room for "xxxx-xx".
122 if (file_name.length() < kIDStringLength) 122 if (file_name.length() < kIDStringLength)
123 return 0; 123 return 0;
124 const std::wstring suffix(&file_name[file_name.length() - kIDStringLength]); 124 const std::wstring suffix(&file_name[file_name.length() - kIDStringLength]);
125 125
126 if (suffix.length() != kIDStringLength || suffix[4] != L'-') { 126 if (suffix.length() != kIDStringLength || suffix[4] != L'-') {
127 return 0; 127 return 0;
128 } 128 }
129 129
130 int year = StringToInt(suffix.substr(0, 4)); 130 int year = StringToInt(WideToUTF16Hack(suffix.substr(0, 4)));
131 int month = StringToInt(suffix.substr(5, 2)); 131 int month = StringToInt(WideToUTF16Hack(suffix.substr(5, 2)));
132 132
133 return year * 100 + month; 133 return year * 100 + month;
134 } 134 }
135 135
136 bool TextDatabase::Init() { 136 bool TextDatabase::Init() {
137 // Make sure, if we're not allowed to create the file, that it exists. 137 // Make sure, if we're not allowed to create the file, that it exists.
138 if (!allow_create_) { 138 if (!allow_create_) {
139 if (!file_util::PathExists(file_name_)) 139 if (!file_util::PathExists(file_name_))
140 return false; 140 return false;
141 } 141 }
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 } else { 385 } else {
386 // Since we got the results in order, we know the last item is the last 386 // Since we got the results in order, we know the last item is the last
387 // time we considered. 387 // time we considered.
388 *first_time_searched = results->back().time; 388 *first_time_searched = results->back().time;
389 } 389 }
390 390
391 statement->reset(); 391 statement->reset();
392 } 392 }
393 393
394 } // namespace history 394 } // namespace history
395
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698