Unverified Commit 04d7eacc authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

remove .c_str() in several places because it is no longer neede

parent c7ef89dc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ void lammps_open(int argc, char **argv, MPI_Comm communicator, void **ptr)
    *ptr = (void *) lmp;
  }
  catch(LAMMPSException & e) {
    fprintf(stderr, "LAMMPS Exception: %s", e.message.c_str());
    fmt::print(stderr, "LAMMPS Exception: {}", e.message);
    *ptr = (void *) NULL;
  }
#else
@@ -172,7 +172,7 @@ void lammps_open_no_mpi(int argc, char **argv, void **ptr)
    *ptr = (void *) lmp;
  }
  catch(LAMMPSException & e) {
    fprintf(stderr, "LAMMPS Exception: %s", e.message.c_str());
    fmt::print(stderr, "LAMMPS Exception: {}", e.message);
    *ptr = (void*) NULL;
  }
#else
+10 −10
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ void utils::sfgets(const char *srcname, int srcline, char *s, int size,
    errmsg += filename;
    errmsg += "'";

    if (error) error->one(srcname,srcline,errmsg.c_str());
    if (error) error->one(srcname,srcline,errmsg);
    if (s) *s = '\0'; // truncate string to empty in case error is NULL
  }
  return;
@@ -184,7 +184,7 @@ void utils::sfread(const char *srcname, int srcline, void *s, size_t size,
    errmsg += filename;
    errmsg += "'";

    if (error) error->one(srcname,srcline,errmsg.c_str());
    if (error) error->one(srcname,srcline,errmsg);
  }
  return;
}
@@ -238,9 +238,9 @@ double utils::numeric(const char *file, int line, const char *str,
    msg += str;
    msg += "' in input script or data file";
    if (do_abort)
      lmp->error->one(file,line,msg.c_str());
      lmp->error->one(file,line,msg);
    else
      lmp->error->all(file,line,msg.c_str());
      lmp->error->all(file,line,msg);
  }

  return atof(str);
@@ -273,9 +273,9 @@ int utils::inumeric(const char *file, int line, const char *str,
    msg += str;
    msg += "' in input script or data file";
    if (do_abort)
      lmp->error->one(file,line,msg.c_str());
      lmp->error->one(file,line,msg);
    else
      lmp->error->all(file,line,msg.c_str());
      lmp->error->all(file,line,msg);
  }

  return atoi(str);
@@ -308,9 +308,9 @@ bigint utils::bnumeric(const char *file, int line, const char *str,
    msg += str;
    msg += "' in input script or data file";
    if (do_abort)
      lmp->error->one(file,line,msg.c_str());
      lmp->error->one(file,line,msg);
    else
      lmp->error->all(file,line,msg.c_str());
      lmp->error->all(file,line,msg);
  }

  return ATOBIGINT(str);
@@ -343,9 +343,9 @@ tagint utils::tnumeric(const char *file, int line, const char *str,
    msg += str;
    msg += "' in input script or data file";
    if (do_abort)
      lmp->error->one(file,line,msg.c_str());
      lmp->error->one(file,line,msg);
    else
      lmp->error->all(file,line,msg.c_str());
      lmp->error->all(file,line,msg);
  }

  return ATOTAGINT(str);
+3 −3
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ void WriteData::command(int narg, char **arg)
    if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost);
  }

  write(file.c_str());
  write(file);
}

/* ----------------------------------------------------------------------
@@ -131,7 +131,7 @@ void WriteData::command(int narg, char **arg)
   might later let it be directly called within run/minimize loop
------------------------------------------------------------------------- */

void WriteData::write(const char *file)
void WriteData::write(const std::string &file)
{
  // special case where reneighboring is not done in integrator
  //   on timestep data file is written (due to build_once being set)
@@ -187,7 +187,7 @@ void WriteData::write(const char *file)
  // open data file

  if (me == 0) {
    fp = fopen(file,"w");
    fp = fopen(file.c_str(),"w");
    if (fp == NULL)
      error->one(FLERR,fmt::format("Cannot open data file {}: {}",
                                   file, utils::getsyserror()));
+2 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ CommandStyle(write_data,WriteData)
#define LMP_WRITE_DATA_H

#include "pointers.h"
#include <string>

namespace LAMMPS_NS {

@@ -28,7 +29,7 @@ class WriteData : protected Pointers {
 public:
  WriteData(class LAMMPS *);
  void command(int, char **);
  void write(const char *);
  void write(const std::string &);

 private:
  int me,nprocs;
+0 −3
Original line number Diff line number Diff line
@@ -293,9 +293,6 @@ void WriteRestart::write(std::string file)

    std::string multiname = file;
    multiname.replace(multiname.find("%"),1,fmt::format("{}",icluster));
    fp = fopen(multiname.c_str(),"wb");
    if (fp == NULL)
      error->one(FLERR,fmt::format("Cannot open restart file {}",multiname).c_str());

    if (filewriter) {
      fp = fopen(multiname.c_str(),"wb");