diff --git a/libraries/ast/fitstable.c b/libraries/ast/fitstable.c index b920bd71a27..172a0bececa 100644 --- a/libraries/ast/fitstable.c +++ b/libraries/ast/fitstable.c @@ -944,6 +944,9 @@ static void GenerateColumns( AstFitsTable *this, AstFitsChan *header, /* Check the global error status. */ if ( !astOK ) return; +/* Initialise */ + type = AST__BADTYPE; + /* Get the number of columns defined in the header. */ if( !astGetFitsI( header, "TFIELDS", &ncol ) ) ncol = 0; @@ -991,7 +994,6 @@ static void GenerateColumns( AstFitsTable *this, AstFitsChan *header, type = AST__STRINGTYPE; } else if( astOK ){ - type = AST__BADTYPE; astError( AST__BDFTS, "astFitsTable: Keyword '%s' in supplied FITS " "binary table header has unsupported value '%s'.", status, keyword, cval ); @@ -1243,6 +1245,9 @@ f AST_COLUMNNULL functiom. /* Check the global error status. */ if ( !astOK ) return; +/* Initialise */ + nb = 0; + /* Find the number of bytes needed to hold a single element of the value in a column cell. */ type = astGetColumnType( this, column ); @@ -1265,7 +1270,6 @@ f AST_COLUMNNULL functiom. nb = sizeof( char ); } else if( astOK ) { - nb = 0; astError( AST__INTER, "astGetColumnData(%s): Unsupported column type " "%d (internal AST programming error).", status, astGetClass( this ), type ); @@ -1951,6 +1955,9 @@ f The global status. /* Check the global error status. */ if ( !astOK ) return; +/* Initialise */ + nb = 0; + /* Find the number of bytes in the supplied array holding a single element of the value in a column cell. */ type = astGetColumnType( this, column ); @@ -1973,7 +1980,6 @@ f The global status. nb = sizeof( char ); } else if( astOK ) { - nb = 0; astError( AST__INTER, "astPutColumnData(%s): Unsupported column type " "%d (internal AST programming error).", status, astGetClass( this ), type ); diff --git a/libraries/ast/mapping.c b/libraries/ast/mapping.c index 1297de3c920..e629789aac3 100644 --- a/libraries/ast/mapping.c +++ b/libraries/ast/mapping.c @@ -1200,6 +1200,8 @@ static double FindGradient( AstMapping *map, double *at, int ax1, int ax2, interval. */ y1 = AST__BAD; y2 = AST__BAD; + gmax = AST__BAD; + gmin = AST__BAD; ngood = 0; for( i = 0; i < RATE_ORDER; i++ ) { @@ -1209,7 +1211,7 @@ static double FindGradient( AstMapping *map, double *at, int ax1, int ax2, g = ( y[ i + 1 ] - y[ i ] )/( x[ i + 1 ] - x[ i ] ); - if( i == 0 ) { + if( ngood == 1 ) { gmax = gmin = g; } else if( g < gmin ) { gmin = g; @@ -7833,6 +7835,11 @@ static double MatrixDet( int nrow, int ncol, const double *matrix, int *status ) /* Check the global error status. */ if ( !astOK ) return result; +/* Initialise... */ + sqmat = NULL; + nrowuse = 0; + ncoluse = 0; + /* Flag any rows and columns that should be ignored because they contain only bad values or zeros. */ userow = astCalloc( nrow, sizeof( *userow ) ); @@ -7849,12 +7856,10 @@ static double MatrixDet( int nrow, int ncol, const double *matrix, int *status ) } /* Find the number of usable rows and columns. */ - nrowuse = 0; for( irow = 0; irow < nrow; irow++ ) { if( userow[ irow ] ) nrowuse++; } - ncoluse = 0; for( icol = 0; icol < ncol; icol++ ) { if( usecol[ icol ] ) ncoluse++; }