summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina <tfarina@chromium.org>2015-05-11 15:31:26 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-11 22:31:49 +0000
commit720d4f346cee3fa9ea9c58b845550e7066a80ec2 (patch)
treee452763cf49776c93a2779e8e08fc90b51690ee4
parentc16f8dcdc00218681934a1425f53c9badefbe01a (diff)
downloadchromium_src-720d4f346cee3fa9ea9c58b845550e7066a80ec2.zip
chromium_src-720d4f346cee3fa9ea9c58b845550e7066a80ec2.tar.gz
chromium_src-720d4f346cee3fa9ea9c58b845550e7066a80ec2.tar.bz2
sql: Remove basictypes.h includes.
* Use the standard integer types from stdint.h instead. * Use macros.h for the DISALLOW_COPY_AND_ASSIGN macro. BUG=138542 TEST=sql_unittests R=shess@chromium.org Review URL: https://codereview.chromium.org/1133053004 Cr-Commit-Position: refs/heads/master@{#329256}
-rw-r--r--sql/connection.cc4
-rw-r--r--sql/connection.h5
-rw-r--r--sql/connection_unittest.cc2
-rw-r--r--sql/meta_table.cc4
-rw-r--r--sql/meta_table.h7
-rw-r--r--sql/meta_table_unittest.cc10
-rw-r--r--sql/recovery.h3
-rw-r--r--sql/statement.cc4
-rw-r--r--sql/statement.h7
-rw-r--r--sql/test/scoped_error_ignorer.h2
-rw-r--r--sql/test/test_helpers.cc2
-rw-r--r--sql/test/test_helpers.h1
-rw-r--r--sql/transaction.h2
13 files changed, 27 insertions, 26 deletions
diff --git a/sql/connection.cc b/sql/connection.cc
index ba799a9..b91234b 100644
--- a/sql/connection.cc
+++ b/sql/connection.cc
@@ -228,7 +228,7 @@ Connection::~Connection() {
bool Connection::Open(const base::FilePath& path) {
if (!histogram_tag_.empty()) {
- int64 size_64 = 0;
+ int64_t size_64 = 0;
if (base::GetFileSize(path, &size_64)) {
size_t sample = static_cast<size_t>(size_64 / 1024);
std::string full_histogram_name = "Sqlite.SizeKB." + histogram_tag_;
@@ -835,7 +835,7 @@ bool Connection::DoesColumnExist(const char* table_name,
return false;
}
-int64 Connection::GetLastInsertRowId() const {
+int64_t Connection::GetLastInsertRowId() const {
if (!db_) {
DLOG_IF(FATAL, !poisoned_) << "Illegal use of connection without a db";
return 0;
diff --git a/sql/connection.h b/sql/connection.h
index 2f6c71f..17d1191 100644
--- a/sql/connection.h
+++ b/sql/connection.h
@@ -5,14 +5,15 @@
#ifndef SQL_CONNECTION_H_
#define SQL_CONNECTION_H_
+#include <stdint.h>
#include <map>
#include <set>
#include <string>
#include <vector>
-#include "base/basictypes.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_restrictions.h"
@@ -372,7 +373,7 @@ class SQL_EXPORT Connection {
// Returns sqlite's internal ID for the last inserted row. Valid only
// immediately after an insert.
- int64 GetLastInsertRowId() const;
+ int64_t GetLastInsertRowId() const;
// Returns sqlite's count of the number of rows modified by the last
// statement executed. Will be 0 if no statement has executed or the database
diff --git a/sql/connection_unittest.cc b/sql/connection_unittest.cc
index 24d21fa..e3b9773 100644
--- a/sql/connection_unittest.cc
+++ b/sql/connection_unittest.cc
@@ -198,7 +198,7 @@ TEST_F(SQLConnectionTest, GetLastInsertRowId) {
ASSERT_TRUE(db().Execute("INSERT INTO foo (value) VALUES (12)"));
// Last insert row ID should be valid.
- int64 row = db().GetLastInsertRowId();
+ int64_t row = db().GetLastInsertRowId();
EXPECT_LT(0, row);
// It should be the primary key of the row we just inserted.
diff --git a/sql/meta_table.cc b/sql/meta_table.cc
index b1b9562..319f73d 100644
--- a/sql/meta_table.cc
+++ b/sql/meta_table.cc
@@ -180,7 +180,7 @@ bool MetaTable::SetValue(const char* key, int value) {
return s.Run();
}
-bool MetaTable::SetValue(const char* key, int64 value) {
+bool MetaTable::SetValue(const char* key, int64_t value) {
Statement s;
PrepareSetStatement(&s, key);
s.BindInt64(1, value);
@@ -205,7 +205,7 @@ bool MetaTable::GetValue(const char* key, int* value) {
return true;
}
-bool MetaTable::GetValue(const char* key, int64* value) {
+bool MetaTable::GetValue(const char* key, int64_t* value) {
Statement s;
if (!PrepareGetStatement(&s, key))
return false;
diff --git a/sql/meta_table.h b/sql/meta_table.h
index 918a261..0ae76bd 100644
--- a/sql/meta_table.h
+++ b/sql/meta_table.h
@@ -5,9 +5,10 @@
#ifndef SQL_META_TABLE_H_
#define SQL_META_TABLE_H_
+#include <stdint.h>
#include <string>
-#include "base/basictypes.h"
+#include "base/macros.h"
#include "sql/sql_export.h"
namespace sql {
@@ -74,13 +75,13 @@ class SQL_EXPORT MetaTable {
// Set the given arbitrary key with the given data. Returns true on success.
bool SetValue(const char* key, const std::string& value);
bool SetValue(const char* key, int value);
- bool SetValue(const char* key, int64 value);
+ bool SetValue(const char* key, int64_t value);
// Retrieves the value associated with the given key. This will use sqlite's
// type conversion rules. It will return true on success.
bool GetValue(const char* key, std::string* value);
bool GetValue(const char* key, int* value);
- bool GetValue(const char* key, int64* value);
+ bool GetValue(const char* key, int64_t* value);
// Deletes the key from the table.
bool DeleteKey(const char* key);
diff --git a/sql/meta_table_unittest.cc b/sql/meta_table_unittest.cc
index e3ee2c6..1412392 100644
--- a/sql/meta_table_unittest.cc
+++ b/sql/meta_table_unittest.cc
@@ -208,15 +208,15 @@ TEST_F(SQLMetaTableTest, IntValue) {
TEST_F(SQLMetaTableTest, Int64Value) {
const char kKey[] = "Int Key";
- const int64 kFirstValue = 5000000017LL;
- const int64 kSecondValue = 5000000023LL;
+ const int64_t kFirstValue = 5000000017LL;
+ const int64_t kSecondValue = 5000000023LL;
// Initially, the value isn't there until set.
{
sql::MetaTable meta_table;
EXPECT_TRUE(meta_table.Init(&db(), 1, 1));
- int64 value;
+ int64_t value;
EXPECT_FALSE(meta_table.GetValue(kKey, &value));
EXPECT_TRUE(meta_table.SetValue(kKey, kFirstValue));
@@ -229,7 +229,7 @@ TEST_F(SQLMetaTableTest, Int64Value) {
sql::MetaTable meta_table;
EXPECT_TRUE(meta_table.Init(&db(), 1, 1));
- int64 value;
+ int64_t value;
EXPECT_TRUE(meta_table.GetValue(kKey, &value));
EXPECT_EQ(kFirstValue, value);
@@ -241,7 +241,7 @@ TEST_F(SQLMetaTableTest, Int64Value) {
sql::MetaTable meta_table;
EXPECT_TRUE(meta_table.Init(&db(), 1, 1));
- int64 value;
+ int64_t value;
EXPECT_TRUE(meta_table.GetValue(kKey, &value));
EXPECT_EQ(kSecondValue, value);
}
diff --git a/sql/recovery.h b/sql/recovery.h
index 60fb674..e334d34 100644
--- a/sql/recovery.h
+++ b/sql/recovery.h
@@ -5,8 +5,7 @@
#ifndef SQL_RECOVERY_H_
#define SQL_RECOVERY_H_
-#include "base/basictypes.h"
-
+#include "base/macros.h"
#include "sql/connection.h"
namespace base {
diff --git a/sql/statement.cc b/sql/statement.cc
index 6dbd8d9..42b4598 100644
--- a/sql/statement.cc
+++ b/sql/statement.cc
@@ -112,7 +112,7 @@ bool Statement::BindInt(int col, int val) {
return CheckOk(sqlite3_bind_int(ref_->stmt(), col + 1, val));
}
-bool Statement::BindInt64(int col, int64 val) {
+bool Statement::BindInt64(int col, int64_t val) {
DCHECK(!stepped_);
if (!is_valid())
return false;
@@ -207,7 +207,7 @@ int Statement::ColumnInt(int col) const {
return sqlite3_column_int(ref_->stmt(), col);
}
-int64 Statement::ColumnInt64(int col) const {
+int64_t Statement::ColumnInt64(int col) const {
if (!CheckValid())
return 0;
diff --git a/sql/statement.h b/sql/statement.h
index e192e60..b411e80 100644
--- a/sql/statement.h
+++ b/sql/statement.h
@@ -5,10 +5,11 @@
#ifndef SQL_STATEMENT_H_
#define SQL_STATEMENT_H_
+#include <stdint.h>
#include <string>
#include <vector>
-#include "base/basictypes.h"
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string16.h"
#include "sql/connection.h"
@@ -104,7 +105,7 @@ class SQL_EXPORT Statement {
bool BindNull(int col);
bool BindBool(int col, bool val);
bool BindInt(int col, int val);
- bool BindInt64(int col, int64 val);
+ bool BindInt64(int col, int64_t val);
bool BindDouble(int col, double val);
bool BindCString(int col, const char* val);
bool BindString(int col, const std::string& val);
@@ -128,7 +129,7 @@ class SQL_EXPORT Statement {
// These all take a 0-based argument index.
bool ColumnBool(int col) const;
int ColumnInt(int col) const;
- int64 ColumnInt64(int col) const;
+ int64_t ColumnInt64(int col) const;
double ColumnDouble(int col) const;
std::string ColumnString(int col) const;
base::string16 ColumnString16(int col) const;
diff --git a/sql/test/scoped_error_ignorer.h b/sql/test/scoped_error_ignorer.h
index 79559a1..6d1c5df 100644
--- a/sql/test/scoped_error_ignorer.h
+++ b/sql/test/scoped_error_ignorer.h
@@ -7,7 +7,7 @@
#include <set>
-#include "base/basictypes.h"
+#include "base/macros.h"
#include "sql/connection.h"
// This is not strictly necessary for the operation of ScopedErrorIgnorer, but
diff --git a/sql/test/test_helpers.cc b/sql/test/test_helpers.cc
index 72d42c6..361b336 100644
--- a/sql/test/test_helpers.cc
+++ b/sql/test/test_helpers.cc
@@ -85,7 +85,7 @@ bool CorruptSizeInHeader(const base::FilePath& db_path) {
if (1u != fread(header, sizeof(header), 1, file.get()))
return false;
- int64 db_size = 0;
+ int64_t db_size = 0;
if (!base::GetFileSize(db_path, &db_size))
return false;
diff --git a/sql/test/test_helpers.h b/sql/test/test_helpers.h
index d9dda22..e93b207 100644
--- a/sql/test/test_helpers.h
+++ b/sql/test/test_helpers.h
@@ -7,7 +7,6 @@
#include <string>
-#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
diff --git a/sql/transaction.h b/sql/transaction.h
index 788a002..5a34e65 100644
--- a/sql/transaction.h
+++ b/sql/transaction.h
@@ -5,7 +5,7 @@
#ifndef SQL_TRANSACTION_H_
#define SQL_TRANSACTION_H_
-#include "base/basictypes.h"
+#include "base/macros.h"
#include "sql/sql_export.h"
namespace sql {