IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42378


Ignore:
Timestamp:
Feb 8, 2023, 11:51:50 AM (3 years ago)
Author:
eugene
Message:

merge from eam_branches/ipp-20220316. deal with more restrictive gcc / autoconf: add no_warn version of strncpy; mysql removes my_bool after v8.0.0

Location:
trunk/psLib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib

  • trunk/psLib/configure.ac

    r34089 r42378  
    4646SRCDIRS="sys astro db fft fits imageops jpeg math mathtypes types"   dnl xml
    4747# escape two escapes at this level so \\ gets passed to the shell and \ to perl
    48 SRCINC=`echo "${SRCDIRS=}" | ${PERL} -pe "s|(\w+)|-I\\\\${SRCPATH=}/\1|g"`
    49 SRCINC="-I${SRCPATH=} ${SRCINC=}"
    50 SRCSUBLIBS=`echo "${SRCDIRS=}" | ${PERL} -pe "s|(\w+)|\1/libpslib\1.la|g"`
    51 AC_SUBST(SRCSUBLIBS,${SRCSUBLIBS=})
    52 AC_SUBST(SRCINC,${SRCINC=})
     48SRCINC=`echo "${SRCDIRS}" | ${PERL} -pe "s|(\w+)|-I\\\\${SRCPATH}/\1|g"`
     49SRCINC="-I${SRCPATH} ${SRCINC}"
     50SRCSUBLIBS=`echo "${SRCDIRS}" | ${PERL} -pe "s|(\w+)|\1/libpslib\1.la|g"`
     51AC_SUBST(SRCSUBLIBS,${SRCSUBLIBS})
     52AC_SUBST(SRCINC,${SRCINC})
    5353AC_SUBST(ABS_SRCDIR,`pwd`) dnl assuming configure is run in top directory -- is there something better?
    5454AC_PROG_MAKE_SET
     
    6767  [AC_MSG_RESULT(memory allocation backtracing enabled)
    6868    AC_DEFINE([PS_MEM_BACKTRACE], 1, [Define to 1 if you want memory backtracing])
    69     CFLAGS="${CFLAGS=} -rdynamic"
     69    CFLAGS="${CFLAGS} -rdynamic"
    7070  ]
    7171)
     
    102102
    103103ACX_PTHREAD(
    104   [PSLIB_CFLAGS="${PSLIB_CFLAGS=} ${PTHREAD_CFLAGS}"
    105     PSLIB_LIBS="${PSLIB_LIBS=} ${PTHREAD_CFLAGS} ${PTHREAD_LIBS}"],
     104  [PSLIB_CFLAGS="${PSLIB_CFLAGS} ${PTHREAD_CFLAGS}"
     105    PSLIB_LIBS="${PSLIB_LIBS} ${PTHREAD_CFLAGS} ${PTHREAD_LIBS}"],
    106106  [AC_MSG_ERROR([pthread support is required to build psLib])]
    107107)
     
    110110
    111111AX_LIB_MYSQL([4.1.2],
    112   [PSLIB_CFLAGS="${PSLIB_CFLAGS=} ${MYSQL_CFLAGS} -DHAVE_PSDB"
    113     PSLIB_LIBS="${PSLIB_LIBS=} ${MYSQL_LDFLAGS}"],
    114   [PSLIB_CFLAGS="${PSLIB_CFLAGS=}"]
     112  [PSLIB_CFLAGS="${PSLIB_CFLAGS} ${MYSQL_CFLAGS} -DHAVE_PSDB"
     113    PSLIB_LIBS="${PSLIB_LIBS} ${MYSQL_LDFLAGS}"],
     114  [PSLIB_CFLAGS="${PSLIB_CFLAGS}"]
    115115)
    116116
     
    125125PKG_CHECK_MODULES([CFITSIO], [cfitsio], [], AC_MSG_ERROR([CFITSIO package not found.  Obtain CFITSIO at  http://heasarc.gsfc.nasa.gov/docs/software/fitsio]))
    126126
    127 PSLIB_CFLAGS="${PSLIB_CFLAGS=} ${CFITSIO_CFLAGS}"
    128 PSLIB_LIBS="${PSLIB_LIBS=} ${CFITSIO_LIBS}"
    129 
    130 CFLAGS="${CFLAGS=} ${CFITSIO_CFLAGS}"
    131 LDFLAGS="${LDFLAGS=} ${CFITSIO_LIBS}"
     127PSLIB_CFLAGS="${PSLIB_CFLAGS} ${CFITSIO_CFLAGS}"
     128PSLIB_LIBS="${PSLIB_LIBS} ${CFITSIO_LIBS}"
     129
     130CFLAGS="${CFLAGS} ${CFITSIO_CFLAGS}"
     131LDFLAGS="${LDFLAGS} ${CFITSIO_LIBS}"
    132132
    133133dnl Now check if CFITSIO supports fits_open_diskfile, i.e., is at least version 2.501
     
    159159PKG_CHECK_MODULES([FFTW3], [fftw3f], [], AC_MSG_ERROR([FFTW version 3 (--enable-float) library not found.  Obtain it at http://www.fftw.org/]))
    160160
    161 PSLIB_CFLAGS="${PSLIB_CFLAGS=} ${FFTW3_CFLAGS}"
    162 PSLIB_LIBS="${PSLIB_LIBS=} ${FFTW3_LIBS}"
     161PSLIB_CFLAGS="${PSLIB_CFLAGS} ${FFTW3_CFLAGS}"
     162PSLIB_LIBS="${PSLIB_LIBS} ${FFTW3_LIBS}"
    163163
    164164CFLAGS="${CFLAGS} ${FFTW3_CFLAGS}"
     
    190190PKG_CHECK_MODULES([GSL], [gsl], [], AC_MSG_ERROR([GSL is required.  Obtain it at http://www.gnu.org/software/gsl]))
    191191
    192 PSLIB_CFLAGS="${PSLIB_CFLAGS=} ${GSL_CFLAGS}"
    193 PSLIB_LIBS="${PSLIB_LIBS=} ${GSL_LIBS}"
     192PSLIB_CFLAGS="${PSLIB_CFLAGS} ${GSL_CFLAGS}"
     193PSLIB_LIBS="${PSLIB_LIBS} ${GSL_LIBS}"
    194194
    195195AC_SUBST([GSL_CFLAGS])
     
    303303LDFLAGS="${LDFLAGS} ${JPEG_LDFLAGS}"
    304304
    305 AC_CHECK_HEADERS([jpeglib.h],[PSLIB_CFLAGS="${PSLIB_CFLAGS=} ${JPEG_CFLAGS}"
     305AC_CHECK_HEADERS([jpeglib.h],[PSLIB_CFLAGS="${PSLIB_CFLAGS} ${JPEG_CFLAGS}"
    306306                              AC_SUBST(JPEG_CFLAGS)],
    307307  [AC_MSG_ERROR([libjpeg headers not found.  Obtain libjpeg from http://www.ijg.org/ or use --with-jpeg to specify location.])]
    308308)
    309309
    310 AC_CHECK_LIB(jpeg,jpeg_CreateCompress,[PSLIB_LIBS="${PSLIB_LIBS=} ${JPEG_LDFLAGS} -ljpeg"],
     310AC_CHECK_LIB(jpeg,jpeg_CreateCompress,[PSLIB_LIBS="${PSLIB_LIBS} ${JPEG_LDFLAGS} -ljpeg"],
    311311  [AC_MSG_ERROR([libjpeg library not found.  Obtain libjpeg from http://www.ijg.org/ or use --with-jpeg to specify location.])]
    312312)
     
    391391  AC_CHECK_FILE($SWIG,[],
    392392     [AC_MSG_ERROR([SWIG is required.  Obtain it at www.swig.org or use --with-swig to specify its install location.])])
    393   SUBDIR="${SUBDIR=} swig"
     393  SUBDIR="${SUBDIR} swig"
    394394
    395395dnl restore the CFLAGS/LDFLAGS
     
    433433
    434434AC_CHECK_LIB(mx,sqrtf,
    435   [PSLIB_LIBS="${PSLIB_LIBS=} -lmx"])
     435  [PSLIB_LIBS="${PSLIB_LIBS} -lmx"])
    436436LIBS=${TMP_LIBS}
    437437AC_CHECK_FUNC(atoll, [],
     
    474474IPP_STDOPTS
    475475IPP_STDCFLAGS
    476 CFLAGS="${CFLAGS=} -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112L"
     476CFLAGS="${CFLAGS} -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112L"
    477477
    478478dnl ---------------- export variables --------------------
  • trunk/psLib/src/db/psDB.c

    r41896 r42378  
    5656
    5757
     58# if (MYSQL_VERSION_ID >= 80000)
     59    # define MYSQL_BOOL bool
     60# else
     61    # define MYSQL_BOOL my_bool
     62# endif
     63
    5864// set the pointer to NULL if we are actually freeing the memory
    5965#define PSDB_NULL_FREE(ptr) \
     
    138144
    139145// pType utility functions
    140 static psPtr    psDBGetPTypeNaN(psElemType pType);
    141 static bool    psDBIsPTypeNaN(psElemType pType, psPtr data);
     146static psPtr      psDBGetPTypeNaN(psElemType pType);
     147static MYSQL_BOOL psDBIsPTypeNaN(psElemType pType, psPtr data);
    142148
    143149// public functions
     
    753759    // the return value also needs to be inverted for the same reason.
    754760    // is it safe to assume my_bool always safely casts to bool?
     761    // XXX EAM 2022.03.15 : at least in mysql 8.0.28, my_bool is gone and just bool is used
     762    // in 5.0 and 5.6, my_bool is char
     763    //
    755764    return !(bool)mysql_autocommit(dbh->mysql, !mode);
    756765}
     
    14471456
    14481457    mysqlType       *mType;             // type tmp variable
    1449     static my_bool isNull = true;       // used in a MYSQL_BIND to indicate NULL
     1458
     1459    // XXX EAM 2022.03.15 : at least in mysql 8.0.28, my_bool is gone and just bool is used
     1460    // in 5.0 and 5.6, my_bool is char
     1461    static MYSQL_BOOL isNull = true;       // used in a MYSQL_BIND to indicate NULL
    14501462
    14511463    MYSQL_BIND *bind = mysqlRow->bind;
     
    16021614                    // assume for the time being that we don't have negative
    16031615                    // time as ISO8601 doesn't support dates prior to 0
    1604                     myTime->neg     = (my_bool)false;
     1616                    // XXX EAM 2022.03.15 : at least in mysql 8.0.28, my_bool is gone and just bool is used
     1617                    // in 5.0 and 5.6, my_bool is char
     1618                    myTime->neg     = (bool)false;
    16051619                    // currently unused by mysql
    16061620                    myTime->second_part  = (unsigned long)time->nsec;
     
    28692883#define PS_IS_NAN(type, data, nan) *(type *)data == nan
    28702884
    2871 static bool psDBIsPTypeNaN(psElemType pType,
    2872                            psPtr data)
     2885static MYSQL_BOOL psDBIsPTypeNaN(psElemType pType, psPtr data)
     2886
    28732887{
    28742888    bool    isNaN = NULL;
  • trunk/psLib/src/sys/psString.c

    r41171 r42378  
    4141
    4242
     43// gcc (Ubuntu 20.04) complains when strncpy is used to copy a fraction of a buffer,
     44// potentially skipping the ending NULL.  To avoid the error, manually copy
     45// and (to ensure the buffer ends in a NULL) set the last + 1 byte to NUL:
     46// WARNING : len(dest) must be >= n + 1
     47char *ps_strncpy_nowarn (char *dest, const char *src, size_t n) {
     48
     49  size_t i;
     50 
     51  char *d = dest;
     52  char *s = (char *) src;
     53  for (i = 0; i < n && *s != 0; i++, d++, s++) { *d = *s; }
     54  for ( ; i <= n; i++, d++) { *d = 0; }
     55 
     56  return dest;
     57}
     58
    4359psString p_psStringAlloc(const char *file,
    4460                         unsigned int lineno,
  • trunk/psLib/src/sys/psString.h

    r40551 r42378  
    4848void psNOOP (void);
    4949
     50char *ps_strncpy_nowarn (char *dest, const char *src, size_t n);
     51
    5052// some constants to use in snprintf statements and variable definitions to ensure
    5153// consistency
  • trunk/psLib/src/sys/psTrace.c

    r26892 r42378  
    213213    }
    214214
    215     strncpy(name, addNodeName, MAX_COMPONENT_LENGTH);
     215    ps_strncpy_nowarn(name, addNodeName, MAX_COMPONENT_LENGTH);
    216216    char *pname = name+1;               // Take off the period
    217217    // Iterate through the components of addNodeName.  Strip off the first
Note: See TracChangeset for help on using the changeset viewer.