base: Stop "using namespace std".
As the std namespace expands, it becomes more and more likely that blanketly importing all its symbols will cause a collision. Also, when it was imported, the std:: was used or left off arbitrarily, sometimes inconsistently even in the same function signature. Change-Id: Ie30cbab154b00c60433908a206c229230d2b109f Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39536 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Gabe Black <gabe.black@gmail.com> Maintainer: Gabe Black <gabe.black@gmail.com>
This commit is contained in:
@@ -34,8 +34,6 @@
|
||||
#include "base/bitunion.hh"
|
||||
#include "base/cprintf.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace {
|
||||
|
||||
BitUnion64(SixtyFour)
|
||||
|
||||
@@ -48,8 +48,6 @@
|
||||
|
||||
#include "base/logging.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
||||
@@ -49,9 +49,7 @@
|
||||
#include "base/str.hh"
|
||||
#include "base/types.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
string
|
||||
std::string
|
||||
__get_hostname()
|
||||
{
|
||||
char host[256];
|
||||
@@ -60,10 +58,10 @@ __get_hostname()
|
||||
return host;
|
||||
}
|
||||
|
||||
string &
|
||||
std::string &
|
||||
hostname()
|
||||
{
|
||||
static string hostname = __get_hostname();
|
||||
static std::string hostname = __get_hostname();
|
||||
return hostname;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,12 +50,11 @@
|
||||
#include "base/logging.hh"
|
||||
#include "base/types.hh"
|
||||
|
||||
using namespace std;
|
||||
namespace Net {
|
||||
|
||||
EthAddr::EthAddr()
|
||||
{
|
||||
memset(data, 0, ETH_ADDR_LEN);
|
||||
std::memset(data, 0, ETH_ADDR_LEN);
|
||||
}
|
||||
|
||||
EthAddr::EthAddr(const uint8_t ea[ETH_ADDR_LEN])
|
||||
@@ -97,13 +96,13 @@ EthAddr::parse(const std::string &addr)
|
||||
int bytes[ETH_ADDR_LEN == 6 ? ETH_ADDR_LEN : -1];
|
||||
if (sscanf(addr.c_str(), "%x:%x:%x:%x:%x:%x", &bytes[0], &bytes[1],
|
||||
&bytes[2], &bytes[3], &bytes[4], &bytes[5]) != ETH_ADDR_LEN) {
|
||||
memset(data, 0xff, ETH_ADDR_LEN);
|
||||
std::memset(data, 0xff, ETH_ADDR_LEN);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ETH_ADDR_LEN; ++i) {
|
||||
if (bytes[i] & ~0xff) {
|
||||
memset(data, 0xff, ETH_ADDR_LEN);
|
||||
std::memset(data, 0xff, ETH_ADDR_LEN);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -111,10 +110,10 @@ EthAddr::parse(const std::string &addr)
|
||||
}
|
||||
}
|
||||
|
||||
string
|
||||
std::string
|
||||
EthAddr::string() const
|
||||
{
|
||||
stringstream stream;
|
||||
std::stringstream stream;
|
||||
stream << *this;
|
||||
return stream.str();
|
||||
}
|
||||
@@ -122,21 +121,21 @@ EthAddr::string() const
|
||||
bool
|
||||
operator==(const EthAddr &left, const EthAddr &right)
|
||||
{
|
||||
return !memcmp(left.bytes(), right.bytes(), ETH_ADDR_LEN);
|
||||
return !std::memcmp(left.bytes(), right.bytes(), ETH_ADDR_LEN);
|
||||
}
|
||||
|
||||
ostream &
|
||||
operator<<(ostream &stream, const EthAddr &ea)
|
||||
std::ostream &
|
||||
operator<<(std::ostream &stream, const EthAddr &ea)
|
||||
{
|
||||
const uint8_t *a = ea.addr();
|
||||
ccprintf(stream, "%x:%x:%x:%x:%x:%x", a[0], a[1], a[2], a[3], a[4], a[5]);
|
||||
return stream;
|
||||
}
|
||||
|
||||
string
|
||||
std::string
|
||||
IpAddress::string() const
|
||||
{
|
||||
stringstream stream;
|
||||
std::stringstream stream;
|
||||
stream << *this;
|
||||
return stream.str();
|
||||
}
|
||||
@@ -147,8 +146,8 @@ operator==(const IpAddress &left, const IpAddress &right)
|
||||
return left.ip() == right.ip();
|
||||
}
|
||||
|
||||
ostream &
|
||||
operator<<(ostream &stream, const IpAddress &ia)
|
||||
std::ostream &
|
||||
operator<<(std::ostream &stream, const IpAddress &ia)
|
||||
{
|
||||
uint32_t ip = ia.ip();
|
||||
ccprintf(stream, "%x.%x.%x.%x",
|
||||
@@ -157,10 +156,10 @@ operator<<(ostream &stream, const IpAddress &ia)
|
||||
return stream;
|
||||
}
|
||||
|
||||
string
|
||||
std::string
|
||||
IpNetmask::string() const
|
||||
{
|
||||
stringstream stream;
|
||||
std::stringstream stream;
|
||||
stream << *this;
|
||||
return stream.str();
|
||||
}
|
||||
@@ -172,17 +171,17 @@ operator==(const IpNetmask &left, const IpNetmask &right)
|
||||
(left.netmask() == right.netmask());
|
||||
}
|
||||
|
||||
ostream &
|
||||
operator<<(ostream &stream, const IpNetmask &in)
|
||||
std::ostream &
|
||||
operator<<(std::ostream &stream, const IpNetmask &in)
|
||||
{
|
||||
ccprintf(stream, "%s/%d", (const IpAddress &)in, in.netmask());
|
||||
return stream;
|
||||
}
|
||||
|
||||
string
|
||||
std::string
|
||||
IpWithPort::string() const
|
||||
{
|
||||
stringstream stream;
|
||||
std::stringstream stream;
|
||||
stream << *this;
|
||||
return stream.str();
|
||||
}
|
||||
@@ -193,8 +192,8 @@ operator==(const IpWithPort &left, const IpWithPort &right)
|
||||
return (left.ip() == right.ip()) && (left.port() == right.port());
|
||||
}
|
||||
|
||||
ostream &
|
||||
operator<<(ostream &stream, const IpWithPort &iwp)
|
||||
std::ostream &
|
||||
operator<<(std::ostream &stream, const IpWithPort &iwp)
|
||||
{
|
||||
ccprintf(stream, "%s:%d", (const IpAddress &)iwp, iwp.port());
|
||||
return stream;
|
||||
@@ -255,7 +254,7 @@ cksum(const UdpPtr &udp)
|
||||
}
|
||||
|
||||
bool
|
||||
IpHdr::options(vector<const IpOpt *> &vec) const
|
||||
IpHdr::options(std::vector<const IpOpt *> &vec) const
|
||||
{
|
||||
vec.clear();
|
||||
|
||||
@@ -352,7 +351,7 @@ Ip6Hdr::proto() const
|
||||
}
|
||||
|
||||
bool
|
||||
TcpHdr::options(vector<const TcpOpt *> &vec) const
|
||||
TcpHdr::options(std::vector<const TcpOpt *> &vec) const
|
||||
{
|
||||
vec.clear();
|
||||
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
|
||||
#include "base/str.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
IniFile::IniFile()
|
||||
{}
|
||||
|
||||
@@ -53,9 +51,9 @@ IniFile::~IniFile()
|
||||
}
|
||||
|
||||
bool
|
||||
IniFile::load(const string &file)
|
||||
IniFile::load(const std::string &file)
|
||||
{
|
||||
ifstream f(file.c_str());
|
||||
std::ifstream f(file.c_str());
|
||||
|
||||
if (!f.is_open())
|
||||
return false;
|
||||
@@ -64,7 +62,7 @@ IniFile::load(const string &file)
|
||||
}
|
||||
|
||||
|
||||
const string &
|
||||
const std::string &
|
||||
IniFile::Entry::getValue() const
|
||||
{
|
||||
referenced = true;
|
||||
@@ -97,18 +95,18 @@ IniFile::Section::addEntry(const std::string &entryName,
|
||||
bool
|
||||
IniFile::Section::add(const std::string &assignment)
|
||||
{
|
||||
string::size_type offset = assignment.find('=');
|
||||
if (offset == string::npos) {
|
||||
std::string::size_type offset = assignment.find('=');
|
||||
if (offset == std::string::npos) {
|
||||
// no '=' found
|
||||
cerr << "Can't parse .ini line " << assignment << endl;
|
||||
std::cerr << "Can't parse .ini line " << assignment << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// if "+=" rather than just "=" then append value
|
||||
bool append = (assignment[offset-1] == '+');
|
||||
|
||||
string entryName = assignment.substr(0, append ? offset-1 : offset);
|
||||
string value = assignment.substr(offset + 1);
|
||||
std::string entryName = assignment.substr(0, append ? offset-1 : offset);
|
||||
std::string value = assignment.substr(offset + 1);
|
||||
|
||||
eat_white(entryName);
|
||||
eat_white(value);
|
||||
@@ -130,7 +128,7 @@ IniFile::Section::findEntry(const std::string &entryName) const
|
||||
|
||||
|
||||
IniFile::Section *
|
||||
IniFile::addSection(const string §ionName)
|
||||
IniFile::addSection(const std::string §ionName)
|
||||
{
|
||||
SectionTable::iterator i = table.find(sectionName);
|
||||
|
||||
@@ -147,7 +145,7 @@ IniFile::addSection(const string §ionName)
|
||||
|
||||
|
||||
IniFile::Section *
|
||||
IniFile::findSection(const string §ionName) const
|
||||
IniFile::findSection(const std::string §ionName) const
|
||||
{
|
||||
SectionTable::const_iterator i = table.find(sectionName);
|
||||
|
||||
@@ -158,15 +156,15 @@ IniFile::findSection(const string §ionName) const
|
||||
// Take string of the form "<section>:<parameter>=<value>" and add to
|
||||
// database. Return true if successful, false if parse error.
|
||||
bool
|
||||
IniFile::add(const string &str)
|
||||
IniFile::add(const std::string &str)
|
||||
{
|
||||
// find ':'
|
||||
string::size_type offset = str.find(':');
|
||||
if (offset == string::npos) // no ':' found
|
||||
std::string::size_type offset = str.find(':');
|
||||
if (offset == std::string::npos) // no ':' found
|
||||
return false;
|
||||
|
||||
string sectionName = str.substr(0, offset);
|
||||
string rest = str.substr(offset + 1);
|
||||
std::string sectionName = str.substr(0, offset);
|
||||
std::string rest = str.substr(offset + 1);
|
||||
|
||||
eat_white(sectionName);
|
||||
Section *s = addSection(sectionName);
|
||||
@@ -175,17 +173,17 @@ IniFile::add(const string &str)
|
||||
}
|
||||
|
||||
bool
|
||||
IniFile::load(istream &f)
|
||||
IniFile::load(std::istream &f)
|
||||
{
|
||||
Section *section = NULL;
|
||||
|
||||
while (!f.eof()) {
|
||||
f >> ws; // Eat whitespace
|
||||
f >> std::ws; // Eat whitespace
|
||||
if (f.eof()) {
|
||||
break;
|
||||
}
|
||||
|
||||
string line;
|
||||
std::string line;
|
||||
getline(f, line);
|
||||
if (line.size() == 0)
|
||||
continue;
|
||||
@@ -194,7 +192,7 @@ IniFile::load(istream &f)
|
||||
int last = line.size() - 1;
|
||||
|
||||
if (line[0] == '[' && line[last] == ']') {
|
||||
string sectionName = line.substr(1, last - 1);
|
||||
std::string sectionName = line.substr(1, last - 1);
|
||||
eat_white(sectionName);
|
||||
section = addSection(sectionName);
|
||||
continue;
|
||||
@@ -211,8 +209,8 @@ IniFile::load(istream &f)
|
||||
}
|
||||
|
||||
bool
|
||||
IniFile::find(const string §ionName, const string &entryName,
|
||||
string &value) const
|
||||
IniFile::find(const std::string §ionName, const std::string &entryName,
|
||||
std::string &value) const
|
||||
{
|
||||
Section *section = findSection(sectionName);
|
||||
if (section == NULL)
|
||||
@@ -228,7 +226,8 @@ IniFile::find(const string §ionName, const string &entryName,
|
||||
}
|
||||
|
||||
bool
|
||||
IniFile::entryExists(const string §ionName, const string &entryName) const
|
||||
IniFile::entryExists(const std::string §ionName,
|
||||
const std::string &entryName) const
|
||||
{
|
||||
Section *section = findSection(sectionName);
|
||||
|
||||
@@ -239,18 +238,18 @@ IniFile::entryExists(const string §ionName, const string &entryName) const
|
||||
}
|
||||
|
||||
bool
|
||||
IniFile::sectionExists(const string §ionName) const
|
||||
IniFile::sectionExists(const std::string §ionName) const
|
||||
{
|
||||
return findSection(sectionName) != NULL;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
IniFile::Section::printUnreferenced(const string §ionName)
|
||||
IniFile::Section::printUnreferenced(const std::string §ionName)
|
||||
{
|
||||
bool unref = false;
|
||||
bool search_unref_entries = false;
|
||||
vector<string> unref_ok_entries;
|
||||
std::vector<std::string> unref_ok_entries;
|
||||
|
||||
Entry *entry = findEntry("unref_entries_ok");
|
||||
if (entry != NULL) {
|
||||
@@ -262,7 +261,7 @@ IniFile::Section::printUnreferenced(const string §ionName)
|
||||
|
||||
for (EntryTable::iterator ei = table.begin();
|
||||
ei != table.end(); ++ei) {
|
||||
const string &entryName = ei->first;
|
||||
const std::string &entryName = ei->first;
|
||||
entry = ei->second;
|
||||
|
||||
if (entryName == "unref_section_ok" ||
|
||||
@@ -279,8 +278,8 @@ IniFile::Section::printUnreferenced(const string §ionName)
|
||||
continue;
|
||||
}
|
||||
|
||||
cerr << "Parameter " << sectionName << ":" << entryName
|
||||
<< " not referenced." << endl;
|
||||
std::cerr << "Parameter " << sectionName << ":" << entryName
|
||||
<< " not referenced." << std::endl;
|
||||
unref = true;
|
||||
}
|
||||
}
|
||||
@@ -290,7 +289,7 @@ IniFile::Section::printUnreferenced(const string §ionName)
|
||||
|
||||
|
||||
void
|
||||
IniFile::getSectionNames(vector<string> &list) const
|
||||
IniFile::getSectionNames(std::vector<std::string> &list) const
|
||||
{
|
||||
for (SectionTable::const_iterator i = table.begin();
|
||||
i != table.end(); ++i)
|
||||
@@ -306,13 +305,13 @@ IniFile::printUnreferenced()
|
||||
|
||||
for (SectionTable::iterator i = table.begin();
|
||||
i != table.end(); ++i) {
|
||||
const string §ionName = i->first;
|
||||
const std::string §ionName = i->first;
|
||||
Section *section = i->second;
|
||||
|
||||
if (!section->isReferenced()) {
|
||||
if (section->findEntry("unref_section_ok") == NULL) {
|
||||
cerr << "Section " << sectionName << " not referenced."
|
||||
<< endl;
|
||||
std::cerr << "Section " << sectionName << " not referenced."
|
||||
<< std::endl;
|
||||
unref = true;
|
||||
}
|
||||
}
|
||||
@@ -328,12 +327,12 @@ IniFile::printUnreferenced()
|
||||
|
||||
|
||||
void
|
||||
IniFile::Section::dump(const string §ionName)
|
||||
IniFile::Section::dump(const std::string §ionName)
|
||||
{
|
||||
for (EntryTable::iterator ei = table.begin();
|
||||
ei != table.end(); ++ei) {
|
||||
cout << sectionName << ": " << (*ei).first << " => "
|
||||
<< (*ei).second->getValue() << "\n";
|
||||
std::cout << sectionName << ": " << (*ei).first << " => "
|
||||
<< (*ei).second->getValue() << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
|
||||
#include "base/inifile.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace {
|
||||
|
||||
std::istringstream iniFile(R"ini_file(
|
||||
|
||||
@@ -39,8 +39,6 @@
|
||||
#include "base/types.hh"
|
||||
#include "sim/serialize.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace Loader
|
||||
{
|
||||
|
||||
@@ -93,10 +91,10 @@ SymbolTable::insert(const SymbolTable &other)
|
||||
}
|
||||
|
||||
bool
|
||||
SymbolTable::load(const string &filename)
|
||||
SymbolTable::load(const std::string &filename)
|
||||
{
|
||||
string buffer;
|
||||
ifstream file(filename.c_str());
|
||||
std::string buffer;
|
||||
std::ifstream file(filename.c_str());
|
||||
|
||||
if (!file)
|
||||
fatal("file error: Can't open symbol table file %s\n", filename);
|
||||
@@ -106,16 +104,16 @@ SymbolTable::load(const string &filename)
|
||||
if (buffer.empty())
|
||||
continue;
|
||||
|
||||
string::size_type idx = buffer.find(',');
|
||||
if (idx == string::npos)
|
||||
std::string::size_type idx = buffer.find(',');
|
||||
if (idx == std::string::npos)
|
||||
return false;
|
||||
|
||||
string address = buffer.substr(0, idx);
|
||||
std::string address = buffer.substr(0, idx);
|
||||
eat_white(address);
|
||||
if (address.empty())
|
||||
return false;
|
||||
|
||||
string name = buffer.substr(idx + 1);
|
||||
std::string name = buffer.substr(idx + 1);
|
||||
eat_white(name);
|
||||
if (name.empty())
|
||||
return false;
|
||||
@@ -133,7 +131,7 @@ SymbolTable::load(const string &filename)
|
||||
}
|
||||
|
||||
void
|
||||
SymbolTable::serialize(const string &base, CheckpointOut &cp) const
|
||||
SymbolTable::serialize(const std::string &base, CheckpointOut &cp) const
|
||||
{
|
||||
paramOut(cp, base + ".size", symbols.size());
|
||||
|
||||
@@ -147,7 +145,7 @@ SymbolTable::serialize(const string &base, CheckpointOut &cp) const
|
||||
}
|
||||
|
||||
void
|
||||
SymbolTable::unserialize(const string &base, CheckpointIn &cp,
|
||||
SymbolTable::unserialize(const std::string &base, CheckpointIn &cp,
|
||||
Symbol::Binding default_binding)
|
||||
{
|
||||
clear();
|
||||
|
||||
@@ -31,13 +31,11 @@
|
||||
|
||||
#include "base/str.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
ObjectMatch::ObjectMatch()
|
||||
{
|
||||
}
|
||||
|
||||
ObjectMatch::ObjectMatch(const string &expr)
|
||||
ObjectMatch::ObjectMatch(const std::string &expr)
|
||||
{
|
||||
setExpression(expr);
|
||||
}
|
||||
@@ -49,20 +47,20 @@ ObjectMatch::add(const ObjectMatch &other)
|
||||
}
|
||||
|
||||
void
|
||||
ObjectMatch::setExpression(const string &expr)
|
||||
ObjectMatch::setExpression(const std::string &expr)
|
||||
{
|
||||
tokens.resize(1);
|
||||
tokenize(tokens[0], expr, '.');
|
||||
}
|
||||
|
||||
void
|
||||
ObjectMatch::setExpression(const vector<string> &expr)
|
||||
ObjectMatch::setExpression(const std::vector<std::string> &expr)
|
||||
{
|
||||
if (expr.empty()) {
|
||||
tokens.resize(0);
|
||||
} else {
|
||||
tokens.resize(expr.size());
|
||||
for (vector<string>::size_type i = 0; i < expr.size(); ++i)
|
||||
for (std::vector<std::string>::size_type i = 0; i < expr.size(); ++i)
|
||||
tokenize(tokens[i], expr[i], '.');
|
||||
}
|
||||
}
|
||||
@@ -72,15 +70,15 @@ ObjectMatch::setExpression(const vector<string> &expr)
|
||||
* expression code
|
||||
*/
|
||||
bool
|
||||
ObjectMatch::domatch(const string &name) const
|
||||
ObjectMatch::domatch(const std::string &name) const
|
||||
{
|
||||
vector<string> name_tokens;
|
||||
std::vector<std::string> name_tokens;
|
||||
tokenize(name_tokens, name, '.');
|
||||
int ntsize = name_tokens.size();
|
||||
|
||||
int num_expr = tokens.size();
|
||||
for (int i = 0; i < num_expr; ++i) {
|
||||
const vector<string> &token = tokens[i];
|
||||
const std::vector<std::string> &token = tokens[i];
|
||||
int jstop = token.size();
|
||||
|
||||
bool match = true;
|
||||
@@ -88,7 +86,7 @@ ObjectMatch::domatch(const string &name) const
|
||||
if (j >= ntsize)
|
||||
break;
|
||||
|
||||
const string &var = token[j];
|
||||
const std::string &var = token[j];
|
||||
if (var != "*" && var != name_tokens[j]) {
|
||||
match = false;
|
||||
break;
|
||||
|
||||
@@ -56,8 +56,6 @@
|
||||
|
||||
#include "base/logging.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
OutputDirectory simout;
|
||||
|
||||
|
||||
@@ -108,8 +106,8 @@ OutputFile<StreamType>::relocate(const OutputDirectory &dir)
|
||||
}
|
||||
}
|
||||
|
||||
OutputStream OutputDirectory::stdout("stdout", &cout);
|
||||
OutputStream OutputDirectory::stderr("stderr", &cerr);
|
||||
OutputStream OutputDirectory::stdout("stdout", &std::cout);
|
||||
OutputStream OutputDirectory::stderr("stderr", &std::cerr);
|
||||
|
||||
/**
|
||||
* @file This file manages creating / deleting output files for the simulator.
|
||||
@@ -131,7 +129,7 @@ OutputDirectory::~OutputDirectory()
|
||||
}
|
||||
|
||||
OutputStream *
|
||||
OutputDirectory::checkForStdio(const string &name)
|
||||
OutputDirectory::checkForStdio(const std::string &name)
|
||||
{
|
||||
if (name == "cerr" || name == "stderr")
|
||||
return &stderr;
|
||||
@@ -160,9 +158,9 @@ OutputDirectory::close(OutputStream *file)
|
||||
}
|
||||
|
||||
void
|
||||
OutputDirectory::setDirectory(const string &d)
|
||||
OutputDirectory::setDirectory(const std::string &d)
|
||||
{
|
||||
const string old_dir(dir);
|
||||
const std::string old_dir(dir);
|
||||
|
||||
dir = d;
|
||||
|
||||
@@ -190,7 +188,7 @@ OutputDirectory::setDirectory(const string &d)
|
||||
|
||||
}
|
||||
|
||||
const string &
|
||||
const std::string &
|
||||
OutputDirectory::directory() const
|
||||
{
|
||||
if (dir.empty())
|
||||
@@ -199,21 +197,21 @@ OutputDirectory::directory() const
|
||||
return dir;
|
||||
}
|
||||
|
||||
string
|
||||
OutputDirectory::resolve(const string &name) const
|
||||
std::string
|
||||
OutputDirectory::resolve(const std::string &name) const
|
||||
{
|
||||
return !isAbsolute(name) ? dir + name : name;
|
||||
}
|
||||
|
||||
OutputStream *
|
||||
OutputDirectory::create(const string &name, bool binary, bool no_gz)
|
||||
OutputDirectory::create(const std::string &name, bool binary, bool no_gz)
|
||||
{
|
||||
OutputStream *file = checkForStdio(name);
|
||||
if (file)
|
||||
return file;
|
||||
|
||||
const ios_base::openmode mode(
|
||||
ios::trunc | (binary ? ios::binary : (ios::openmode)0));
|
||||
const std::ios_base::openmode mode(
|
||||
std::ios::trunc | (binary ? std::ios::binary : (std::ios::openmode)0));
|
||||
const bool recreateable(!isAbsolute(name));
|
||||
|
||||
return open(name, mode, recreateable, no_gz);
|
||||
@@ -221,7 +219,7 @@ OutputDirectory::create(const string &name, bool binary, bool no_gz)
|
||||
|
||||
OutputStream *
|
||||
OutputDirectory::open(const std::string &name,
|
||||
ios_base::openmode mode,
|
||||
std::ios_base::openmode mode,
|
||||
bool recreateable,
|
||||
bool no_gz)
|
||||
{
|
||||
@@ -234,7 +232,7 @@ OutputDirectory::open(const std::string &name,
|
||||
mode |= std::ios::out;
|
||||
os = new OutputFile<gzofstream>(*this, name, mode, recreateable);
|
||||
} else {
|
||||
os = new OutputFile<ofstream>(*this, name, mode, recreateable);
|
||||
os = new OutputFile<std::ofstream>(*this, name, mode, recreateable);
|
||||
}
|
||||
|
||||
files[name] = os;
|
||||
@@ -243,7 +241,7 @@ OutputDirectory::open(const std::string &name,
|
||||
}
|
||||
|
||||
OutputStream *
|
||||
OutputDirectory::find(const string &name) const
|
||||
OutputDirectory::find(const std::string &name) const
|
||||
{
|
||||
OutputStream *file = checkForStdio(name);
|
||||
if (file)
|
||||
@@ -268,7 +266,7 @@ OutputDirectory::findOrCreate(const std::string &name, bool binary)
|
||||
}
|
||||
|
||||
bool
|
||||
OutputDirectory::isFile(const string &name) const
|
||||
OutputDirectory::isFile(const std::string &name) const
|
||||
{
|
||||
// definitely a file if in our data structure
|
||||
if (find(name) != NULL) return true;
|
||||
@@ -279,10 +277,10 @@ OutputDirectory::isFile(const string &name) const
|
||||
}
|
||||
|
||||
OutputDirectory *
|
||||
OutputDirectory::createSubdirectory(const string &name)
|
||||
OutputDirectory::createSubdirectory(const std::string &name)
|
||||
{
|
||||
const string new_dir = resolve(name);
|
||||
if (new_dir.find(directory()) == string::npos)
|
||||
const std::string new_dir = resolve(name);
|
||||
if (new_dir.find(directory()) == std::string::npos)
|
||||
fatal("Attempting to create subdirectory not in m5 output dir\n");
|
||||
|
||||
OutputDirectory *dir(new OutputDirectory(new_dir));
|
||||
@@ -292,11 +290,11 @@ OutputDirectory::createSubdirectory(const string &name)
|
||||
}
|
||||
|
||||
void
|
||||
OutputDirectory::remove(const string &name, bool recursive)
|
||||
OutputDirectory::remove(const std::string &name, bool recursive)
|
||||
{
|
||||
const string fname = resolve(name);
|
||||
const std::string fname = resolve(name);
|
||||
|
||||
if (fname.find(directory()) == string::npos)
|
||||
if (fname.find(directory()) == std::string::npos)
|
||||
fatal("Attempting to remove file/dir not in output dir\n");
|
||||
|
||||
if (isFile(fname)) {
|
||||
|
||||
@@ -50,8 +50,6 @@
|
||||
#include "sim/eventq.hh"
|
||||
#include "sim/serialize.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
PollQueue pollQueue;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@@ -35,16 +35,15 @@
|
||||
|
||||
#include "base/refcnt.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace {
|
||||
|
||||
class TestRC;
|
||||
typedef list<TestRC *> LiveList;
|
||||
typedef std::list<TestRC *> LiveList;
|
||||
LiveList liveList;
|
||||
|
||||
int
|
||||
liveListSize(){
|
||||
liveListSize()
|
||||
{
|
||||
return liveList.size();
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,6 @@
|
||||
#include "sim/full_system.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
using namespace std;
|
||||
using namespace TheISA;
|
||||
|
||||
static const char GDBStart = '$';
|
||||
@@ -159,7 +158,7 @@ static const char GDBEnd = '#';
|
||||
static const char GDBGoodP = '+';
|
||||
static const char GDBBadP = '-';
|
||||
|
||||
vector<BaseRemoteGDB *> debuggers;
|
||||
std::vector<BaseRemoteGDB *> debuggers;
|
||||
|
||||
class HardBreakpoint : public PCEvent
|
||||
{
|
||||
@@ -202,7 +201,7 @@ struct BadClient
|
||||
// Exception to throw when an error needs to be reported to the client.
|
||||
struct CmdError
|
||||
{
|
||||
string error;
|
||||
std::string error;
|
||||
CmdError(std::string _error) : error(_error)
|
||||
{}
|
||||
};
|
||||
@@ -328,7 +327,7 @@ BaseRemoteGDB::~BaseRemoteGDB()
|
||||
delete dataEvent;
|
||||
}
|
||||
|
||||
string
|
||||
std::string
|
||||
BaseRemoteGDB::name()
|
||||
{
|
||||
return sys->name() + ".remote_gdb";
|
||||
@@ -350,7 +349,7 @@ BaseRemoteGDB::listen()
|
||||
connectEvent = new ConnectEvent(this, listener.getfd(), POLLIN);
|
||||
pollQueue.schedule(connectEvent);
|
||||
|
||||
ccprintf(cerr, "%d: %s: listening for remote gdb on port %d\n",
|
||||
ccprintf(std::cerr, "%d: %s: listening for remote gdb on port %d\n",
|
||||
curTick(), name(), _port);
|
||||
}
|
||||
|
||||
@@ -940,8 +939,8 @@ BaseRemoteGDB::cmd_mem_w(GdbCommand::Context &ctx)
|
||||
bool
|
||||
BaseRemoteGDB::cmd_query_var(GdbCommand::Context &ctx)
|
||||
{
|
||||
string s(ctx.data, ctx.len - 1);
|
||||
string xfer_read_prefix = "Xfer:features:read:";
|
||||
std::string s(ctx.data, ctx.len - 1);
|
||||
std::string xfer_read_prefix = "Xfer:features:read:";
|
||||
if (s.rfind("Supported:", 0) == 0) {
|
||||
std::ostringstream oss;
|
||||
// This reply field mandatory. We can receive arbitrarily
|
||||
|
||||
@@ -43,8 +43,6 @@
|
||||
#include "base/types.hh"
|
||||
#include "sim/byteswap.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool ListenSocket::listeningDisabled = false;
|
||||
bool ListenSocket::anyListening = false;
|
||||
|
||||
@@ -121,7 +119,7 @@ ListenSocket::listen(int port, bool reuse)
|
||||
htobe<in_addr_t>(bindToLoopback ? INADDR_LOOPBACK : INADDR_ANY);
|
||||
sockaddr.sin_port = htons(port);
|
||||
// finally clear sin_zero
|
||||
memset(&sockaddr.sin_zero, 0, sizeof(sockaddr.sin_zero));
|
||||
std::memset(&sockaddr.sin_zero, 0, sizeof(sockaddr.sin_zero));
|
||||
int ret = ::bind(fd, (struct sockaddr *)&sockaddr, sizeof (sockaddr));
|
||||
if (ret != 0) {
|
||||
if (ret == -1 && errno != EADDRINUSE)
|
||||
|
||||
@@ -56,17 +56,15 @@
|
||||
#include "base/trace.hh"
|
||||
#include "sim/root.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace Stats {
|
||||
|
||||
std::string Info::separatorString = "::";
|
||||
|
||||
// We wrap these in a function to make sure they're built in time.
|
||||
list<Info *> &
|
||||
std::list<Info *> &
|
||||
statsList()
|
||||
{
|
||||
static list<Info *> the_list;
|
||||
static std::list<Info *> the_list;
|
||||
return the_list;
|
||||
}
|
||||
|
||||
@@ -94,9 +92,9 @@ InfoAccess::setInfo(Group *parent, Info *info)
|
||||
statsList().push_back(info);
|
||||
|
||||
#ifndef NDEBUG
|
||||
pair<MapType::iterator, bool> result =
|
||||
std::pair<MapType::iterator, bool> result =
|
||||
#endif
|
||||
statsMap().insert(make_pair(this, info));
|
||||
statsMap().insert(std::make_pair(this, info));
|
||||
assert(result.second && "this should never fail");
|
||||
assert(statsMap().find(this) != statsMap().end());
|
||||
}
|
||||
@@ -169,19 +167,19 @@ Info::~Info()
|
||||
}
|
||||
|
||||
bool
|
||||
validateStatName(const string &name)
|
||||
validateStatName(const std::string &name)
|
||||
{
|
||||
if (name.empty())
|
||||
return false;
|
||||
|
||||
vector<string> vec;
|
||||
std::vector<std::string> vec;
|
||||
tokenize(vec, name, '.');
|
||||
vector<string>::const_iterator item = vec.begin();
|
||||
std::vector<std::string>::const_iterator item = vec.begin();
|
||||
while (item != vec.end()) {
|
||||
if (item->empty())
|
||||
return false;
|
||||
|
||||
string::const_iterator c = item->begin();
|
||||
std::string::const_iterator c = item->begin();
|
||||
|
||||
// The first character is different
|
||||
if (!isalpha(*c) && *c != '_')
|
||||
@@ -200,13 +198,13 @@ validateStatName(const string &name)
|
||||
}
|
||||
|
||||
void
|
||||
Info::setName(const string &name)
|
||||
Info::setName(const std::string &name)
|
||||
{
|
||||
setName(nullptr, name);
|
||||
}
|
||||
|
||||
void
|
||||
Info::setName(const Group *parent, const string &name)
|
||||
Info::setName(const Group *parent, const std::string &name)
|
||||
{
|
||||
if (!validateStatName(name))
|
||||
panic("invalid stat name '%s'", name);
|
||||
@@ -229,16 +227,16 @@ Info::setName(const Group *parent, const string &name)
|
||||
bool
|
||||
Info::less(Info *stat1, Info *stat2)
|
||||
{
|
||||
const string &name1 = stat1->name;
|
||||
const string &name2 = stat2->name;
|
||||
const std::string &name1 = stat1->name;
|
||||
const std::string &name2 = stat2->name;
|
||||
|
||||
vector<string> v1;
|
||||
vector<string> v2;
|
||||
std::vector<std::string> v1;
|
||||
std::vector<std::string> v2;
|
||||
|
||||
tokenize(v1, name1, '.');
|
||||
tokenize(v2, name2, '.');
|
||||
|
||||
size_type last = min(v1.size(), v2.size()) - 1;
|
||||
size_type last = std::min(v1.size(), v2.size()) - 1;
|
||||
for (off_type i = 0; i < last; ++i)
|
||||
if (v1[i] != v2[i])
|
||||
return v1[i] < v2[i];
|
||||
@@ -502,7 +500,7 @@ Formula::zero() const
|
||||
return true;
|
||||
}
|
||||
|
||||
string
|
||||
std::string
|
||||
Formula::str() const
|
||||
{
|
||||
return root ? root->str() : "";
|
||||
|
||||
@@ -66,8 +66,6 @@
|
||||
#include "base/stats/info.hh"
|
||||
#include "base/str.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#ifndef NAN
|
||||
float __nan();
|
||||
/** Define Not a number. */
|
||||
@@ -137,7 +135,7 @@ Text::open(const std::string &file)
|
||||
panic("stream already set!");
|
||||
|
||||
mystream = true;
|
||||
stream = new ofstream(file.c_str(), ios::trunc);
|
||||
stream = new std::ofstream(file.c_str(), std::ios::trunc);
|
||||
if (!valid())
|
||||
fatal("Unable to open statistics file for writing\n");
|
||||
}
|
||||
@@ -199,10 +197,10 @@ Text::noOutput(const Info &info)
|
||||
return false;
|
||||
}
|
||||
|
||||
string
|
||||
std::string
|
||||
ValueToString(Result value, int precision)
|
||||
{
|
||||
stringstream val;
|
||||
std::stringstream val;
|
||||
|
||||
if (!std::isnan(value)) {
|
||||
if (precision != -1)
|
||||
@@ -210,8 +208,8 @@ ValueToString(Result value, int precision)
|
||||
else if (value == rint(value))
|
||||
val.precision(0);
|
||||
|
||||
val.unsetf(ios::showpoint);
|
||||
val.setf(ios::fixed);
|
||||
val.unsetf(std::ios::showpoint);
|
||||
val.setf(std::ios::fixed);
|
||||
val << value;
|
||||
} else {
|
||||
val << "nan";
|
||||
@@ -223,8 +221,8 @@ ValueToString(Result value, int precision)
|
||||
struct ScalarPrint
|
||||
{
|
||||
Result value;
|
||||
string name;
|
||||
string desc;
|
||||
std::string name;
|
||||
std::string desc;
|
||||
Flags flags;
|
||||
bool descriptions;
|
||||
bool spaces;
|
||||
@@ -250,7 +248,7 @@ struct ScalarPrint
|
||||
}
|
||||
}
|
||||
void update(Result val, Result total);
|
||||
void operator()(ostream &stream, bool oneLine = false) const;
|
||||
void operator()(std::ostream &stream, bool oneLine = false) const;
|
||||
};
|
||||
|
||||
void
|
||||
@@ -264,13 +262,13 @@ ScalarPrint::update(Result val, Result total)
|
||||
}
|
||||
|
||||
void
|
||||
ScalarPrint::operator()(ostream &stream, bool oneLine) const
|
||||
ScalarPrint::operator()(std::ostream &stream, bool oneLine) const
|
||||
{
|
||||
if ((flags.isSet(nozero) && (!oneLine) && value == 0.0) ||
|
||||
(flags.isSet(nonan) && std::isnan(value)))
|
||||
return;
|
||||
|
||||
stringstream pdfstr, cdfstr;
|
||||
std::stringstream pdfstr, cdfstr;
|
||||
|
||||
if (!std::isnan(pdf))
|
||||
ccprintf(pdfstr, "%.2f%%", pdf * 100.0);
|
||||
@@ -293,17 +291,17 @@ ScalarPrint::operator()(ostream &stream, bool oneLine) const
|
||||
if (!desc.empty())
|
||||
ccprintf(stream, " # %s", desc);
|
||||
}
|
||||
stream << endl;
|
||||
stream << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
struct VectorPrint
|
||||
{
|
||||
string name;
|
||||
string separatorString;
|
||||
string desc;
|
||||
vector<string> subnames;
|
||||
vector<string> subdescs;
|
||||
std::string name;
|
||||
std::string separatorString;
|
||||
std::string desc;
|
||||
std::vector<std::string> subnames;
|
||||
std::vector<std::string> subdescs;
|
||||
Flags flags;
|
||||
bool descriptions;
|
||||
bool spaces;
|
||||
@@ -321,7 +319,7 @@ struct VectorPrint
|
||||
nameSpaces = 0;
|
||||
}
|
||||
}
|
||||
void operator()(ostream &stream) const;
|
||||
void operator()(std::ostream &stream) const;
|
||||
};
|
||||
|
||||
void
|
||||
@@ -336,7 +334,7 @@ VectorPrint::operator()(std::ostream &stream) const
|
||||
}
|
||||
}
|
||||
|
||||
string base = name + separatorString;
|
||||
std::string base = name + separatorString;
|
||||
|
||||
ScalarPrint print(spaces);
|
||||
print.name = name;
|
||||
@@ -382,7 +380,7 @@ VectorPrint::operator()(std::ostream &stream) const
|
||||
if (!desc.empty())
|
||||
ccprintf(stream, " # %s", desc);
|
||||
}
|
||||
stream << endl;
|
||||
stream << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,9 +396,9 @@ VectorPrint::operator()(std::ostream &stream) const
|
||||
|
||||
struct DistPrint
|
||||
{
|
||||
string name;
|
||||
string separatorString;
|
||||
string desc;
|
||||
std::string name;
|
||||
std::string separatorString;
|
||||
std::string desc;
|
||||
Flags flags;
|
||||
bool descriptions;
|
||||
bool spaces;
|
||||
@@ -412,7 +410,7 @@ struct DistPrint
|
||||
DistPrint(const Text *text, const DistInfo &info);
|
||||
DistPrint(const Text *text, const VectorDistInfo &info, int i);
|
||||
void init(const Text *text, const Info &info);
|
||||
void operator()(ostream &stream) const;
|
||||
void operator()(std::ostream &stream) const;
|
||||
};
|
||||
|
||||
DistPrint::DistPrint(const Text *text, const DistInfo &info)
|
||||
@@ -452,10 +450,10 @@ DistPrint::init(const Text *text, const Info &info)
|
||||
}
|
||||
|
||||
void
|
||||
DistPrint::operator()(ostream &stream) const
|
||||
DistPrint::operator()(std::ostream &stream) const
|
||||
{
|
||||
if (flags.isSet(nozero) && data.samples == 0) return;
|
||||
string base = name + separatorString;
|
||||
std::string base = name + separatorString;
|
||||
|
||||
ScalarPrint print(spaces);
|
||||
print.precision = precision;
|
||||
@@ -530,11 +528,11 @@ DistPrint::operator()(ostream &stream) const
|
||||
}
|
||||
|
||||
for (off_type i = 0; i < size; ++i) {
|
||||
stringstream namestr;
|
||||
std::stringstream namestr;
|
||||
namestr << base;
|
||||
|
||||
Counter low = i * data.bucket_size + data.min;
|
||||
Counter high = ::min(low + data.bucket_size - 1.0, data.max);
|
||||
Counter high = std::min(low + data.bucket_size - 1.0, data.max);
|
||||
namestr << low;
|
||||
if (low < high)
|
||||
namestr << "-" << high;
|
||||
@@ -549,7 +547,7 @@ DistPrint::operator()(ostream &stream) const
|
||||
if (!desc.empty())
|
||||
ccprintf(stream, " # %s", desc);
|
||||
}
|
||||
stream << endl;
|
||||
stream << std::endl;
|
||||
}
|
||||
|
||||
if (data.type == Dist && data.overflow != NAN) {
|
||||
@@ -691,7 +689,7 @@ Text::visit(const Vector2dInfo &info)
|
||||
}
|
||||
|
||||
// Create a subname for printing the total
|
||||
vector<string> total_subname;
|
||||
std::vector<std::string> total_subname;
|
||||
total_subname.push_back("total");
|
||||
|
||||
if (info.flags.isSet(::Stats::total) && (info.x > 1)) {
|
||||
@@ -738,9 +736,9 @@ Text::visit(const FormulaInfo &info)
|
||||
*/
|
||||
struct SparseHistPrint
|
||||
{
|
||||
string name;
|
||||
string separatorString;
|
||||
string desc;
|
||||
std::string name;
|
||||
std::string separatorString;
|
||||
std::string desc;
|
||||
Flags flags;
|
||||
bool descriptions;
|
||||
bool spaces;
|
||||
@@ -750,7 +748,7 @@ struct SparseHistPrint
|
||||
|
||||
SparseHistPrint(const Text *text, const SparseHistInfo &info);
|
||||
void init(const Text *text, const Info &info);
|
||||
void operator()(ostream &stream) const;
|
||||
void operator()(std::ostream &stream) const;
|
||||
};
|
||||
|
||||
/* Call initialization function */
|
||||
@@ -775,9 +773,9 @@ SparseHistPrint::init(const Text *text, const Info &info)
|
||||
|
||||
/* Grab data from map and write to output stream */
|
||||
void
|
||||
SparseHistPrint::operator()(ostream &stream) const
|
||||
SparseHistPrint::operator()(std::ostream &stream) const
|
||||
{
|
||||
string base = name + separatorString;
|
||||
std::string base = name + separatorString;
|
||||
|
||||
ScalarPrint print(spaces);
|
||||
print.precision = precision;
|
||||
@@ -793,7 +791,7 @@ SparseHistPrint::operator()(ostream &stream) const
|
||||
|
||||
MCounter::const_iterator it;
|
||||
for (it = data.cmap.begin(); it != data.cmap.end(); it++) {
|
||||
stringstream namestr;
|
||||
std::stringstream namestr;
|
||||
namestr << base;
|
||||
|
||||
namestr <<(*it).first;
|
||||
@@ -814,7 +812,7 @@ Text::visit(const SparseHistInfo &info)
|
||||
}
|
||||
|
||||
Output *
|
||||
initText(const string &filename, bool desc, bool spaces)
|
||||
initText(const std::string &filename, bool desc, bool spaces)
|
||||
{
|
||||
static Text text;
|
||||
static bool connected = false;
|
||||
|
||||
@@ -31,13 +31,11 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool
|
||||
split_first(const string &s, string &lhs, string &rhs, char c)
|
||||
split_first(const std::string &s, std::string &lhs, std::string &rhs, char c)
|
||||
{
|
||||
string::size_type offset = s.find(c);
|
||||
if (offset == string::npos) {
|
||||
std::string::size_type offset = s.find(c);
|
||||
if (offset == std::string::npos) {
|
||||
lhs = s;
|
||||
rhs = "";
|
||||
return false;
|
||||
@@ -49,10 +47,10 @@ split_first(const string &s, string &lhs, string &rhs, char c)
|
||||
}
|
||||
|
||||
bool
|
||||
split_last(const string &s, string &lhs, string &rhs, char c)
|
||||
split_last(const std::string &s, std::string &lhs, std::string &rhs, char c)
|
||||
{
|
||||
string::size_type offset = s.rfind(c);
|
||||
if (offset == string::npos) {
|
||||
std::string::size_type offset = s.rfind(c);
|
||||
if (offset == std::string::npos) {
|
||||
lhs = s;
|
||||
rhs = "";
|
||||
return false;
|
||||
@@ -64,10 +62,11 @@ split_last(const string &s, string &lhs, string &rhs, char c)
|
||||
}
|
||||
|
||||
void
|
||||
tokenize(vector<string>& v, const string &s, char token, bool ignore)
|
||||
tokenize(std::vector<std::string>& v, const std::string &s, char token,
|
||||
bool ignore)
|
||||
{
|
||||
string::size_type first = 0;
|
||||
string::size_type last = s.find_first_of(token);
|
||||
std::string::size_type first = 0;
|
||||
std::string::size_type last = s.find_first_of(token);
|
||||
|
||||
if (s.empty())
|
||||
return;
|
||||
@@ -76,20 +75,20 @@ tokenize(vector<string>& v, const string &s, char token, bool ignore)
|
||||
while (last == first)
|
||||
last = s.find_first_of(token, ++first);
|
||||
|
||||
if (last == string::npos) {
|
||||
if (last == std::string::npos) {
|
||||
if (first != s.size())
|
||||
v.push_back(s.substr(first));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
while (last != string::npos) {
|
||||
while (last != std::string::npos) {
|
||||
v.push_back(s.substr(first, last - first));
|
||||
|
||||
if (ignore) {
|
||||
first = s.find_first_not_of(token, last + 1);
|
||||
|
||||
if (first == string::npos)
|
||||
if (first == std::string::npos)
|
||||
return;
|
||||
} else
|
||||
first = last + 1;
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
#include "sim/core.hh"
|
||||
#include "sim/serialize.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
void
|
||||
Time::_set(bool monotonic)
|
||||
{
|
||||
@@ -68,8 +66,8 @@ Time::getTick() const
|
||||
static_cast<uint64_t>(nsec() * SimClock::Float::ns);
|
||||
}
|
||||
|
||||
string
|
||||
Time::date(const string &format) const
|
||||
std::string
|
||||
Time::date(const std::string &format) const
|
||||
{
|
||||
time_t sec = this->sec();
|
||||
char buf[256];
|
||||
@@ -89,7 +87,7 @@ Time::date(const string &format) const
|
||||
return buf;
|
||||
}
|
||||
|
||||
string
|
||||
std::string
|
||||
Time::time() const
|
||||
{
|
||||
double time = double(*this);
|
||||
@@ -98,7 +96,7 @@ Time::time() const
|
||||
double mins = fmod(all_mins, 60.0);
|
||||
double hours = floor(all_mins / 60.0);
|
||||
|
||||
stringstream str;
|
||||
std::stringstream str;
|
||||
|
||||
if (hours > 0.0) {
|
||||
if (hours < 10.0)
|
||||
|
||||
@@ -49,8 +49,6 @@
|
||||
#include "base/trace.hh"
|
||||
#include "debug/VNC.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
VncInput::VncInput(const Params &p)
|
||||
: SimObject(p), keyboard(NULL), mouse(NULL),
|
||||
fb(&FrameBuffer::dummy),
|
||||
@@ -62,7 +60,7 @@ VncInput::VncInput(const Params &p)
|
||||
if (captureEnabled) {
|
||||
// remove existing frame output directory if it exists, then create a
|
||||
// clean empty directory
|
||||
const string FRAME_OUTPUT_SUBDIR = "frames_" + name();
|
||||
const std::string FRAME_OUTPUT_SUBDIR = "frames_" + name();
|
||||
simout.remove(FRAME_OUTPUT_SUBDIR, true);
|
||||
captureOutputDirectory = simout.createSubdirectory(
|
||||
FRAME_OUTPUT_SUBDIR);
|
||||
@@ -124,7 +122,7 @@ VncInput::captureFrameBuffer()
|
||||
snprintf(frameFilenameBuffer, 64, "fb.%06d.%lld.%s.gz",
|
||||
captureCurrentFrame, static_cast<long long int>(curTick()),
|
||||
captureImage->getImgExtension());
|
||||
const string frameFilename(frameFilenameBuffer);
|
||||
const std::string frameFilename(frameFilenameBuffer);
|
||||
|
||||
// create the compressed framebuffer file
|
||||
OutputStream *fb_out(captureOutputDirectory->create(frameFilename, true));
|
||||
|
||||
@@ -69,8 +69,6 @@
|
||||
#include "sim/byteswap.hh"
|
||||
#include "sim/core.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
const PixelConverter VncServer::pixelConverter(
|
||||
4, // 4 bytes / pixel
|
||||
16, 8, 0, // R in [23, 16], G in [15, 8], B in [7, 0]
|
||||
@@ -171,7 +169,7 @@ VncServer::listen(int port)
|
||||
port++;
|
||||
}
|
||||
|
||||
ccprintf(cerr, "%s: Listening for connections on port %d\n",
|
||||
ccprintf(std::cerr, "%s: Listening for connections on port %d\n",
|
||||
name(), port);
|
||||
|
||||
listenEvent = new ListenEvent(this, listener.getfd(), POLLIN);
|
||||
@@ -470,7 +468,7 @@ VncServer::sendServerInit()
|
||||
memset(msg.px.padding, 0, 3);
|
||||
msg.namelen = 2;
|
||||
msg.namelen = htobe(msg.namelen);
|
||||
memcpy(msg.name, "M5", 2);
|
||||
std::memcpy(msg.name, "M5", 2);
|
||||
|
||||
if (!write(&msg))
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user