IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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
File:
1 edited

Legend:

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