Commit a09ee1e6 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

setzaxis: set MAX_LINE_LEN from 1024 to 65536

parent 5d1d16de
......@@ -5,9 +5,10 @@
* New operator: atan2 (Arith) [request: Tom Hardy]
* New operator: abs (Math) [request: Reiner Schnur]
* New module: Enlargegrid [request: Tom Hardy] <- docu missing
* setzaxis: set MAX_LINE_LEN from 1024 to 65536 [bug report: Martine Michou]
* enlarge: update for zonal and meridional data [request: Wolfgang Mueller]
* gradsdes: bug fix for unsorted GRIB data [report: Stefan Bauer]
* splitzaxis: generate file name from zaxisID+1 (bug report: Martina Stockhaus)
* splitzaxis: generate file name from zaxisID+1 [bug report: Martina Stockhaus]
* splitgrid: generate file name from gridID+1
* Vardup: bug fix for missing values
* Timsort: bug fix for time constant fields
......
This diff is collapsed.
......@@ -49,6 +49,9 @@ void extClose(int fileID);
#define UNDEFID -1
#define MAX_LINE_LEN 65536
typedef struct {
double *xvals;
double *yvals;
......@@ -513,7 +516,7 @@ double *readfield4(GRID *grid, int record, char *format, char *filename)
int gridFromFile(FILE *gfp, const char *dname)
{
static char func[] = "gridFromFile";
char line[1024], *pline;
char line[MAX_LINE_LEN], *pline;
/* char path[4096]; */
int gridID = -1;
int size;
......@@ -521,7 +524,7 @@ int gridFromFile(FILE *gfp, const char *dname)
gridInit(&grid);
while ( readline(gfp, line, 1024) )
while ( readline(gfp, line, MAX_LINE_LEN) )
{
if ( line[0] == '#' ) continue;
if ( line[0] == '\0' ) continue;
......@@ -882,7 +885,7 @@ int gridFromFile(FILE *gfp, const char *dname)
grid.yvals = (double *) malloc(grid.size*sizeof(double));
for ( i = 0; i < (int) grid.size; i++ )
{
if ( ! readline(gfp, line, 1024) )
if ( ! readline(gfp, line, MAX_LINE_LEN) )
{
Warning(func, "Incomplete commmand: >gridlatlon<");
break;
......@@ -914,7 +917,7 @@ int gridFromFile(FILE *gfp, const char *dname)
fval = strtod(pline, &endptr);
if ( pline == endptr )
{
if ( ! readline(gfp, line, 1024) )
if ( ! readline(gfp, line, MAX_LINE_LEN) )
{
Warning(func, "Incomplete commmand: >xvals<");
break;
......@@ -951,7 +954,7 @@ int gridFromFile(FILE *gfp, const char *dname)
fval = strtod(pline, &endptr);
if ( pline == endptr )
{
if ( ! readline(gfp, line, 1024) )
if ( ! readline(gfp, line, MAX_LINE_LEN) )
{
Warning(func, "Incomplete commmand: >yvals<");
break;
......@@ -988,7 +991,7 @@ int gridFromFile(FILE *gfp, const char *dname)
fval = strtod(pline, &endptr);
if ( pline == endptr )
{
if ( ! readline(gfp, line, 1024) )
if ( ! readline(gfp, line, MAX_LINE_LEN) )
{
Warning(func, "Incomplete commmand: >xbounds<");
break;
......@@ -1028,7 +1031,7 @@ int gridFromFile(FILE *gfp, const char *dname)
fval = strtod(pline, &endptr);
if ( pline == endptr )
{
if ( ! readline(gfp, line, 1024) )
if ( ! readline(gfp, line, MAX_LINE_LEN) )
{
Warning(func, "Incomplete commmand: >ybounds<");
break;
......@@ -1809,7 +1812,7 @@ int cdoDefineGrid(const char *gridfile)
void defineGrid(const char *gridarg)
{
char gridfile[1024];
char gridfile[4096];
int nfile = 0;
while ( getoptname(gridfile, gridarg, nfile++) == 0 )
......
This diff is collapsed.
......@@ -25,7 +25,11 @@ int readline(FILE *fp, char *line, int len)
{
if ( ichar == '\n' ) break;
line[ipos++] = ichar;
if ( ipos >= len ) break;
if ( ipos >= len )
{
fprintf(stderr, "readline Warning: end of line not found (maxlen = %d)!\n", len);
break;
}
}
line[ipos] = 0;
......
......@@ -27,6 +27,8 @@
#define UNDEFID -1
#define MAX_LINE_LEN 65536
typedef struct {
double *vals;
......@@ -151,13 +153,13 @@ static char *skipSeparator(char *pline)
int zaxisFromFile(FILE *gfp)
{
static char func[] = "zaxisFromFile";
char line[1024], *pline;
char line[MAX_LINE_LEN], *pline;
int zaxisID;
ZAXIS zaxis;
zaxisInit(&zaxis);
while ( readline(gfp, line, 1024) )
while ( readline(gfp, line, MAX_LINE_LEN) )
{
if ( line[0] == '#' ) continue;
if ( line[0] == '\0' ) continue;
......@@ -224,7 +226,7 @@ int zaxisFromFile(FILE *gfp)
pline = skipSeparator(pline);
if ( strlen(pline) == 0 )
{
if ( ! readline(gfp, line, 1024) )
if ( ! readline(gfp, line, MAX_LINE_LEN) )
{
Warning(func, "Incomplete commmand: >levels<");
break;
......@@ -259,7 +261,7 @@ int zaxisFromFile(FILE *gfp)
pline = skipSeparator(pline);
if ( strlen(pline) == 0 )
{
if ( ! readline(gfp, line, 1024) )
if ( ! readline(gfp, line, MAX_LINE_LEN) )
{
Warning(func, "Incomplete commmand: >vct<");
break;
......@@ -294,7 +296,7 @@ int zaxisFromFile(FILE *gfp)
pline = skipSeparator(pline);
if ( strlen(pline) == 0 )
{
if ( ! readline(gfp, line, 1024) )
if ( ! readline(gfp, line, MAX_LINE_LEN) )
{
Warning(func, "Incomplete commmand: >lbounds<");
break;
......@@ -329,7 +331,7 @@ int zaxisFromFile(FILE *gfp)
pline = skipSeparator(pline);
if ( strlen(pline) == 0 )
{
if ( ! readline(gfp, line, 1024) )
if ( ! readline(gfp, line, MAX_LINE_LEN) )
{
Warning(func, "Incomplete commmand: >ubounds<");
break;
......@@ -385,7 +387,7 @@ int cdoDefineZaxis(const char *zaxisfile)
void defineZaxis(const char *zaxisarg)
{
char zaxisfile[1024];
char zaxisfile[4096];
int nfile = 0;
while ( getoptname(zaxisfile, zaxisarg, nfile++) == 0 )
......
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