Stop using deprecated Block constructor
Change-Id: I7ea18187df50c81879a1f9d990d2ca1c902ecf84
diff --git a/src/storage/repo-storage.cpp b/src/storage/repo-storage.cpp
index 49873d7..1828eb9 100644
--- a/src/storage/repo-storage.cpp
+++ b/src/storage/repo-storage.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
@@ -18,7 +18,8 @@
*/
#include "repo-storage.hpp"
-#include "../../build/src/config.hpp"
+#include "config.hpp"
+
#include <istream>
namespace repo {
diff --git a/src/storage/sqlite-storage.cpp b/src/storage/sqlite-storage.cpp
index 35fa642..42739c3 100644
--- a/src/storage/sqlite-storage.cpp
+++ b/src/storage/sqlite-storage.cpp
@@ -18,7 +18,7 @@
*/
#include "sqlite-storage.hpp"
-#include "../../build/src/config.hpp"
+#include "config.hpp"
#include "index.hpp"
#include <ndn-cxx/util/sha256.hpp>
@@ -103,16 +103,16 @@
if (rc == SQLITE_ROW) {
ItemMeta item;
- item.fullName.wireDecode(Block(sqlite3_column_blob(m_stmt, 1),
+ item.fullName.wireDecode(Block(reinterpret_cast<const uint8_t*>(sqlite3_column_blob(m_stmt, 1)),
sqlite3_column_bytes(m_stmt, 1)));
item.id = sqlite3_column_int(m_stmt, 0);
- item.keyLocatorHash = make_shared<const ndn::Buffer>
- (ndn::Buffer(sqlite3_column_blob(m_stmt, 3), sqlite3_column_bytes(m_stmt, 3)));
+ item.keyLocatorHash = make_shared<const ndn::Buffer>(sqlite3_column_blob(m_stmt, 3),
+ sqlite3_column_bytes(m_stmt, 3));
try {
f(item);
}
- catch (...){
+ catch (...) {
sqlite3_finalize(m_stmt);
throw;
}
@@ -176,7 +176,7 @@
if (result == SQLITE_OK) {
rc = sqlite3_step(insertStmt);
if (rc == SQLITE_CONSTRAINT) {
- std::cerr << "Insert failed" << std::endl;
+ std::cerr << "Insert failed" << std::endl;
sqlite3_finalize(insertStmt);
BOOST_THROW_EXCEPTION(Error("Insert failed"));
}
@@ -237,14 +237,14 @@
if (sqlite3_bind_int64(queryStmt, 1, id) == SQLITE_OK) {
rc = sqlite3_step(queryStmt);
if (rc == SQLITE_ROW) {
- shared_ptr<Data> data(new Data());
- data->wireDecode(Block(sqlite3_column_blob(queryStmt, 2),
- sqlite3_column_bytes(queryStmt, 2)));
+ auto data = make_shared<Data>();
+ data->wireDecode(Block(reinterpret_cast<const uint8_t*>(sqlite3_column_blob(queryStmt, 2)),
+ sqlite3_column_bytes(queryStmt, 2)));
sqlite3_finalize(queryStmt);
return data;
}
else if (rc == SQLITE_DONE) {
- return shared_ptr<Data>();
+ return nullptr;
}
else {
std::cerr << "Database query failure rc:" << rc << std::endl;
@@ -264,7 +264,7 @@
std::cerr << "select statement prepared failed" << std::endl;
BOOST_THROW_EXCEPTION(Error("select statement prepared failed"));
}
- return shared_ptr<Data>();
+ return nullptr;
}
int64_t