Add some std namespaces to get tests building.

I guess a rogue header had previously been using the std namespace.
This commit is contained in:
Joe Thornber 2017-07-24 15:40:17 +01:00
parent 2c6278ed4b
commit 467be1a69e
4 changed files with 14 additions and 10 deletions

View File

@ -83,11 +83,11 @@ namespace persistent_data {
out << "array_block::grow called with more than max_entries ("
<< nr << " > " << max_entries();
throw runtime_error(out.str());
throw std::runtime_error(out.str());
}
if (nr <= old_nr)
throw runtime_error("array_block grow method called with smaller size");
throw std::runtime_error("array_block grow method called with smaller size");
grow_(nr, default_value);
}
@ -96,7 +96,7 @@ namespace persistent_data {
uint32_t old_nr = nr_entries();
if (nr >= old_nr)
throw runtime_error("array_block shrink called with larger size");
throw std::runtime_error("array_block shrink called with larger size");
shrink_(nr);
}
@ -172,7 +172,7 @@ namespace persistent_data {
disk_type &element_at(unsigned int index) {
if (index >= nr_entries())
throw runtime_error("array_block index out of bounds");
throw std::runtime_error("array_block index out of bounds");
array_block_disk *a = get_header();
disk_type *elts = reinterpret_cast<disk_type *>(a + 1);
@ -181,7 +181,7 @@ namespace persistent_data {
disk_type const &element_at(unsigned int index) const {
if (index >= nr_entries())
throw runtime_error("array_block index out of bounds");
throw std::runtime_error("array_block index out of bounds");
array_block_disk const *a = get_header();
disk_type const *elts = reinterpret_cast<disk_type const *>(a + 1);

View File

@ -85,7 +85,7 @@ namespace persistent_data {
if (search_start_ >= ms->second)
continue;
for (block_address b = max(search_start_, ms->first); b < ms->second; b++) {
for (block_address b = std::max(search_start_, ms->first); b < ms->second; b++) {
if (b >= counts_.size())
throw std::runtime_error("block out of bounds");

View File

@ -2,6 +2,10 @@
#include "persistent-data/space-maps/core.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
using namespace persistent_data;
using namespace std;
using namespace test;

View File

@ -31,10 +31,10 @@ namespace test {
template <uint32_t BlockSize>
typename block_manager<BlockSize>::ptr
create_bm(block_address nr = 1024) {
string const path("./test.data");
std::string const path("./test.data");
int r = system("rm -f ./test.data");
if (r < 0)
throw runtime_error("couldn't rm -f ./test.data");
throw std::runtime_error("couldn't rm -f ./test.data");
return typename block_manager<BlockSize>::ptr(
new block_manager<BlockSize>(path, nr, MAX_HELD_LOCKS,
@ -121,9 +121,9 @@ namespace test {
std::string const &get_path() const;
private:
static string gen_path(string const &base);
static std::string gen_path(std::string const &base);
string path_;
std::string path_;
};
//--------------------------------