*/
#include "gmxpre.h"
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cctype>
+#include <cstdlib>
+#include <cstring>
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/confio.h"
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<int>(nw*gmx_rng_uniform_real(rng));
maxrand--;
}
while (bSet[ei] && (maxrand > 0));
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--;
{
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");
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';
}
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);