Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/39538 )
Change subject: dev: Stop "using namespace std"
......................................................................
dev: Stop "using namespace std"
Change-Id: I317df9b566936445c3a02c28ed37146a16610454
---
M src/dev/baddev.cc
M src/dev/intel_8254_timer.cc
M src/dev/isa_fake.cc
M src/dev/mc146818.cc
M src/dev/mips/malta.cc
M src/dev/mips/malta_cchip.cc
M src/dev/mips/malta_io.cc
M src/dev/net/dist_etherlink.cc
M src/dev/net/dist_iface.cc
M src/dev/net/etherbus.cc
M src/dev/net/etherlink.cc
M src/dev/net/etherpkt.cc
M src/dev/net/etherswitch.cc
M src/dev/net/ethertap.cc
M src/dev/net/pktfifo.cc
M src/dev/net/sinic.cc
M src/dev/net/tcp_iface.cc
M src/dev/platform.cc
M src/dev/serial/terminal.cc
M src/dev/serial/uart8250.cc
M src/dev/sparc/dtod.cc
M src/dev/sparc/t1000.cc
M src/dev/storage/disk_image.cc
M src/dev/storage/simple_disk.cc
24 files changed, 67 insertions(+), 113 deletions(-)
diff --git a/src/dev/baddev.cc b/src/dev/baddev.cc
index 3a64212..f291459 100644
--- a/src/dev/baddev.cc
+++ b/src/dev/baddev.cc
@@ -38,8 +38,6 @@
#include "params/BadDevice.hh"
#include "sim/system.hh"
-using namespace std;
-
BadDevice::BadDevice(const Params &p)
: BasicPioDevice(p, 0x10), devname(p.devicename)
{
diff --git a/src/dev/intel_8254_timer.cc b/src/dev/intel_8254_timer.cc
index 7877c91..a2ba7a4 100644
--- a/src/dev/intel_8254_timer.cc
+++ b/src/dev/intel_8254_timer.cc
@@ -31,9 +31,7 @@
#include "base/logging.hh"
#include "debug/Intel8254Timer.hh"
-using namespace std;
-
-Intel8254Timer::Intel8254Timer(EventManager *em, const string &name,
+Intel8254Timer::Intel8254Timer(EventManager *em, const std::string &name,
Counter *counter0, Counter *counter1, Counter *counter2) :
EventManager(em), _name(name)
{
@@ -42,7 +40,7 @@
counter[2] = counter2;
}
-Intel8254Timer::Intel8254Timer(EventManager *em, const string &name) :
+Intel8254Timer::Intel8254Timer(EventManager *em, const std::string &name) :
EventManager(em), _name(name)
{
counter[0] = new Counter(this, name + ".counter0", 0);
@@ -68,7 +66,7 @@
}
void
-Intel8254Timer::serialize(const string &base, CheckpointOut &cp) const
+Intel8254Timer::serialize(const std::string &base, CheckpointOut &cp) const
{
// serialize the counters
counter[0]->serialize(base + ".counter0", cp);
@@ -77,7 +75,7 @@
}
void
-Intel8254Timer::unserialize(const string &base, CheckpointIn &cp)
+Intel8254Timer::unserialize(const std::string &base, CheckpointIn &cp)
{
// unserialze the counters
counter[0]->unserialize(base + ".counter0", cp);
@@ -94,7 +92,7 @@
}
Intel8254Timer::Counter::Counter(Intel8254Timer *p,
- const string &name, unsigned int _num)
+ const std::string &name, unsigned int _num)
: _name(name), num(_num), event(this), running(false),
initial_count(0), latched_count(0), period(0), mode(0),
output_high(false), latch_on(false), read_byte(LSB),
@@ -225,7 +223,8 @@
}
void
-Intel8254Timer::Counter::serialize(const string &base, CheckpointOut &cp)
const
+Intel8254Timer::Counter::serialize(
+ const std::string &base, CheckpointOut &cp) const
{
paramOut(cp, base + ".initial_count", initial_count);
paramOut(cp, base + ".latched_count", latched_count);
@@ -243,7 +242,7 @@
}
void
-Intel8254Timer::Counter::unserialize(const string &base, CheckpointIn &cp)
+Intel8254Timer::Counter::unserialize(const std::string &base, CheckpointIn
&cp)
{
paramIn(cp, base + ".initial_count", initial_count);
paramIn(cp, base + ".latched_count", latched_count);
diff --git a/src/dev/isa_fake.cc b/src/dev/isa_fake.cc
index b441120..0132ddc 100644
--- a/src/dev/isa_fake.cc
+++ b/src/dev/isa_fake.cc
@@ -38,8 +38,6 @@
#include "mem/packet_access.hh"
#include "sim/system.hh"
-using namespace std;
-
IsaFake::IsaFake(const Params &p)
: BasicPioDevice(p, p.ret_bad_addr ? 0 : p.pio_size)
{
diff --git a/src/dev/mc146818.cc b/src/dev/mc146818.cc
index 3ea1d0d..5e76a23 100644
--- a/src/dev/mc146818.cc
+++ b/src/dev/mc146818.cc
@@ -39,8 +39,6 @@
#include "debug/MC146818.hh"
#include "dev/rtcreg.h"
-using namespace std;
-
static uint8_t
bcdize(uint8_t val)
{
@@ -87,8 +85,8 @@
}
}
-MC146818::MC146818(EventManager *em, const string &n, const struct tm time,
- bool bcd, Tick frequency)
+MC146818::MC146818(EventManager *em, const std::string &n,
+ const struct tm time, bool bcd, Tick frequency)
: EventManager(em), _name(n), event(this, frequency), tickEvent(this)
{
memset(clock_data, 0, sizeof(clock_data));
@@ -262,7 +260,7 @@
}
void
-MC146818::serialize(const string &base, CheckpointOut &cp) const
+MC146818::serialize(const std::string &base, CheckpointOut &cp) const
{
uint8_t regA_serial(stat_regA);
uint8_t regB_serial(stat_regB);
@@ -282,7 +280,7 @@
}
void
-MC146818::unserialize(const string &base, CheckpointIn &cp)
+MC146818::unserialize(const std::string &base, CheckpointIn &cp)
{
uint8_t tmp8;
diff --git a/src/dev/mips/malta.cc b/src/dev/mips/malta.cc
index 5438233..f9a0f22 100644
--- a/src/dev/mips/malta.cc
+++ b/src/dev/mips/malta.cc
@@ -43,8 +43,6 @@
#include "params/Malta.hh"
#include "sim/system.hh"
-using namespace std;
-
Malta::Malta(const Params &p)
: Platform(p), system(p.system)
{
diff --git a/src/dev/mips/malta_cchip.cc b/src/dev/mips/malta_cchip.cc
index 2948077..711731b 100644
--- a/src/dev/mips/malta_cchip.cc
+++ b/src/dev/mips/malta_cchip.cc
@@ -48,8 +48,6 @@
#include "params/MaltaCChip.hh"
#include "sim/system.hh"
-using namespace std;
-
MaltaCChip::MaltaCChip(const Params &p)
: BasicPioDevice(p, 0xfffffff), malta(p.malta)
{
diff --git a/src/dev/mips/malta_io.cc b/src/dev/mips/malta_io.cc
index c14a980..d914d5f 100644
--- a/src/dev/mips/malta_io.cc
+++ b/src/dev/mips/malta_io.cc
@@ -51,9 +51,7 @@
#include "params/MaltaIO.hh"
#include "sim/system.hh"
-using namespace std;
-
-MaltaIO::RTC::RTC(const string &name, const MaltaIOParams &p)
+MaltaIO::RTC::RTC(const std::string &name, const MaltaIOParams &p)
: MC146818(p.malta, name, p.time, p.year_is_bcd, p.frequency),
malta(p.malta)
{
diff --git a/src/dev/net/dist_etherlink.cc b/src/dev/net/dist_etherlink.cc
index f275630..8cbf6ef 100644
--- a/src/dev/net/dist_etherlink.cc
+++ b/src/dev/net/dist_etherlink.cc
@@ -66,8 +66,6 @@
#include "sim/serialize.hh"
#include "sim/system.hh"
-using namespace std;
-
DistEtherLink::DistEtherLink(const Params &p)
: SimObject(p), linkDelay(p.delay)
{
@@ -228,7 +226,7 @@
bool packet_exists;
UNSERIALIZE_SCALAR(packet_exists);
if (packet_exists) {
- packet = make_shared<EthPacketData>();
+ packet = std::make_shared<EthPacketData>();
packet->unserialize("packet", cp);
}
diff --git a/src/dev/net/dist_iface.cc b/src/dev/net/dist_iface.cc
index 7974242..7f8a4a0 100644
--- a/src/dev/net/dist_iface.cc
+++ b/src/dev/net/dist_iface.cc
@@ -54,7 +54,6 @@
#include "sim/sim_object.hh"
#include "sim/system.hh"
-using namespace std;
DistIface::Sync *DistIface::sync = nullptr;
System *DistIface::sys = nullptr;
DistIface::SyncEvent *DistIface::syncEvent = nullptr;
diff --git a/src/dev/net/etherbus.cc b/src/dev/net/etherbus.cc
index 28c9f8d..bc9379e 100644
--- a/src/dev/net/etherbus.cc
+++ b/src/dev/net/etherbus.cc
@@ -46,8 +46,6 @@
#include "params/EtherBus.hh"
#include "sim/core.hh"
-using namespace std;
-
EtherBus::EtherBus(const Params &p)
: SimObject(p), ticksPerByte(p.speed), loopback(p.loopback),
event([this]{ txDone(); }, "ethernet bus completion"),
diff --git a/src/dev/net/etherlink.cc b/src/dev/net/etherlink.cc
index eff38e6..3c9bfea 100644
--- a/src/dev/net/etherlink.cc
+++ b/src/dev/net/etherlink.cc
@@ -63,8 +63,6 @@
#include "sim/serialize.hh"
#include "sim/system.hh"
-using namespace std;
-
EtherLink::EtherLink(const Params &p)
: SimObject(p)
{
@@ -98,14 +96,14 @@
}
-EtherLink::Interface::Interface(const string &name, Link *tx, Link *rx)
+EtherLink::Interface::Interface(const std::string &name, Link *tx, Link
*rx)
: EtherInt(name), txlink(tx)
{
tx->setTxInt(this);
rx->setRxInt(this);
}
-EtherLink::Link::Link(const string &name, EtherLink *p, int num,
+EtherLink::Link::Link(const std::string &name, EtherLink *p, int num,
double rate, Tick delay, Tick delay_var, EtherDump
*d)
: objName(name), parent(p), number(num), txint(NULL), rxint(NULL),
ticksPerByte(rate), linkDelay(delay), delayVar(delay_var), dump(d),
@@ -198,7 +196,7 @@
}
void
-EtherLink::Link::serialize(const string &base, CheckpointOut &cp) const
+EtherLink::Link::serialize(const std::string &base, CheckpointOut &cp)
const
{
bool packet_exists = packet != nullptr;
paramOut(cp, base + ".packet_exists", packet_exists);
@@ -224,12 +222,12 @@
}
void
-EtherLink::Link::unserialize(const string &base, CheckpointIn &cp)
+EtherLink::Link::unserialize(const std::string &base, CheckpointIn &cp)
{
bool packet_exists;
paramIn(cp, base + ".packet_exists", packet_exists);
if (packet_exists) {
- packet = make_shared<EthPacketData>();
+ packet = std::make_shared<EthPacketData>();
packet->unserialize(base + ".packet", cp);
}
@@ -245,7 +243,7 @@
if (optParamIn(cp, base + ".tx_queue_size", tx_queue_size)) {
for (size_t idx = 0; idx < tx_queue_size; ++idx) {
Tick tick;
- EthPacketPtr delayed_packet = make_shared<EthPacketData>();
+ EthPacketPtr delayed_packet =
std::make_shared<EthPacketData>();
paramIn(cp, csprintf("%s.txQueue[%i].tick", base, idx), tick);
delayed_packet->unserialize(
diff --git a/src/dev/net/etherpkt.cc b/src/dev/net/etherpkt.cc
index 7cd3275..d64815c 100644
--- a/src/dev/net/etherpkt.cc
+++ b/src/dev/net/etherpkt.cc
@@ -34,10 +34,8 @@
#include "base/logging.hh"
#include "sim/serialize.hh"
-using namespace std;
-
void
-EthPacketData::serialize(const string &base, CheckpointOut &cp) const
+EthPacketData::serialize(const std::string &base, CheckpointOut &cp) const
{
paramOut(cp, base + ".simLength", simLength);
paramOut(cp, base + ".bufLength", bufLength);
@@ -46,7 +44,7 @@
}
void
-EthPacketData::unserialize(const string &base, CheckpointIn &cp)
+EthPacketData::unserialize(const std::string &base, CheckpointIn &cp)
{
paramIn(cp, base + ".length", length);
unsigned chkpt_buf_length;
diff --git a/src/dev/net/etherswitch.cc b/src/dev/net/etherswitch.cc
index 22c684c..b88d630 100644
--- a/src/dev/net/etherswitch.cc
+++ b/src/dev/net/etherswitch.cc
@@ -37,8 +37,6 @@
#include "debug/EthernetAll.hh"
#include "sim/core.hh"
-using namespace std;
-
EtherSwitch::EtherSwitch(const Params &p)
: SimObject(p), ttl(p.time_to_live)
{
@@ -308,7 +306,7 @@
void
EtherSwitch::Interface::PortFifoEntry::unserialize(CheckpointIn &cp)
{
- packet = make_shared<EthPacketData>(16384);
+ packet = std::make_shared<EthPacketData>(16384);
packet->unserialize("packet", cp);
UNSERIALIZE_SCALAR(recvTick);
UNSERIALIZE_SCALAR(srcId);
diff --git a/src/dev/net/ethertap.cc b/src/dev/net/ethertap.cc
index ec67f47..1ac9b66 100644
--- a/src/dev/net/ethertap.cc
+++ b/src/dev/net/ethertap.cc
@@ -67,8 +67,6 @@
#include "dev/net/etherint.hh"
#include "dev/net/etherpkt.hh"
-using namespace std;
-
class TapEvent : public PollEvent
{
protected:
@@ -185,7 +183,7 @@
EtherTapBase::sendSimulated(void *data, size_t len)
{
EthPacketPtr packet;
- packet = make_shared<EthPacketData>(len);
+ packet = std::make_shared<EthPacketData>(len);
packet->length = len;
packet->simLength = len;
memcpy(packet->data, data, len);
@@ -261,7 +259,7 @@
port++;
}
- ccprintf(cerr, "Listening for tap connection on port %d\n", port);
+ ccprintf(std::cerr, "Listening for tap connection on port %d\n", port);
event = new Event(this, listener.getfd(), POLLIN|POLLERR);
pollQueue.schedule(event);
}
diff --git a/src/dev/net/pktfifo.cc b/src/dev/net/pktfifo.cc
index 005f303..bf92933 100644
--- a/src/dev/net/pktfifo.cc
+++ b/src/dev/net/pktfifo.cc
@@ -30,8 +30,6 @@
#include "base/logging.hh"
-using namespace std;
-
bool
PacketFifo::copyout(void *dest, unsigned offset, unsigned len)
{
@@ -51,7 +49,7 @@
if (i == end)
panic("invalid fifo");
- unsigned size = min(pkt->length - offset, len);
+ unsigned size = std::min(pkt->length - offset, len);
memcpy(data, pkt->data, size);
offset = 0;
len -= size;
@@ -64,7 +62,7 @@
void
-PacketFifoEntry::serialize(const string &base, CheckpointOut &cp) const
+PacketFifoEntry::serialize(const std::string &base, CheckpointOut &cp)
const
{
packet->serialize(base + ".packet", cp);
paramOut(cp, base + ".slack", slack);
@@ -73,9 +71,9 @@
}
void
-PacketFifoEntry::unserialize(const string &base, CheckpointIn &cp)
+PacketFifoEntry::unserialize(const std::string &base, CheckpointIn &cp)
{
- packet = make_shared<EthPacketData>();
+ packet = std::make_shared<EthPacketData>();
packet->unserialize(base + ".packet", cp);
paramIn(cp, base + ".slack", slack);
paramIn(cp, base + ".number", number);
@@ -83,7 +81,7 @@
}
void
-PacketFifo::serialize(const string &base, CheckpointOut &cp) const
+PacketFifo::serialize(const std::string &base, CheckpointOut &cp) const
{
paramOut(cp, base + ".size", _size);
paramOut(cp, base + ".maxsize", _maxsize);
@@ -96,7 +94,7 @@
}
void
-PacketFifo::unserialize(const string &base, CheckpointIn &cp)
+PacketFifo::unserialize(const std::string &base, CheckpointIn &cp)
{
paramIn(cp, base + ".size", _size);
// paramIn(cp, base + ".maxsize", _maxsize);
diff --git a/src/dev/net/sinic.cc b/src/dev/net/sinic.cc
index ffec996..f270487 100644
--- a/src/dev/net/sinic.cc
+++ b/src/dev/net/sinic.cc
@@ -43,7 +43,6 @@
#include "sim/eventq.hh"
#include "sim/stats.hh"
-using namespace std;
using namespace Net;
namespace Sinic {
@@ -835,8 +834,8 @@
goto exit;
rxDmaAddr = pciToDma(Regs::get_RxData_Addr(vnic->RxData));
- rxDmaLen = min<unsigned>(Regs::get_RxData_Len(vnic->RxData),
- vnic->rxPacketBytes);
+ rxDmaLen = std::min<unsigned>(Regs::get_RxData_Len(vnic->RxData),
+ vnic->rxPacketBytes);
/*
* if we're doing zero/delay copy and we're below the fifo
@@ -1016,7 +1015,7 @@
assert(Regs::get_TxDone_Busy(vnic->TxDone));
if (!txPacket) {
// Grab a new packet from the fifo.
- txPacket = make_shared<EthPacketData>(16384);
+ txPacket = std::make_shared<EthPacketData>(16384);
txPacketOffset = 0;
}
@@ -1425,7 +1424,7 @@
UNSERIALIZE_SCALAR(txPacketExists);
txPacket = 0;
if (txPacketExists) {
- txPacket = make_shared<EthPacketData>(16384);
+ txPacket = std::make_shared<EthPacketData>(16384);
txPacket->unserialize("txPacket", cp);
UNSERIALIZE_SCALAR(txPacketOffset);
UNSERIALIZE_SCALAR(txPacketBytes);
diff --git a/src/dev/net/tcp_iface.cc b/src/dev/net/tcp_iface.cc
index f7591a0..0148442 100644
--- a/src/dev/net/tcp_iface.cc
+++ b/src/dev/net/tcp_iface.cc
@@ -71,14 +71,12 @@
#endif
#endif
-using namespace std;
-
std::vector<std::pair<TCPIface::NodeInfo, int> > TCPIface::nodes;
-vector<int> TCPIface::sockRegistry;
+std::vector<int> TCPIface::sockRegistry;
int TCPIface::fdStatic = -1;
bool TCPIface::anyListening = false;
-TCPIface::TCPIface(string server_name, unsigned server_port,
+TCPIface::TCPIface(std::string server_name, unsigned server_port,
unsigned dist_rank, unsigned dist_size,
Tick sync_start, Tick sync_repeat,
EventManager *em, bool use_pseudo_op, bool is_switch,
@@ -105,7 +103,7 @@
DPRINTF(DistEthernet, "First connection, waiting for link
info\n");
if (!recvTCP(sock, &ni, sizeof(ni)))
panic("Failed to receive link info");
- nodes.push_back(make_pair(ni, sock));
+ nodes.push_back(std::make_pair(ni, sock));
}
}
}
@@ -157,10 +155,10 @@
if (isSwitch) {
if (cur_id == 0) { // first connection accepted in the ctor already
auto const &iface0 =
- find_if(nodes.begin(), nodes.end(),
- [](const pair<NodeInfo, int> &cn) -> bool {
- return cn.first.rank == cur_rank;
- });
+ std::find_if(nodes.begin(), nodes.end(),
+ [](const std::pair<NodeInfo, int> &cn) ->
bool {
+ return cn.first.rank == cur_rank;
+ });
assert(iface0 != nodes.end());
assert(iface0->first.distIfaceId == 0);
sock = iface0->second;
@@ -223,7 +221,7 @@
struct addrinfo addr_hint, *addr_results;
int ret;
- string port_str = to_string(serverPort);
+ std::string port_str = std::to_string(serverPort);
sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
panic_if(sock < 0, "socket() failed: %s", strerror(errno));
@@ -326,7 +324,7 @@
void
TCPIface::recvPacket(const Header &header, EthPacketPtr &packet)
{
- packet = make_shared<EthPacketData>(header.dataPacketLength);
+ packet = std::make_shared<EthPacketData>(header.dataPacketLength);
bool ret = recvTCP(sock, packet->data, header.dataPacketLength);
panic_if(!ret, "Error while reading socket");
packet->simLength = header.simLength;
diff --git a/src/dev/platform.cc b/src/dev/platform.cc
index 718f767..a0fa153 100644
--- a/src/dev/platform.cc
+++ b/src/dev/platform.cc
@@ -31,8 +31,6 @@
#include "base/logging.hh"
#include "sim/sim_exit.hh"
-using namespace std;
-
Platform::Platform(const Params &p)
: SimObject(p), intrctrl(p.intrctrl)
{
diff --git a/src/dev/serial/terminal.cc b/src/dev/serial/terminal.cc
index af4ffdd..deed03f 100644
--- a/src/dev/serial/terminal.cc
+++ b/src/dev/serial/terminal.cc
@@ -73,9 +73,6 @@
#include "dev/platform.hh"
#include "dev/serial/uart.hh"
-using namespace std;
-
-
/*
* Poll event for the listen socket
*/
@@ -124,7 +121,7 @@
#endif
{
if (outfile)
- outfile->stream()->setf(ios::unitbuf);
+ outfile->stream()->setf(std::ios::unitbuf);
if (p.port)
listen(p.port);
@@ -178,7 +175,7 @@
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);
@@ -203,7 +200,7 @@
dataEvent = new DataEvent(this, data_fd, POLLIN);
pollQueue.schedule(dataEvent);
- stringstream stream;
+ std::stringstream stream;
ccprintf(stream, "==== m5 terminal: Terminal %d ====", number);
// we need an actual carriage return followed by a newline for the
diff --git a/src/dev/serial/uart8250.cc b/src/dev/serial/uart8250.cc
index 83238d6..1804a3b 100644
--- a/src/dev/serial/uart8250.cc
+++ b/src/dev/serial/uart8250.cc
@@ -43,8 +43,6 @@
#include "mem/packet_access.hh"
#include "sim/serialize.hh"
-using namespace std;
-
void
Uart8250::processIntrEvent(int intrBit)
{
diff --git a/src/dev/sparc/dtod.cc b/src/dev/sparc/dtod.cc
index e2bdbb1..b36b7f5 100644
--- a/src/dev/sparc/dtod.cc
+++ b/src/dev/sparc/dtod.cc
@@ -44,8 +44,6 @@
#include "mem/port.hh"
#include "sim/system.hh"
-using namespace std;
-
DumbTOD::DumbTOD(const Params &p)
: BasicPioDevice(p, 0x08)
{
diff --git a/src/dev/sparc/t1000.cc b/src/dev/sparc/t1000.cc
index ee61fbf..0a90974 100644
--- a/src/dev/sparc/t1000.cc
+++ b/src/dev/sparc/t1000.cc
@@ -39,8 +39,6 @@
#include "cpu/intr_control.hh"
#include "sim/system.hh"
-using namespace std;
-
T1000::T1000(const Params &p)
: Platform(p), system(p.system)
{}
diff --git a/src/dev/storage/disk_image.cc b/src/dev/storage/disk_image.cc
index 199ecc2..50e8cf2 100644
--- a/src/dev/storage/disk_image.cc
+++ b/src/dev/storage/disk_image.cc
@@ -50,8 +50,6 @@
#include "sim/serialize.hh"
#include "sim/sim_exit.hh"
-using namespace std;
-
////////////////////////////////////////////////////////////////////////
//
// Raw Disk image
@@ -79,16 +77,16 @@
}
void
-RawDiskImage::open(const string &filename, bool rd_only)
+RawDiskImage::open(const std::string &filename, bool rd_only)
{
if (!filename.empty()) {
initialized = true;
readonly = rd_only;
file = filename;
- ios::openmode mode = ios::in | ios::binary;
+ std::ios::openmode mode = std::ios::in | std::ios::binary;
if (!readonly)
- mode |= ios::out;
+ mode |= std::ios::out;
stream.open(file.c_str(), mode);
if (!stream.is_open())
panic("Error opening %s", filename);
@@ -107,7 +105,7 @@
if (disk_size == 0) {
if (!stream.is_open())
panic("file not open!\n");
- stream.seekg(0, ios::end);
+ stream.seekg(0, std::ios::end);
disk_size = stream.tellg();
}
@@ -123,11 +121,11 @@
if (!stream.is_open())
panic("file not open!\n");
- stream.seekg(offset * SectorSize, ios::beg);
+ stream.seekg(offset * SectorSize, std::ios::beg);
if (!stream.good())
panic("Could not seek to location in file");
- streampos pos = stream.tellg();
+ std::streampos pos = stream.tellg();
stream.read((char *)data, SectorSize);
DPRINTF(DiskImageRead, "read: offset=%d\n", (uint64_t)offset);
@@ -148,14 +146,14 @@
if (!stream.is_open())
panic("file not open!\n");
- stream.seekp(offset * SectorSize, ios::beg);
+ stream.seekp(offset * SectorSize, std::ios::beg);
if (!stream.good())
panic("Could not seek to location in file");
DPRINTF(DiskImageWrite, "write: offset=%d\n", (uint64_t)offset);
DDUMP(DiskImageWrite, data, SectorSize);
- streampos pos = stream.tellp();
+ std::streampos pos = stream.tellp();
stream.write((const char *)data, SectorSize);
return stream.tellp() - pos;
}
@@ -206,7 +204,7 @@
}
void
-SafeRead(ifstream &stream, void *data, int count)
+SafeRead(std::ifstream &stream, void *data, int count)
{
stream.read((char *)data, count);
if (!stream.is_open())
@@ -221,23 +219,23 @@
template<class T>
void
-SafeRead(ifstream &stream, T &data)
+SafeRead(std::ifstream &stream, T &data)
{
SafeRead(stream, &data, sizeof(data));
}
template<class T>
void
-SafeReadSwap(ifstream &stream, T &data)
+SafeReadSwap(std::ifstream &stream, T &data)
{
SafeRead(stream, &data, sizeof(data));
data = letoh(data); //is this the proper byte order conversion?
}
bool
-CowDiskImage::open(const string &file)
+CowDiskImage::open(const std::string &file)
{
- ifstream stream(file.c_str());
+ std::ifstream stream(file.c_str());
if (!stream.is_open())
return false;
@@ -289,7 +287,7 @@
}
void
-SafeWrite(ofstream &stream, const void *data, int count)
+SafeWrite(std::ofstream &stream, const void *data, int count)
{
stream.write((const char *)data, count);
if (!stream.is_open())
@@ -304,14 +302,14 @@
template<class T>
void
-SafeWrite(ofstream &stream, const T &data)
+SafeWrite(std::ofstream &stream, const T &data)
{
SafeWrite(stream, &data, sizeof(data));
}
template<class T>
void
-SafeWriteSwap(ofstream &stream, const T &data)
+SafeWriteSwap(std::ofstream &stream, const T &data)
{
T swappeddata = letoh(data); //is this the proper byte order
conversion?
SafeWrite(stream, &swappeddata, sizeof(data));
@@ -327,12 +325,12 @@
save(filename);}
void
-CowDiskImage::save(const string &file) const
+CowDiskImage::save(const std::string &file) const
{
if (!initialized)
panic("RawDiskImage not initialized");
- ofstream stream(file.c_str());
+ std::ofstream stream(file.c_str());
if (!stream.is_open() || stream.fail() || stream.bad())
panic("Error opening %s", file);
@@ -423,7 +421,7 @@
void
CowDiskImage::serialize(CheckpointOut &cp) const
{
- string cowFilename = name() + ".cow";
+ std::string cowFilename = name() + ".cow";
SERIALIZE_SCALAR(cowFilename);
save(CheckpointIn::dir() + "/" + cowFilename);
}
@@ -431,7 +429,7 @@
void
CowDiskImage::unserialize(CheckpointIn &cp)
{
- string cowFilename;
+ std::string cowFilename;
UNSERIALIZE_SCALAR(cowFilename);
cowFilename = cp.getCptDir() + "/" + cowFilename;
open(cowFilename);
diff --git a/src/dev/storage/simple_disk.cc b/src/dev/storage/simple_disk.cc
index 91f213b..e52526b 100644
--- a/src/dev/storage/simple_disk.cc
+++ b/src/dev/storage/simple_disk.cc
@@ -48,8 +48,6 @@
#include "mem/port_proxy.hh"
#include "sim/system.hh"
-using namespace std;
-
SimpleDisk::SimpleDisk(const Params &p)
: SimObject(p), system(p.system), image(p.disk)
{}
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39538
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I317df9b566936445c3a02c28ed37146a16610454
Gerrit-Change-Number: 39538
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s