IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8627


Ignore:
Timestamp:
Aug 25, 2006, 6:34:28 PM (20 years ago)
Author:
jhoblitt
Message:

add gcc format attributes to:

psAbort()
psErrorStackPrint()
p_psError()
p_psWarning()
psLogMsg()
p_psTrace()

add PS_ASSERT_LONG_LARGER_THAN_OR_EQUAL
add PS_ASSERT_S64_WITHIN_RANGE
fix PS_ASSERT_LONG_WITHIN_RANGE
fix a wide range of format related issues:

  • missing format field specifiers
  • missing format args
  • incorrect format field specifiers
  • constants declared with the wrong type (float vs. int)
  • PS_ASSERT* for the wrong type
  • attemps to print structs with *printf()
  • unportable format specifiers, eg. long vs. long long
Location:
trunk/psLib/src
Files:
36 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psTime.c

    r8232 r8627  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.93 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-08-08 23:32:22 $
     12 *  @version $Revision: 1.94 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-08-26 04:34:27 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8080
    8181// Offset of year 0000 from epoch
    82 #define YEAR_0000_SEC                 -62125920000.0
     82#define YEAR_0000_SEC                 -62125920000
    8383
    8484// Offset of year 9999 from epoch
    85 #define YEAR_9999_SEC                 253202544000.0
     85#define YEAR_9999_SEC                 253202544000
    8686
    8787/** Static function prototypes */
     
    299299    if(tablesFrom->n != numTables) {
    300300        p_psMemAllocatePersistent(initialPersistence);
    301         psError(PS_ERR_BAD_PARAMETER_VALUE, true, _("Incorrect vector size. Size: %d, Expected %d."), tablesFrom->n, numTables);
     301        psError(PS_ERR_BAD_PARAMETER_VALUE, true, _("Incorrect vector size. Size: %ld, Expected %d."), tablesFrom->n, numTables);
    302302        psFree(tablesFrom);
    303303        return false;
     
    316316    if(tablesTo->n != numTables) {
    317317        p_psMemAllocatePersistent(initialPersistence);
    318         psError(PS_ERR_BAD_PARAMETER_VALUE, true, _("Incorrect vector size. Size: %d, Expected %d."), tablesTo->n, numTables);
     318        psError(PS_ERR_BAD_PARAMETER_VALUE, true, _("Incorrect vector size. Size: %ld, Expected %d."), tablesTo->n, numTables);
    319319        psFree(tablesFrom);
    320320        psFree(tablesTo);
     
    335335    if(tablesIndex->n != numTables) {
    336336        p_psMemAllocatePersistent(initialPersistence);
    337         psError(PS_ERR_BAD_PARAMETER_VALUE,true,_("Incorrect vector size. Size: %d, Expected %d."),tablesIndex->n,numTables);
     337        psError(PS_ERR_BAD_PARAMETER_VALUE,true,_("Incorrect vector size. Size: %ld, Expected %d."),tablesIndex->n,numTables);
    338338        psFree(tablesFrom);
    339339        psFree(tablesTo);
     
    13571357
    13581358    // Check valid year range
    1359     PS_ASSERT_LONG_WITHIN_RANGE(time->sec,YEAR_0000_SEC,YEAR_9999_SEC,NULL)
     1359    PS_ASSERT_S64_WITHIN_RANGE(time->sec, (psS64)YEAR_0000_SEC, (psS64)YEAR_9999_SEC, NULL);
    13601360
    13611361    // Allocate temp strings
     
    17271727    // Create output time
    17281728    sec = delta + (psF64)tempTime->sec + (psF64)tempTime->nsec/1e9;
    1729     PS_ASSERT_LONG_WITHIN_RANGE((psS64)sec,0,PS_MAX_S64,outTime);
     1729    PS_ASSERT_S64_WITHIN_RANGE((psS64)sec, (psS64)0, PS_MAX_S64, NULL);
    17301730    outTime->sec = (psS64)sec;
    17311731    outTime->nsec = (psU32)((sec - (psF64)outTime->sec)*1e9);
    17321732
    17331733    // Error check
    1734     PS_ASSERT_INT_WITHIN_RANGE(outTime->nsec,0,(psU32)((1e9)-1),outTime);
     1734    PS_ASSERT_INT_WITHIN_RANGE(outTime->nsec,0,(psU32)((1e9)-1), NULL);
    17351735
    17361736    // Convert result to same time type as input
  • trunk/psLib/src/db/psDB.c

    r8610 r8627  
    1212 *  @author Joshua Hoblitt
    1313 *
    14  *  @version $Revision: 1.87 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2006-08-26 00:32:39 $
     14 *  @version $Revision: 1.88 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2006-08-26 04:34:28 $
    1616 *
    1717 *  Copyright (C) 2005-2006  Joshua Hoblitt, University of Hawaii
     
    157157    if (!psDBExplicitTrans(dbh, false)) {
    158158        psError(PS_ERR_UNKNOWN, true,
    159                 "failed to set transaction type", mysql_error(mysql));
     159                "failed to set transaction type. Error: %s", mysql_error(mysql));
    160160
    161161        mysql_close(mysql);
     
    11031103            // convert NaNs to NULL and set the buffer_length for strings
    11041104
    1105             if ((char *)item->data.V) {
     1105            if (item->data.str) {
    11061106                // will handle the case of "" as a NULL database value
    1107                 bind[i].buffer_length = (unsigned long)strlen((char *)item->data.V);
     1107                bind[i].buffer_length = (unsigned long)strlen(item->data.str);
    11081108                bind[i].length  = &bind[i].buffer_length;
    11091109                bind[i].buffer  = psStringCopy(item->data.V);
    1110                 bind[i].is_null = *(char *)item->data.V == '\0'
     1110                bind[i].is_null = *item->data.str == '\0'
    11111111                                  ? (my_bool *)&isNull
    11121112                                  : NULL;
     
    11241124            // make a copy of the psTime so we don't modify user data when we
    11251125            // try to do the conversion
    1126             if ((char *)item->data.V) {
     1126            if (item->data.str) {
    11271127                psTime *time = (psTime *)item->data.V;
    11281128                struct tm *tmTime = psTimeToTM(time);
     
    12521252        } else if (item->type == PS_DATA_STRING) {
    12531253            // + column name + _ + varchar( + length + )
    1254             psStringAppend(&query, "%s VARCHAR(%s)", item->name, (char *)item->data.V);
     1254            psStringAppend(&query, "%s VARCHAR(%s)", item->name, item->data.str);
    12551255        } else {
    12561256            psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     
    16341634        // + column name + _ + like + _ + ' + value + '
    16351635        // check for NULL and empty ("") strings
    1636         if (item->data.V == NULL || *(char *)item->data.V == '\0') {
     1636        if (item->data.V == NULL || *item->data.str == '\0') {
    16371637            psStringAppend(&query, "%s IS NULL", item->name);
    16381638        } else {
     
    16421642                // very large TEXT columns that really shouldn't be
    16431643                // used in a where clause...
    1644                 psStringAppend(&query, "%s LIKE '%s'", item->name, (char *)item->data.V);
     1644                psStringAppend(&query, "%s LIKE '%s'", item->name, item->data.str);
    16451645            } else {
    1646                 psStringAppend(&query, "%s = '%s'", item->name, (char *)item->data.V);
     1646                psStringAppend(&query, "%s = '%s'", item->name, item->data.str);
    16471647            }
    16481648        }
  • trunk/psLib/src/fits/psFitsImage.c

    r8412 r8627  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2006-08-17 22:15:17 $
     9 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2006-08-26 04:34:28 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    450450    if (z >= nAxes[2]) {
    451451        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
    452                 _("Current FITS HDU has %d z-planes, but z-plane %d was specified."),
    453                 nAxes[2],z);
     452                _("Current FITS HDU has %ld z-planes, but z-plane %d was specified."),
     453                nAxes[2], z);
    454454        return false;
    455455    }
     
    472472            lastPixel[1] < 1 || lastPixel[1] > nAxes[1]) {
    473473        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    474                 "Input image [size of %ix%i] at position (%i,%i) does not all lay in the %ix%i FITS image.",
     474                "Input image [size of %ix%i] at position (%i,%i) does not all lay in the %lix%li FITS image.",
    475475                numCols, numRows,
    476476                x0, y0,
  • trunk/psLib/src/fits/psFitsTable.c

    r8623 r8627  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2006-08-26 03:11:59 $
     9 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2006-08-26 04:34:28 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7474    }
    7575
    76     psTrace("psLib.fits",5,"Table size is %ix%i\n",numCols, numRows);
     76    psTrace("psLib.fits",5,"Table size is %ix%li\n",numCols, numRows);
    7777    // the row parameter in the proper range?
    7878    if (row < 0 || row >= numRows) {
    7979        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    80                 _("Specified row, %d, is not valid for current table of %d rows."),
    81                 row,numRows);
     80                _("Specified row, %d, is not valid for current table of %ld rows."),
     81                row, numRows);
    8282        return NULL;
    8383    }
     
    110110                    fits_read_col(fits->fd, FITSTYPE, col,row+1, \
    111111                                  1, 1, NULL, &value, &anynul, &status); \
    112                     psTrace("psLib.fits",5,"Column #%i, '%s', is type %i, repeat %i, Value = %g\n", \
     112                    psTrace("psLib.fits",5,"Column #%i, '%s', is type %i, repeat %li, Value = %g\n", \
    113113                            col, name, typecode, repeat, (double)value); \
    114114                    psMetadataAdd(data,PS_LIST_TAIL, name, \
     
    144144                    fits_read_col(fits->fd, TSTRING, col,row+1,
    145145                                  1, 1, NULL, &value, &anynul, &status);
    146                     psTrace("psLib.fits",5,"Column #%i, '%s', is type %i, repeat %i, value = %s\n",
     146                    psTrace("psLib.fits",5,"Column #%i, '%s', is type %i, repeat %li, value = %s\n",
    147147                            col, name, typecode, repeat, value);
    148148                    if (anynul == 0) {
     
    387387
    388388    for (int row = 0; row < numRows; row++) {
    389         psTrace("psLib.fits",5,"Reading row %i of %i\n",row, numRows);
     389        psTrace("psLib.fits",5,"Reading row %i of %li\n",row, numRows);
    390390        table->data[row] = psFitsReadTableRow(fits,row);
    391391        table->n++;
     
    507507                // unsupported type -- treating as an error
    508508                psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    509                         "Unsupported data type (%d) for Metadata Item '%s' in row %d.",
    510                         colItem->type, colItem->name, row);
     509                        "Unsupported data type (%d) for Metadata Item '%s' in row %ld.",
     510                        colItem->type, colItem->name, i);
    511511                psFree(rowIter);
    512512                psFree(colSpecs);
     
    620620        char fitsErr[MAX_STRING_LENGTH];
    621621        fits_get_errstatus(status, fitsErr);
    622         psError(PS_ERR_LOCATION_INVALID, true, "Unable to create FITS table with %d columns and %d rows:",
     622        psError(PS_ERR_LOCATION_INVALID, true, "Unable to create FITS table with %ld columns and %ld rows: %s",
    623623                numColumns, table->n, fitsErr);
    624624        psFree(colSpecsIter);
     
    709709            char fitsErr[MAX_STRING_LENGTH];
    710710            fits_get_errstatus(status, fitsErr);
    711             psError(PS_ERR_LOCATION_INVALID, true, "Unable to write column %d of FITS table:",
     711            psError(PS_ERR_LOCATION_INVALID, true, "Unable to write column %ld of FITS table: %s",
    712712                    colNum, fitsErr);
    713713            psFree(colSpecsIter);
  • trunk/psLib/src/imageops/psImagePixelExtract.c

    r8232 r8627  
    88 *  @author Robert DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2006-08-08 23:32:23 $
     10 *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2006-08-26 04:34:28 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    790790    if (radii->n < 2) {
    791791        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
    792                 _("Input radii vector size, %d, can not be less than 2."),
     792                _("Input radii vector size, %ld, can not be less than 2."),
    793793                radii->n);
    794794        psFree(out);
  • trunk/psLib/src/imageops/psImageStats.c

    r8232 r8627  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.99 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-08-08 23:32:23 $
     11 *  @version $Revision: 1.100 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-08-26 04:34:28 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    592592        return -1;
    593593    }/* else if (col0 == col1 && row0 == row1) {
    594                                             psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    595                                                     "Invalid psRegion specified.  Region contains only 1 pixel.\n");
    596                                             return -1;
    597                                         }
    598                                     */
     594                                                psError(PS_ERR_BAD_PARAMETER_VALUE, true,
     595                                                        "Invalid psRegion specified.  Region contains only 1 pixel.\n");
     596                                                return -1;
     597                                            }
     598                                        */
    599599    x0 = col0;
    600600    x1 = col1;
     
    631631    case PS_TYPE_C64:
    632632    default:
     633        // XXX this should include the mask type (as a string)
    633634        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    634                 _("Input psImage mask type, %s, is not the supported mask datatype of %s."), type, PS_TYPE_U8);
     635                _("Input psImage mask type is not a supported mask datatype"));
     636
    635637        return -1;
    636638    }
  • trunk/psLib/src/math/psBinaryOp.c

    r8232 r8627  
    3030 *  @author Robert DeSonia, MHPCC
    3131 *
    32  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    33  *  @date $Date: 2006-08-08 23:32:23 $
     32 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     33 *  @date $Date: 2006-08-26 04:34:28 $
    3434 *
    3535 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    107107    long n2 = ((psVector*)IN2)->n; \
    108108    if (n1 != n2) { \
    109         psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %d vs %d.  Number of elements must match."), n1, n2); \
     109        psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %ld vs %ld.  Number of elements must match."), n1, n2); \
    110110        if (OUT != IN1 && OUT != IN2) { \
    111111            psFree(OUT); \
     
    129129    if (((psVector*)IN1)->type.dimen == PS_DIMEN_VECTOR) { /* Regular vectors */ \
    130130        if (n1 != numRows2) { \
    131             psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %d vs %d.  Number of elements must match."), n1, numRows2); \
     131            psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %ld vs %ld.  Number of elements must match."), n1, numRows2); \
    132132            if (OUT != IN1 && OUT != IN2) { \
    133133                psFree(OUT); \
     
    146146    } else {  /* Transposed vectors */ \
    147147        if (n1 != numCols2) { \
    148             psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %d vs %d.  Number of elements must match."), n1, numCols2); \
     148            psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %ld vs %ld.  Number of elements must match."), n1, numCols2); \
    149149            if (OUT != IN1 && OUT != IN2) { \
    150150                psFree(OUT); \
     
    187187    if (((psVector*)IN2)->type.dimen == PS_DIMEN_VECTOR) { /* Regular vectors */ \
    188188        if (n2 != numRows1) { \
    189             psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %d vs %d.  Number of elements must match."), n2, numRows1); \
     189            psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %ld vs %ld.  Number of elements must match."), n2, numRows1); \
    190190            if (OUT != IN1 && OUT != IN2) { \
    191191                psFree(OUT); \
     
    204204    } else {  /* Transposed vectors */ \
    205205        if (n2 != numCols1) { \
    206             psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %d vs %d.  Number of elements must match."), n2, numCols1); \
     206            psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %ld vs %ld.  Number of elements must match."), n2, numCols1); \
    207207            if (OUT != IN1) { \
    208208                psFree(OUT); \
     
    229229    long numCols2 = ((psImage*)IN2)->numCols; \
    230230    if (numRows1 != numRows2 || numCols1 != numCols2) { \
    231         psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Specified psImage dimensions differed, %dx%d vs %dx%d."), \
     231        psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Specified psImage dimensions differed, %ldx%ld vs %ldx%ld."), \
    232232                numCols1, numRows1, numCols2, numRows2); \
    233233        if (OUT != IN1 && OUT != IN2) { \
     
    360360    } else {                                                                                                 \
    361361        psError(PS_ERR_BAD_PARAMETER_VALUE, true,                                                            \
    362                 "Types (%x,%x) are not appropriate for logical OR.\n", IN1->type, IN2->type);                \
     362                "Types (%x,%x) are not appropriate for logical OR.\n", IN1->type, IN2->type);               \
    363363        return NULL;                                                                                         \
    364364    }                                                                                                        \
  • trunk/psLib/src/math/psMathUtils.c

    r8245 r8627  
    33 *  This file contains standard math routines.
    44 *
    5  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-08-09 02:26:44 $
     5 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-08-26 04:34:28 $
    77 *
    88 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5858    long max; \
    5959    long mid; \
    60     psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); \
     60    psTrace("psLib.math", 4, "---- () begin ----\n"); \
    6161    /* psTrace("psLib.math", 6, "Determining the bin for: %f\n", x); */\
    6262    if (value < bounds[0]) { \
    6363        psLogMsg(__func__, PS_LOG_WARN, \
    6464                 "vectorBinDisect%s(): ordinate %f is outside vector range (%f - %f).", \
    65                  #TYPE, value, bounds[0], bounds[numBins-1]); \
     65                 #TYPE, (double)value, (double)bounds[0], (double)bounds[numBins-1]); \
    6666        return(-2); \
    6767    } \
     
    6969        psLogMsg(__func__, PS_LOG_WARN, \
    7070                 "vectorBinDisect%s(): ordinate %f is outside vector range (%f - %f).", \
    71                  #TYPE, value, bounds[0], bounds[numBins-1]); \
     71                 #TYPE, (double)value, (double)bounds[0], (double)bounds[numBins-1]); \
    7272        return(-1); \
    7373    } \
     
    7979        \
    8080        if (value == bounds[mid]) { \
    81             psTrace("psLib.math", 4, "---- %s(%d) end (1) ----\n", __func__, mid); \
     81            psTrace("psLib.math", 4, "---- %s(%ld) end (1) ----\n", __func__, mid); \
    8282            return(mid); \
    8383        } else if (value < bounds[mid]) { \
     
    8888        mid = ((max+1)+min)/2; \
    8989    } \
    90     psTrace("psLib.math", 4, "---- %s(%d) end (2) ----\n", __func__, min); \
     90    psTrace("psLib.math", 4, "---- %s(%ld) end (2) ----\n", __func__, min); \
    9191    return(min); \
    9292}
  • trunk/psLib/src/math/psMatrix.c

    r8245 r8627  
    2121 *  @author Robert DeSonia, MHPCC
    2222 *
    23  *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
    24  *  @date $Date: 2006-08-09 02:26:44 $
     23 *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
     24 *  @date $Date: 2006-08-26 04:34:28 $
    2525 *
    2626 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    675675        if (outVector->n != inImage->numRows) {
    676676            psError(PS_ERR_BAD_PARAMETER_SIZE, true,
    677                     "Image and vector sizes differ: (%d vs %d).",
     677                    "Image and vector sizes differ: (%d vs %ld).",
    678678                    inImage->numRows, outVector->n);
    679679            psMatrixToVector_EXIT;
     
    691691        if (outVector->n != inImage->numCols) {
    692692            psError(PS_ERR_BAD_PARAMETER_SIZE, true,
    693                     "Image and vector sizes differ: (%d vs %d).",
     693                    "Image and vector sizes differ: (%d vs %ld).",
    694694                    inImage->numCols, outVector->n);
    695695            psMatrixToVector_EXIT;
     
    727727        } else if (outImage->numRows != inVector->n) {
    728728            psError(PS_ERR_BAD_PARAMETER_SIZE, true,
    729                     "Image and vector sizes differ: (%d vs %d).",
     729                    "Image and vector sizes differ: (%d vs %ld).",
    730730                    outImage->numRows, inVector->n);
    731731            VECTORTOMATRIX_CLEANUP;
     
    746746        } else if (outImage->numCols != inVector->n) {
    747747            psError(PS_ERR_BAD_PARAMETER_SIZE, true,
    748                     "Image and vector sizes differ: (%d vs %d).",
     748                    "Image and vector sizes differ: (%d vs %ld).",
    749749                    outImage->numCols, inVector->n);
    750750            VECTORTOMATRIX_CLEANUP;
  • trunk/psLib/src/math/psMinimizeLMM.c

    r8245 r8627  
    1010 *  @author EAM, IfA
    1111 *
    12  *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-08-09 02:26:44 $
     12 *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-08-26 04:34:28 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    181181    psF64 rcF64 = p_psMinLM_SetABX(alpha, beta, params, paramMask, x, y, dy, func);
    182182    if (isnan(rcF64)) {
    183         psTrace (__func__, 5, "p_psMinLM_SetABX() returned a NAN.\n");
     183        psTrace ("psLib.math", 5, "p_psMinLM_SetABX() returned a NAN.\n");
    184184        rc = false;
    185185    }
    186     psTrace("psLib.math", 5, "p_psMinLM_SetABX() was succesful\n", __func__);
     186    psTrace("psLib.math", 5, "p_psMinLM_SetABX() was succesful\n");
    187187
    188188    psBool rcBool = p_psMinLM_GuessABP(Alpha, delta, Params, alpha, beta, params, paramMask, NULL, NULL, NULL, 0.0);
    189189    if (rcBool == false) {
    190         psTrace (__func__, 5, "p_psMinLM_GuessABP() returned FALSE.\n");
     190        psTrace ("psLib.math", 5, "p_psMinLM_GuessABP() returned FALSE.\n");
    191191        rc = false;
    192192    }
    193     psTrace("psLib.math", 5, "p_psMinLM_GuessABP() was succesful\n", __func__);
     193    psTrace("psLib.math", 5, "p_psMinLM_GuessABP() was succesful\n");
    194194
    195195    psFree(alpha);
     
    200200        psFree(dy);
    201201    }
    202     psTrace("psLib.math", 3, "---- %s() end ----\n", __func__);
     202    psTrace("psLib.math", 3, "---- end ----\n");
    203203    return(rc);
    204204}
     
    417417        psTrace("psLib.math", 6, "The current Param vector: \n");
    418418        for (psS32 i = 0 ; i < Params->n ; i++) {
    419             psTrace("psLib.math", 6, "Params[%d] is %f\n", Params->data.F32[i]);
     419            psTrace("psLib.math", 6, "Params[%d] is %f\n", i, Params->data.F32[i]);
    420420        }
    421421    }
     
    447447                psTrace("psLib.math", 6, "The current Param vector: \n");
    448448                for (psS32 i = 0 ; i < Params->n ; i++) {
    449                     psTrace("psLib.math", 6, "Params[%d] is %f\n", Params->data.F32[i]);
     449                    psTrace("psLib.math", 6, "Params[%d] is %f\n", i, Params->data.F32[i]);
    450450                }
    451451            }
  • trunk/psLib/src/math/psMinimizePolyFit.c

    r8467 r8627  
    1010 *  @author EAM, IfA
    1111 *
    12  *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-08-22 15:01:12 $
     12 *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-08-26 04:34:28 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    816816    //
    817817    for (psS32 N = 0; N < stats->clipIter; N++) {
    818         psTrace("psLib.math", 6, "Loop iteration %d.  Calling psVectorFitPolynomial1D()\n");
     818        psTrace("psLib.math", 6, "Loop iteration %d.  Calling psVectorFitPolynomial1D()\n", N);
    819819        psS32 Nkeep = 0;
    820820        if (psTraceGetLevel(__func__) >= 6) {
     
    894894        // since the polynomial fit won't change.
    895895        //
    896         psTrace("psLib.math", 6, "keeping %d of %d pts for fit\n", Nkeep, x->n);
     896        psTrace("psLib.math", 6, "keeping %d of %ld pts for fit\n", Nkeep, x->n);
    897897        psFree(fit);
    898898    }
     
    12501250
    12511251    for (psS32 N = 0; N < stats->clipIter; N++) {
    1252         psTrace("psLib.math", 6, "Loop iteration %d.  Calling psVectorFitPolynomial1D()\n");
     1252        psTrace("psLib.math", 6, "Loop iteration %d.  Calling psVectorFitPolynomial1D()\n", N);
    12531253        psS32 Nkeep = 0;
    12541254        if (psTraceGetLevel(__func__) >= 6) {
     
    13311331        }
    13321332
    1333         psTrace("psLib.math", 6, "keeping %d of %d pts for fit\n", Nkeep, x->n);
     1333        psTrace("psLib.math", 6, "keeping %d of %ld pts for fit\n", Nkeep, x->n);
    13341334        psFree(fit);
    13351335    }
     
    17701770
    17711771    for (psS32 N = 0; N < stats->clipIter; N++) {
    1772         psTrace("psLib.math", 6, "Loop iteration %d.  Calling psVectorFitPolynomial1D()\n");
     1772        psTrace("psLib.math", 6, "Loop iteration %d.  Calling psVectorFitPolynomial1D()\n", N);
    17731773        psS32 Nkeep = 0;
    17741774        if (psTraceGetLevel(__func__) >= 6) {
     
    18511851        }
    18521852
    1853         psTrace("psLib.math", 6, "keeping %d of %d pts for fit\n", Nkeep, x->n);
     1853        psTrace("psLib.math", 6, "keeping %d of %ld pts for fit\n", Nkeep, x->n);
    18541854        psFree(fit);
    18551855    }
     
    23382338
    23392339    for (psS32 N = 0; N < stats->clipIter; N++) {
    2340         psTrace("psLib.math", 6, "Loop iteration %d.  Calling psVectorFitPolynomial4D()\n");
     2340        psTrace("psLib.math", 6, "Loop iteration %d.  Calling psVectorFitPolynomial4D()\n", N);
    23412341        psS32 Nkeep = 0;
    23422342        if (psTraceGetLevel(__func__) >= 6) {
     
    24202420        }
    24212421
    2422         psTrace("psLib.math", 6, "keeping %d of %d pts for fit\n", Nkeep, x->n);
     2422        psTrace("psLib.math", 6, "keeping %d of %ld pts for fit\n", Nkeep, x->n);
    24232423        psFree (fit);
    24242424    }
  • trunk/psLib/src/math/psPolynomialUtils.c

    r7766 r8627  
    105105        }
    106106
    107         psTrace (__func__, 4, "keeping %d of %d pts for fit\n",
     107        psTrace (__func__, 4, "keeping %d of %ld pts for fit\n",
    108108                 Nkeep, x->n);
    109109
  • trunk/psLib/src/math/psSparse.c

    r7766 r8627  
    6262
    6363    if (i < j) {
    64         psLogMsg(__func__, PS_LOG_WARN, "i=%ld, j=%ld refers to a sub-diagonal element; values switched.\n");
     64        psLogMsg(__func__, PS_LOG_WARN, "i=%d, j=%d refers to a sub-diagonal element; values switched.\n", i, j);
    6565        int temp = i;
    6666        i = j;
  • trunk/psLib/src/math/psSpline.c

    r8245 r8627  
    66*  This file contains the routines that allocate, free, and evaluate splines.
    77*
    8 *  @version $Revision: 1.152 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2006-08-09 02:26:44 $
     8*  @version $Revision: 1.153 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2006-08-26 04:34:28 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    213213    PS_ASSERT_VECTOR_NON_NULL(y, NULL);
    214214    PS_ASSERT_VECTOR_TYPE_F32_OR_F64(y, NULL);
    215     PS_ASSERT_INT_LARGER_THAN_OR_EQUAL(y->n, 2, NULL);
     215    PS_ASSERT_LONG_LARGER_THAN_OR_EQUAL(y->n, (long)2, NULL);
    216216    psS32 numSplines = (y->n)-1;
    217217    psTrace("psLib.math", 5, "numSplines is %d\n", numSplines);
  • trunk/psLib/src/math/psStats.c

    r8245 r8627  
    1616 * use ->min and ->max (PS_STAT_USE_RANGE)
    1717 *
    18  *  @version $Revision: 1.184 $ $Name: not supported by cvs2svn $
    19  *  @date $Date: 2006-08-09 02:26:44 $
     18 *  @version $Revision: 1.185 $ $Name: not supported by cvs2svn $
     19 *  @date $Date: 2006-08-26 04:34:28 $
    2020 *
    2121 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    665665    if (count == 0) {
    666666        stats->sampleStdev = NAN;
    667         psLogMsg(__func__, PS_LOG_WARN, "WARNING: vectorSampleStdev(): no valid psVector elements (%d).  Setting stats->sampleStdev = NAN.\n", count);
     667        psLogMsg(__func__, PS_LOG_WARN, "WARNING: vectorSampleStdev(): no valid psVector elements (%ld).  Setting stats->sampleStdev = NAN.\n", count);
    668668        return false;
    669669    }
    670670    if (count == 1) {
    671671        stats->sampleStdev = 0.0;
    672         psLogMsg(__func__, PS_LOG_WARN, "WARNING: vectorSampleStdev(): only one valid psVector elements (%d).  Setting stats->sampleStdev = 0.0.\n", count);
     672        psLogMsg(__func__, PS_LOG_WARN, "WARNING: vectorSampleStdev(): only one valid psVector elements (%ld).  Setting stats->sampleStdev = 0.0.\n", count);
    673673        return false;
    674674    }
     
    713713
    714714    // Ensure that stats->clipSigma is within the proper range.
    715     PS_ASSERT_INT_WITHIN_RANGE(stats->clipSigma,
    716                                PS_CLIPPED_SIGMA_LB,
    717                                PS_CLIPPED_SIGMA_UB, -1);
     715    PS_ASSERT_FLOAT_WITHIN_RANGE(stats->clipSigma,
     716                                 PS_CLIPPED_SIGMA_LB,
     717                                 PS_CLIPPED_SIGMA_UB, -1);
    718718
    719719    // Allocate a psStats structure for calculating the mean, median, and
     
    777777                        fabsf(myVector->data.F32[j] - clippedMean) > stats->clipSigma * errors->data.F32[j]) {
    778778                    tmpMask->data.U8[j] = 0xff;
    779                     psTrace("psLib.math", 10, "Clipped %d: %f +/- %f\n", j,
     779                    psTrace("psLib.math", 10, "Clipped %ld: %f +/- %f\n", j,
    780780                            myVector->data.F32[j], errors->data.F32[j]);
    781781                    numClipped++;
     
    788788                        fabsf(myVector->data.F32[j] - clippedMean) > (stats->clipSigma * clippedStdev)) {
    789789                    tmpMask->data.U8[j] = 0xff;
    790                     psTrace("psLib.math", 10, "Clipped %d: %f\n", j, myVector->data.F32[j]);
     790                    psTrace("psLib.math", 10, "Clipped %ld: %f\n", j, myVector->data.F32[j]);
    791791                    numClipped++;
    792792                    clipped = true;
     
    896896    PS_ASSERT_VECTOR_TYPE(yVec, PS_TYPE_F32, NAN);
    897897    //    PS_ASSERT_VECTORS_SIZE_EQUAL(xVec, yVec, NAN);
    898     PS_ASSERT_INT_WITHIN_RANGE(binNum, 0, (xVec->n - 1), NAN);
    899     PS_ASSERT_INT_WITHIN_RANGE(binNum, 0, (yVec->n - 1), NAN);
     898    PS_ASSERT_INT_WITHIN_RANGE(binNum, 0, (int)(xVec->n - 1), NAN);
     899    PS_ASSERT_INT_WITHIN_RANGE(binNum, 0, (int)(yVec->n - 1), NAN);
    900900
    901901    psVector *x = psVectorAlloc(3, PS_TYPE_F64);
     
    10081008    psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
    10091009    PS_ASSERT_VECTOR_NON_NULL(params, NAN);
    1010     PS_ASSERT_VECTOR_SIZE(params, 2, NAN);
     1010    PS_ASSERT_VECTOR_SIZE(params, (long)2, NAN);
    10111011    PS_ASSERT_VECTOR_TYPE(params, PS_TYPE_F32, NAN);
    10121012    PS_ASSERT_VECTOR_NON_NULL(coords, NAN);
    1013     PS_ASSERT_VECTOR_SIZE(coords, 1, NAN);
     1013    PS_ASSERT_VECTOR_SIZE(coords, (long)1, NAN);
    10141014    PS_ASSERT_VECTOR_TYPE(coords, PS_TYPE_F32, NAN);
    10151015
     
    10201020    psF32 gauss = psGaussian(x, mean, stdev, false);
    10211021    if (deriv) {
    1022         PS_ASSERT_VECTOR_SIZE(deriv, 2, NAN);
     1022        PS_ASSERT_VECTOR_SIZE(deriv, (long)2, NAN);
    10231023        PS_ASSERT_VECTOR_TYPE(deriv, PS_TYPE_F32, NAN);
    10241024        psF32 tmp = (x - mean) * gauss;
     
    11361136        // we get here, we know that binSize != 0.0.
    11371137        long numBins = (max - min) / binSize; // Number of bins
    1138         psTrace("psLib.math", 6, "Numbins is %d\n", numBins);
     1138        psTrace("psLib.math", 6, "Numbins is %ld\n", numBins);
    11391139        psTrace("psLib.math", 6, "Creating a robust histogram from data range (%.2f - %.2f)\n", min, max);
    11401140        // Generate the histogram
     
    11591159        // ADD step 2: Find the bin which contains the 50% data point.
    11601160        totalDataPoints = cumulative->nums->data.F32[numBins - 1];
    1161         psTrace("psLib.math", 6, "Total data points is %d\n", totalDataPoints);
     1161        psTrace("psLib.math", 6, "Total data points is %ld\n", totalDataPoints);
    11621162        long binMedian;
    11631163        if (totalDataPoints/2.0 < cumulative->nums->data.F32[0]) {
     
    11701170            if (binMedian < 0) {
    11711171                psError(PS_ERR_UNKNOWN, false,
    1172                         "Failed to calculate the 50 precent data point (%d).\n", binMedian);
     1172                        "Failed to calculate the 50 precent data point (%ld).\n", binMedian);
    11731173                psFree(statsMinMax);
    11741174                psFree(histogram);
     
    11791179            }
    11801180        }
    1181         psTrace("psLib.math", 6, "The median bin is %d (%.2f to %.2f)\n", binMedian,
     1181        psTrace("psLib.math", 6, "The median bin is %ld (%.2f to %.2f)\n", binMedian,
    11821182                cumulative->bounds->data.F32[binMedian], cumulative->bounds->data.F32[binMedian+1]);
    11831183
     
    12171217            }
    12181218        }
    1219         psTrace("psLib.math", 6, "The 15.8655%% and 84.1345%% data point bins are (%d, %d).\n",
     1219        psTrace("psLib.math", 6, "The 15.8655%% and 84.1345%% data point bins are (%ld, %ld).\n",
    12201220                binLo, binHi);
    12211221        psTrace("psLib.math", 6, "binLo midpoint is %f\n", PS_BIN_MIDPOINT(cumulative, binLo));
     
    12481248        #else
    12491249        // This code basically interpolates to find the positions exactly.
    1250         psTrace("psLib.math", 6, "binLo is %d.  Nums at that bin and the next are (%.2f, %.2f)\n",
     1250        psTrace("psLib.math", 6, "binLo is %ld.  Nums at that bin and the next are (%.2f, %.2f)\n",
    12511251                binLo, cumulative->nums->data.F32[binLo], cumulative->nums->data.F32[binLo+1]);
    1252         psTrace("psLib.math", 6, "binHi is %d.  Nums at that bin and the next are (%.2f, %.2f)\n",
     1252        psTrace("psLib.math", 6, "binHi is %ld.  Nums at that bin and the next are (%.2f, %.2f)\n",
    12531253                binHi, cumulative->nums->data.F32[binHi], cumulative->nums->data.F32[binHi+1]);
    12541254
     
    13041304            psTrace("psLib.math", 6, "Masking data more than 25 bins from the median\n");
    13051305            psTrace("psLib.math", 6,
    1306                     "The median is at bin number %d.  We mask bins outside the bin range (%d:%d)\n",
     1306                    "The median is at bin number %ld.  We mask bins outside the bin range (%ld:%ld)\n",
    13071307                    binMedian, maskLo, maskHi);
    13081308            psTrace("psLib.math", 6, "Masking data outside (%f %f)\n", medianLo, medianHi);
     
    13101310                if ((myVector->data.F32[i] < medianLo) || (myVector->data.F32[i] > medianHi)) {
    13111311                    mask->data.U8[i] = 0xff;
    1312                     psTrace("psLib.math", 6, "Masking element %d is %f\n", i, myVector->data.F32[i]);
     1312                    psTrace("psLib.math", 6, "Masking element %ld is %f\n", i, myVector->data.F32[i]);
    13131313                }
    13141314            }
     
    13501350        return false;
    13511351    }
    1352     psTrace("psLib.math", 6, "The 25-percent and 75-precent data point bins are (%d, %d).\n", binLo25, binHi25);
     1352    psTrace("psLib.math", 6, "The 25-percent and 75-precent data point bins are (%ld, %ld).\n", binLo25, binHi25);
    13531353
    13541354    // ADD step 8: Interpolate to find these two positions exactly: these are the upper and lower quartile
     
    13811381    }
    13821382    stats->robustN50 = N50;
    1383     psTrace("psLib.math", 6, "The robustN50 is %d.\n", N50);
     1383    psTrace("psLib.math", 6, "The robustN50 is %ld.\n", N50);
    13841384
    13851385
     
    14131413        psTrace("psLib.math", 6, "The new min/max values are (%f, %f).\n", min, max);
    14141414        psTrace("psLib.math", 6, "The new bin size is %f.\n", newBinSize);
    1415         psTrace("psLib.math", 6, "The numBins is %d\n", numBins);
     1415        psTrace("psLib.math", 6, "The numBins is %ld\n", numBins);
    14161416
    14171417        psHistogram *histogram = psHistogramAlloc(min, max, numBins); // A new histogram (without outliers)
     
    14601460            }
    14611461        }
    1462         psTrace("psLib.math", 6, "The peak bin is %d, with %f data.n", binNum, binMaxNums);
     1462        psTrace("psLib.math", 6, "The peak bin is %ld, with %f data.n", binNum, binMaxNums);
    14631463
    14641464        // Fit a Gaussian to the bins in the range 20 sigma of the robust histogram median.
     
    16961696    PS_ASSERT_VECTOR_NON_NULL(bounds, NULL);
    16971697    PS_ASSERT_VECTOR_TYPE(bounds, PS_TYPE_F32, NULL);
    1698     PS_ASSERT_INT_LARGER_THAN_OR_EQUAL(bounds->n, 2, NULL);
     1698    PS_ASSERT_LONG_LARGER_THAN_OR_EQUAL(bounds->n, (long)2, NULL);
    16991699
    17001700    // Allocate memory for the new histogram structure.
     
    17611761    PS_ASSERT_PTR_NON_NULL(out->bounds, false);
    17621762    PS_ASSERT_PTR_NON_NULL(out->nums, false);
    1763     PS_ASSERT_INT_WITHIN_RANGE(binNum, 0, ((out->nums->n)-1), false);
     1763    PS_ASSERT_LONG_WITHIN_RANGE(binNum, (long)0, (long)((out->nums->n)-1), false);
    17641764    PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(error, 0.0, false);
    17651765    PS_ASSERT_FLOAT_WITHIN_RANGE(data, out->bounds->data.F32[0],
  • trunk/psLib/src/math/psUnaryOp.c

    r8232 r8627  
    3030 *  @author Robert DeSonia, MHPCC
    3131 *
    32  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    33  *  @date $Date: 2006-08-08 23:32:23 $
     32 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     33 *  @date $Date: 2006-08-26 04:34:28 $
    3434 *
    3535 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7878    long nOut = ((psVector*)OUT)->n; \
    7979    if (nIn != nOut) { \
    80         psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %d vs %d.  Number of elements must match."), nIn, nOut); \
     80        psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %ld vs %ld.  Number of elements must match."), nIn, nOut); \
    8181        if (OUT != IN) { \
    8282            psFree(OUT); \
     
    9999    long numColsOut = ((psImage*)OUT)->numCols; \
    100100    if(numRowsIn!=numRowsOut || numColsIn!=numColsOut) { \
    101         psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Specified psImage dimensions differed, %dx%d vs %dx%d."), \
     101        psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Specified psImage dimensions differed, %ldx%ld vs %ldx%ld."), \
    102102                numColsIn, numRowsIn, numColsOut, numRowsOut); \
    103103        if (OUT != IN) { \
  • trunk/psLib/src/mathtypes/psImage.c

    r8232 r8627  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.113 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-08-08 23:32:23 $
     11 *  @version $Revision: 1.114 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-08-26 04:34:28 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    203203
    204204    default:
    205         psError (PS_ERR_BAD_PARAMETER_TYPE, true, "datatype %d not defined in psImageInit\n", image->type);
     205        psError(PS_ERR_BAD_PARAMETER_TYPE, true, "datatype not defined in psImageInit\n");
    206206    }
    207207    return (false);
  • trunk/psLib/src/mathtypes/psVector.c

    r8374 r8627  
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.81 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2006-08-16 03:28:13 $
     11*  @version $Revision: 1.82 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2006-08-26 04:34:28 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    301301                PS_TYPE_NAME(typeStr,type); \
    302302                psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
    303                         _("Input psVector is an unsupported type (0x%x)."), \
     303                        _("Input psVector is an unsupported type (0x%s)."), \
    304304                        typeStr); \
    305305                psFree(output); \
     
    326326            PS_TYPE_NAME(typeStr,type);
    327327            psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    328                     _("Input psVector is an unsupported type (0x%x)."),
     328                    _("Input psVector is an unsupported type (0x%s)."),
    329329                    typeStr);
    330330            psFree(output);
     
    816816        return (true);
    817817    default:
    818         psError (PS_ERR_BAD_PARAMETER_TYPE, true, "datatype %d not defined in psImageInit\n", vector->type);
     818        psError (PS_ERR_BAD_PARAMETER_TYPE, true, "datatype not defined in psImageInit\n");
    819819        return (false);
    820820    }
  • trunk/psLib/src/mathtypes/psVector.h

    r8387 r8627  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2006-08-16 20:36:04 $
     13 *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-08-26 04:34:28 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    318318if ((VEC1)->n != (VEC2)->n) { \
    319319    psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
    320             "psVector %s has size %d, psVector %s has size %d.", \
     320            "psVector %s has size %ld, psVector %s has size %ld.", \
    321321            #VEC1, (VEC1)->n, #VEC2, (VEC2)->n); \
    322322    return(RVAL); \
     
    326326if ((VEC)->n != (SIZE)) { \
    327327    psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
    328             "psVector %s has size %d, should be %d.", \
     328            "psVector %s has size %ld, should be %ld.", \
    329329            #VEC, (VEC)->n, (SIZE)); \
    330330    return(RVAL); \
  • trunk/psLib/src/sys/psAbort.h

    r4307 r8627  
    1212 *  @author Eric Van Alst, MHPCC
    1313 *
    14  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-06-17 23:39:51 $
     14 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2006-08-26 04:34:28 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3737 *
    3838 */
     39#ifdef __GNUC__
     40void psAbort(
     41    const char *name,                  ///< Source of abort such as file or function detected
     42    const char *format,                   ///< A printf style formatting statement defining msg
     43    ...
     44) __attribute__((format(printf, 2, 3)));
     45#else // __GNUC__
    3946void psAbort(
    4047    const char *name,                  ///< Source of abort such as file or function detected
     
    4249    ...
    4350);
     51#endif // __GNUC__
    4452
    4553/** @} */ // Doxygen - End of SystemGroup Functions
  • trunk/psLib/src/sys/psAssert.h

    r8409 r8627  
    33
    44#include <assert.h>
     5#include <inttypes.h>
     6
    57#include "psError.h"
    68#include "psLogMsg.h"
     
    155157if ((NAME) < (LOWER) || (NAME) > (UPPER)) { \
    156158    psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    157             "Error: %s, %lld, is out of range.", \
     159            "Error: %s, %ld, is out of range.  Must be between %ld and %ld.", \
     160            #NAME, NAME, LOWER, UPPER); \
     161    return RVAL; \
     162}
     163
     164#define PS_ASSERT_LONG_LARGER_THAN_OR_EQUAL(NAME1, NAME2, RVAL) \
     165if (!((NAME1) >= (NAME2))) { \
     166    psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: !(%s >= %s) (%ld %ld).",\
     167            #NAME1, #NAME2, NAME1, NAME2); \
     168    return(RVAL); \
     169}
     170
     171#define PS_ASSERT_S64_WITHIN_RANGE(NAME, LOWER, UPPER, RVAL) \
     172if ((NAME) < (LOWER) || (NAME) > (UPPER)) { \
     173    psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
     174            "Error: %s, %" PRId64 ", is out of range.  Must be between %" PRId64 " and %" PRId64 ".", \
    158175            #NAME, NAME, LOWER, UPPER); \
    159176    return RVAL; \
  • trunk/psLib/src/sys/psConfigure.c

    r8232 r8627  
    1313 *  @author Robert DeSonia, MHPCC
    1414 *
    15  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2006-08-08 23:32:23 $
     15 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2006-08-26 04:34:28 $
    1717 *
    1818 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8080    nCorrupted = psMemCheckCorruption(false);
    8181    if (nCorrupted > 0) {
    82         psError(PS_ERR_UNKNOWN, true, "%d memory blocks corrupted; list written to %s.\n", nCorrupted);
     82        psError(PS_ERR_UNKNOWN, true, "%d memory blocks corrupted; list written to %s.\n", nCorrupted, memCheckName);
    8383    } else {
    8484        psLogMsg(__func__, PS_LOG_INFO, "No memory corruption found.\n");
  • trunk/psLib/src/sys/psError.h

    r8231 r8627  
    1212 *  @author Eric Van Alst, MHPCC
    1313 *
    14  *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2006-08-08 23:11:25 $
     14 *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2006-08-26 04:34:28 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    9292 *
    9393 */
     94#ifdef __GNUC__
    9495void psErrorStackPrint(
    9596    FILE* fd,                          ///< destination file descriptor
    96     const char* format,                   ///< printf-style format of header line
    97     ...                                ///< any parameters required in fmt
    98 );
     97    const char* format,                ///< printf-style format of header line
     98    ...                                ///< any parameters required in fmt
     99) __attribute__((format(printf, 2, 3)));
     100#else // __GNUC__
     101void psErrorStackPrint(
     102    FILE* fd,                          ///< destination file descriptor
     103    const char* format,                ///< printf-style format of header line
     104    ...                                ///< any parameters required in fmt
     105);
     106#endif // __GNUC__
     107
    99108
    100109#ifndef SWIG
     
    155164 *  @return psErrorcode    the given error code
    156165 */
     166#ifdef __GNUC__
    157167psErrorCode p_psError(
    158168    const char* filename,              ///< file name
     
    163173    const char* format,                ///< printf-style format of header line
    164174    ...                                ///< any parameters required in fmt
    165 );
     175) __attribute__((format(printf, 6, 7)));
     176#else // __GNUC__
     177psErrorCode p_psError(
     178    const char* filename,              ///< file name
     179    unsigned int lineno,               ///< line number in file
     180    const char* func,                  ///< function name
     181    psErrorCode code,                  ///< Error class code
     182    bool new,                          ///< true if error originates at this location
     183    const char* format,                ///< printf-style format of header line
     184    ...                                ///< any parameters required in fmt
     185);
     186#endif // __GNUC__
    166187
    167188/** Logs a warning message.
     
    172193 *
    173194*/
     195#ifdef __GNUC__
    174196void p_psWarning(
    175197    const char* file,                  ///< file name
    176198    int lineno,                        ///< line number in file
    177199    const char* func,                  ///< function name
    178     const char* fmt,                   ///< printf-style format of header line
    179     ...                                ///< any parameters required in fmt
    180 );
     200    const char* format,                ///< printf-style format of header line
     201    ...                                ///< any parameters required in fmt
     202) __attribute__((format(printf, 4, 5)));
     203#else // __GNUC__
     204void p_psWarning(
     205    const char* file,                  ///< file name
     206    int lineno,                        ///< line number in file
     207    const char* func,                  ///< function name
     208    const char* format,                ///< printf-style format of header line
     209    ...                                ///< any parameters required in fmt
     210);
     211#endif // __GNUC__
    181212
    182213
  • trunk/psLib/src/sys/psLogMsg.h

    r7587 r8627  
    1111 *  @author GLG, MHPCC
    1212 *
    13  *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2006-06-16 23:01:10 $
     13 *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-08-26 04:34:28 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    9090 *
    9191 */
     92#ifdef __GNUC__
     93void psLogMsg(
     94    const char *name,                  ///< name of the log source
     95    int level,                         ///< severity level of this log message
     96    const char *format,                ///< printf-style format command
     97    ...
     98) __attribute__((format(printf, 3, 4)));
     99#else // __GNUC__
    92100void psLogMsg(
    93101    const char *name,                  ///< name of the log source
     
    96104    ...
    97105);
     106#endif // __GNUC__
    98107
    99108#ifndef SWIG
  • trunk/psLib/src/sys/psMemory.c

    r8540 r8627  
    88*  @author Robert Lupton, Princeton University
    99*
    10 *  @version $Revision: 1.79 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2006-08-24 02:17:17 $
     10*  @version $Revision: 1.80 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2006-08-26 04:34:28 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    530530        ptr = memExhaustedCallback(size);
    531531        if (ptr == NULL) {
    532             psAbort(__func__, "Failed to reallocate %ld bytes at %s:%d", size, file, lineno);
     532            psAbort(__func__, "Failed to reallocate %zd bytes at %s:%d", size, file, lineno);
    533533        }
    534534    }
  • trunk/psLib/src/sys/psTrace.h

    r8404 r8627  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-08-17 01:39:03 $
     11 *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-08-26 04:34:28 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8989);
    9090
    91 #else
     91#else // DOXYGEN
     92#ifdef __GNUC__
    9293/// Send a trace message
    9394void p_psTrace(
     
    99100    const char *format,                ///< printf-style format command
    100101    ...                                ///< trace message arguments
     102) __attribute__((format(printf, 6, 7)));
     103#else // __GNUC__
     104void p_psTrace(
     105    const char* file,                  ///< file name
     106    int lineno,                        ///< line number in file
     107    const char* func,                  ///< function name
     108    const char *facil,                 ///< facilty of interest
     109    psS32 level,                       ///< desired trace level
     110    const char *format,                ///< printf-style format command
     111    ...                                ///< trace message arguments
    101112);
    102 
     113#endif // __GNUC__
    103114#ifndef SWIG
    104115#define psTrace(facil, level, ...) p_psTrace(__FILE__,__LINE__,__func__,facil, level, __VA_ARGS__)
     
    110121    va_list ap                         ///< varargs argument list
    111122);
    112 
    113123#endif /* SWIG */
    114 
    115124#endif /* DOXYGEN */
    116125
  • trunk/psLib/src/types/psArguments.c

    r8245 r8627  
    77 *  @author David Robbins, MHPCC
    88 *
    9  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2006-08-09 02:26:44 $
     9 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2006-08-26 04:34:28 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    304304        case PS_DATA_STRING:
    305305            if (item->data.V) {
    306                 printf("""%s""", (char*)(item->data.V));
     306                printf("""%s""", item->data.str);
    307307            }
    308308            break;
  • trunk/psLib/src/types/psArray.c

    r8591 r8627  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.47 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-08-25 05:26:19 $
     11 *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-08-26 04:34:28 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    215215        if (position >= array->nalloc) {
    216216            psError(PS_ERR_BAD_PARAMETER_NULL, true,
    217                     _("Specified position, %d, is greater than the allocated size of the array, %d."),
     217                    _("Specified position, %ld, is greater than the allocated size of the array, %ld."),
    218218                    position, array->nalloc);
    219219            return false;
  • trunk/psLib/src/types/psBitSet.c

    r8232 r8627  
    1111 *  @author Robert DeSonia, MHPCC
    1212 *
    13  *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2006-08-08 23:32:23 $
     13 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-08-26 04:34:28 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8282    if (nalloc < 0) {
    8383        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    84                 _("The number of bit in a psBitSet (%d) must be greater than zero."),
     84                _("The number of bit in a psBitSet (%ld) must be greater than zero."),
    8585                nalloc);
    8686        return NULL;
     
    113113                (bit > bitSet->n * 8 - 1) ) {
    114114        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    115                 _("The specified bit position (%d) is invalid.  Position must be between 0 and %d."),
    116                 bit,bitSet->n * 8 - 1);
     115                _("The specified bit position (%ld) is invalid.  Position must be between 0 and %ld."),
     116                bit, bitSet->n * 8 - 1);
    117117        return bitSet;
    118118    }
     
    136136                (bit > bitSet->n * 8 - 1) ) {
    137137        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    138                 _("The specified bit position (%d) is invalid.  Position must be between 0 and %d."),
    139                 bit,bitSet->n * 8 - 1);
     138                _("The specified bit position (%ld) is invalid.  Position must be between 0 and %ld."),
     139                bit, bitSet->n * 8 - 1);
    140140        return bitSet;
    141141    }
     
    159159                (bit > bitSet->n * 8 - 1) ) {
    160160        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    161                 _("The specified bit position (%d) is invalid.  Position must be between 0 and %d."),
     161                _("The specified bit position (%ld) is invalid.  Position must be between 0 and %ld."),
    162162                bit,bitSet->n * 8 - 1);
    163163        return false;
  • trunk/psLib/src/types/psHash.c

    r8245 r8627  
    1212*  @author GLG, MHPCC
    1313*
    14 *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2006-08-09 02:26:44 $
     14*  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2006-08-26 04:34:28 $
    1616*
    1717*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2020#include <stdio.h>
    2121#include <string.h>
     22#include <inttypes.h>
     23
    2224#include "psHash.h"
    2325#include "psMemory.h"
     
    148150    table->n = nalloc;
    149151
    150     psTrace("psLib.types", 1, "Creating %d-element hash table\n", nalloc);
     152    psTrace("psLib.types", 1, "Creating %ld-element hash table\n", nalloc);
    151153
    152154    // Initialize all buckets to NULL.
     
    260262    if ((hash < 0) || (hash >= table->n)) {
    261263        psError(PS_ERR_UNKNOWN, true,
    262                 "Internal hash function out of range (%d)", hash);
     264                "Internal hash function out of range (%" PRId64 ")", hash);
    263265    }
    264266    // ptr will have the correct hash bucket.
  • trunk/psLib/src/types/psList.c

    r8232 r8627  
    66 *  @author Robert Daniel DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-08-08 23:32:23 $
     8 *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-08-26 04:34:28 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    206206    if (location < 0 || location >= (int)list->n) {
    207207        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    208                 _("Specified location, %d, is invalid."),
     208                _("Specified location, %ld, is invalid."),
    209209                location);
    210210        return false;
     
    260260    if (location > 0 && location >= (int)list->n) {
    261261        psLogMsg(__func__,PS_LOG_WARN,
    262                  "Specified location, %d, is beyond the end of the list.  "
     262                 "Specified location, %ld, is beyond the end of the list.  "
    263263                 "Adding data item to tail.",
    264264                 location);
     
    485485    if (! psListIteratorSet(iterator,location)) {
    486486        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    487                 _("Specified location, %d, is invalid."),
     487                _("Specified location, %ld, is invalid."),
    488488                location);
    489489        return NULL;
  • trunk/psLib/src/types/psLookupTable.c

    r8483 r8627  
    77*  @author Ross Harman, MHPCC
    88*
    9 *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2006-08-23 01:56:15 $
     9*  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2006-08-26 04:34:28 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
     
    2020#include <limits.h>
    2121#include <math.h>
     22#include <inttypes.h>
    2223
    2324#include "psMemory.h"
     
    593594
    594595    if (indexCol >= vectors->n) {
    595         psError(PS_ERR_BAD_PARAMETER_VALUE,true,"Index column, %d, is larger than number of columns, %d.",
     596        psError(PS_ERR_BAD_PARAMETER_VALUE,true,"Index column, %ld, is larger than number of columns, %ld.",
    596597                indexCol, vectors->n);
    597598        return NULL;
     
    814815        if(hiIdx >= numRows) {
    815816            psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    816                     _("High index too big, %d."), hiIdx);
     817                    _("High index too big, %" PRIu64 "."), hiIdx);
    817818            return NAN;
    818819        }
     
    824825    if(loIdx < 0) {
    825826        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    826                 _("Low index too small, %d."), loIdx);
     827                _("Low index too small, %" PRIu64 "."), loIdx);
    827828        return NAN;
    828829    }
  • trunk/psLib/src/types/psMetadata.c

    r8605 r8627  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.128 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2006-08-25 22:10:35 $
     14 *  @version $Revision: 1.129 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2006-08-26 04:34:28 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    733733        if (entry == NULL) {
    734734            psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    735                     _("Could not find metadata item at index %d."), where);
     735                    _("Could not find metadata item at index %ld."), where);
    736736            return false;
    737737        }
     
    740740        if (key == NULL) {
    741741            psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    742                     _("Failed to remove metadata item, at index %d, from metadata list."),
     742                    _("Failed to remove metadata item, at index %ld, from metadata list."),
    743743                    where);
    744744            return false;
     
    959959        }
    960960        if (!psMetadataIteratorSet(newIter, location)) {
    961             psError(PS_ERR_UNKNOWN, false, "Unable to set location=%d for metadata iterator.\n", location);
     961            psError(PS_ERR_UNKNOWN, false, "Unable to set location=%ld for metadata iterator.\n", location);
    962962            psFree(newIter);
    963963            return NULL;
     
    12291229        switch (item->type) {
    12301230        case PS_DATA_STRING:
    1231             fprintf(fd, "%s\n", (char*)(item->data.V));
     1231            fprintf(fd, "%s\n", item->data.str);
    12321232            break;
    12331233        case PS_DATA_BOOL:
  • trunk/psLib/src/types/psMetadataConfig.c

    r8610 r8627  
    1010*  @author Eric Van Alst, MHPCC
    1111*
    12 *  @version $Revision: 1.74 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2006-08-26 00:32:39 $
     12*  @version $Revision: 1.75 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2006-08-26 04:34:28 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    539539    case 's':
    540540        if (type == PS_DATA_STRING) {
    541             fprintf(fd,format,(char*)item->data.V);
     541            fprintf(fd,format, item->data.str);
    542542        } else {
    543543            psError(PS_ERR_BAD_PARAMETER_TYPE,true,
     
    10101010        break;
    10111011    default:
    1012         psError(PS_ERR_IO,true,_("Metadata type '%s', found on line %u of %s, is invalid."),
     1012        psError(PS_ERR_IO,true,_("Metadata of unknown type found on line %u of %s."),
    10131013                lineCount,fileName);
    10141014        break;
     
    13461346    case PS_DATA_STRING:
    13471347        psStringAppend(&content, "%-15s  %-8s", item->name, "STR");
    1348         psStringAppend(&content, "  %s", ((char *)(item->data.V)));
     1348        psStringAppend(&content, "  %s", item->data.str);
    13491349        if ( strncmp(item->comment,"",2) ) {
    13501350            psStringAppend(&content, " #%s", item->comment);
  • trunk/psLib/src/types/psMetadataItemCompare.c

    r8245 r8627  
    6767            return false;
    6868        }
    69         psTrace("psLib.types", 10, "Comparing '%s' with '%s'\n", compare->data.V, template->
    70                 data.V);
     69        psTrace("psLib.types", 10, "Comparing '%s' with '%s'\n",
     70                compare->data.str, template->
     71                data.str);
    7172        return (strcasecmp(compare->data.V, template->
    7273                           data.V) == 0) ? true : false;
  • trunk/psLib/src/xml/psXML.c

    r8232 r8627  
    1010*  @author David Robbins, MHPCC
    1111*
    12 *  @version $Revision: 1.46 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2006-08-08 23:32:23 $
     12*  @version $Revision: 1.47 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2006-08-26 04:34:28 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    105105            prop = xmlNewProp(cur_node, (const xmlChar*)"name", (const xmlChar*)item->name);
    106106            prop = xmlNewProp(cur_node, (const xmlChar*)"psType", (const xmlChar*)"STR");
    107             strncpy(content, ((char *)(item->data.V)), MAXSTR);
     107            strncpy(content, item->data.str, MAXSTR);
    108108            prop = xmlNewProp(cur_node, (const xmlChar*)"value", (const xmlChar*)content);
    109109            break;
Note: See TracChangeset for help on using the changeset viewer.