lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 63529b4 2/2: Use standard names more appropri


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 63529b4 2/2: Use standard names more appropriately
Date: Sun, 24 Mar 2019 22:15:13 -0400 (EDT)

branch: master
commit 63529b443858ff70c542d7d79d807c1f59a733a1
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Use standard names more appropriately
    
    Included standard headers iff necessary. Added missing 'std::'.
---
 alert_cli.cpp              | 2 +-
 crc32.hpp                  | 2 +-
 interpolate_string.cpp     | 3 ++-
 istream_to_string_test.cpp | 2 +-
 pdf_command_wx.cpp         | 5 +++--
 rate_table.cpp             | 6 +++---
 ssize_lmi.hpp              | 2 --
 7 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/alert_cli.cpp b/alert_cli.cpp
index 2f56c22..8ff349a 100644
--- a/alert_cli.cpp
+++ b/alert_cli.cpp
@@ -41,7 +41,7 @@ bool continue_anyway()
 {
     int c;
   ask:
-    c = getchar();
+    c = std::getchar();
     if('y' == c || 'Y' == c)
         {
         std::cout << std::endl;
diff --git a/crc32.hpp b/crc32.hpp
index 8a166b4..ae18d90 100644
--- a/crc32.hpp
+++ b/crc32.hpp
@@ -25,7 +25,7 @@
 #include "config.hpp"
 
 #include "so_attributes.hpp"
-#include "ssize_lmi.hpp"
+#include "ssize_lmi.hpp"                // sstrlen()
 
 #include <string>
 #include <vector>
diff --git a/interpolate_string.cpp b/interpolate_string.cpp
index 8aa5514..7b979d2 100644
--- a/interpolate_string.cpp
+++ b/interpolate_string.cpp
@@ -25,6 +25,7 @@
 
 #include "alert.hpp"
 
+#include <cstring>                      // strlen()
 #include <stack>
 #include <stdexcept>
 #include <vector>
@@ -275,7 +276,7 @@ std::string interpolate_string
     // interpolated variables tend to be longer than the variables names
     // themselves, but it's difficult to estimate the resulting string length
     // any better than this.
-    out.reserve(strlen(s));
+    out.reserve(std::strlen(s));
 
     // The stack contains all the sections that we're currently in.
     std::stack<section_info, std::vector<section_info>> sections;
diff --git a/istream_to_string_test.cpp b/istream_to_string_test.cpp
index d5a25b9..f9fb2b1 100644
--- a/istream_to_string_test.cpp
+++ b/istream_to_string_test.cpp
@@ -107,7 +107,7 @@ std::string mete_3()
         if(0 != bytes_read)
         s.append(buffer, bytes_read);
         }
-    fclose(fp);
+    std::fclose(fp);
     return s;
 }
 
diff --git a/pdf_command_wx.cpp b/pdf_command_wx.cpp
index 5a6b4a4..d2de0f4 100644
--- a/pdf_command_wx.cpp
+++ b/pdf_command_wx.cpp
@@ -53,6 +53,7 @@
 #include <array>
 #include <cstdint>                      // ULONG_MAX
 #include <cstdlib>                      // strtoul()
+#include <cstring>                      // strchr(), strlen()
 #include <exception>                    // uncaught_exceptions()
 #include <fstream>
 #include <map>
@@ -74,7 +75,7 @@ namespace
 inline
 bool starts_with(std::string const& s, char const* prefix)
 {
-    return s.compare(0, strlen(prefix), prefix) == 0;
+    return s.compare(0, std::strlen(prefix), prefix) == 0;
 }
 
 // Helper enums identifying the possible {Guaranteed,Current}{Zero,}
@@ -2210,7 +2211,7 @@ class pdf_illustration_naic : public pdf_illustration
             mode0[0] = lmi_tolower(mode0[0]);
             add_variable
                 ("ErModeLCWithArticle"
-                ,(strchr("aeiou", mode0[0]) ? "an " : "a ") + mode0
+                ,(std::strchr("aeiou", mode0[0]) ? "an " : "a ") + mode0
                 );
             }
 
diff --git a/rate_table.cpp b/rate_table.cpp
index a04eebe..d3d0afb 100644
--- a/rate_table.cpp
+++ b/rate_table.cpp
@@ -37,7 +37,7 @@
 #include <algorithm>                    // count()
 #include <climits>                      // ULLONG_MAX
 #include <cstdlib>                      // strtoull()
-#include <cstring>                      // strncmp()
+#include <cstring>                      // memcpy(), strncmp()
 #include <iomanip>
 #include <ios>
 #include <istream>
@@ -155,7 +155,7 @@ inline
 T from_bytes(char const* bytes)
 {
     T t;
-    memcpy(&t, bytes, sizeof(T));
+    std::memcpy(&t, bytes, sizeof(T));
     return swap_bytes_if_big_endian(t);
 }
 
@@ -164,7 +164,7 @@ inline
 void to_bytes(char* bytes, T value)
 {
     T const t = swap_bytes_if_big_endian(value);
-    memcpy(bytes, &t, sizeof(T));
+    std::memcpy(bytes, &t, sizeof(T));
 }
 
 // Functions doing the same thing as istream::read() and ostream::write()
diff --git a/ssize_lmi.hpp b/ssize_lmi.hpp
index 4d16bc2..80f16ee 100644
--- a/ssize_lmi.hpp
+++ b/ssize_lmi.hpp
@@ -26,9 +26,7 @@
 
 #include "bourn_cast.hpp"
 
-#include <cstddef>                      // size_t
 #include <cstring>                      // strlen()
-#include <type_traits>                  // make_signed_t
 
 /// Reformed std::size() [C++17 27.8/2-3] returning a signed integer.
 ///



reply via email to

[Prev in Thread] Current Thread [Next in Thread]