#include <stdio.h>
#include <ctype.h>
+
+#include <algorithm>
+
#include "sysstuff.h"
#include "futil.h"
#include "string2.h"
{
t_mapping *map;
char *line_buf = NULL, *line = NULL, *str, buf[256] = {0};
- int i, m, col_len, nch, n_axis_x, n_axis_y, llmax;
+ int i, m, col_len, nch = 0, n_axis_x, n_axis_y, llmax;
int llalloc = 0;
unsigned int r, g, b;
double u;
{
gmx_fatal(FARGS, "Dimensions of xpm-file have to be larger than 0\n");
}
- llmax = max(STRLEN, mm->nx+10);
+ llmax = std::max(STRLEN, mm->nx+10);
bGetOnWithIt = TRUE;
}
}
fprintf(debug, "mm->nx %d mm->ny %d mm->nmap %d nch %d\n",
mm->nx, mm->ny, mm->nmap, nch);
}
+ if (nch == 0)
+ {
+ gmx_fatal(FARGS, "Number of characters per pixel not found in xpm\n");
+ }
/* Read color map */
snew(map, mm->nmap);
/* Read axes, if there are any */
n_axis_x = 0;
n_axis_y = 0;
- bGetOnWithIt = FALSE;
bSetLine = FALSE;
do
{
{
/* Take care that we have at least 1 entry in the mid to hi range
*/
- return min(max(0, ((mid-lo)/(hi-lo))*(nlevels-1)), nlevels-1);
+ return std::min(std::max(0, static_cast<int>(((mid-lo)/(hi-lo))*(nlevels-1))),
+ nlevels-1);
}
void write_xpm_map3(FILE *out, int n_x, int n_y, int *nlevels,
int i, n;
- *nlevel = min(16, *nlevel);
+ *nlevel = std::min(16, *nlevel);
n = *nlevel;
for (i = 0; (i < n); i++)
{
int *nlevel_bot, real lo_bot, real hi_bot,
t_rgb rlo_bot, t_rgb rhi_bot)
{
- int i, ntot;
- real r, g, b, fac;
+ int ntot;
ntot = *nlevel_top + *nlevel_bot;
if (ntot > NMAP)