~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/bindings/javahl/native/org_apache_subversion_javahl_types_VersionExtended.cpp

  • Committer: Package Import Robot
  • Author(s): James McCoy, Peter Samuelson, James McCoy
  • Date: 2014-01-12 19:48:33 UTC
  • mfrom: (0.2.10)
  • Revision ID: package-import@ubuntu.com-20140112194833-w3axfwksn296jn5x
Tags: 1.8.5-1
[ Peter Samuelson ]
* New upstream release.  (Closes: #725787) Rediff patches:
  - Remove apr-abi1 (applied upstream), rename apr-abi2 to apr-abi
  - Remove loosen-sqlite-version-check (shouldn't be needed)
  - Remove java-osgi-metadata (applied upstream)
  - svnmucc prompts for a changelog if none is provided. (Closes: #507430)
  - Remove fix-bdb-version-detection, upstream uses "apu-config --dbm-libs"
  - Remove ruby-test-wc (applied upstream)
  - Fix “svn diff -r N file” when file has svn:mime-type set.
    (Closes: #734163)
  - Support specifying an encoding for mod_dav_svn's environment in which
    hooks are run.  (Closes: #601544)
  - Fix ordering of “svnadmin dump” paths with certain APR versions.
    (Closes: #687291)
  - Provide a better error message when authentication fails with an
    svn+ssh:// URL.  (Closes: #273874)
  - Updated Polish translations.  (Closes: #690815)

[ James McCoy ]
* Remove all traces of libneon, replaced by libserf.
* patches/sqlite_3.8.x_workaround: Upstream fix for wc-queries-test test
  failurse.
* Run configure with --with-apache-libexecdir, which allows removing part of
  patches/rpath.
* Re-enable auth-test as upstream has fixed the problem of picking up
  libraries from the environment rather than the build tree.
  (Closes: #654172)
* Point LD_LIBRARY_PATH at the built auth libraries when running the svn
  command during the build.  (Closes: #678224)
* Add a NEWS entry describing how to configure mod_dav_svn to understand
  UTF-8.  (Closes: #566148)
* Remove ancient transitional package, libsvn-ruby.
* Enable compatibility with Sqlite3 versions back to Wheezy.
* Enable hardening flags.  (Closes: #734918)
* patches/build-fixes: Enable verbose build logs.
* Build against the default ruby version.  (Closes: #722393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @copyright
 
3
 * ====================================================================
 
4
 *    Licensed to the Apache Software Foundation (ASF) under one
 
5
 *    or more contributor license agreements.  See the NOTICE file
 
6
 *    distributed with this work for additional information
 
7
 *    regarding copyright ownership.  The ASF licenses this file
 
8
 *    to you under the Apache License, Version 2.0 (the
 
9
 *    "License"); you may not use this file except in compliance
 
10
 *    with the License.  You may obtain a copy of the License at
 
11
 *
 
12
 *      http://www.apache.org/licenses/LICENSE-2.0
 
13
 *
 
14
 *    Unless required by applicable law or agreed to in writing,
 
15
 *    software distributed under the License is distributed on an
 
16
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 
17
 *    KIND, either express or implied.  See the License for the
 
18
 *    specific language governing permissions and limitations
 
19
 *    under the License.
 
20
 * ====================================================================
 
21
 * @endcopyright
 
22
 *
 
23
 * @file org_apache_subversion_javahl_types_VersionExtended.cpp
 
24
 * @brief Implementation of the native methods in the Java class VersionExtended.
 
25
 */
 
26
 
 
27
#include "../include/org_apache_subversion_javahl_types_VersionExtended.h"
 
28
#include "../include/org_apache_subversion_javahl_types_VersionExtended_LinkedLib.h"
 
29
#include "../include/org_apache_subversion_javahl_types_VersionExtended_LinkedLibIterator.h"
 
30
#include "../include/org_apache_subversion_javahl_types_VersionExtended_LoadedLib.h"
 
31
#include "../include/org_apache_subversion_javahl_types_VersionExtended_LoadedLibIterator.h"
 
32
#include "VersionExtended.h"
 
33
#include "JNIStackElement.h"
 
34
#include <string>
 
35
 
 
36
// VersionExtended native methods
 
37
 
 
38
JNIEXPORT jstring JNICALL
 
39
Java_org_apache_subversion_javahl_types_VersionExtended_getBuildDate(
 
40
    JNIEnv *env, jobject jthis)
 
41
{
 
42
  JNIEntry(VersionExtended, getBuildDate);
 
43
  const VersionExtended *const vx = VersionExtended::getCppObject(jthis);
 
44
  if (vx)
 
45
    return env->NewStringUTF(vx->build_date());
 
46
  return 0;
 
47
}
 
48
 
 
49
JNIEXPORT jstring JNICALL
 
50
Java_org_apache_subversion_javahl_types_VersionExtended_getBuildTime(
 
51
    JNIEnv *env, jobject jthis)
 
52
{
 
53
  JNIEntry(VersionExtended, getBuildTime);
 
54
  const VersionExtended *const vx = VersionExtended::getCppObject(jthis);
 
55
  if (vx)
 
56
    return env->NewStringUTF(vx->build_time());
 
57
  return 0;
 
58
}
 
59
 
 
60
JNIEXPORT jstring JNICALL
 
61
Java_org_apache_subversion_javahl_types_VersionExtended_getBuildHost(
 
62
    JNIEnv *env, jobject jthis)
 
63
{
 
64
  JNIEntry(VersionExtended, getBuildHost);
 
65
  const VersionExtended *const vx = VersionExtended::getCppObject(jthis);
 
66
  if (vx)
 
67
    return env->NewStringUTF(vx->build_host());
 
68
  return 0;
 
69
}
 
70
 
 
71
JNIEXPORT jstring JNICALL
 
72
Java_org_apache_subversion_javahl_types_VersionExtended_getCopyright(
 
73
    JNIEnv *env, jobject jthis)
 
74
{
 
75
  JNIEntry(VersionExtended, getCopyright);
 
76
  const VersionExtended *const vx = VersionExtended::getCppObject(jthis);
 
77
  if (vx)
 
78
    return env->NewStringUTF(vx->copyright());
 
79
  return 0;
 
80
}
 
81
 
 
82
JNIEXPORT jstring JNICALL
 
83
Java_org_apache_subversion_javahl_types_VersionExtended_getRuntimeHost(
 
84
    JNIEnv *env, jobject jthis)
 
85
{
 
86
  JNIEntry(VersionExtended, getRuntimeHost);
 
87
  const VersionExtended *const vx = VersionExtended::getCppObject(jthis);
 
88
  if (vx)
 
89
    return env->NewStringUTF(vx->runtime_host());
 
90
  return 0;
 
91
}
 
92
 
 
93
JNIEXPORT jstring JNICALL
 
94
Java_org_apache_subversion_javahl_types_VersionExtended_getRuntimeOSName(
 
95
    JNIEnv *env, jobject jthis)
 
96
{
 
97
  JNIEntry(VersionExtended, getRuntimeOSName);
 
98
  const VersionExtended *const vx = VersionExtended::getCppObject(jthis);
 
99
  if (vx)
 
100
    return env->NewStringUTF(vx->runtime_osname());
 
101
  return 0;
 
102
}
 
103
 
 
104
 
 
105
// VersionExtended.LinkedLib native methods
 
106
 
 
107
namespace {
 
108
static const svn_version_ext_linked_lib_t *
 
109
getLinkedLib(JNIEnv *env, jobject jthis)
 
110
{
 
111
  static volatile jfieldID fid = 0;
 
112
  if (!fid)
 
113
    {
 
114
      fid = env->GetFieldID(env->GetObjectClass(jthis), "index", "I");
 
115
      if (JNIUtil::isJavaExceptionThrown())
 
116
        return NULL;
 
117
    }
 
118
 
 
119
  const int index = env->GetIntField(jthis, fid);
 
120
  if (JNIUtil::isJavaExceptionThrown())
 
121
    return NULL;
 
122
 
 
123
  const VersionExtended *const vx =
 
124
    VersionExtended::getCppObjectFromLinkedLib(jthis);
 
125
  if (vx)
 
126
    return vx->get_linked_lib(index);
 
127
  return NULL;
 
128
}
 
129
} // anonymous namespace
 
130
 
 
131
JNIEXPORT jstring JNICALL
 
132
Java_org_apache_subversion_javahl_types_VersionExtended_00024LinkedLib_getName(
 
133
    JNIEnv *env, jobject jthis)
 
134
{
 
135
  JNIEntry(VersionExtended$LinkedLib, getName);
 
136
  const svn_version_ext_linked_lib_t *const lib = getLinkedLib(env, jthis);
 
137
  if (lib)
 
138
    return env->NewStringUTF(lib->name);
 
139
  return 0;
 
140
}
 
141
 
 
142
JNIEXPORT jstring JNICALL
 
143
Java_org_apache_subversion_javahl_types_VersionExtended_00024LinkedLib_getCompiledVersion(
 
144
    JNIEnv *env, jobject jthis)
 
145
{
 
146
  JNIEntry(VersionExtended$LinkedLib, getCompiledVersion);
 
147
  const svn_version_ext_linked_lib_t *const lib = getLinkedLib(env, jthis);
 
148
  if (lib)
 
149
    return env->NewStringUTF(lib->compiled_version);
 
150
  return 0;
 
151
}
 
152
 
 
153
JNIEXPORT jstring JNICALL
 
154
Java_org_apache_subversion_javahl_types_VersionExtended_00024LinkedLib_getRuntimeVersion(
 
155
    JNIEnv *env, jobject jthis)
 
156
{
 
157
  JNIEntry(VersionExtended$LinkedLib, getRuntimeVersion);
 
158
  const svn_version_ext_linked_lib_t *const lib = getLinkedLib(env, jthis);
 
159
  if (lib)
 
160
    return env->NewStringUTF(lib->runtime_version);
 
161
  return 0;
 
162
}
 
163
 
 
164
 
 
165
// VersionExtended.LoadedLib native methods
 
166
 
 
167
namespace {
 
168
static const svn_version_ext_loaded_lib_t *
 
169
getLoadedLib(JNIEnv *env, jobject jthis)
 
170
{
 
171
  static volatile jfieldID fid = 0;
 
172
  if (!fid)
 
173
    {
 
174
      fid = env->GetFieldID(env->GetObjectClass(jthis), "index", "I");
 
175
      if (JNIUtil::isJavaExceptionThrown())
 
176
        return NULL;
 
177
    }
 
178
 
 
179
  const int index = env->GetIntField(jthis, fid);
 
180
  if (JNIUtil::isJavaExceptionThrown())
 
181
    return NULL;
 
182
 
 
183
  const VersionExtended *const vx =
 
184
    VersionExtended::getCppObjectFromLoadedLib(jthis);
 
185
  if (vx)
 
186
    return vx->get_loaded_lib(index);
 
187
  return NULL;
 
188
}
 
189
} // anonymous namespace
 
190
 
 
191
JNIEXPORT jstring JNICALL
 
192
Java_org_apache_subversion_javahl_types_VersionExtended_00024LoadedLib_getName(
 
193
    JNIEnv *env, jobject jthis)
 
194
{
 
195
  JNIEntry(VersionExtended$LoadedLib, getName);
 
196
  const svn_version_ext_loaded_lib_t *const lib = getLoadedLib(env, jthis);
 
197
  if (lib)
 
198
    return env->NewStringUTF(lib->name);
 
199
  return 0;
 
200
}
 
201
 
 
202
JNIEXPORT jstring JNICALL
 
203
Java_org_apache_subversion_javahl_types_VersionExtended_00024LoadedLib_getVersion(
 
204
    JNIEnv *env, jobject jthis)
 
205
{
 
206
  JNIEntry(VersionExtended$LoadedLib, getVersion);
 
207
  const svn_version_ext_loaded_lib_t *const lib = getLoadedLib(env, jthis);
 
208
  if (lib)
 
209
    return env->NewStringUTF(lib->version);
 
210
  return 0;
 
211
}
 
212
 
 
213
 
 
214
// VersionExtended.LinkedLibIterator and .LoadedLibIterator native methods
 
215
 
 
216
JNIEXPORT jboolean JNICALL
 
217
Java_org_apache_subversion_javahl_types_VersionExtended_00024LinkedLibIterator_hasNext(
 
218
    JNIEnv *env, jobject jthis)
 
219
{
 
220
  JNIEntry(VersionExtended$LinkedLibIterator, hasNext);
 
221
 
 
222
  static volatile jfieldID fid = 0;
 
223
  if (!fid)
 
224
    {
 
225
      fid = env->GetFieldID(env->GetObjectClass(jthis), "index", "I");
 
226
      if (JNIUtil::isJavaExceptionThrown())
 
227
        return false;
 
228
    }
 
229
 
 
230
  const int index = env->GetIntField(jthis, fid);
 
231
  if (JNIUtil::isJavaExceptionThrown())
 
232
    return false;
 
233
 
 
234
  const VersionExtended *const vx =
 
235
    VersionExtended::getCppObjectFromLinkedLibIterator(jthis);
 
236
  if (vx)
 
237
    return !!vx->get_linked_lib(1 + index);
 
238
  return false;
 
239
}
 
240
 
 
241
JNIEXPORT jboolean JNICALL
 
242
Java_org_apache_subversion_javahl_types_VersionExtended_00024LoadedLibIterator_hasNext(
 
243
    JNIEnv *env, jobject jthis)
 
244
{
 
245
  JNIEntry(VersionExtended$LoadedLibIterator, hasNext);
 
246
 
 
247
  static volatile jfieldID fid = 0;
 
248
  if (!fid)
 
249
    {
 
250
      fid = env->GetFieldID(env->GetObjectClass(jthis), "index", "I");
 
251
      if (JNIUtil::isJavaExceptionThrown())
 
252
        return false;
 
253
    }
 
254
 
 
255
  const int index = env->GetIntField(jthis, fid);
 
256
  if (JNIUtil::isJavaExceptionThrown())
 
257
    return false;
 
258
 
 
259
  const VersionExtended *const vx =
 
260
    VersionExtended::getCppObjectFromLoadedLibIterator(jthis);
 
261
  if (vx)
 
262
    return !!vx->get_loaded_lib(1 + index);
 
263
  return false;
 
264
}