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

  1. From 4f60ce245b3cfe2117fdaf00a9e74a49f769daca Mon Sep 17 00:00:00 2001
  2. From: Rosen Penev <rosenp@gmail.com>
  3. Date: Mon, 22 Feb 2021 16:03:21 -0800
  4. Subject: [PATCH] remove using namespace std
  5. Fixes: warning: using directive refers to implicitly-defined namespace 'std'
  6. Signed-off-by: Rosen Penev <rosenp@gmail.com>
  7. ---
  8. bon_time.cpp | 8 ++++----
  9. bonnie++.cpp | 8 ++++----
  10. bonnie.h | 2 --
  11. duration.cpp | 4 +---
  12. getc_putc.cpp | 2 +-
  13. rand.cpp | 4 ++--
  14. rand.h | 5 ++---
  15. 7 files changed, 14 insertions(+), 19 deletions(-)
  16. --- a/bon_time.cpp
  17. +++ b/bon_time.cpp
  18. @@ -26,12 +26,12 @@ void BonTimer::add_delta_report(report_s
  19. }
  20. else
  21. {
  22. - m_delta[test].FirstStart = min(m_delta[test].FirstStart, rep.StartTime);
  23. - m_delta[test].LastStop = max(m_delta[test].LastStop, rep.EndTime);
  24. + m_delta[test].FirstStart = std::min(m_delta[test].FirstStart, rep.StartTime);
  25. + m_delta[test].LastStop = std::max(m_delta[test].LastStop, rep.EndTime);
  26. }
  27. m_delta[test].CPU += rep.CPU;
  28. m_delta[test].Elapsed = m_delta[test].LastStop - m_delta[test].FirstStart;
  29. - m_delta[test].Latency = max(m_delta[test].Latency, rep.Latency);
  30. + m_delta[test].Latency = std::max(m_delta[test].Latency, rep.Latency);
  31. }
  32. BonTimer::BonTimer()
  33. @@ -56,7 +56,7 @@ BonTimer::Initialize()
  34. void
  35. BonTimer::add_latency(tests_t test, double t)
  36. {
  37. - m_delta[test].Latency = max(m_delta[test].Latency, t);
  38. + m_delta[test].Latency = std::max(m_delta[test].Latency, t);
  39. }
  40. int BonTimer::print_cpu_stat(tests_t test)
  41. --- a/bonnie++.cpp
  42. +++ b/bonnie++.cpp
  43. @@ -75,7 +75,7 @@ public:
  44. void set_io_chunk_size(int size)
  45. { delete m_buf; pa_new(size, m_buf, m_buf_pa); m_io_chunk_size = size; }
  46. void set_file_chunk_size(int size)
  47. - { delete m_buf; m_buf = new char[max(size, m_io_chunk_size)]; m_file_chunk_size = size; }
  48. + { delete m_buf; m_buf = new char[std::max(size, m_io_chunk_size)]; m_file_chunk_size = size; }
  49. // Return the page-aligned version of the local buffer
  50. char *buf() { return m_buf_pa; }
  51. @@ -142,7 +142,7 @@ CGlobalItems::CGlobalItems(bool *exitFla
  52. , m_buf(NULL)
  53. , m_buf_pa(NULL)
  54. {
  55. - pa_new(max(m_io_chunk_size, m_file_chunk_size), m_buf, m_buf_pa);
  56. + pa_new(std::max(m_io_chunk_size, m_file_chunk_size), m_buf, m_buf_pa);
  57. SetName(".");
  58. }
  59. @@ -407,8 +407,8 @@ int main(int argc, char *argv[])
  60. usage();
  61. }
  62. #endif
  63. - globals.byte_io_size = min(file_size, globals.byte_io_size);
  64. - globals.byte_io_size = max(0, globals.byte_io_size);
  65. + globals.byte_io_size = std::min(file_size, globals.byte_io_size);
  66. + globals.byte_io_size = std::max(0, globals.byte_io_size);
  67. if(machine == NULL)
  68. {
  69. --- a/bonnie.h
  70. +++ b/bonnie.h
  71. @@ -1,8 +1,6 @@
  72. #ifndef BONNIE
  73. #define BONNIE
  74. -using namespace std;
  75. -
  76. #define BON_VERSION "2.00"
  77. #define CSV_VERSION "1.98"
  78. --- a/duration.cpp
  79. +++ b/duration.cpp
  80. @@ -1,5 +1,3 @@
  81. -using namespace std;
  82. -
  83. #include <stdlib.h>
  84. #include "duration.h"
  85. @@ -38,7 +36,7 @@ double Duration_Base::stop()
  86. getTime(&tv);
  87. double ret;
  88. ret = tv - m_start;
  89. - m_max = max(m_max, ret);
  90. + m_max = std::max(m_max, ret);
  91. return ret;
  92. }
  93. --- a/getc_putc.cpp
  94. +++ b/getc_putc.cpp
  95. @@ -140,7 +140,7 @@ int main(int argc, char *argv[])
  96. int size = 0, wrote;
  97. while(size < file_size)
  98. {
  99. - wrote = write(FILE_FD, buf, min(sizeof(buf), (size_t)file_size - size));
  100. + wrote = write(FILE_FD, buf, std::min(sizeof(buf), (size_t)file_size - size));
  101. if(wrote < 0)
  102. {
  103. fprintf(stderr, "Can't extend file - disk full?\n");
  104. --- a/rand.cpp
  105. +++ b/rand.cpp
  106. @@ -31,7 +31,7 @@ bool Rand::seedFile(CPCCHAR name)
  107. }
  108. close(fd);
  109. m_ind = -1;
  110. - m_name = string(name);
  111. + m_name = std::string(name);
  112. return false;
  113. }
  114. @@ -44,7 +44,7 @@ void Rand::seedNum(UINT num)
  115. m_init = num;
  116. char buf[12];
  117. sprintf(buf, "%u", num);
  118. - m_name = string(buf);
  119. + m_name = std::string(buf);
  120. }
  121. void Rand::reset()
  122. --- a/rand.h
  123. +++ b/rand.h
  124. @@ -1,7 +1,6 @@
  125. #ifndef RAND_H
  126. #define RAND_H
  127. -using namespace std;
  128. #include "port.h"
  129. #include <string>
  130. #include <stdio.h>
  131. @@ -31,7 +30,7 @@ public:
  132. int getSize() { return m_size; }
  133. - string getSeed() { return m_name; }
  134. + std::string getSeed() { return m_name; }
  135. void reset();
  136. @@ -39,7 +38,7 @@ private:
  137. int *m_arr;
  138. int m_size;
  139. int m_ind;
  140. - string m_name;
  141. + std::string m_name;
  142. UINT m_init;
  143. Rand(const Rand &t);