From 9cc2638c91df074652fa74f0c86351e2aad0b1d7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 25 Jun 2025 20:02:41 -0400 Subject: [PATCH] modernize code --- src/utils.cpp | 5 +++-- tools/binary2txt.cpp | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/utils.cpp b/src/utils.cpp index 2fbaa91b20..55de82bfe7 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -247,7 +247,7 @@ std::string utils::point_to_error(Input *input, int failed) } return cmdline; } else - return std::string(""); + return {""}; } /* specialization for the case of just a single string argument */ @@ -290,7 +290,8 @@ std::string utils::errorurl(int errorcode) return "\nFor more information see https://docs.lammps.org/Errors_details.html"; else if (errorcode > 0) return fmt::format("\nFor more information see https://docs.lammps.org/err{:04d}", errorcode); - else return ""; // negative numbers are reserved for future use pointing to a different URL + else + return ""; // negative numbers are reserved for future use pointing to a different URL } void utils::flush_buffers(LAMMPS *lmp) diff --git a/tools/binary2txt.cpp b/tools/binary2txt.cpp index 2f7eb1e222..5671f31451 100644 --- a/tools/binary2txt.cpp +++ b/tools/binary2txt.cpp @@ -41,12 +41,12 @@ #endif #if defined(LAMMPS_SMALLBIG) -typedef int tagint; -typedef int64_t bigint; +using tagint = int; +using bigint = int64_t; #define BIGINT_FORMAT "%" PRId64 #else /* LAMMPS_BIGBIG */ -typedef int64_t tagint; -typedef int64_t bigint; +using tagint = int64_t; +using bigint = int64_t; #define BIGINT_FORMAT "%" PRId64 #endif @@ -80,7 +80,7 @@ int main(int narg, char **arg) } n = strlen(arg[iarg]) + 1 + 4; - auto filetxt = new char[n]; + auto *filetxt = new char[n]; strcpy(filetxt, arg[iarg]); strcat(filetxt, ".txt"); FILE *fptxt = fopen(filetxt, "w");