Skip to content

Commit

Permalink
ast: Add some initialisations to avoid compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
David Berry committed Nov 19, 2012
1 parent 9126089 commit 86757e5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
12 changes: 9 additions & 3 deletions libraries/ast/fitstable.c
Expand Up @@ -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;

Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand All @@ -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 );
Expand Down Expand Up @@ -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 );
Expand All @@ -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 );
Expand Down
11 changes: 8 additions & 3 deletions libraries/ast/mapping.c
Expand Up @@ -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++ ) {
Expand All @@ -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;
Expand Down Expand Up @@ -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 ) );
Expand All @@ -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++;
}
Expand Down

0 comments on commit 86757e5

Please sign in to comment.