X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=blobdiff_plain;f=src%2Fgromacs%2Fgmxana%2Fgmx_genion.cpp;fp=src%2Fgromacs%2Fgmxana%2Fgmx_genion.c;h=a77f6b11d40e6562dc85be988406c6e4aa1419cd;hb=c3f2d46e4047f0c465f7234b3784a2fa6f02a065;hp=c7d980eee99a68d5b8a266427d420ef520f95c5b;hpb=0595b4a4c763a0bc574658992081abf8b0abc3fe;p=alexxy%2Fgromacs.git diff --git a/src/gromacs/gmxana/gmx_genion.c b/src/gromacs/gmxana/gmx_genion.cpp similarity index 96% rename from src/gromacs/gmxana/gmx_genion.c rename to src/gromacs/gmxana/gmx_genion.cpp index c7d980eee9..a77f6b11d4 100644 --- a/src/gromacs/gmxana/gmx_genion.c +++ b/src/gromacs/gmxana/gmx_genion.cpp @@ -36,9 +36,9 @@ */ #include "gmxpre.h" -#include -#include -#include +#include +#include +#include #include "gromacs/commandline/pargs.h" #include "gromacs/fileio/confio.h" @@ -68,14 +68,13 @@ static void insert_ion(int nsa, int *nwater, rvec dx; gmx_int64_t maxrand; - ei = -1; nw = *nwater; maxrand = nw; maxrand *= 1000; do { - ei = nw*gmx_rng_uniform_real(rng); + ei = static_cast(nw*gmx_rng_uniform_real(rng)); maxrand--; } while (bSet[ei] && (maxrand > 0)); @@ -122,8 +121,8 @@ static char *aname(const char *mname) int i; str = gmx_strdup(mname); - i = strlen(str)-1; - while (i > 1 && (isdigit(str[i]) || (str[i] == '+') || (str[i] == '-'))) + i = std::strlen(str)-1; + while (i > 1 && (std::isdigit(str[i]) || (str[i] == '+') || (str[i] == '-'))) { str[i] = '\0'; i--; @@ -235,13 +234,13 @@ static void update_topol(const char *topinout, int p_num, int n_num, { FILE *fpin, *fpout; char buf[STRLEN], buf2[STRLEN], *temp, **mol_line = NULL; - int line, i, nsol, nmol_line, sol_line, nsol_last; + int line, i, nmol_line, sol_line, nsol_last; gmx_bool bMolecules; char temporary_filename[STRLEN]; printf("\nProcessing topology\n"); fpin = gmx_ffopen(topinout, "r"); - strncpy(temporary_filename, "temp.topXXXXXX", STRLEN); + std::strncpy(temporary_filename, "temp.topXXXXXX", STRLEN); gmx_tmpnam(temporary_filename); fpout = gmx_ffopen(temporary_filename, "w"); @@ -253,8 +252,8 @@ static void update_topol(const char *topinout, int p_num, int n_num, while (fgets(buf, STRLEN, fpin)) { line++; - strcpy(buf2, buf); - if ((temp = strchr(buf2, '\n')) != NULL) + std::strcpy(buf2, buf); + if ((temp = std::strchr(buf2, '\n')) != NULL) { temp[0] = '\0'; } @@ -262,14 +261,14 @@ static void update_topol(const char *topinout, int p_num, int n_num, if (buf2[0] == '[') { buf2[0] = ' '; - if ((temp = strchr(buf2, '\n')) != NULL) + if ((temp = std::strchr(buf2, '\n')) != NULL) { temp[0] = '\0'; } rtrim(buf2); - if (buf2[strlen(buf2)-1] == ']') + if (buf2[std::strlen(buf2)-1] == ']') { - buf2[strlen(buf2)-1] = '\0'; + buf2[std::strlen(buf2)-1] = '\0'; ltrim(buf2); rtrim(buf2); bMolecules = (gmx_strcasecmp(buf2, "molecules") == 0);