IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8627 for trunk/psLib/src/types


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/types
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.