You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

163 lines
4.3 KiB

From 4f60ce245b3cfe2117fdaf00a9e74a49f769daca Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Mon, 22 Feb 2021 16:03:21 -0800
Subject: [PATCH] remove using namespace std
Fixes: warning: using directive refers to implicitly-defined namespace 'std'
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
bon_time.cpp | 8 ++++----
bonnie++.cpp | 8 ++++----
bonnie.h | 2 --
duration.cpp | 4 +---
getc_putc.cpp | 2 +-
rand.cpp | 4 ++--
rand.h | 5 ++---
7 files changed, 14 insertions(+), 19 deletions(-)
--- a/bon_time.cpp
+++ b/bon_time.cpp
@@ -26,12 +26,12 @@ void BonTimer::add_delta_report(report_s
}
else
{
- m_delta[test].FirstStart = min(m_delta[test].FirstStart, rep.StartTime);
- m_delta[test].LastStop = max(m_delta[test].LastStop, rep.EndTime);
+ m_delta[test].FirstStart = std::min(m_delta[test].FirstStart, rep.StartTime);
+ m_delta[test].LastStop = std::max(m_delta[test].LastStop, rep.EndTime);
}
m_delta[test].CPU += rep.CPU;
m_delta[test].Elapsed = m_delta[test].LastStop - m_delta[test].FirstStart;
- m_delta[test].Latency = max(m_delta[test].Latency, rep.Latency);
+ m_delta[test].Latency = std::max(m_delta[test].Latency, rep.Latency);
}
BonTimer::BonTimer()
@@ -56,7 +56,7 @@ BonTimer::Initialize()
void
BonTimer::add_latency(tests_t test, double t)
{
- m_delta[test].Latency = max(m_delta[test].Latency, t);
+ m_delta[test].Latency = std::max(m_delta[test].Latency, t);
}
int BonTimer::print_cpu_stat(tests_t test)
--- a/bonnie++.cpp
+++ b/bonnie++.cpp
@@ -75,7 +75,7 @@ public:
void set_io_chunk_size(int size)
{ delete m_buf; pa_new(size, m_buf, m_buf_pa); m_io_chunk_size = size; }
void set_file_chunk_size(int size)
- { delete m_buf; m_buf = new char[max(size, m_io_chunk_size)]; m_file_chunk_size = size; }
+ { delete m_buf; m_buf = new char[std::max(size, m_io_chunk_size)]; m_file_chunk_size = size; }
// Return the page-aligned version of the local buffer
char *buf() { return m_buf_pa; }
@@ -142,7 +142,7 @@ CGlobalItems::CGlobalItems(bool *exitFla
, m_buf(NULL)
, m_buf_pa(NULL)
{
- pa_new(max(m_io_chunk_size, m_file_chunk_size), m_buf, m_buf_pa);
+ pa_new(std::max(m_io_chunk_size, m_file_chunk_size), m_buf, m_buf_pa);
SetName(".");
}
@@ -407,8 +407,8 @@ int main(int argc, char *argv[])
usage();
}
#endif
- globals.byte_io_size = min(file_size, globals.byte_io_size);
- globals.byte_io_size = max(0, globals.byte_io_size);
+ globals.byte_io_size = std::min(file_size, globals.byte_io_size);
+ globals.byte_io_size = std::max(0, globals.byte_io_size);
if(machine == NULL)
{
--- a/bonnie.h
+++ b/bonnie.h
@@ -1,8 +1,6 @@
#ifndef BONNIE
#define BONNIE
-using namespace std;
-
#define BON_VERSION "2.00"
#define CSV_VERSION "1.98"
--- a/duration.cpp
+++ b/duration.cpp
@@ -1,5 +1,3 @@
-using namespace std;
-
#include <stdlib.h>
#include "duration.h"
@@ -38,7 +36,7 @@ double Duration_Base::stop()
getTime(&tv);
double ret;
ret = tv - m_start;
- m_max = max(m_max, ret);
+ m_max = std::max(m_max, ret);
return ret;
}
--- a/getc_putc.cpp
+++ b/getc_putc.cpp
@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
int size = 0, wrote;
while(size < file_size)
{
- wrote = write(FILE_FD, buf, min(sizeof(buf), (size_t)file_size - size));
+ wrote = write(FILE_FD, buf, std::min(sizeof(buf), (size_t)file_size - size));
if(wrote < 0)
{
fprintf(stderr, "Can't extend file - disk full?\n");
--- a/rand.cpp
+++ b/rand.cpp
@@ -31,7 +31,7 @@ bool Rand::seedFile(CPCCHAR name)
}
close(fd);
m_ind = -1;
- m_name = string(name);
+ m_name = std::string(name);
return false;
}
@@ -44,7 +44,7 @@ void Rand::seedNum(UINT num)
m_init = num;
char buf[12];
sprintf(buf, "%u", num);
- m_name = string(buf);
+ m_name = std::string(buf);
}
void Rand::reset()
--- a/rand.h
+++ b/rand.h
@@ -1,7 +1,6 @@
#ifndef RAND_H
#define RAND_H
-using namespace std;
#include "port.h"
#include <string>
#include <stdio.h>
@@ -31,7 +30,7 @@ public:
int getSize() { return m_size; }
- string getSeed() { return m_name; }
+ std::string getSeed() { return m_name; }
void reset();
@@ -39,7 +38,7 @@ private:
int *m_arr;
int m_size;
int m_ind;
- string m_name;
+ std::string m_name;
UINT m_init;
Rand(const Rand &t);