Commit 75668dfb authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

removed several warings when compiling with c++/c++14

parent c02dea99
......@@ -42,11 +42,11 @@ static double starttime = 0.0;
void afterInqHistory(int fileID);
void afterDefHistory(int fileID, char *histstring);
int scan_par_obsolate(char *namelist, char *name, int def);
int scan_par_obsolate(char *namelist, const char *name, int def);
void scan_code(char *namelist, struct Variable *vars, int maxCodes, int *numCodes);
int scan_par(int verbose, char *namelist, char *name, int def);
int scan_par(int verbose, char *namelist, const char *name, int def);
int scan_time(int verbose, char *namelist, int *hours, int max_hours);
void scan_darray(char *namelist, char *name, double *values, int maxValues, int *numValues);
void scan_darray(char *namelist, const char *name, double *values, int maxValues, int *numValues);
long get_nfft(void);
......
......@@ -93,7 +93,7 @@ void *CDIwrite(void *argument)
{
int memtype = MEMTYPE_DOUBLE;
int nvars = 10, nlevs = 0, ntimesteps = 30;
char *defaultgrid = "global_.2";
const char *defaultgrid = "global_.2";
int streamID;
int tsID, varID, levelID;
int gridsize, i;
......
......@@ -50,19 +50,19 @@ double *gl_data = NULL;
int Done = 0;
int com_help(char *);
int com_list(char *);
int com_quit(char *);
int com_stat(char *);
int com_set(char *);
int com_vars(char *);
int com_help(const char *);
int com_list(const char *);
int com_quit(const char *);
int com_stat(const char *);
int com_set(const char *);
int com_vars(const char *);
//int com_stat(char *);
typedef struct {
char *name; /* User printable name of the function. */
int (*func)(char *); /* Function to call to do the job. */
char *doc; /* Documentation for this function. */
const char *name; /* User printable name of the function. */
int (*func)(const char *); /* Function to call to do the job. */
const char *doc; /* Documentation for this function. */
}
command_t;
......@@ -92,7 +92,7 @@ int valid_argument (char *caller, char *arg)
}
/* Print out help for ARG, or for all of the commands if ARG is not present. */
int com_help(char *arg)
int com_help(const char *arg)
{
int i;
int printed = 0;
......@@ -129,7 +129,7 @@ int com_help(char *arg)
/* List the file(s) named in arg. */
int com_list(char *arg)
int com_list(const char *arg)
{
if (!arg)
arg = "";
......@@ -138,7 +138,7 @@ int com_list(char *arg)
}
/* The user wishes to quit using this program. Just set DONE non-zero. */
int com_quit(char *arg)
int com_quit(const char *arg)
{
UNUSED(arg);
......@@ -148,7 +148,7 @@ int com_quit(char *arg)
}
int com_stat(char *arg)
int com_stat(const char *arg)
{
int nrecs;
int tsID;
......@@ -195,7 +195,7 @@ int com_stat(char *arg)
}
int com_set(char *arg)
int com_set(const char *arg)
{
printf("com_set: %s\n", arg);
......@@ -203,7 +203,7 @@ int com_set(char *arg)
}
int com_vars(char *arg)
int com_vars(const char *arg)
{
int varID;
char paramstr[32];
......
......@@ -296,7 +296,7 @@ void export_e5ml(const char *filename, VAR *vars, int nvars, int vdate, int vtim
char atttext[1024];
size_t attlen;
//int attint;
char *username;
const char *username;
char timestr[30];
time_t date_and_time_in_sec;
struct tm *date_and_time;
......
......@@ -961,7 +961,8 @@ void *Gradsdes(void *argument)
int flt64 = 0;
int cal365day = 0;
int sequential = FALSE;
char Time[30], Incr[10] = {"1mn"}, *IncrKey[] = {"mn","hr","dy","mo","yr"};
char Time[30], Incr[10] = {"1mn"};
const char *IncrKey[] = {"mn","hr","dy","mo","yr"};
int isd, imn, ihh, iyy, imm, idd;
int isds = 0, imns = 0, ihhs = 0, iyys = 0, imms = 0, idds = 0;
int imn0 = 0, ihh0 = 0, iyy0 = 0, imm0 = 0, idd0 = 0;
......
......@@ -45,8 +45,8 @@ void init_amsr_day(int vlistID, int gridID, int zaxisID, int nvars)
5:cloud cloud liquid water in millimeters
6:rain rain rate in millimeters/hour
*/
char *name[] = {"hours", "sst", "wind", "vapor", "cloud", "rain"};
char *units[] = {"h", "deg Celcius", "m/s", "mm", "mm", "mm/h"};
const char *name[] = {"hours", "sst", "wind", "vapor", "cloud", "rain"};
const char *units[] = {"h", "deg Celcius", "m/s", "mm", "mm", "mm/h"};
double xscale[] = {0.1, 0.15, 0.2, 0.3, 0.01, 0.1};
double xminval[] = {0., -3., 0., 0., 0., 0.};
int i, varID;
......@@ -91,8 +91,8 @@ void init_amsr_averaged(int vlistID, int gridID, int zaxisID, int nvars)
4:cloud cloud liquid water in millimeters
5:rain rain rate in millimeters/hour
*/
char *name[] = {"sst", "wind", "vapor", "cloud", "rain"};
char *units[] = {"deg Celcius", "m/s", "mm", "mm", "mm/h"};
const char *name[] = {"sst", "wind", "vapor", "cloud", "rain"};
const char *units[] = {"deg Celcius", "m/s", "mm", "mm", "mm/h"};
double xscale[] = {0.15, 0.2, 0.3, 0.01, 0.1};
double xminval[] = {-3., 0., 0., 0., 0.};
int i, varID;
......
......@@ -333,7 +333,7 @@ void *Output(void *argument)
{
if ( tsID == 0 && recID == 0 )
{
char *fname = "frontplane.xyz";
const char *fname = "frontplane.xyz";
FILE *fp;
double fmin = 0;
double dx, x0, y0, z0, x, y, z;
......
......@@ -32,7 +32,7 @@
#define LIM_NTSM 1024
enum {TU_SECONDS=0, TU_MINUTES, TU_HOURS, TU_DAYS, TU_MONTHS, TU_YEARS};
char *tunits[] = {"second", "minute", "hour", "day", "month", "year"};
const char *tunits[] = {"second", "minute", "hour", "day", "month", "year"};
int iunits[] = {1, 60, 3600, 86400, 1, 12};
......
#include <math.h>
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include "constants.h"
......
......@@ -2,6 +2,10 @@
#include <stdlib.h>
#include <math.h>
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#ifndef _DMEMORY_H
# include "dmemory.h"
#endif
......
......@@ -6,7 +6,7 @@
static
char *amatch(char *msr, char *sub)
char *amatch(char *msr, const char *sub)
{
int i,nm,ns;
......@@ -20,7 +20,7 @@ char *amatch(char *msr, char *sub)
}
int scan_par_obsolate(char *namelist, char *name, int def)
int scan_par_obsolate(char *namelist, const char *name, int def)
{
char *cp;
int value;
......@@ -38,7 +38,7 @@ int scan_par_obsolate(char *namelist, char *name, int def)
}
int scan_par(int verbose, char *namelist, char *name, int def)
int scan_par(int verbose, char *namelist, const char *name, int def)
{
char *cp;
int value;
......@@ -115,7 +115,7 @@ void scan_code(char *namelist, struct Variable *vars, int maxCodes, int *numCode
}
void scan_darray(char *namelist, char *name, double *values, int maxValues, int *numValues)
void scan_darray(char *namelist, const char *name, double *values, int maxValues, int *numValues)
{
char *cp,*icp;
double val;
......
......@@ -3,6 +3,10 @@
#include <string.h>
#include <math.h>
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#ifndef _DMEMORY_H
# include "dmemory.h"
#endif
......
#ifndef _AFTERBURNER_H
#define _AFTERBURNER_H
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
/* =============================================== */
/* These include files should be standard on all */
/* UNIX systems. */
......
......@@ -100,7 +100,7 @@ void FreeSamp(struct Variable *vars)
/* alloc_dp - Allocate space for double array */
static
double *alloc_dp(int words, char *array_name)
double *alloc_dp(int words, const char *array_name)
{
double *result = NULL;
......
......@@ -294,7 +294,7 @@ void cdoSetDebug(int level)
#define IsBigendian() ( u_byteorder.c[sizeof(long) - 1] )
static
void setDefaultDataType(char *datatypestr)
void setDefaultDataType(const char *datatypestr)
{
static union {unsigned long l; unsigned char c[sizeof(long)];} u_byteorder = {1};
int nbits = -1;
......@@ -464,11 +464,11 @@ void setDefaultDataTypeByte(char *datatypestr)
}
*/
static
void setDefaultFileType(char *filetypestr, int labort)
void setDefaultFileType(const char *filetypestr, int labort)
{
if ( filetypestr )
{
char *ftstr = filetypestr;
const char *ftstr = filetypestr;
size_t len;
if ( cmpstrlen(filetypestr, "grb2", len) == 0 ) { ftstr += len; cdoDefaultFileType = FILETYPE_GRB2;}
......@@ -975,7 +975,7 @@ void cdo_set_options(void)
static
long str_to_int(char *intstring)
long str_to_int(const char *intstring)
{
long intval = -1;
long fact = 1;
......
......@@ -100,7 +100,7 @@ char *__progname(char *nargv0)
static
int cdo_getopt_internal(int nargc, char * const *nargv, const char *ostr)
{
static char *place = EMSG; /* option letter processing */
static const char *place = EMSG; /* option letter processing */
char *oli; /* option letter list index */
assert(nargv != NULL);
......
......@@ -126,8 +126,8 @@ int days_per_year(int calendar, int year);
int calendar_dpy(int calendar);
void defineGrid(const char *gridarg);
void defineInstitution(char *instarg);
int defineTable(char *tablearg);
void defineInstitution(const char *instarg);
int defineTable(const char *tablearg);
void cdolog(const char *prompt, double cputime);
void cdologs(int noper);
......
......@@ -226,9 +226,9 @@ static int vector_is_between_lat (double a[], double b[], double p[]) {
// dot product is most accurate for angles around half PI
// (for angles very close to half PI: alpha = fabs(acos(alpha))
double angle = fabs(cross_cd[0] * a[0] +
double angle = fabs((double)(cross_cd[0] * a[0] +
cross_cd[1] * a[1] +
cross_cd[2] * a[2]) / length_cross_cd ;
cross_cd[2] * a[2])) / length_cross_cd ;
// if ab is on the plane of cd
if (fabs(angle) < tol) {
......@@ -258,9 +258,9 @@ static int vector_is_between_lat (double a[], double b[], double p[]) {
// dot product is most accurate for angles around half PI
// (for angles very close to half PI: alpha = fabs(acos(alpha))
double angle = fabs(cross_ab[0] * c[0] +
double angle = fabs((double)(cross_ab[0] * c[0] +
cross_ab[1] * c[1] +
cross_ab[2] * c[2]) / length_cross_ab;
cross_ab[2] * c[2])) / length_cross_ab;
// if cd is on the plane of ab
if (fabs(angle) < tol) {
......@@ -447,9 +447,9 @@ int gcxgc_vec_ (double a[3], double b[3], double c[3], double d[3]) {
// dot product is most accurate for angles around half PI
// (for angles very close to half PI: alpha = fabs(acos(alpha))
double angle = fabs(cross_cd[0] * a[0] +
double angle = fabs((double)(cross_cd[0] * a[0] +
cross_cd[1] * a[1] +
cross_cd[2] * a[2]) / length_cross_cd ;
cross_cd[2] * a[2])) / length_cross_cd ;
// if ab is not on the plane of cd
if (fabs(angle) >= tol)
......@@ -467,9 +467,9 @@ int gcxgc_vec_ (double a[3], double b[3], double c[3], double d[3]) {
// dot product is most accurate for angles around half PI
// (for angles very close to half PI: alpha = fabs(acos(alpha))
double angle = fabs(cross_ab[0] * c[0] +
double angle = fabs((double)(cross_ab[0] * c[0] +
cross_ab[1] * c[1] +
cross_ab[2] * c[2]) / length_cross_ab;
cross_ab[2] * c[2])) / length_cross_ab;
// if cd is not on the plane of ab
if (fabs(angle) >= tol)
......
......@@ -62,7 +62,7 @@ void yac_free_pointer_unique_lookup() {
pointer_lookup_table_size = 0;
}
void yac_internal_abort_message ( char * text, char * file, int line )
void yac_internal_abort_message ( const char * text, const char * file, int line )
{
fprintf(stderr, "%s \n", text);
fprintf(stderr, "Aborting in file %s, line %i ...\n", file, line );
......
......@@ -69,7 +69,7 @@ void yac_free_pointer_unique_lookup();
* prints a short error message and info from where it was called
* followed by an exit.
*/
void yac_internal_abort_message ( char * text, char * file, int line );
void yac_internal_abort_message ( const char * text, const char * file, int line );
/** \example test_quicksort.c
* This contains an example of how to use quicksort_index.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment