Author: brane
Date: Sun Feb 8 03:10:25 2015
New Revision: 1658128
URL: http://svn.apache.org/r1658128
Log:
On the pin-externals branch: Sync with trunk up to r1658120
to bring in the latest changesin JavaHL list and map wrappers.
Added:
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_iterator.cpp
- copied unchanged from r1658120,
subversion/trunk/subversion/bindings/javahl/native/jniwrapper/jni_iterator.cpp
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_iterator.hpp
- copied unchanged from r1658120,
subversion/trunk/subversion/bindings/javahl/native/jniwrapper/jni_iterator.hpp
Removed:
subversion/branches/pin-externals/subversion/tests/cmdline/svnsync_tests_data/mergeinfo-contains-r0.expected.dump
Modified:
subversion/branches/pin-externals/ (props changed)
subversion/branches/pin-externals/Makefile.in
subversion/branches/pin-externals/build/run_tests.py
subversion/branches/pin-externals/notes/ (props changed)
subversion/branches/pin-externals/subversion/bindings/cxxhl/include/svncxxhl/exception.hpp
subversion/branches/pin-externals/subversion/bindings/javahl/native/AuthnCallback.cpp
subversion/branches/pin-externals/subversion/bindings/javahl/native/Utility.cpp
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_class_cache.cpp
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_exception.hpp
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_list.cpp
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_list.hpp
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_object.hpp
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_string_map.cpp
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_string_map.hpp
subversion/branches/pin-externals/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp
subversion/branches/pin-externals/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.cpp
subversion/branches/pin-externals/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_SubstLib.cpp
subversion/branches/pin-externals/subversion/include/private/svn_auth_private.h
subversion/branches/pin-externals/subversion/include/svn_string.h
subversion/branches/pin-externals/subversion/libsvn_client/mtcc.c
subversion/branches/pin-externals/subversion/libsvn_client/repos_diff.c
subversion/branches/pin-externals/subversion/libsvn_fs/fs-loader.h
subversion/branches/pin-externals/subversion/libsvn_fs_base/tree.c
subversion/branches/pin-externals/subversion/libsvn_fs_fs/cached_data.c
subversion/branches/pin-externals/subversion/libsvn_fs_fs/index.c
subversion/branches/pin-externals/subversion/libsvn_fs_fs/index.h
subversion/branches/pin-externals/subversion/libsvn_fs_fs/lock.c
subversion/branches/pin-externals/subversion/libsvn_fs_x/ (props changed)
subversion/branches/pin-externals/subversion/libsvn_fs_x/dag.c
subversion/branches/pin-externals/subversion/libsvn_fs_x/dag.h
subversion/branches/pin-externals/subversion/libsvn_fs_x/fs.c
subversion/branches/pin-externals/subversion/libsvn_fs_x/fs_x.c
subversion/branches/pin-externals/subversion/libsvn_fs_x/fs_x.h
subversion/branches/pin-externals/subversion/libsvn_fs_x/hotcopy.c
subversion/branches/pin-externals/subversion/libsvn_fs_x/noderevs.c
subversion/branches/pin-externals/subversion/libsvn_fs_x/revprops.c
subversion/branches/pin-externals/subversion/libsvn_fs_x/revprops.h
subversion/branches/pin-externals/subversion/libsvn_fs_x/tree.c
subversion/branches/pin-externals/subversion/libsvn_fs_x/verify.c
subversion/branches/pin-externals/subversion/libsvn_ra/ra_loader.c
subversion/branches/pin-externals/subversion/libsvn_ra_serf/commit.c
subversion/branches/pin-externals/subversion/libsvn_repos/hooks.c
subversion/branches/pin-externals/subversion/libsvn_repos/log.c
subversion/branches/pin-externals/subversion/libsvn_repos/reporter.c
subversion/branches/pin-externals/subversion/libsvn_subr/auth.c
subversion/branches/pin-externals/subversion/libsvn_subr/cache-membuffer.c
subversion/branches/pin-externals/subversion/libsvn_subr/io.c
subversion/branches/pin-externals/subversion/libsvn_subr/string.c
subversion/branches/pin-externals/subversion/libsvn_wc/copy.c
subversion/branches/pin-externals/subversion/libsvn_wc/diff_editor.c
subversion/branches/pin-externals/subversion/libsvn_wc/externals.c
subversion/branches/pin-externals/subversion/libsvn_wc/props.c
subversion/branches/pin-externals/subversion/libsvn_wc/update_editor.c
subversion/branches/pin-externals/subversion/libsvn_wc/wc-queries.sql
subversion/branches/pin-externals/subversion/libsvn_wc/wc_db.c
subversion/branches/pin-externals/subversion/libsvn_wc/wc_db.h
subversion/branches/pin-externals/subversion/libsvn_wc/wc_db_private.h
subversion/branches/pin-externals/subversion/libsvn_wc/wc_db_update_move.c
subversion/branches/pin-externals/subversion/svn/conflict-callbacks.c
subversion/branches/pin-externals/subversion/svn/notify.c
subversion/branches/pin-externals/subversion/svnrdump/load_editor.c
subversion/branches/pin-externals/subversion/svnsync/sync.c
subversion/branches/pin-externals/subversion/tests/cmdline/authz_tests.py
subversion/branches/pin-externals/subversion/tests/cmdline/davautocheck.sh
subversion/branches/pin-externals/subversion/tests/cmdline/externals_tests.py
subversion/branches/pin-externals/subversion/tests/cmdline/info_tests.py
subversion/branches/pin-externals/subversion/tests/cmdline/log_tests.py
subversion/branches/pin-externals/subversion/tests/cmdline/move_tests.py
subversion/branches/pin-externals/subversion/tests/cmdline/schedule_tests.py
subversion/branches/pin-externals/subversion/tests/cmdline/svnadmin_tests.py
subversion/branches/pin-externals/subversion/tests/cmdline/svndumpfilter_tests.py
subversion/branches/pin-externals/subversion/tests/cmdline/svnrdump_tests.py
subversion/branches/pin-externals/subversion/tests/cmdline/svnsync_authz_tests.py
subversion/branches/pin-externals/subversion/tests/cmdline/svnsync_tests.py
subversion/branches/pin-externals/subversion/tests/cmdline/svnsync_tests_data/mergeinfo-contains-r0.dump
subversion/branches/pin-externals/subversion/tests/cmdline/svntest/actions.py
subversion/branches/pin-externals/subversion/tests/cmdline/svntest/main.py
subversion/branches/pin-externals/subversion/tests/cmdline/svntest/sandbox.py
subversion/branches/pin-externals/subversion/tests/cmdline/svntest/testcase.py
subversion/branches/pin-externals/subversion/tests/cmdline/svntest/verify.py
subversion/branches/pin-externals/subversion/tests/libsvn_fs/locks-test.c
subversion/branches/pin-externals/subversion/tests/libsvn_fs_x/ (props
changed)
subversion/branches/pin-externals/subversion/tests/libsvn_repos/repos-test.c
subversion/branches/pin-externals/subversion/tests/libsvn_wc/conflict-data-test.c
subversion/branches/pin-externals/subversion/tests/libsvn_wc/op-depth-test.c
subversion/branches/pin-externals/subversion/tests/libsvn_wc/utils.c
subversion/branches/pin-externals/subversion/tests/libsvn_wc/utils.h
Propchange: subversion/branches/pin-externals/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 8 03:10:25 2015
@@ -11,6 +11,7 @@
/subversion/branches/diff-optimizations-bytes:1037353-1067789
/subversion/branches/dont-save-plaintext-passwords-by-default:870728-871118
/subversion/branches/double-delete:870511-872970
+/subversion/branches/dump-load-cross-check:1654853-1657295
/subversion/branches/ev2-export:1325914,1332738,1413107
/subversion/branches/explore-wc:875486,875493,875497,875507,875511,875514,875559,875580-875581,875584,875587,875611,875627,875647,875667-875668,875711-875712,875733-875734,875736,875744-875748,875751,875758,875782,875795-875796,875830,875836,875838,875842,875852,875855,875864,875870,875873,875880,875885-875888,875890,875897-875898,875905,875907-875909,875935,875943-875944,875946,875979,875982-875983,875985-875986,875990,875997
/subversion/branches/file-externals:871779-873302
@@ -86,4 +87,4 @@
/subversion/branches/verify-at-commit:1462039-1462408
/subversion/branches/verify-keep-going:1439280-1546110
/subversion/branches/wc-collate-path:1402685-1480384
-/subversion/trunk:1643755-1657123
+/subversion/trunk:1643755-1658120
Modified: subversion/branches/pin-externals/Makefile.in
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/Makefile.in?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
--- subversion/branches/pin-externals/Makefile.in (original)
+++ subversion/branches/pin-externals/Makefile.in Sun Feb 8 03:10:25 2015
@@ -529,6 +529,9 @@ check: bin @TRANSFORM_LIBTOOL_SCRIPTS@ $
if test "$(SKIP_C_TESTS)" != ""; then \
flags="--skip-c-tests $$flags"; \
fi; \
+ if test "$(DUMP_LOAD_CROSS_CHECK)" != ""; then \
+ flags="--dump-load-cross-check $$flags"; \
+ fi; \
if test "$(FS_TYPE)" != ""; then \
flags="--fs-type $(FS_TYPE) $$flags"; \
fi; \
Modified: subversion/branches/pin-externals/build/run_tests.py
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/build/run_tests.py?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
--- subversion/branches/pin-externals/build/run_tests.py (original)
+++ subversion/branches/pin-externals/build/run_tests.py Sun Feb 8 03:10:25
2015
@@ -130,7 +130,8 @@ class TestHarness:
http_proxy=None, http_proxy_username=None,
http_proxy_password=None, httpd_version=None,
exclusive_wc_locks=None,
- memcached_server=None, skip_c_tests=None):
+ memcached_server=None, skip_c_tests=None,
+ dump_load_cross_check=None):
'''Construct a TestHarness instance.
ABS_SRCDIR and ABS_BUILDDIR are the source and build directories.
@@ -193,6 +194,7 @@ class TestHarness:
if not sys.stdout.isatty() or sys.platform == 'win32':
TextColors.disable()
self.skip_c_tests = (not not skip_c_tests)
+ self.dump_load_cross_check = (not not dump_load_cross_check)
# Parse out the FSFS version number
if self.fs_type is not None and self.fs_type.startswith('fsfs-v'):
@@ -396,9 +398,11 @@ class TestHarness:
# Enable access for http
if self.base_url.startswith('http'):
- open(os.path.join(self.builddir, subdir, 'authz'), 'w').write(
- '[/]\n' +
- '* = rw\n')
+ authzparent = os.path.join(self.builddir, subdir)
+ if not os.path.exists(authzparent):
+ os.makedirs(authzparent);
+ open(os.path.join(authzparent, 'authz'), 'w').write('[/]\n'
+ '* = rw\n')
# ### Support --repos-template
if self.verbose is not None:
@@ -549,6 +553,8 @@ class TestHarness:
svntest.main.options.exclusive_wc_locks = self.exclusive_wc_locks
if self.memcached_server is not None:
svntest.main.options.memcached_server = self.memcached_server
+ if self.dump_load_cross_check is not None:
+ svntest.main.options.dump_load_cross_check = self.dump_load_cross_check
svntest.main.options.srcdir = self.srcdir
@@ -712,6 +718,7 @@ def main():
opts, args = my_getopt(sys.argv[1:], 'u:f:vc',
['url=', 'fs-type=', 'verbose', 'cleanup',
'skip-c-tests', 'skip-C-tests',
+ 'dump-load-cross-check',
'http-library=', 'server-minor-version=',
'fsfs-packing', 'fsfs-sharding=',
'enable-sasl', 'parallel=', 'config-file=',
@@ -733,10 +740,10 @@ def main():
parallel, config_file, log_to_stdout, list_tests, mode_filter, \
milestone_filter, set_log_level, ssl_cert, http_proxy, \
http_proxy_username, http_proxy_password, httpd_version, \
- exclusive_wc_locks, memcached_server = \
+ exclusive_wc_locks, memcached_server, dump_load_cross_check = \
None, None, None, None, None, None, None, None, None, None, \
None, None, None, None, None, None, None, None, None, None, \
- None, None, None, None,
+ None, None, None, None, None
for opt, val in opts:
if opt in ['-u', '--url']:
base_url = val
@@ -756,6 +763,8 @@ def main():
cleanup = 1
elif opt in ['--skip-c-tests', '--skip-C-tests']:
skip_c_tests = 1
+ elif opt in ['--dump-load-cross-check']:
+ dump_load_cross_check = 1
elif opt in ['--enable-sasl']:
enable_sasl = 1
elif opt in ['--parallel']:
@@ -808,7 +817,8 @@ def main():
httpd_version=httpd_version,
exclusive_wc_locks=exclusive_wc_locks,
memcached_server=memcached_server,
- skip_c_tests=skip_c_tests)
+ skip_c_tests=skip_c_tests,
+ dump_load_cross_check=dump_load_cross_check)
failed = th.run(args[2:])
if failed:
Propchange: subversion/branches/pin-externals/notes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 8 03:10:25 2015
@@ -3,6 +3,7 @@
/subversion/branches/diff-callbacks3/notes:870059-870761
/subversion/branches/dont-save-plaintext-passwords-by-default/notes:870728-871118
/subversion/branches/double-delete/notes:870511-872970
+/subversion/branches/dump-load-cross-check/notes:1654853-1657295
/subversion/branches/explore-wc/notes:875486,875493,875497,875507,875511,875514,875559,875580-875581,875584,875587,875611,875627,875647,875667-875668,875711-875712,875733-875734,875736,875744-875748,875751,875758,875782,875795-875796,875830,875836,875838,875842,875852,875855,875864,875870,875873,875880,875885-875888,875890,875897-875898,875905,875907-875909,875935,875943-875944,875946,875979,875982-875983,875985-875986,875990,875997
/subversion/branches/file-externals/notes:871779-873302
/subversion/branches/fs-rep-sharing/notes:869036-873803
@@ -37,4 +38,4 @@
/subversion/branches/tc_url_rev/notes:874351-874483
/subversion/branches/tree-conflicts/notes:868291-873154
/subversion/branches/tree-conflicts-notify/notes:873926-874008
-/subversion/trunk/notes:1643755-1656940
+/subversion/trunk/notes:1643755-1658120
Modified:
subversion/branches/pin-externals/subversion/bindings/cxxhl/include/svncxxhl/exception.hpp
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/bindings/cxxhl/include/svncxxhl/exception.hpp?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
---
subversion/branches/pin-externals/subversion/bindings/cxxhl/include/svncxxhl/exception.hpp
(original)
+++
subversion/branches/pin-externals/subversion/bindings/cxxhl/include/svncxxhl/exception.hpp
Sun Feb 8 03:10:25 2015
@@ -94,8 +94,8 @@ public:
/**
* Create a message object given an error code and error message.
*/
- Message(int errno, const std::string& message)
- : m_errno(errno),
+ Message(int errval, const std::string& message)
+ : m_errno(errval),
m_message(message),
m_trace(false)
{}
@@ -104,8 +104,8 @@ public:
* Create a message object given an error code and error message,
* and set the flag that tells if this is a debugging traceback entry.
*/
- Message(int errno, const std::string& message, bool trace)
- : m_errno(errno),
+ Message(int errval, const std::string& message, bool trace)
+ : m_errno(errval),
m_message(message),
m_trace(trace)
{}
Modified:
subversion/branches/pin-externals/subversion/bindings/javahl/native/AuthnCallback.cpp
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/bindings/javahl/native/AuthnCallback.cpp?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
---
subversion/branches/pin-externals/subversion/bindings/javahl/native/AuthnCallback.cpp
(original)
+++
subversion/branches/pin-externals/subversion/bindings/javahl/native/AuthnCallback.cpp
Sun Feb 8 03:10:25 2015
@@ -242,7 +242,7 @@ AuthnCallback::SSLServerCertInfo::SSLSer
svn_x509_certinfo_get_hostnames(certinfo);
if (hostnames)
{
- ::Java::MutableList< ::Java::String> hn(env, hostnames->nelts);
+ ::Java::List< ::Java::String> hn(env, hostnames->nelts);
for (int i = 0; i < hostnames->nelts; ++i)
hn.add(::Java::String(env, APR_ARRAY_IDX(hostnames, i, const char*)));
jhostnames = hn.get();
Modified:
subversion/branches/pin-externals/subversion/bindings/javahl/native/Utility.cpp
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/bindings/javahl/native/Utility.cpp?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
---
subversion/branches/pin-externals/subversion/bindings/javahl/native/Utility.cpp
(original)
+++
subversion/branches/pin-externals/subversion/bindings/javahl/native/Utility.cpp
Sun Feb 8 03:10:25 2015
@@ -52,7 +52,10 @@ public:
const char* const safe_key =
apr_pstrmemdup(m_pool, key.c_str(), key.size() + 1);
if (!value.get())
- apr_hash_set(m_hash, safe_key, key.size(), m_default);
+ {
+ if (m_default != NULL)
+ apr_hash_set(m_hash, safe_key, key.size(), m_default);
+ }
else
{
Java::ByteArray::Contents val(value);
@@ -70,20 +73,22 @@ private:
apr_hash_t* const m_hash;
const svn_string_t* const m_default;
};
+
+typedef ::Java::ImmutableMap< ::Java::ByteArray, jbyteArray>
ImmutableByteArrayMap;
} // anonymous namespace
apr_hash_t*
make_keyword_hash(::Java::Env env, jobject jkeywords, apr_pool_t* pool)
{
const svn_string_t* const empty = svn_string_create_empty(pool);
- const ::Java::Map< ::Java::ByteArray, jbyteArray> keywords(env, jkeywords);
+ const ImmutableByteArrayMap keywords(env, jkeywords);
return keywords.for_each(MapToHashIteration(empty, pool)).get();
}
apr_hash_t*
make_property_hash(::Java::Env env, jobject jproperties, apr_pool_t* pool)
{
- const ::Java::Map< ::Java::ByteArray, jbyteArray> props(env, jproperties);
+ const ImmutableByteArrayMap props(env, jproperties);
return props.for_each(MapToHashIteration(NULL, pool)).get();
}
Modified:
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
---
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp
(original)
+++
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp
Sun Feb 8 03:10:25 2015
@@ -325,6 +325,7 @@ const char* const OutOfMemoryError::m_cl
const char* const IndexOutOfBoundsException::m_class_name =
"java/lang/IndexOutOfBoundsException";
+IndexOutOfBoundsException::ClassImpl::~ClassImpl() {}
const char* const IOException::m_class_name =
"java/io/IOException";
@@ -332,6 +333,10 @@ const char* const IOException::m_class_n
const char* const IllegalArgumentException::m_class_name =
"java/lang/IllegalArgumentException";
+const char *const NoSuchElementException::m_class_name =
+ "java/util/NoSuchElementException";
+NoSuchElementException::ClassImpl::~ClassImpl() {}
+
// Implementation of jni_stack.hpp
void handle_svn_error(Env env, ::svn_error_t* err)
Modified:
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_class_cache.cpp
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_class_cache.cpp?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
---
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_class_cache.cpp
(original)
+++
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_class_cache.cpp
Sun Feb 8 03:10:25 2015
@@ -163,14 +163,20 @@ class ClassCacheImpl
return pimpl; \
}
- JNIWRAPPER_DEFINE_CACHED_CLASS(list, BaseList);
- JNIWRAPPER_DEFINE_CACHED_CLASS(array_list, BaseMutableList);
-
- JNIWRAPPER_DEFINE_CACHED_CLASS(map, BaseMap);
- JNIWRAPPER_DEFINE_CACHED_CLASS(set, BaseMap::Set);
- JNIWRAPPER_DEFINE_CACHED_CLASS(iterator, BaseMap::Iterator);
- JNIWRAPPER_DEFINE_CACHED_CLASS(map_entry, BaseMap::Entry);
- JNIWRAPPER_DEFINE_CACHED_CLASS(hash_map, BaseMutableMap);
+ JNIWRAPPER_DEFINE_CACHED_CLASS(exc_index_out_of_bounds,
+ IndexOutOfBoundsException);
+ JNIWRAPPER_DEFINE_CACHED_CLASS(exc_no_such_element,
+ NoSuchElementException);
+
+ JNIWRAPPER_DEFINE_CACHED_CLASS(iterator, BaseIterator);
+
+ JNIWRAPPER_DEFINE_CACHED_CLASS(list, BaseImmutableList);
+ JNIWRAPPER_DEFINE_CACHED_CLASS(array_list, BaseList);
+
+ JNIWRAPPER_DEFINE_CACHED_CLASS(map, BaseImmutableMap);
+ JNIWRAPPER_DEFINE_CACHED_CLASS(set, BaseImmutableMap::Set);
+ JNIWRAPPER_DEFINE_CACHED_CLASS(map_entry, BaseImmutableMap::Entry);
+ JNIWRAPPER_DEFINE_CACHED_CLASS(hash_map, BaseMap);
JNIWRAPPER_DEFINE_CACHED_CLASS(input_stream, InputStream);
JNIWRAPPER_DEFINE_CACHED_CLASS(output_stream, OutputStream);
@@ -279,6 +285,9 @@ JNIWRAPPER_IMPL_CLASS_CACHE_ACCESSOR(cla
JNIWRAPPER_IMPL_CLASS_CACHE_ACCESSOR(throwable);
JNIWRAPPER_IMPL_CLASS_CACHE_ACCESSOR(string);
+JNIWRAPPER_IMPL_CLASS_CACHE_ACCESSOR(exc_index_out_of_bounds);
+JNIWRAPPER_IMPL_CLASS_CACHE_ACCESSOR(exc_no_such_element);
+
JNIWRAPPER_IMPL_CLASS_CACHE_ACCESSOR(list);
JNIWRAPPER_IMPL_CLASS_CACHE_ACCESSOR(array_list);
Modified:
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_exception.hpp
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_exception.hpp?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
---
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_exception.hpp
(original)
+++
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_exception.hpp
Sun Feb 8 03:10:25 2015
@@ -264,6 +264,23 @@ public:
{}
private:
+ /**
+ * This object's implementation details.
+ */
+ class ClassImpl : public Object::ClassImpl
+ {
+ friend class ClassCacheImpl;
+
+ protected:
+ explicit ClassImpl(Env env, jclass cls)
+ : Object::ClassImpl(env, cls)
+ {}
+
+ public:
+ virtual ~ClassImpl();
+ };
+
+ friend class ClassCacheImpl;
static const char* const m_class_name;
};
@@ -305,6 +322,43 @@ private:
static const char* const m_class_name;
};
+/**
+ * Generator class for exceptions of type
+ * @c java.util.NoSuchElementException.
+ *
+ * @since New in 1.9.
+ */
+class NoSuchElementException : public Exception
+{
+public:
+ /**
+ * Constructs an exception generator object.
+ */
+ explicit NoSuchElementException(Env env)
+ : Exception(env, m_class_name)
+ {}
+
+private:
+ /**
+ * This object's implementation details.
+ */
+ class ClassImpl : public Object::ClassImpl
+ {
+ friend class ClassCacheImpl;
+
+ protected:
+ explicit ClassImpl(Env env, jclass cls)
+ : Object::ClassImpl(env, cls)
+ {}
+
+ public:
+ virtual ~ClassImpl();
+ };
+
+ friend class ClassCacheImpl;
+ static const char* const m_class_name;
+};
+
} // namespace Java
-#endif // SVN_JAVAHL_JNIWRAPPER_ENV_HPP
+#endif // SVN_JAVAHL_JNIWRAPPER_EXCEPTION_HPP
Modified:
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_list.cpp
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_list.cpp?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
---
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_list.cpp
(original)
+++
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_list.cpp
Sun Feb 8 03:10:25 2015
@@ -21,54 +21,65 @@
* @endcopyright
*/
+#include <stdexcept>
+#include <string>
+
#include "jni_list.hpp"
+#include "svn_private_config.h"
+
namespace Java {
-// Class Java::BaseList
+// Class Java::BaseImmutableList
-const char* const BaseList::m_class_name = "java/util/List";
+const char* const BaseImmutableList::m_class_name = "java/util/List";
-BaseList::ClassImpl::ClassImpl(Env env, jclass cls)
+BaseImmutableList::ClassImpl::ClassImpl(Env env, jclass cls)
: Object::ClassImpl(env, cls),
m_mid_size(env.GetMethodID(cls, "size", "()I")),
- m_mid_get(env.GetMethodID(cls, "get", "(I)Ljava/lang/Object;"))
+ m_mid_get(env.GetMethodID(cls, "get", "(I)Ljava/lang/Object;")),
+ m_mid_add(env.GetMethodID(cls, "add", "(Ljava/lang/Object;)Z")),
+ m_mid_clear(env.GetMethodID(cls, "clear", "()V")),
+ m_mid_iter(env.GetMethodID(cls, "listIterator",
"()Ljava/util/ListIterator;"))
{}
-BaseList::ClassImpl::~ClassImpl() {}
+BaseImmutableList::ClassImpl::~ClassImpl() {}
-BaseList::ovector
-BaseList::convert_to_vector(Env env, jobject jlist)
+jobject BaseImmutableList::operator[](jint index) const
{
- const ClassImpl* pimpl =
- dynamic_cast<const ClassImpl*>(ClassCache::get_list(env));
- const jint length = env.CallIntMethod(jlist, pimpl->m_mid_size);
-
- if (!length)
- return ovector();
-
- ovector contents(length);
- ovector::iterator it;
- jint i;
- for (i = 0, it = contents.begin(); it != contents.end(); ++it, ++i)
- *it = env.CallObjectMethod(jlist, pimpl->m_mid_get, i);
- return contents;
+ try
+ {
+ return m_env.CallObjectMethod(m_jthis, impl().m_mid_get, index);
+ }
+ catch (const SignalExceptionThrown&)
+ {
+ // Just rethrow if it's not an IndexOutOfBoundsException.
+ if (!m_env.IsInstanceOf(
+ m_env.ExceptionOccurred(),
+ ClassCache::get_exc_index_out_of_bounds(m_env)->get_class()))
+ throw;
+
+ m_env.ExceptionClear();
+ std::string msg(_("List index out of bounds: "));
+ msg += index;
+ throw std::out_of_range(msg.c_str());
+ }
}
+BaseImmutableList::Iterator BaseImmutableList::get_iterator() const
+{
+ return Iterator(m_env, m_env.CallObjectMethod(m_jthis, impl().m_mid_iter));
+}
-// Class Java::BaseMutableList
+// Class Java::BaseList
-const char* const BaseMutableList::m_class_name = "java/util/ArrayList";
+const char* const BaseList::m_class_name = "java/util/ArrayList";
-BaseMutableList::ClassImpl::ClassImpl(Env env, jclass cls)
- : Object::ClassImpl(env, cls),
- m_mid_ctor(env.GetMethodID(cls, "<init>", "(I)V")),
- m_mid_add(env.GetMethodID(cls, "add", "(Ljava/lang/Object;)Z")),
- m_mid_clear(env.GetMethodID(cls, "clear", "()V")),
- m_mid_get(env.GetMethodID(cls, "get", "(I)Ljava/lang/Object;")),
- m_mid_size(env.GetMethodID(cls, "size", "()I"))
+BaseList::ClassImpl::ClassImpl(Env env, jclass cls)
+ : BaseImmutableList::ClassImpl(env, cls),
+ m_mid_ctor(env.GetMethodID(cls, "<init>", "(I)V"))
{}
-BaseMutableList::ClassImpl::~ClassImpl() {}
+BaseList::ClassImpl::~ClassImpl() {}
} // namespace Java
Modified:
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_list.hpp
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_list.hpp?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
---
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_list.hpp
(original)
+++
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_list.hpp
Sun Feb 8 03:10:25 2015
@@ -24,56 +24,89 @@
#ifndef SVN_JAVAHL_JNIWRAPPER_LIST_HPP
#define SVN_JAVAHL_JNIWRAPPER_LIST_HPP
-#include <algorithm>
-#include <vector>
-
#include "jni_env.hpp"
#include "jni_object.hpp"
+#include "jni_iterator.hpp"
namespace Java {
/**
* Non-template base for an immutable type-safe Java list.
*
- * Converts the list to a @c std::vector of @c jobject references.
- *
* @since New in 1.9.
*/
-class BaseList : public Object
+class BaseImmutableList : public Object
{
- typedef std::vector<jobject> ovector;
-
public:
/**
* Returns the number of elements in the list.
*/
jint length() const
{
- return jint(m_contents.size());
+ return m_env.CallIntMethod(m_jthis, impl().m_mid_size);
+ }
+
+ /**
+ * Checks if the list is empty.
+ */
+ bool is_empty() const
+ {
+ return (length() == 0);
}
protected:
/**
- * Constructs the list wrapper, converting the contents to an
- * @c std::vector.
+ * Constructs the list wrapper
*/
- explicit BaseList(Env env, jobject jlist)
- : Object(env, ClassCache::get_list(env), jlist),
- m_contents(convert_to_vector(env, m_jthis))
+ explicit BaseImmutableList(Env env, jobject jlist)
+ : Object(env, ClassCache::get_list(env), jlist)
{}
/**
- * Returns the object reference at @a index.
- * @throw std::out_of_range if the index value is not valid.
+ * Constructor used by BaseList
*/
- jobject operator[](jint index) const
+ explicit BaseImmutableList(Env env, const Object::ClassImpl* pimpl)
+ : Object(env, pimpl)
+ {}
+
+ /**
+ * Clears the contents of the list.
+ */
+ void clear()
{
- return m_contents[ovector::size_type(index)];
+ m_env.CallVoidMethod(m_jthis, impl().m_mid_clear);
}
- const ovector m_contents;
+ /**
+ * Appends @a obj to the end of the list.
+ */
+ void add(jobject obj)
+ {
+ m_env.CallVoidMethod(m_jthis, impl().m_mid_add, obj);
+ }
+
+ /**
+ * Returns the object reference at @a index.
+ * @throw std::out_of_range if the index value is not valid.
+ */
+ jobject operator[](jint index) const;
+
+ /**
+ * Iterator used by subclasses.
+ */
+ class Iterator : public BaseIterator
+ {
+ friend class BaseImmutableList;
+ explicit Iterator(Env env, jobject jiterator)
+ : BaseIterator(env, jiterator)
+ {}
+ };
+
+ /**
+ * Returns an iterator instance.
+ */
+ Iterator get_iterator() const;
-private:
/**
* This object's implementation details.
*/
@@ -89,11 +122,15 @@ private:
const MethodID m_mid_size;
const MethodID m_mid_get;
+ const MethodID m_mid_add;
+ const MethodID m_mid_clear;
+ const MethodID m_mid_iter;
};
+private:
+ friend class Iterator;
friend class ClassCacheImpl;
static const char* const m_class_name;
- static ovector convert_to_vector(Env env, jobject jlist);
const ClassImpl& impl() const
{
@@ -107,15 +144,14 @@ private:
* @since New in 1.9.
*/
template <typename T, typename NativeT=jobject>
-class List : public BaseList
+class ImmutableList : public BaseImmutableList
{
public:
/**
- * Constructs the list wrapper, converting the contents to an
- * @c std::vector.
+ * Constructs the list wrapper.
*/
- explicit List(Env env, jobject jlist)
- : BaseList(env, jlist)
+ explicit ImmutableList(Env env, jobject jlist)
+ : BaseImmutableList(env, jlist)
{}
/**
@@ -124,7 +160,7 @@ public:
*/
T operator[](jint index) const
{
- return T(m_env, NativeT(BaseList::operator[](index)));
+ return T(m_env, NativeT(BaseImmutableList::operator[](index)));
}
/**
@@ -135,29 +171,11 @@ public:
template<typename F>
F for_each(F function) const
{
- const FunctorAdapter<F> adapter(m_env, function);
- std::for_each(m_contents.begin(), m_contents.end(), adapter);
+ Iterator iter(get_iterator());
+ while (iter.has_next())
+ function(T(m_env, NativeT(iter.next())));
return function;
}
-
-private:
- template<typename F>
- struct FunctorAdapter
- {
- explicit FunctorAdapter(const Env& env, F& function)
- : m_env(env),
- m_function(function)
- {}
-
- void operator()(const jobject& obj) const
- {
- const T item(m_env, NativeT(obj));
- m_function(item);
- }
-
- const Env& m_env;
- F& m_function;
- };
};
/**
@@ -165,7 +183,7 @@ private:
*
* @since New in 1.9.
*/
-class BaseMutableList : public Object
+class BaseList : public BaseImmutableList
{
public:
/**
@@ -173,66 +191,40 @@ public:
*/
void clear()
{
- m_env.CallVoidMethod(m_jthis, impl().m_mid_clear);
- }
-
- /**
- * Returns the number of elements in the list.
- */
- jint length() const
- {
- return m_env.CallIntMethod(m_jthis, impl().m_mid_size);
- }
-
- /**
- * Checks if the list is empty.
- */
- bool is_empty() const
- {
- return (length() == 0);
+ BaseImmutableList::clear();
}
protected:
/**
- * Constructs the list wrapper, deriving the class from @a jlist.
+ * Constructs the list wrapper, treating @a jlist as a @c java.util.List.
*/
- explicit BaseMutableList(Env env, jobject jlist)
- : Object(env, ClassCache::get_array_list(env), jlist)
+ explicit BaseList(Env env, jobject jlist)
+ : BaseImmutableList(env, jlist)
{}
/**
* Constructs and wraps an empty list of type @c java.util.ArrayList
* with initial allocation size @a length.
*/
- explicit BaseMutableList(Env env, jint length)
- : Object(env, ClassCache::get_array_list(env))
+ explicit BaseList(Env env, jint length)
+ : BaseImmutableList(env, ClassCache::get_array_list(env))
{
set_this(env.NewObject(get_class(), impl().m_mid_ctor, length));
}
-
/**
* Appends @a obj to the end of the list.
*/
void add(jobject obj)
{
- m_env.CallBooleanMethod(m_jthis, impl().m_mid_add, obj);
- }
-
- /**
- * Returns the object reference at @a index.
- * @note Throws a Java exception if the index value is not valid.
- */
- jobject operator[](jint index) const
- {
- return m_env.CallObjectMethod(m_jthis, impl().m_mid_get, index);
+ BaseImmutableList::add(obj);
}
private:
/**
* This object's implementation details.
*/
- class ClassImpl : public Object::ClassImpl
+ class ClassImpl : public BaseImmutableList::ClassImpl
{
friend class ClassCacheImpl;
@@ -243,10 +235,6 @@ private:
virtual ~ClassImpl();
const MethodID m_mid_ctor;
- const MethodID m_mid_add;
- const MethodID m_mid_clear;
- const MethodID m_mid_get;
- const MethodID m_mid_size;
};
friend class ClassCacheImpl;
@@ -264,39 +252,53 @@ private:
* @since New in 1.9.
*/
template <typename T, typename NativeT=jobject>
-class MutableList : public BaseMutableList
+class List : public BaseList
{
public:
/**
* Constructs the list wrapper, deriving the class from @a jlist.
*/
- explicit MutableList(Env env, jobject jlist)
- : BaseMutableList(env, jlist)
+ explicit List(Env env, jobject jlist)
+ : BaseList(env, jlist)
{}
/**
* Constructs and wraps an empty list of type @c java.util.ArrayList
* with initial allocation size @a length.
*/
- explicit MutableList(Env env, jint length_ = 0)
- : BaseMutableList(env, length_)
+ explicit List(Env env, jint length_ = 0)
+ : BaseList(env, length_)
{}
/**
+ * Returns a wrapper object for the object reference at @a index.
+ * @throw std::out_of_range if the index value is not valid.
+ */
+ T operator[](jint index) const
+ {
+ return T(m_env, NativeT(BaseList::operator[](index)));
+ }
+
+ /**
* Appends @a obj to the end of the list.
*/
void add(const T& obj)
{
- BaseMutableList::add(obj.get());
+ BaseList::add(obj.get());
}
/**
- * Returns a wrapper object for the object reference at @a index.
- * @note Throws a Java exception if the index value is not valid.
+ * Iterates over the items in the list, calling @a function for
+ * each item.
+ * @see std::for_each
*/
- T operator[](jint index) const
+ template<typename F>
+ F for_each(F function) const
{
- return T(m_env, NativeT(BaseMutableList::operator[](index)));
+ Iterator iter(get_iterator());
+ while (iter.has_next())
+ function(T(m_env, NativeT(iter.next())));
+ return function;
}
};
Modified:
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_object.hpp
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_object.hpp?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
---
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_object.hpp
(original)
+++
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_object.hpp
Sun Feb 8 03:10:25 2015
@@ -171,6 +171,9 @@ public:
JNIWRAPPER_DECLARE_CACHED_CLASS_ACCESSOR(throwable);
JNIWRAPPER_DECLARE_CACHED_CLASS_ACCESSOR(string);
+ JNIWRAPPER_DECLARE_CACHED_CLASS_ACCESSOR(exc_index_out_of_bounds);
+ JNIWRAPPER_DECLARE_CACHED_CLASS_ACCESSOR(exc_no_such_element);
+
JNIWRAPPER_DECLARE_CACHED_CLASS_ACCESSOR(list);
JNIWRAPPER_DECLARE_CACHED_CLASS_ACCESSOR(array_list);
Modified:
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_string_map.cpp
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_string_map.cpp?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
---
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_string_map.cpp
(original)
+++
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_string_map.cpp
Sun Feb 8 03:10:25 2015
@@ -30,123 +30,81 @@
namespace Java {
-// Class Java::BaseMap
+// Class Java::BaseImmutableMap
-const char* const BaseMap::m_class_name = "java/util/Map";
+const char* const BaseImmutableMap::m_class_name = "java/util/Map";
-BaseMap::ClassImpl::ClassImpl(Env env, jclass cls)
+BaseImmutableMap::ClassImpl::ClassImpl(Env env, jclass cls)
: Object::ClassImpl(env, cls),
+ m_mid_put(env.GetMethodID(cls, "put",
+ "(Ljava/lang/Object;Ljava/lang/Object;)"
+ "Ljava/lang/Object;")),
+ m_mid_clear(env.GetMethodID(cls, "clear", "()V")),
+ m_mid_has_key(env.GetMethodID(cls, "containsKey",
+ "(Ljava/lang/Object;)Z")),
+ m_mid_get(env.GetMethodID(cls, "get",
+ "(Ljava/lang/Object;)Ljava/lang/Object;")),
m_mid_size(env.GetMethodID(cls, "size", "()I")),
m_mid_entry_set(env.GetMethodID(cls, "entrySet", "()Ljava/util/Set;"))
{}
-BaseMap::ClassImpl::~ClassImpl() {}
-
-const char* const BaseMap::Set::m_class_name = "java/util/Set";
-
-BaseMap::Set::ClassImpl::ClassImpl(Env env, jclass cls)
- : Object::ClassImpl(env, cls),
- m_mid_iterator(env.GetMethodID(cls, "iterator",
- "()Ljava/util/Iterator;"))
-{}
-
-BaseMap::Set::ClassImpl::~ClassImpl() {}
+BaseImmutableMap::ClassImpl::~ClassImpl() {}
-const char* const BaseMap::Iterator::m_class_name = "java/util/Iterator";
+jobject BaseImmutableMap::operator[](const std::string& index) const
+{
+ const String key(m_env, index);
+ if (!m_env.CallBooleanMethod(m_jthis, impl().m_mid_has_key, key.get()))
+ {
+ std::string msg(_("Map does not contain key: "));
+ msg += index;
+ throw std::out_of_range(msg.c_str());
+ }
+ return m_env.CallObjectMethod(m_jthis, impl().m_mid_get, key.get());
+}
-BaseMap::Iterator::ClassImpl::ClassImpl(Env env, jclass cls)
- : Object::ClassImpl(env, cls),
- m_mid_has_next(env.GetMethodID(cls, "hasNext", "()Z")),
- m_mid_next(env.GetMethodID(cls, "next", "()Ljava/lang/Object;"))
-{}
+BaseImmutableMap::Iterator BaseImmutableMap::get_iterator() const
+{
+ const jobject jentry_set =
+ m_env.CallObjectMethod(m_jthis, impl().m_mid_entry_set);
+ const jobject jiterator =
+ m_env.CallObjectMethod(jentry_set, Set::impl(m_env).m_mid_iterator);
+ return Iterator(m_env, jiterator);
+}
-BaseMap::Iterator::ClassImpl::~ClassImpl() {}
+// Class Java::BaseImmutableMap::Entry
-const char* const BaseMap::Entry::m_class_name = "java/util/Map$Entry";
+const char* const BaseImmutableMap::Entry::m_class_name =
"java/util/Map$Entry";
-BaseMap::Entry::ClassImpl::ClassImpl(Env env, jclass cls)
+BaseImmutableMap::Entry::ClassImpl::ClassImpl(Env env, jclass cls)
: Object::ClassImpl(env, cls),
m_mid_get_key(env.GetMethodID(cls, "getKey", "()Ljava/lang/Object;")),
m_mid_get_value(env.GetMethodID(cls, "getValue", "()Ljava/lang/Object;"))
{}
-BaseMap::Entry::ClassImpl::~ClassImpl() {}
+BaseImmutableMap::Entry::ClassImpl::~ClassImpl() {}
+// Class Java::BaseImmutableMap::Set
-jobject BaseMap::operator[](const std::string& index) const
-{
- somap::const_iterator it = m_contents.find(index);
- if (it == m_contents.end())
- {
- std::string msg(_("Map does not contain key: "));
- msg += index;
- throw std::out_of_range(msg.c_str());
- }
- return it->second;
-}
+const char* const BaseImmutableMap::Set::m_class_name = "java/util/Set";
-BaseMap::somap BaseMap::convert_to_map(Env env, jobject jmap)
-{
- const ClassImpl* pimpl =
- dynamic_cast<const ClassImpl*>(ClassCache::get_map(env));
+BaseImmutableMap::Set::ClassImpl::ClassImpl(Env env, jclass cls)
+ : Object::ClassImpl(env, cls),
+ m_mid_iterator(env.GetMethodID(cls, "iterator",
+ "()Ljava/util/Iterator;"))
+{}
- if (!env.CallIntMethod(jmap, pimpl->m_mid_size))
- return somap();
+BaseImmutableMap::Set::ClassImpl::~ClassImpl() {}
- // Get an iterator over the map's entry set
- const jobject entries = env.CallObjectMethod(jmap, pimpl->m_mid_entry_set);
- const jobject iterator = env.CallObjectMethod(entries,
- Set::impl(env).m_mid_iterator);
-
- const Iterator::ClassImpl& iterimpl = Iterator::impl(env);
- const Entry::ClassImpl& entimpl = Entry::impl(env);
-
- // Yterate over the map, filling the native map
- somap contents;
- while (env.CallBooleanMethod(iterator, iterimpl.m_mid_has_next))
- {
- const jobject entry =
- env.CallObjectMethod(iterator, iterimpl.m_mid_next);
- const String keystr(
- env, jstring(env.CallObjectMethod(entry, entimpl.m_mid_get_key)));
- const jobject value(
- env.CallObjectMethod(entry, entimpl.m_mid_get_value));
- const String::Contents key(keystr);
- contents.insert(somap::value_type(key.c_str(), value));
- }
- return contents;
-}
-// Class Java::BaseMutableMap
+// Class Java::BaseMap
-const char* const BaseMutableMap::m_class_name = "java/util/HashMap";
+const char* const BaseMap::m_class_name = "java/util/HashMap";
-BaseMutableMap::ClassImpl::ClassImpl(Env env, jclass cls)
- : Object::ClassImpl(env, cls),
- m_mid_ctor(env.GetMethodID(cls, "<init>", "(I)V")),
- m_mid_put(env.GetMethodID(cls, "put",
- "(Ljava/lang/Object;Ljava/lang/Object;)"
- "Ljava/lang/Object;")),
- m_mid_clear(env.GetMethodID(cls, "clear", "()V")),
- m_mid_has_key(env.GetMethodID(cls, "containsKey",
- "(Ljava/lang/Object;)Z")),
- m_mid_get(env.GetMethodID(cls, "get",
- "(Ljava/lang/Object;)Ljava/lang/Object;")),
- m_mid_size(env.GetMethodID(cls, "size", "()I"))
+BaseMap::ClassImpl::ClassImpl(Env env, jclass cls)
+ : BaseImmutableMap::ClassImpl(env, cls),
+ m_mid_ctor(env.GetMethodID(cls, "<init>", "(I)V"))
{}
-BaseMutableMap::ClassImpl::~ClassImpl() {}
-
-jobject BaseMutableMap::operator[](const std::string& index) const
-{
- const String key(m_env, index);
- if (!m_env.CallBooleanMethod(m_jthis, impl().m_mid_has_key, key.get()))
- {
- std::string msg(_("Map does not contain key: "));
- msg += index;
- throw std::out_of_range(msg.c_str());
- }
- return m_env.CallObjectMethod(m_jthis, impl().m_mid_get, key.get());
-}
+BaseMap::ClassImpl::~ClassImpl() {}
} // namespace Java
Modified:
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_string_map.hpp
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_string_map.hpp?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
---
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_string_map.hpp
(original)
+++
subversion/branches/pin-externals/subversion/bindings/javahl/native/jniwrapper/jni_string_map.hpp
Sun Feb 8 03:10:25 2015
@@ -24,54 +24,76 @@
#ifndef SVN_JAVAHL_JNIWRAPPER_STRING_MAP_HPP
#define SVN_JAVAHL_JNIWRAPPER_STRING_MAP_HPP
-#include <map>
#include <string>
-#include <algorithm>
#include "jni_env.hpp"
#include "jni_object.hpp"
+#include "jni_iterator.hpp"
namespace Java {
/**
* Non-template base for an immutable type-safe Java map with String keys.
*
- * Converts the map to a @c std::map containing @c jobject references.
- *
* @since New in 1.9.
*/
-class BaseMap : public Object
+class BaseImmutableMap : public Object
{
- typedef std::map<std::string, jobject> somap;
-
public:
/**
* Returns the number of elements in the map.
*/
jint length() const
{
- return jint(m_contents.size());
+ return m_env.CallIntMethod(m_jthis, impl().m_mid_size);
+ }
+
+ /**
+ * Checks if the map is empty.
+ */
+ bool is_empty() const
+ {
+ return (length() == 0);
}
protected:
/**
- * Constructs the map wrapper, converting the contents to an
- * @c std::map.
+ * Constructs the map wrapper.
*/
- explicit BaseMap(Env env, jobject jmap)
- : Object(env, ClassCache::get_map(env), jmap),
- m_contents(convert_to_map(env, m_jthis))
+ explicit BaseImmutableMap(Env env, jobject jmap)
+ : Object(env, ClassCache::get_map(env), jmap)
{}
/**
+ * Constructor used by BaseMap.
+ */
+ explicit BaseImmutableMap(Env env, const Object::ClassImpl* pimpl)
+ : Object(env, pimpl)
+ {}
+
+ /**
+ * Clears the contents of the map.
+ */
+ void clear()
+ {
+ m_env.CallVoidMethod(m_jthis, impl().m_mid_clear);
+ }
+
+ /**
+ * Inserts @a obj identified by @a key into the map.
+ */
+ void put(const std::string& key, jobject obj)
+ {
+ m_env.CallObjectMethod(m_jthis, impl().m_mid_put,
+ String(m_env, key).get(), obj);
+ }
+
+ /**
* Returns the object reference identified by @a index.
* @throw std::out_of_range if there is no such element.
*/
jobject operator[](const std::string& index) const;
- const somap m_contents;
-
-private:
/**
* This object's implementation details.
*/
@@ -85,6 +107,10 @@ private:
public:
virtual ~ClassImpl();
+ const MethodID m_mid_put;
+ const MethodID m_mid_clear;
+ const MethodID m_mid_has_key;
+ const MethodID m_mid_get;
const MethodID m_mid_size;
const MethodID m_mid_entry_set;
};
@@ -96,35 +122,38 @@ private:
friend class ClassCacheImpl;
static const char* const m_class_name;
- static somap convert_to_map(Env env, jobject jmap);
- struct Set
+ class Iterator : public BaseIterator
{
- /**
- * This object's implementation details.
- */
- class ClassImpl : public Object::ClassImpl
- {
- friend class ClassCacheImpl;
+ friend class BaseImmutableMap;
+ explicit Iterator(Env env, jobject jiterator)
+ : BaseIterator(env, jiterator)
+ {}
+ };
- protected:
- explicit ClassImpl(Env env, jclass cls);
+ Iterator get_iterator() const;
- public:
- virtual ~ClassImpl();
+ class Entry : public Object
+ {
+ public:
+ explicit Entry(Env env, jobject jentry)
+ : Object(env, ClassCache::get_map_entry(env), jentry)
+ {}
- const MethodID m_mid_iterator;
- };
+ const std::string key() const
+ {
+ const jstring jkey =
+ jstring(m_env.CallObjectMethod(m_jthis, impl().m_mid_get_key));
+ const String::Contents key(String(m_env, jkey));
+ return std::string(key.c_str());
+ }
- static const char* const m_class_name;
- static const ClassImpl& impl(Env env)
+ jobject value() const
{
- return *dynamic_cast<const ClassImpl*>(ClassCache::get_set(env));
+ return m_env.CallObjectMethod(m_jthis, impl().m_mid_get_value);
}
- };
- struct Iterator
- {
+ private:
/**
* This object's implementation details.
*/
@@ -138,18 +167,20 @@ private:
public:
virtual ~ClassImpl();
- const MethodID m_mid_has_next;
- const MethodID m_mid_next;
+ const MethodID m_mid_get_key;
+ const MethodID m_mid_get_value;
};
+ friend class ClassCacheImpl;
static const char* const m_class_name;
- static const ClassImpl& impl(Env env)
+ const ClassImpl& impl() const
{
- return *dynamic_cast<const ClassImpl*>(ClassCache::get_iterator(env));
+ return *dynamic_cast<const ClassImpl*>(m_impl);
}
};
- struct Entry
+private:
+ struct Set
{
/**
* This object's implementation details.
@@ -164,14 +195,13 @@ private:
public:
virtual ~ClassImpl();
- const MethodID m_mid_get_key;
- const MethodID m_mid_get_value;
+ const MethodID m_mid_iterator;
};
static const char* const m_class_name;
static const ClassImpl& impl(Env env)
{
- return *dynamic_cast<const ClassImpl*>(ClassCache::get_map_entry(env));
+ return *dynamic_cast<const ClassImpl*>(ClassCache::get_set(env));
}
};
};
@@ -182,15 +212,15 @@ private:
* @since New in 1.9.
*/
template <typename T, typename NativeT=jobject>
-class Map : public BaseMap
+class ImmutableMap : public BaseImmutableMap
{
public:
/**
* Constructs the map wrapper, converting the contents to an
* @c std::map.
*/
- explicit Map(Env env, jobject jmap)
- : BaseMap(env, jmap)
+ explicit ImmutableMap(Env env, jobject jmap)
+ : BaseImmutableMap(env, jmap)
{}
/**
@@ -199,7 +229,7 @@ public:
*/
T operator[](const std::string& index) const
{
- return T(m_env, NativeT(BaseMap::operator[](index)));
+ return T(m_env, NativeT(BaseImmutableMap::operator[](index)));
}
/**
@@ -207,37 +237,22 @@ public:
* each item.
* @see std::for_each
* @note Unlike std::for_each, which invokes the functor with a
- * single @c value_type argument, this iterator adapts it to cal
- * @a function with separate @c const references to the key and
- * value.
+ * single @c value_type argument, this iterator calls
+ * @a function with separate @c const references to the key
+ * and value.
*/
template<typename F>
F for_each(F function) const
{
- const FunctorAdapter<F> adapter(m_env, function);
- std::for_each(m_contents.begin(), m_contents.end(), adapter);
+ Iterator iter(get_iterator());
+ while (iter.has_next())
+ {
+ Entry entry(m_env, iter.next());
+ const std::string& key(entry.key());
+ function(key, T(m_env, NativeT(entry.value())));
+ }
return function;
}
-
-private:
- template<typename F>
- struct FunctorAdapter
- {
- explicit FunctorAdapter(const Env& env, F& function)
- : m_env(env),
- m_function(function)
- {}
-
- void operator()(const std::pair<std::string, jobject>& item) const
- {
- const std::string& key(item.first);
- const T value(m_env, NativeT(item.second));
- m_function(key, value);
- }
-
- const Env& m_env;
- F& m_function;
- };
};
/**
@@ -245,7 +260,7 @@ private:
*
* @since New in 1.9.
*/
-class BaseMutableMap : public Object
+class BaseMap : public BaseImmutableMap
{
public:
/**
@@ -253,64 +268,32 @@ public:
*/
void clear()
{
- m_env.CallVoidMethod(m_jthis, impl().m_mid_clear);
- }
-
- /**
- * Returns the number of elements in the map.
- */
- jint length() const
- {
- return m_env.CallIntMethod(m_jthis, impl().m_mid_size);
- }
-
- /**
- * Checks if the map is empty.
- */
- bool is_empty() const
- {
- return (length() == 0);
+ BaseImmutableMap::clear();
}
protected:
/**
- * Constructs the map wrapper, deriving the class from @a jmap.
+ * Constructs the map wrapper, treating @a jmap as a @c java.util.Map.
*/
- explicit BaseMutableMap(Env env, jobject jmap)
- : Object(env, ClassCache::get_hash_map(env), jmap)
+ explicit BaseMap(Env env, jobject jmap)
+ : BaseImmutableMap(env, jmap)
{}
/**
* Constructs and wraps an empty map of type @c java.util.HashMap
* with initial allocation size @a length.
*/
- explicit BaseMutableMap(Env env, jint length)
- : Object(env, ClassCache::get_hash_map(env))
+ explicit BaseMap(Env env, jint length)
+ : BaseImmutableMap(env, ClassCache::get_hash_map(env))
{
set_this(env.NewObject(get_class(), impl().m_mid_ctor, length));
}
-
- /**
- * Inserts @a obj identified by @a key into the map.
- */
- void put(const std::string& key, jobject obj)
- {
- m_env.CallObjectMethod(m_jthis, impl().m_mid_put,
- String(m_env, key).get(), obj);
- }
-
- /**
- * Returns the object reference identified by @a index.
- * @throw std::out_of_range if there is no such element.
- */
- jobject operator[](const std::string& index) const;
-
private:
/**
* This object's implementation details.
*/
- class ClassImpl : public Object::ClassImpl
+ class ClassImpl : public BaseImmutableMap::ClassImpl
{
friend class ClassCacheImpl;
@@ -321,11 +304,6 @@ private:
virtual ~ClassImpl();
const MethodID m_mid_ctor;
- const MethodID m_mid_put;
- const MethodID m_mid_clear;
- const MethodID m_mid_has_key;
- const MethodID m_mid_get;
- const MethodID m_mid_size;
};
const ClassImpl& impl() const
@@ -343,22 +321,22 @@ private:
* @since New in 1.9.
*/
template <typename T, typename NativeT=jobject>
-class MutableMap : public BaseMutableMap
+class Map : public BaseMap
{
public:
/**
* Constructs the map wrapper, deriving the class from @a jmap.
*/
- explicit MutableMap(Env env, jobject jmap)
- : BaseMutableMap(env, jmap)
+ explicit Map(Env env, jobject jmap)
+ : BaseMap(env, jmap)
{}
/**
* Constructs and wraps an empty map of type @c java.util.HashMap
* with initial allocation size @a length.
*/
- explicit MutableMap(Env env, jint length = 0)
- : BaseMutableMap(env, length)
+ explicit Map(Env env, jint length = 0)
+ : BaseMap(env, length)
{}
/**
@@ -366,7 +344,7 @@ public:
*/
void put(const std::string& key, const T& obj)
{
- BaseMutableMap::put(key, obj.get());
+ BaseMap::put(key, obj.get());
}
/**
@@ -375,7 +353,29 @@ public:
*/
T operator[](const std::string& index) const
{
- return T(m_env, NativeT(BaseMutableMap::operator[](index)));
+ return T(m_env, NativeT(BaseMap::operator[](index)));
+ }
+
+ /**
+ * Iterates over the items in the map, calling @a function for
+ * each item.
+ * @see std::for_each
+ * @note Unlike std::for_each, which invokes the functor with a
+ * single @c value_type argument, this iterator calls
+ * @a function with separate @c const references to the key
+ * and value.
+ */
+ template<typename F>
+ F for_each(F function) const
+ {
+ Iterator iter(get_iterator());
+ while (iter.has_next())
+ {
+ Entry entry(m_env, iter.next());
+ const std::string& key(entry.key());
+ function(key, T(m_env, NativeT(entry.value())));
+ }
+ return function;
}
};
Modified:
subversion/branches/pin-externals/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
---
subversion/branches/pin-externals/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp
(original)
+++
subversion/branches/pin-externals/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp
Sun Feb 8 03:10:25 2015
@@ -343,7 +343,7 @@ Java_org_apache_subversion_javahl_util_C
const char* const m_text_pattern;
const ::Java::Env m_env;
- ::Java::MutableList<JavaHL::Credential> m_credentials;
+ ::Java::List<JavaHL::Credential> m_credentials;
bool match_array(const char* pattern,
const apr_array_header_t* hostnames)
Modified:
subversion/branches/pin-externals/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.cpp
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.cpp?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
---
subversion/branches/pin-externals/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.cpp
(original)
+++
subversion/branches/pin-externals/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.cpp
Sun Feb 8 03:10:25 2015
@@ -291,7 +291,7 @@ Java_org_apache_subversion_javahl_util_P
pool.getPool()));
}
- Java::MutableList<JavaHL::ExternalItem> items(env, externals->nelts);
+ Java::List<JavaHL::ExternalItem> items(env, externals->nelts);
for (jint i = 0; i < externals->nelts; ++i)
{
// References to the newly created external items are stored
@@ -323,7 +323,7 @@ Java_org_apache_subversion_javahl_util_P
{
const Java::Env env(jenv);
- const Java::List<JavaHL::ExternalItem> items(env, jitems);
+ const Java::ImmutableList<JavaHL::ExternalItem> items(env, jitems);
const Java::String parent_dir(env, jparent_dir);
// Using a "global" iteration pool since we don't keep a context
Modified:
subversion/branches/pin-externals/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_SubstLib.cpp
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_SubstLib.cpp?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
---
subversion/branches/pin-externals/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_SubstLib.cpp
(original)
+++
subversion/branches/pin-externals/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_SubstLib.cpp
Sun Feb 8 03:10:25 2015
@@ -118,6 +118,8 @@ Java_org_apache_subversion_javahl_util_S
jstring jurl, jstring jrepos_root_url,
jobject jdate, jstring jauthor)
{
+ typedef Java::Map<Java::ByteArray, jbyteArray> ByteArrayMap;
+
SVN_JAVAHL_JNI_TRY(SubstLib, buildKeywords)
{
const Java::Env env(jenv);
@@ -130,8 +132,7 @@ Java_org_apache_subversion_javahl_util_S
env, pool, jkeywords_value, jrevision,
jurl, jrepos_root_url, jdate, jauthor);
- Java::MutableMap<Java::ByteArray, jbyteArray>
- keywords(env, jint(apr_hash_count(kw)));
+ ByteArrayMap keywords(env, jint(apr_hash_count(kw)));
for (apr_hash_index_t* hi = apr_hash_first(pool.getPool(), kw);
hi; hi = apr_hash_next(hi))
{
Modified:
subversion/branches/pin-externals/subversion/include/private/svn_auth_private.h
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/include/private/svn_auth_private.h?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
---
subversion/branches/pin-externals/subversion/include/private/svn_auth_private.h
(original)
+++
subversion/branches/pin-externals/subversion/include/private/svn_auth_private.h
Sun Feb 8 03:10:25 2015
@@ -231,6 +231,14 @@ svn_auth__ssl_client_cert_pw_set(svn_boo
svn_boolean_t non_interactive,
apr_pool_t *pool);
+/* Apply the specified configuration for connecting with SERVER_NAME
+ to the auth baton */
+svn_error_t *
+svn_auth__apply_config_for_server(svn_auth_baton_t *ab,
+ apr_hash_t *config,
+ const char *server_name,
+ apr_pool_t *scratch_pool);
+
#if (defined(WIN32) && !defined(__MINGW32__)) || defined(DOXYGEN)
/**
* Set @a *provider to an authentication provider that implements
Modified: subversion/branches/pin-externals/subversion/include/svn_string.h
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/include/svn_string.h?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/include/svn_string.h (original)
+++ subversion/branches/pin-externals/subversion/include/svn_string.h Sun Feb
8 03:10:25 2015
@@ -170,7 +170,11 @@ svn_string_createv(apr_pool_t *pool, con
svn_boolean_t
svn_string_isempty(const svn_string_t *str);
-/** Return a duplicate of @a original_string. */
+/** Return a duplicate of @a original_string.
+ *
+ * @since Since 1.9, @a original_string can be NULL in which case NULL will
+ * be returned.
+ */
svn_string_t *
svn_string_dup(const svn_string_t *original_string, apr_pool_t *pool);
Modified: subversion/branches/pin-externals/subversion/libsvn_client/mtcc.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_client/mtcc.c?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/libsvn_client/mtcc.c (original)
+++ subversion/branches/pin-externals/subversion/libsvn_client/mtcc.c Sun Feb
8 03:10:25 2015
@@ -710,8 +710,7 @@ mtcc_prop_getter(const svn_string_t **mi
if (! strcmp(mod->name, SVN_PROP_MIME_TYPE))
{
- *mime_type = mod->value ? svn_string_dup(mod->value, pool)
- : NULL;
+ *mime_type = svn_string_dup(mod->value, pool);
mime_type = NULL;
}
}
Modified:
subversion/branches/pin-externals/subversion/libsvn_client/repos_diff.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_client/repos_diff.c?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/libsvn_client/repos_diff.c
(original)
+++ subversion/branches/pin-externals/subversion/libsvn_client/repos_diff.c Sun
Feb 8 03:10:25 2015
@@ -1162,7 +1162,7 @@ change_file_prop(void *file_baton,
propchange = apr_array_push(fb->propchanges);
propchange->name = apr_pstrdup(fb->pool, name);
- propchange->value = value ? svn_string_dup(value, fb->pool) : NULL;
+ propchange->value = svn_string_dup(value, fb->pool);
return SVN_NO_ERROR;
}
@@ -1192,7 +1192,7 @@ change_dir_prop(void *dir_baton,
propchange = apr_array_push(db->propchanges);
propchange->name = apr_pstrdup(db->pool, name);
- propchange->value = value ? svn_string_dup(value, db->pool) : NULL;
+ propchange->value = svn_string_dup(value, db->pool);
return SVN_NO_ERROR;
}
Modified: subversion/branches/pin-externals/subversion/libsvn_fs/fs-loader.h
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs/fs-loader.h?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/libsvn_fs/fs-loader.h
(original)
+++ subversion/branches/pin-externals/subversion/libsvn_fs/fs-loader.h Sun Feb
8 03:10:25 2015
@@ -548,7 +548,8 @@ struct svn_fs_access_t
const char *username;
/* A collection of lock-tokens supplied by the fs caller.
- Hash maps (const char *) UUID --> (void *) 1
+ Hash maps (const char *) UUID --> path where path can be the
+ magic value (void *) 1 if no path was specified.
fs functions should really only be interested whether a UUID
exists as a hash key at all; the value is irrelevant. */
apr_hash_t *lock_tokens;
Modified: subversion/branches/pin-externals/subversion/libsvn_fs_base/tree.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs_base/tree.c?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/libsvn_fs_base/tree.c
(original)
+++ subversion/branches/pin-externals/subversion/libsvn_fs_base/tree.c Sun Feb
8 03:10:25 2015
@@ -1237,7 +1237,7 @@ base_node_prop(svn_string_t **value_p,
args.propname = propname;
SVN_ERR(svn_fs_base__retry_txn(root->fs, txn_body_node_prop, &args,
FALSE, scratch_pool));
- *value_p = value ? svn_string_dup(value, pool) : NULL;
+ *value_p = svn_string_dup(value, pool);
svn_pool_destroy(scratch_pool);
return SVN_NO_ERROR;
}
Modified:
subversion/branches/pin-externals/subversion/libsvn_fs_fs/cached_data.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs_fs/cached_data.c?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/libsvn_fs_fs/cached_data.c
(original)
+++ subversion/branches/pin-externals/subversion/libsvn_fs_fs/cached_data.c Sun
Feb 8 03:10:25 2015
@@ -2460,7 +2460,7 @@ get_dir_contents(apr_array_header_t **en
changes we've made in this transaction. */
SVN_ERR(svn_stream_open_readonly(&contents, filename, scratch_pool,
scratch_pool));
- SVN_ERR(read_dir_entries(*entries, contents, TRUE, noderev->id,
+ SVN_ERR(read_dir_entries(*entries, contents, TRUE, noderev->id,
result_pool, scratch_pool));
SVN_ERR(svn_stream_close(contents));
}
@@ -2524,7 +2524,7 @@ locate_dir_cache(svn_fs_t *fs,
A NULL key causes a cache miss. */
*key = NULL;
}
-
+
return ffd->dir_cache;
}
}
Modified: subversion/branches/pin-externals/subversion/libsvn_fs_fs/index.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs_fs/index.c?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/libsvn_fs_fs/index.c (original)
+++ subversion/branches/pin-externals/subversion/libsvn_fs_fs/index.c Sun Feb
8 03:10:25 2015
@@ -1833,7 +1833,7 @@ svn_fs_fs__p2l_proto_index_open(apr_file
svn_error_t *
svn_fs_fs__p2l_proto_index_add_entry(apr_file_t *proto_index,
- svn_fs_fs__p2l_entry_t *entry,
+ const svn_fs_fs__p2l_entry_t *entry,
apr_pool_t *scratch_pool)
{
apr_uint64_t revision;
Modified: subversion/branches/pin-externals/subversion/libsvn_fs_fs/index.h
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs_fs/index.h?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/libsvn_fs_fs/index.h (original)
+++ subversion/branches/pin-externals/subversion/libsvn_fs_fs/index.h Sun Feb
8 03:10:25 2015
@@ -113,7 +113,7 @@ svn_fs_fs__p2l_proto_index_open(apr_file
*/
svn_error_t *
svn_fs_fs__p2l_proto_index_add_entry(apr_file_t *proto_index,
- svn_fs_fs__p2l_entry_t *entry,
+ const svn_fs_fs__p2l_entry_t *entry,
apr_pool_t *scratch_pool);
/* Set *NEXT_OFFSET to the first offset behind the last entry in the
Modified: subversion/branches/pin-externals/subversion/libsvn_fs_fs/lock.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs_fs/lock.c?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/libsvn_fs_fs/lock.c (original)
+++ subversion/branches/pin-externals/subversion/libsvn_fs_fs/lock.c Sun Feb 8
03:10:25 2015
@@ -853,9 +853,6 @@ lock_body(void *baton, apr_pool_t *pool)
int i, outstanding = 0;
apr_pool_t *iterpool = svn_pool_create(pool);
- lb->infos = apr_array_make(lb->result_pool, lb->targets->nelts,
- sizeof(struct lock_info_t));
-
/* Until we implement directory locks someday, we only allow locks
on files or non-existent paths. */
/* Use fs->vtable->foo instead of svn_fs_foo to avoid circular
@@ -1056,9 +1053,6 @@ unlock_body(void *baton, apr_pool_t *poo
int i, max_components = 0, outstanding = 0;
apr_pool_t *iterpool = svn_pool_create(pool);
- ub->infos = apr_array_make(ub->result_pool, ub->targets->nelts,
- sizeof(struct unlock_info_t));
-
SVN_ERR(ub->fs->vtable->youngest_rev(&youngest, ub->fs, pool));
SVN_ERR(ub->fs->vtable->revision_root(&root, ub->fs, youngest, pool));
@@ -1180,6 +1174,8 @@ unlock_single(svn_fs_t *fs,
ub.fs = fs;
ub.targets = targets;
+ ub.infos = apr_array_make(pool, targets->nelts,
+ sizeof(struct unlock_info_t));
ub.skip_check = TRUE;
ub.result_pool = pool;
@@ -1240,6 +1236,8 @@ svn_fs_fs__lock(svn_fs_t *fs,
lb.fs = fs;
lb.targets = sorted_targets;
+ lb.infos = apr_array_make(result_pool, sorted_targets->nelts,
+ sizeof(struct lock_info_t));
lb.comment = comment;
lb.is_dav_comment = is_dav_comment;
lb.expiration_date = expiration_date;
@@ -1330,6 +1328,8 @@ svn_fs_fs__unlock(svn_fs_t *fs,
ub.fs = fs;
ub.targets = sorted_targets;
+ ub.infos = apr_array_make(result_pool, sorted_targets->nelts,
+ sizeof(struct unlock_info_t));
ub.skip_check = FALSE;
ub.break_lock = break_lock;
ub.result_pool = result_pool;
Propchange: subversion/branches/pin-externals/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 8 03:10:25 2015
@@ -10,6 +10,7 @@
/subversion/branches/diff-optimizations-bytes/subversion/libsvn_fs_x:1037353-1067789
/subversion/branches/dont-save-plaintext-passwords-by-default/subversion/libsvn_fs_x:870728-871118
/subversion/branches/double-delete/subversion/libsvn_fs_x:870511-872970
+/subversion/branches/dump-load-cross-check/subversion/libsvn_fs_x:1654853-1657295
/subversion/branches/ev2-export/subversion/libsvn_fs_x:1325914,1332738,1413107
/subversion/branches/explore-wc/subversion/libsvn_fs_x:875486,875493,875497,875507,875511,875514,875559,875580-875581,875584,875587,875611,875627,875647,875667-875668,875711-875712,875733-875734,875736,875744-875748,875751,875758,875782,875795-875796,875830,875836,875838,875842,875852,875855,875864,875870,875873,875880,875885-875888,875890,875897-875898,875905,875907-875909,875935,875943-875944,875946,875979,875982-875983,875985-875986,875990,875997
/subversion/branches/file-externals/subversion/libsvn_fs_x:871779-873302
@@ -88,4 +89,4 @@
/subversion/branches/verify-keep-going/subversion/libsvn_fs_x:1439280-1492639,1546002-1546110
/subversion/branches/wc-collate-path/subversion/libsvn_fs_x:1402685-1480384
/subversion/trunk/subversion/libsvn_fs_fs:1415133-1596500,1596567,1597414,1597989,1598273,1599140,1600872,1601633,1603485-1603487,1603499,1603605,1604128,1604188,1604413-1604414,1604416-1604417,1604421,1604442,1604700,1604717,1604720,1604726,1604755,1604794,1604802,1604824,1604836,1604844,1604902-1604903,1604911,1604925,1604933,1604947,1605059-1605060,1605064-1605065,1605068,1605071-1605073,1605075,1605123,1605188-1605189,1605191,1605197,1605444,1605633,1606132,1606142,1606144,1606514,1606526,1606528,1606551,1606554,1606564,1606598-1606599,1606656,1606658,1606662,1606744,1606840,1607085,1607572,1612407,1612810,1613339,1613872,1614611,1615348,1615351-1615352,1615356,1616338-1616339,1616613,1617586,1617688,1618138,1618151,1618153,1618226,1618641,1618653,1618662,1619068,1619358,1619413,1619769,1619774,1620602,1620909,1620912,1620928,1620930,1621275,1621635,1622931,1622937,1622942,1622946,1622959-1622960,1622963,1622987,1623007,1623368,1623373,1623377,1623379,1623381,1623398,1623402,162
4011,1624265,1624512,1626246,1626871,1626873,1626886,1627497-1627498,1627502,1627947-1627949,1627966,1628083,1628093,1628158-1628159,1628161,1628392-1628393,1628415,1628427,1628676,1628738,1628762,1628764,1629854-1629855,1629857,1629865,1629873,1629875,1629879,1630067,1630070,1631049-1631051,1631075,1631115,1631171,1631180,1631185-1631186,1631196-1631197,1631239-1631240,1631548,1631550,1631563,1631567,1631588,1631598,1632646,1632776,1632849,1632851-1632853,1632856-1632857,1632868,1632908,1632926,1633232,1633617-1633618,1634872,1634875,1634879-1634880,1634920,1636478,1636483,1636629,1636644,1637184,1637186,1637330,1637358,1637363,1637393,1639319,1639322,1639335,1639348,1639352,1639355,1639358,1639414,1639419,1639426,1639430,1639436,1639440,1639549,1640061-1640062,1640197,1640915,1640966,1641013,1643139,1643233,1645567,1646021,1646712,1646716,1647537,1647540-1647541,1647820,1647905,1648230,1648238,1648241-1648243,1648253,1648272,1648532,1648537-1648539,1648542,1648591,1648612,1653608
-/subversion/trunk/subversion/libsvn_fs_x:1414756-1509914,1643755-1657123
+/subversion/trunk/subversion/libsvn_fs_x:1414756-1509914,1643755-1658120
Modified: subversion/branches/pin-externals/subversion/libsvn_fs_x/dag.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs_x/dag.c?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/libsvn_fs_x/dag.c (original)
+++ subversion/branches/pin-externals/subversion/libsvn_fs_x/dag.c Sun Feb 8
03:10:25 2015
@@ -245,7 +245,8 @@ svn_error_t *
svn_fs_x__dag_get_node(dag_node_t **node,
svn_fs_t *fs,
const svn_fs_x__id_t *id,
- apr_pool_t *result_pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
dag_node_t *new_node;
svn_fs_x__noderev_t *noderev;
@@ -257,12 +258,14 @@ svn_fs_x__dag_get_node(dag_node_t **node
new_node->hint = APR_SIZE_MAX;
/* Grab the contents so we can inspect the node's kind and created path. */
+ SVN_ERR(svn_fs_x__get_node_revision(&noderev, fs, id,
+ result_pool, scratch_pool));
new_node->node_pool = result_pool;
- SVN_ERR(get_node_revision(&noderev, new_node));
+ new_node->node_revision = noderev;
/* Initialize the KIND and CREATED_PATH attributes */
new_node->kind = noderev->kind;
- new_node->created_path = apr_pstrdup(result_pool, noderev->created_path);
+ new_node->created_path = noderev->created_path;
/* Support our quirky svn_fs_node_created_rev API.
Untouched txn roots report the base rev as theirs. */
@@ -373,6 +376,12 @@ dir_entry_id_from_node(svn_fs_x__id_t *i
return svn_error_create(SVN_ERR_FS_NOT_DIRECTORY, NULL,
_("Can't get entries of non-directory"));
+ /* Make sure that NAME is a single path component. */
+ if (! svn_path_is_single_path_component(name))
+ return svn_error_createf
+ (SVN_ERR_FS_NOT_SINGLE_PATH_COMPONENT, NULL,
+ "Attempted to open node with an illegal name '%s'", name);
+
/* Get a dirent hash for this directory. */
SVN_ERR(svn_fs_x__rep_contents_dir_entry(&dirent, parent->fs, noderev,
name, &parent->hint,
@@ -469,7 +478,8 @@ make_entry(dag_node_t **child_p,
/* Create a new dag_node_t for our new node */
SVN_ERR(svn_fs_x__dag_get_node(child_p, svn_fs_x__dag_get_fs(parent),
- &new_noderev.noderev_id, result_pool));
+ &new_noderev.noderev_id, result_pool,
+ scratch_pool));
/* We can safely call set_entry because we already know that
PARENT is mutable, and we just created CHILD, so we know it has
@@ -654,27 +664,14 @@ svn_error_t *
svn_fs_x__dag_revision_root(dag_node_t **node_p,
svn_fs_t *fs,
svn_revnum_t rev,
- apr_pool_t *result_pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
- dag_node_t *new_node;
-
- /* Construct the node. */
- new_node = apr_pcalloc(result_pool, sizeof(*new_node));
- new_node->fs = fs;
- new_node->revision = rev;
- svn_fs_x__init_rev_root(&new_node->id, rev);
-
- /* Grab the contents so we can inspect the node's kind and created path. */
- new_node->node_pool = result_pool;
-
- /* Initialize the KIND and CREATED_PATH attributes */
- new_node->kind = svn_node_dir;
- new_node->created_path = "/";
- new_node->hint = APR_SIZE_MAX;
+ svn_fs_x__id_t root_id;
- /* Return a fresh new node */
- *node_p = new_node;
- return SVN_NO_ERROR;
+ svn_fs_x__init_rev_root(&root_id, rev);
+ return svn_fs_x__dag_get_node(node_p, fs, &root_id, result_pool,
+ scratch_pool);
}
@@ -682,29 +679,14 @@ svn_error_t *
svn_fs_x__dag_txn_root(dag_node_t **node_p,
svn_fs_t *fs,
svn_fs_x__txn_id_t txn_id,
- apr_pool_t *result_pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
svn_fs_x__id_t root_id;
svn_fs_x__init_txn_root(&root_id, txn_id);
- return svn_fs_x__dag_get_node(node_p, fs, &root_id, result_pool);
-}
-
-
-svn_error_t *
-svn_fs_x__dag_txn_base_root(dag_node_t **node_p,
- svn_fs_t *fs,
- svn_fs_x__txn_id_t txn_id,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- svn_fs_x__id_t base_root_id;
- svn_revnum_t base_rev;
-
- SVN_ERR(svn_fs_x__get_base_rev(&base_rev, fs, txn_id, scratch_pool));
-
- svn_fs_x__init_rev_root(&base_root_id, base_rev);
- return svn_fs_x__dag_get_node(node_p, fs, &base_root_id, result_pool);
+ return svn_fs_x__dag_get_node(node_p, fs, &root_id, result_pool,
+ scratch_pool);
}
@@ -787,22 +769,8 @@ svn_fs_x__dag_clone_child(dag_node_t **c
}
/* Initialize the youngster. */
- return svn_fs_x__dag_get_node(child_p, fs, new_node_id, result_pool);
-}
-
-
-
-svn_error_t *
-svn_fs_x__dag_clone_root(dag_node_t **root_p,
- svn_fs_t *fs,
- svn_fs_x__txn_id_t txn_id,
- apr_pool_t *result_pool)
-{
- svn_fs_x__id_t root_id;
- svn_fs_x__init_txn_root(&root_id, txn_id);
-
- /* One way or another, root_id now identifies a cloned root node. */
- return svn_fs_x__dag_get_node(root_p, fs, &root_id, result_pool);
+ return svn_fs_x__dag_get_node(child_p, fs, new_node_id, result_pool,
+ scratch_pool);
}
@@ -821,7 +789,7 @@ delete_if_mutable(svn_fs_t *fs,
dag_node_t *node;
/* Get the node. */
- SVN_ERR(svn_fs_x__dag_get_node(&node, fs, id, scratch_pool));
+ SVN_ERR(svn_fs_x__dag_get_node(&node, fs, id, scratch_pool, scratch_pool));
/* If immutable, do nothing and return immediately. */
if (! svn_fs_x__dag_check_mutable(node))
@@ -1231,15 +1199,9 @@ svn_fs_x__dag_open(dag_node_t **child_p,
return SVN_NO_ERROR;
}
- /* Make sure that NAME is a single path component. */
- if (! svn_path_is_single_path_component(name))
- return svn_error_createf
- (SVN_ERR_FS_NOT_SINGLE_PATH_COMPONENT, NULL,
- "Attempted to open node with an illegal name '%s'", name);
-
/* Now get the node that was requested. */
return svn_fs_x__dag_get_node(child_p, svn_fs_x__dag_get_fs(parent),
- &node_id, result_pool);
+ &node_id, result_pool, scratch_pool);
}
Modified: subversion/branches/pin-externals/subversion/libsvn_fs_x/dag.h
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs_x/dag.h?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/libsvn_fs_x/dag.h (original)
+++ subversion/branches/pin-externals/subversion/libsvn_fs_x/dag.h Sun Feb 8
03:10:25 2015
@@ -65,12 +65,13 @@ extern "C" {
typedef struct dag_node_t dag_node_t;
/* Fill *NODE with a dag_node_t representing node revision ID in FS,
- allocating in RESULT_POOL. */
+ allocating in RESULT_POOL. Use SCRATCH_POOL for temporaries. */
svn_error_t *
svn_fs_x__dag_get_node(dag_node_t **node,
svn_fs_t *fs,
const svn_fs_x__id_t *id,
- apr_pool_t *result_pool);
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Return a new dag_node_t object referring to the same node as NODE,
@@ -252,49 +253,24 @@ svn_fs_x__dag_set_has_mergeinfo(dag_node
/* Open the root of revision REV of filesystem FS, allocating from
- RESULT_POOL. Set *NODE_P to the new node. */
+ RESULT_POOL. Set *NODE_P to the new node. Use SCRATCH_POOL for
+ temporary allocations.*/
svn_error_t *
svn_fs_x__dag_revision_root(dag_node_t **node_p,
svn_fs_t *fs,
svn_revnum_t rev,
- apr_pool_t *result_pool);
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Set *NODE_P to the root of transaction TXN_ID in FS, allocating
- from RESULT_POOL.
-
- Note that the root node of TXN_ID is not necessarily mutable. If
- no changes have been made in the transaction, then it may share its
- root directory with its base revision. To get a mutable root node
- for a transaction, call svn_fs_x__dag_clone_root. */
+ from RESULT_POOL. Use SCRATCH_POOL for temporary allocations. */
svn_error_t *
svn_fs_x__dag_txn_root(dag_node_t **node_p,
svn_fs_t *fs,
svn_fs_x__txn_id_t txn_id,
- apr_pool_t *result_pool);
-
-
-/* Set *NODE_P to the base root of transaction TXN_ID in FS,
- allocating from RESULT_POOL. Allocate the node in TRAIL->pool.
- Use SCRATCH_POOL for temporaries. */
-svn_error_t *
-svn_fs_x__dag_txn_base_root(dag_node_t **node_p,
- svn_fs_t *fs,
- svn_fs_x__txn_id_t txn_id,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
-
-
-/* Clone the root directory of TXN_ID in FS, and update the
- `transactions' table entry to point to it, unless this has been
- done already. In either case, set *ROOT_P to a reference to the
- root directory clone. Allocate *ROOT_P in RESULT_POOL. */
-svn_error_t *
-svn_fs_x__dag_clone_root(dag_node_t **root_p,
- svn_fs_t *fs,
- svn_fs_x__txn_id_t txn_id,
- apr_pool_t *result_pool);
-
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Directories. */
Modified: subversion/branches/pin-externals/subversion/libsvn_fs_x/fs.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs_x/fs.c?rev=1658128&r1=1658127&r2=1658128&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/libsvn_fs_x/fs.c (original)
+++ subversion/branches/pin-externals/subversion/libsvn_fs_x/fs.c Sun Feb 8
03:10:25 2015
@@ -216,6 +216,23 @@ x_info(const void **fsx_info,
return SVN_NO_ERROR;
}
+/* Wrapper around svn_fs_x__revision_prop() adapting between function
+ signatures. */
+static svn_error_t *
+x_revision_prop(svn_string_t **value_p,
+ svn_fs_t *fs,
+ svn_revnum_t rev,
+ const char *propname,
+ apr_pool_t *pool)
+{
+ apr_pool_t *scratch_pool = svn_pool_create(pool);
+ SVN_ERR(svn_fs_x__revision_prop(value_p, fs, rev, propname, pool,
+ scratch_pool));
+ svn_pool_destroy(scratch_pool);
+
+ return SVN_NO_ERROR;
+}
+
/* Wrapper around svn_fs_x__get_revision_proplist() adapting between function
signatures. */
static svn_error_t *
@@ -224,9 +241,14 @@ x_revision_proplist(apr_hash_t **proplis
svn_revnum_t rev,
apr_pool_t *pool)
{
+ apr_pool_t *scratch_pool = svn_pool_create(pool);
+
/* No need to bypass the caches for r/o access to revprops. */
- return svn_error_trace(svn_fs_x__get_revision_proplist(proplist_p, fs,
- rev, FALSE, pool));
+ SVN_ERR(svn_fs_x__get_revision_proplist(proplist_p, fs, rev, FALSE,
+ pool, scratch_pool));
+ svn_pool_destroy(scratch_pool);
+
+ return SVN_NO_ERROR;
}
/* Wrapper around svn_fs_x__set_uuid() adapting between function
@@ -261,7 +283,7 @@ x_begin_txn(svn_fs_txn_t **txn_p,
/* The vtable associated with a specific open filesystem. */
static fs_vtable_t fs_vtable = {
svn_fs_x__youngest_rev,
- svn_fs_x__revision_prop,
+ x_revision_prop,
x_revision_proplist,
svn_fs_x__change_rev_prop,
x_set_uuid,