IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18845


Ignore:
Timestamp:
Aug 1, 2008, 8:33:14 AM (18 years ago)
Author:
Paul Price
Message:

Need to check return value of fwrite to avoid compiler warning on some
systems. It's a good thing to do anyway.

Location:
trunk/psModules/src/objects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourceIO_CMP.c

    r15562 r18845  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-11-10 01:09:20 $
     5 *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2008-08-01 18:33:01 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    113113        pmSource *source = (pmSource *) sources->data[i];
    114114
    115         // no difference between PSF and non-PSF model
     115        // no difference between PSF and non-PSF model
    116116        pmModel *model = pmSourceGetModel (NULL, source);
    117117        if (model == NULL)
     
    140140        psLineAdd (line, "%6.2f ",  axes.minor);
    141141        psLineAdd (line, "%5.1f\n", axes.theta);
    142         fwrite (line->line, 1, line->Nline, f);
     142        if (fwrite(line->line, 1, line->Nline, f) < line->Nline) {
     143            psError(PS_ERR_IO, true, "Unable to write CMP sources file (%s)", filename);
     144            fclose(f);
     145            psFree(line);
     146            return false;
     147        }
    143148    }
    144149    fclose (f);
     
    233238                int Nskip = c2 - c;
    234239                nbytes -= Nskip;
    235                 memset(buffer + nbytes, '\0', Nskip);
     240                memset(buffer + nbytes, '\0', Nskip);
    236241                psLogMsg (__func__, 4, "deleted line, %d extra chars\n", Nskip);
    237242            } else {
     
    277282                goto skip_source;
    278283
    279             pmPSF_AxesToModel (PAR, axes);
     284            pmPSF_AxesToModel (PAR, axes);
    280285
    281286            psArrayAdd (sources, 100, source);
  • trunk/psModules/src/objects/pmSourceIO_SX.c

    r15562 r18845  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-11-10 01:09:20 $
     5 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2008-08-01 18:33:14 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6060        pmSource *source = (pmSource *) sources->data[i];
    6161
    62         // no difference between PSF and non-PSF model
     62        // no difference between PSF and non-PSF model
    6363        pmModel *model = pmSourceGetModel (NULL, source);
    6464        if (model == NULL)
     
    7070        // pmSourceSextractType (source, &type, &flags);
    7171
    72         axes = pmPSF_ModelToAxes (PAR, 20.0);
     72        axes = pmPSF_ModelToAxes (PAR, 20.0);
    7373
    7474        psLineInit (line);
     
    8585        psLineAdd (line, "%9.4f",  source->apMag);
    8686        psLineAdd (line, "%4d\n",  0); // should be flags
    87         fwrite (line->line, 1, line->Nline, f);
     87        if (fwrite(line->line, 1, line->Nline, f) < line->Nline) {
     88            psError(PS_ERR_IO, true, "Unable to write SX sources file (%s)", filename);
     89            fclose(f);
     90            psFree(line);
     91            return false;
     92        }
    8893    }
    8994    fclose (f);
Note: See TracChangeset for help on using the changeset viewer.