~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to libdb/cxx/cxx_mpool.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*-
2
 
 * See the file LICENSE for redistribution information.
3
 
 *
4
 
 * Copyright (c) 1997-2002
5
 
 *      Sleepycat Software.  All rights reserved.
6
 
 */
7
 
 
8
 
#include "db_config.h"
9
 
 
10
 
#ifndef lint
11
 
static const char revid[] = "$Id$";
12
 
#endif /* not lint */
13
 
 
14
 
#include <errno.h>
15
 
 
16
 
#include "db_cxx.h"
17
 
#include "dbinc/cxx_int.h"
18
 
 
19
 
#include "db_int.h"
20
 
 
21
 
// Helper macros for simple methods that pass through to the
22
 
// underlying C method. It may return an error or raise an exception.
23
 
// Note this macro expects that input _argspec is an argument
24
 
// list element (e.g., "char *arg") and that _arglist is the arguments
25
 
// that should be passed through to the C method (e.g., "(mpf, arg)")
26
 
//
27
 
#define DB_MPOOLFILE_METHOD(_name, _argspec, _arglist, _retok)          \
28
 
int DbMpoolFile::_name _argspec                                         \
29
 
{                                                                       \
30
 
        int ret;                                                        \
31
 
        DB_MPOOLFILE *mpf = unwrap(this);                               \
32
 
                                                                        \
33
 
        if (mpf == NULL)                                                \
34
 
                ret = EINVAL;                                           \
35
 
        else                                                            \
36
 
                ret = mpf->_name _arglist;                              \
37
 
        if (!_retok(ret))                                               \
38
 
                DB_ERROR("DbMpoolFile::"#_name, ret, ON_ERROR_UNKNOWN); \
39
 
        return (ret);                                                   \
40
 
}
41
 
 
42
 
#define DB_MPOOLFILE_METHOD_VOID(_name, _argspec, _arglist)             \
43
 
void DbMpoolFile::_name _argspec                                        \
44
 
{                                                                       \
45
 
        DB_MPOOLFILE *mpf = unwrap(this);                               \
46
 
                                                                        \
47
 
        mpf->_name _arglist;                                            \
48
 
}
49
 
 
50
 
////////////////////////////////////////////////////////////////////////
51
 
//                                                                    //
52
 
//                            DbMpoolFile                             //
53
 
//                                                                    //
54
 
////////////////////////////////////////////////////////////////////////
55
 
 
56
 
DbMpoolFile::DbMpoolFile()
57
 
:       imp_(0)
58
 
{
59
 
}
60
 
 
61
 
DbMpoolFile::~DbMpoolFile()
62
 
{
63
 
}
64
 
 
65
 
int DbMpoolFile::close(u_int32_t flags)
66
 
{
67
 
        DB_MPOOLFILE *mpf = unwrap(this);
68
 
        int ret;
69
 
 
70
 
        if (mpf == NULL)
71
 
                ret = EINVAL;
72
 
        else
73
 
                ret = mpf->close(mpf, flags);
74
 
 
75
 
        imp_ = 0;                   // extra safety
76
 
 
77
 
        // This may seem weird, but is legal as long as we don't access
78
 
        // any data before returning.
79
 
        delete this;
80
 
 
81
 
        if (!DB_RETOK_STD(ret))
82
 
                DB_ERROR("DbMpoolFile::close", ret, ON_ERROR_UNKNOWN);
83
 
 
84
 
        return (ret);
85
 
}
86
 
 
87
 
DB_MPOOLFILE_METHOD(get, (db_pgno_t *pgnoaddr, u_int32_t flags, void *pagep),
88
 
    (mpf, pgnoaddr, flags, pagep), DB_RETOK_MPGET)
89
 
DB_MPOOLFILE_METHOD_VOID(last_pgno, (db_pgno_t *pgnoaddr), (mpf, pgnoaddr))
90
 
DB_MPOOLFILE_METHOD(open,
91
 
    (const char *file, u_int32_t flags, int mode, size_t pagesize),
92
 
    (mpf, file, flags, mode, pagesize), DB_RETOK_STD)
93
 
DB_MPOOLFILE_METHOD(put, (void *pgaddr, u_int32_t flags),
94
 
    (mpf, pgaddr, flags), DB_RETOK_STD)
95
 
DB_MPOOLFILE_METHOD_VOID(refcnt, (db_pgno_t *pgnoaddr), (mpf, pgnoaddr))
96
 
DB_MPOOLFILE_METHOD(set, (void *pgaddr, u_int32_t flags),
97
 
    (mpf, pgaddr, flags), DB_RETOK_STD)
98
 
DB_MPOOLFILE_METHOD(set_clear_len, (u_int32_t len),
99
 
    (mpf, len), DB_RETOK_STD)
100
 
DB_MPOOLFILE_METHOD(set_fileid, (u_int8_t *fileid),
101
 
    (mpf, fileid), DB_RETOK_STD)
102
 
DB_MPOOLFILE_METHOD(set_ftype, (int ftype),
103
 
    (mpf, ftype), DB_RETOK_STD)
104
 
DB_MPOOLFILE_METHOD(set_lsn_offset, (int32_t offset),
105
 
    (mpf, offset), DB_RETOK_STD)
106
 
DB_MPOOLFILE_METHOD(set_pgcookie, (DBT *dbt),
107
 
    (mpf, dbt), DB_RETOK_STD)
108
 
DB_MPOOLFILE_METHOD_VOID(set_unlink, (int ul), (mpf, ul))
109
 
DB_MPOOLFILE_METHOD(sync, (),
110
 
    (mpf), DB_RETOK_STD)