apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i...@apache.org
Subject cvs commit: apr-util/dbm apr_dbm.c
Date Wed, 29 Aug 2001 18:34:05 GMT
ianh        01/08/29 11:34:05

  Modified:    dbm      apr_dbm.c
  Log:
  testdbm now works with berkelyDB 3 DBM
  db3 version also produces meaningfull error strings
  
  Revision  Changes    Path
  1.27      +12 -6     apr-util/dbm/apr_dbm.c
  
  Index: apr_dbm.c
  ===================================================================
  RCS file: /home/cvs/apr-util/dbm/apr_dbm.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- apr_dbm.c	2001/05/21 19:14:39	1.26
  +++ apr_dbm.c	2001/08/29 18:34:05	1.27
  @@ -98,7 +98,7 @@
   /* Most DBM libraries take a POSIX mode for creating files.  Don't trust
    * the mode_t type, some platforms may not support it, int is safe.
    */
  -int apr_posix_perms2mode(apr_fileperms_t perm) 
  +int apr_posix_perms2mode(apr_fileperms_t perm)
   {
       int mode = 0;
   
  @@ -206,14 +206,14 @@
   #define APR_DBM_DBMODE_RO       DB_RDONLY
   #define APR_DBM_DBMODE_RW       0
   #define APR_DBM_DBMODE_RWCREATE DB_CREATE
  -#endif
  +#endif /* DBVER == 1 */
   
   /* map a DB error to an apr_status_t */
   static apr_status_t db2s(int dberr)
   {
       if (dberr != 0) {
           /* ### need to fix this */
  -        return APR_EGENERAL;
  +        return APR_OS_START_USEERR+dberr;
       }
   
       return APR_SUCCESS;
  @@ -225,6 +225,9 @@
       int dberr;
       DBT data;
   
  +    memset(pkey,0,sizeof(DBT));
  +
  +    memset(&data,0,sizeof(DBT));
   #if DB_VER == 1
       dberr = (*f->bdb->seq)(f->bdb, pkey, &data, R_FIRST);
   #else
  @@ -344,9 +347,9 @@
       else {
           /* ### need to fix. dberr was tossed in db2s(). */
           /* ### use db_strerror() */
  -        dbm->errcode = 1;
  -        dbm->errmsg = "DB error occurred.";
  -        rv = APR_EGENERAL;
  +        dbm->errcode = dbm_said;
  +        dbm->errmsg = db_strerror( dbm_said - APR_OS_START_USEERR);
  +        rv = dbm_said;
       }
   #else
   #error set_error has not been coded for this database type
  @@ -455,6 +458,9 @@
       result_datum_t rd;
   
       CONVERT_DATUM(ckey, &key);
  +#if APU_USE_DB
  +    memset(&rd,0,sizeof(rd));
  +#endif
       rv = APR_DBM_FETCH(dbm->file, ckey, rd);
       RETURN_DATUM(pvalue, rd);
   
  
  
  

Mime
View raw message