IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17447


Ignore:
Timestamp:
Apr 17, 2008, 1:43:03 PM (18 years ago)
Author:
jhoblitt
Message:

convert assert() to psAssert()

Location:
trunk/psLib/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/fits/psFitsFloat.c

    r16549 r17447  
    153153            return NULL;
    154154        }
    155         assert(out->type.type == PS_TYPE_F32);
     155        psAssert(out->type.type == PS_TYPE_F32, "impossible");
    156156        for (int y = 0; y < numRows; y++) {
    157157            for (int x = 0; x < numCols; x++) {
  • trunk/psLib/src/fits/psFitsHeader.c

    r17053 r17447  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2008-03-19 20:23:06 $
     9 *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2008-04-17 23:43:02 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2121#include <strings.h>
    2222
     23#include "psAbort.h"
    2324#include "psAssert.h"
    2425#include "psFits.h"
     
    230231                              )
    231232{
    232     assert(fits);
     233    psAssert(fits, "impossible");
    233234
    234235    psMetadata *header = psMetadataAlloc(); // Header, to return
     
    414415        // Need to look for MULTI, which won't be picked up using the iterator.
    415416        psMetadataItem *multiCheckItem = psMetadataLookup(header, item->name);
    416         assert(multiCheckItem);
     417        psAssert(multiCheckItem, "impossible");
    417418        unsigned int flag = 0;      // Flag to indicate MULTI; otherwise default action
    418419        if (multiCheckItem->type == PS_DATA_METADATA_MULTI) {
  • trunk/psLib/src/fits/psFitsImage.c

    r16934 r17447  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2008-03-11 19:57:41 $
     9 *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2008-04-17 23:43:02 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    253253                                          )
    254254{
    255     assert(bscale);
    256     assert(bzero);
    257     assert(floatType);
    258     assert(fits);
    259     assert(image);
     255    psAssert(bscale, "impossible");
     256    psAssert(bzero, "impossible");
     257    psAssert(floatType, "impossible");
     258    psAssert(fits, "impossible");
     259    psAssert(image, "impossible");
    260260
    261261    *bscale = 1.0;
     
    358358{
    359359    // n.b., this assumes contiguous image buffer
    360     assert(output);
    361     assert(fits);
    362     assert(info);
    363     assert(output->numCols == info->lastPixel[0] - info->firstPixel[0] + 1);
    364     assert(output->numRows == info->lastPixel[1] - info->firstPixel[1] + 1); // Right size
    365     assert(!output->parent);            // No parents means the buffer is contiguous
     360    psAssert(output, "impossible");
     361    psAssert(fits, "impossible");
     362    psAssert(info, "impossible");
     363    psAssert(output->numCols == info->lastPixel[0] - info->firstPixel[0] + 1, "impossible");
     364    psAssert(output->numRows == info->lastPixel[1] - info->firstPixel[1] + 1, "impossible"); // Right size
     365    psAssert(!output->parent, "impossible");            // No parents means the buffer is contiguous
    366366
    367367    int anynull = 0;                    // Are there any NULLs in the data?
     
    516516    if (cfitsioBzero != 0.0) {
    517517        // p_psFitsTypeToCfitsio and imageToDiskRepresentation must not clash!
    518         assert(bzero == 0.0 && bscale == 1.0);
     518        psAssert(bzero == 0.0 && bscale == 1.0, "impossible");
    519519        bscale = 1.0;
    520520        bzero = cfitsioBzero;
    521521    }
    522522    psFitsOptions *options = fits->options; // FITS I/O options
    523     assert(!options || bitPix == options->bitpix || options->bitpix == 0);
     523    psAssert(!options || bitPix == options->bitpix || options->bitpix == 0, "impossible");
    524524
    525525    int naxis = 3;                      // Number of axes
     
    647647    if (cfitsioBzero != 0.0) {
    648648        // p_psFitsTypeToCfitsio and imageToDiskRepresentation must not clash!
    649         assert(bzero == 0.0 && bscale == 1.0);
     649        psAssert(bzero == 0.0 && bscale == 1.0, "impossible");
    650650        bscale = 1.0;
    651651        bzero = cfitsioBzero;
    652652    }
    653653    psFitsOptions *options = fits->options; // FITS I/O options
    654     assert(!options || bitPix == options->bitpix || options->bitpix == 0);
     654    psAssert(!options || bitPix == options->bitpix || options->bitpix == 0, "impossible");
    655655
    656656    //check to see if the HDU has the same datatype
  • trunk/psLib/src/fits/psFitsScale.c

    r17048 r17447  
    4141    )
    4242{
    43     assert(bscale);
    44     assert(bzero);
    45     assert(image);
    46     assert(options);
     43    psAssert(bscale, "impossible");
     44    psAssert(bzero, "impossible");
     45    psAssert(image, "impossible");
     46    psAssert(options, "impossible");
    4747
    4848    double range = pow(2.0, options->bitpix); // Range of values for target BITPIX
     
    101101    )
    102102{
    103     assert(bscale);
    104     assert(bzero);
    105     assert(image);
    106     assert(options);
     103    psAssert(bscale, "impossible");
     104    psAssert(bzero, "impossible");
     105    psAssert(image, "impossible");
     106    psAssert(options, "impossible");
    107107
    108108    // Measure the mean and stdev
  • trunk/psLib/src/imageops/psImageMapFit.c

    r15841 r17447  
    77 *  @author Eugene Magnier, IfA
    88 *
    9  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2007-12-15 01:20:03 $
     9 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2008-04-17 23:43:02 $
    1111 *
    1212 *  Copyright 2007 Institute for Astronomy, University of Hawaii
     
    338338{
    339339    // XXX add in full PS_ASSERTS
    340     assert(map);
    341     assert(stats);
    342     assert(x);
    343     assert(y);
    344     assert(f);
     340    psAssert(map, "impossible");
     341    psAssert(stats, "impossible");
     342    psAssert(x, "impossible");
     343    psAssert(y, "impossible");
     344    psAssert(f, "impossible");
    345345
    346346    // the user supplies one of various stats option pairs,
  • trunk/psLib/src/math/psMatrix.c

    r15824 r17447  
    2222 *  @author Andy Becker, University of Washington (SVD).
    2323 *
    24  *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
    25  *  @date $Date: 2007-12-14 02:49:44 $
     24 *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
     25 *  @date $Date: 2008-04-17 23:43:02 $
    2626 *
    2727 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    768768        /* make sure that these things are sorted! */
    769769        if (i > 0) {
    770             assert(eval->data.F64[i] <= eval->data.F64[i-1]);
     770            psAssert(eval->data.F64[i] <= eval->data.F64[i-1], "impossible");
    771771        }
    772772    }
  • trunk/psLib/src/math/psPolynomialMD.c

    r17147 r17447  
    4444{
    4545    int numTerms = vector->n;           // Number of terms
    46     assert(matrix->numCols == numTerms && matrix->numRows == numTerms);
    47     assert(buffer && buffer->n == numTerms && buffer->type.type == PS_TYPE_F64);
     46    psAssert(matrix->numCols == numTerms && matrix->numRows == numTerms, "impossible");
     47    psAssert(buffer && buffer->n == numTerms && buffer->type.type == PS_TYPE_F64, "impossible");
    4848
    4949#ifdef DEBUG
     
    161161                              )
    162162{
    163     assert(poly);
    164     assert(coords);
    165     assert(values);
     163    psAssert(poly, "impossible");
     164    psAssert(coords, "impossible");
     165    psAssert(values, "impossible");
    166166
    167167    double rms = 0.0;                   // Root mean square deviation
  • trunk/psLib/src/math/psStats.c

    r15840 r17447  
    1313 * use ->min and ->max (PS_STAT_USE_RANGE)
    1414 *
    15  *  @version $Revision: 1.221 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2007-12-15 01:17:28 $
     15 *  @version $Revision: 1.222 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2008-04-17 23:43:02 $
    1717 *
    1818 *  Copyright 2006 IfA, University of Hawaii
     
    521521    }
    522522
    523     assert(count > 1);                  // It should be, because we have a mean and standard deviation
     523    psAssert(count > 1, "impossible");                  // It should be, because we have a mean and standard deviation
    524524
    525525    double stdev = stats->sampleStdev;  // Standard deviation
  • trunk/psLib/src/sys/psTrace.c

    r12286 r17447  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.86 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2007-03-07 00:17:48 $
     11 *  @version $Revision: 1.87 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2008-04-17 23:43:02 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5252#include <stdarg.h>
    5353
     54#include "psAbort.h"
    5455#include "psAssert.h"
    5556#include "psTrace.h"
     
    8384static p_psComponent* componentAlloc(const char *name, int level)
    8485{
    85     assert(name);
     86    psAssert(name, "impossible");
    8687
    8788    p_psComponent* comp = psAlloc(sizeof(p_psComponent));
     
    149150void p_psTraceReset(p_psComponent* currentNode)
    150151{
    151     assert(currentNode);
     152    psAssert(currentNode, "impossible");
    152153
    153154    psS32 i = 0;
     
    184185static bool componentAdd(const char *addNodeName, psS32 level)
    185186{
    186     assert(addNodeName);
     187    psAssert(addNodeName, "impossible");
    187188
    188189    psS32 i = 0;                        // Loop index variable.
     
    346347static psS32 doGetTraceLevel(const char *aname)
    347348{
    348     assert(aname);
     349    psAssert(aname, "impossible");
    349350    char name[strlen(aname) + 1];       // need a writeable copy: for strsep()
    350351    char *pname = name;
     
    472473                               psS32 defLevel)
    473474{
    474     assert(comp);
     475    psAssert(comp, "impossible");
    475476
    476477    char line[1024];
  • trunk/psLib/src/types/psHash.c

    r12316 r17447  
    1212*  @author GLG, MHPCC
    1313*
    14 *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2007-03-08 19:58:37 $
     14*  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2008-04-17 23:43:03 $
    1616*
    1717*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2727#include <inttypes.h>
    2828
     29#include "psAbort.h"
    2930#include "psHash.h"
    3031#include "psMemory.h"
     
    9293                                     psHashBucket* next)
    9394{
    94     assert(key && strlen(key) > 0);
     95    psAssert(key && strlen(key) > 0, "impossible");
    9596
    9697    // Allocate memory for the new hash bucket.
     
    229230                           )
    230231{
    231     assert(table);
    232     assert(table->n >= 0);
    233     assert(key && strlen(key) > 0);
     232    psAssert(table, "impossible");
     233    psAssert(table->n >= 0, "impossible");
     234    psAssert(key && strlen(key) > 0, "impossible");
    234235
    235236    if (table->n == 0) {
     
    244245        hash = (64 * hash + *tmpchar) % (table->n);
    245246    }
    246     assert(hash >= 0 && hash < table->n);
     247    psAssert(hash >= 0 && hash < table->n, "impossible");
    247248
    248249    // ptr will have the correct hash bucket.
  • trunk/psLib/src/types/psList.c

    r12317 r17447  
    77 *  @author Joshua Hoblitt, University of Hawaii
    88 *
    9  *  @version $Revision: 1.67 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2007-03-08 20:38:30 $
     9 *  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2008-04-17 23:43:03 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8484static bool listIteratorRemove(psListIterator* iterator)
    8585{
    86     assert(iterator);
     86    psAssert(iterator, "impossible");
    8787    if (iterator->cursor == NULL) {
    8888        return false;
  • trunk/psLib/src/types/psLookupTable.c

    r12329 r17447  
    77*  @author Ross Harman, MHPCC
    88*
    9 *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2007-03-08 22:08:26 $
     9*  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2008-04-17 23:43:03 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
     
    193193static void lookupTableFree(psLookupTable* table)
    194194{
    195     assert(table);
     195    psAssert(table, "impossible");
    196196    psFree(table->values);
    197197    psFree(table->filename);
  • trunk/psLib/src/types/psPixels.c

    r16963 r17447  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2008-03-13 01:03:08 $
     9 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2008-04-17 23:43:03 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2020#include <stdlib.h>
    2121
     22#include "psAbort.h"
    2223#include "psPixels.h"
    2324#include "psMemory.h"
     
    3132static void pixelsFree(psPixels* pixels)
    3233{
    33     assert(pixels);
     34    psAssert(pixels, "impossible");
    3435    psFree(pixels->data);
    3536}
Note: See TracChangeset for help on using the changeset viewer.