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

« back to all changes in this revision

Viewing changes to libdb/libdb_java/java_locked.h

  • 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
 
 * $Id$
8
 
 */
9
 
 
10
 
#ifndef _JAVA_LOCKED_H_
11
 
#define _JAVA_LOCKED_H_
12
 
 
13
 
/*
14
 
 * Used as argument to locked_dbt_get().
15
 
 */
16
 
typedef enum _OpKind {
17
 
        inOp,           /* setting data in database (passing data in) */
18
 
        outOp,          /* getting data from database to user memory */
19
 
        inOutOp         /* both getting/setting data */
20
 
} OpKind;
21
 
 
22
 
/*
23
 
 * LOCKED_DBT
24
 
 *
25
 
 * A stack variable LOCKED_DBT should be declared for each Dbt used in a
26
 
 * native call to the DB API.  Before the DBT can be used, locked_dbt_get()
27
 
 * must be called to temporarily convert any java array found in the
28
 
 * Dbt (which has a pointer to a DBT_JAVAINFO struct) to actual bytes
29
 
 * in memory that remain locked in place.  These bytes are used during
30
 
 * the call to the DB C API, and are released and/or copied back when
31
 
 * locked_dbt_put is called.
32
 
 */
33
 
typedef struct _locked_dbt
34
 
{
35
 
        /* these are accessed externally to locked_dbt_ functions */
36
 
        DBT_JAVAINFO *javainfo;
37
 
        unsigned int java_array_len;
38
 
        jobject jdbt;
39
 
 
40
 
        /* these are for used internally by locked_dbt_ functions */
41
 
        jbyte *java_data;
42
 
        jbyte *before_data;
43
 
        OpKind kind;
44
 
 
45
 
#define LOCKED_ERROR            0x01    /* error occurred */
46
 
#define LOCKED_CREATE_DATA      0x02    /* must create data on the fly */
47
 
#define LOCKED_REALLOC_NONNULL  0x04    /* DB_DBT_REALLOC flag, nonnull data */
48
 
        u_int32_t flags;
49
 
} LOCKED_DBT;
50
 
 
51
 
/* Fill the LOCKED_DBT struct and lock the Java byte array */
52
 
extern int locked_dbt_get(LOCKED_DBT *, JNIEnv *, DB_ENV *, jobject, OpKind);
53
 
 
54
 
/* unlock the Java byte array */
55
 
extern void locked_dbt_put(LOCKED_DBT *, JNIEnv *, DB_ENV *);
56
 
 
57
 
/* realloc the Java byte array */
58
 
extern int locked_dbt_realloc(LOCKED_DBT *, JNIEnv *, DB_ENV *);
59
 
 
60
 
/*
61
 
 * LOCKED_STRING
62
 
 *
63
 
 * A LOCKED_STRING exists temporarily to convert a java jstring object
64
 
 * to a char *.  Because the memory for the char * string is
65
 
 * managed by the JVM, it must be released when we are done
66
 
 * looking at it.  Typically, locked_string_get() is called at the
67
 
 * beginning of a function for each jstring object, and locked_string_put
68
 
 * is called at the end of each function for each LOCKED_STRING.
69
 
 */
70
 
typedef struct _locked_string
71
 
{
72
 
        /* this accessed externally to locked_string_ functions */
73
 
        const char *string;
74
 
 
75
 
        /* this is used internally by locked_string_ functions */
76
 
        jstring jstr;
77
 
} LOCKED_STRING;
78
 
 
79
 
extern int locked_string_get(LOCKED_STRING *, JNIEnv *jnienv, jstring jstr);
80
 
extern void locked_string_put(LOCKED_STRING *, JNIEnv *jnienv);  /* this unlocks and frees mem */
81
 
 
82
 
#endif /* !_JAVA_LOCKED_H_ */