| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Bug: 15350832
Change-Id: I8d84f3e50b643806ccf01190797c69ce6445b539
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ICU can't handle the new toString forms for scripts etc.
and it's also guaranteed to deal with BCP-47 tags correctly.
Most of the changes in this patch are required to keep
backwards compatibility for getDisplayCountry string etc. in
the face of the transformations toLanguageTag performs.
A few tests were changed, but for the better.
The tagalog -> filipino charlie foxtrot will be dealt with
in a follow up change.
Co-Authored-By: Narayan Kamath <narayan@google.com>
Change-Id: Ia7f26d92a0e38c4bbb1d839c0fbd8ad16a473bf5
|
|
|
|
|
|
| |
The switch to C++11 means we have static_assert now.
Change-Id: Iaa39af8c4fa7143fc83fda550543eb3270f9f161
|
|
|
|
| |
Change-Id: Idd1aca43a2315398d52fec7c8fba8906e970d8cb
|
|
|
|
| |
Change-Id: If23ff812f5283c15aeb2ca3a5d82f685f78d540d
|
|
|
|
|
|
|
| |
Also reformat in Google C++ style and remove a couple of unnecessary #includes.
Bug: https://code.google.com/p/android/issues/detail?id=45724
Change-Id: I6d1a78b3b1f72e7015baba64811d9749f330fba7
|
|
|
|
|
|
|
|
| |
This makes writing SetObjectField() code easier.
(cherry-pick of 74adde45e60587a41d7ec8ed59f247f7c33ac6ac.)
Change-Id: Ia64d58748ce721cbdc89742c020edd22dbb694b0
|
|
|
|
| |
Change-Id: I4194810646a2a0661331aaf941fb5f99ce7758b1
|
|
|
|
| |
Change-Id: I755dc2feb90d767a1e16e98bd39f1de7681eb60c
|
|
|
|
|
|
|
|
|
|
|
|
| |
unique_ptr-like.
(cherry-pick of 1c459db4ea31c1f284353bc71bfd2dbc97ca53d7.)
Conflicts:
include/ScopedLocalRef.h
Change-Id: Id01cb907406cc93f6b0f6ddaa8e7fb3714d18c53
|
|
|
|
|
|
|
| |
(And silence the warnings in those cases where it isn't because we're working
around OpenSSL API lossage.)
Change-Id: Ibc7958373e7a899a6cd03a0177f97bf3a73c0e15
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To do this tastefully required some cunning in the native code. The new
ScopedBytesRO/ScopedBytesRW classes let us paper over the differences
between byte[] and DirectByteBuffer, which in turn lets us paper over the
differences between the various kinds of ByteBuffer.
I've also rewritten Posix.read/Posix.readDirectBuffer and
Posix.write/Posix.writeDirectBuffer to use the same idea. I haven't rewritten
readv and writev, but can do and probably should.
Bug: http://code.google.com/p/android/issues/detail?id=16184
Change-Id: Ia30d2f2fe1b1716a8f068187df2218b407a55aae
|
|
|
|
|
|
| |
This class should be usable by native code unrelated to ICU.
Change-Id: I5017a023b68b3c9d625162f3a0b2dfb7a6edbeb8
|
|
|
|
|
|
|
|
|
| |
This removes the duplicated error-checking in the ICU classes that started
this investigation, but also cleans up a bunch of other stuff. There shouldn't
be any other behavioral differences, just clearer code.
Bug: 3418769
Change-Id: I4da4d2a5b2fce1b152e527909b7c76a6db76c5c0
|
|
|
|
|
|
|
|
|
|
| |
limits.
This started with the question "are the fields in struct statfs really 64-bit?",
but grew a bit. I'll need ftruncate64 in bionic before we can kill
offsetTooLarge completely.
Change-Id: Ia1dcda49e2c93c3cb0f9efe61a70c667c1415bee
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Every thread about to block on network I/O registers its thread id and
the fd it's going to block on. In close, we scan the list and signal
every thread that's blocked on the fd we're closing. They wake up with
EINTR, see that their java.io.FileDescriptor has been invalidated (by
the close code), and infer that this EINTR is not to be retried: this
EINTR implies that they should throw.
This patch also fixes a couple of bugs in accept. We were trying (and,
obviously, failing) to reset SO_RCVTIMEO on fd -1 if the accept failed,
and then throwing an exception relating to that rather than the failed
accept(2). We were also not treating timeouts as a special case of
failure and throwing the appropriate SocketTimeoutException. (One has
to suspect that there's an errno-to-Exception function that we could
write that would work for all this native code.)
This patch also cleans up connect a little more. I've inlined doConnect
into its single caller, I've removed the bogus use of 100ms polling,
and I've rewritten the checking for success/failure to be based on the
advice in Stevens' "Unix Network Programming".
Bug: 2823977
Change-Id: I4f0cbd95be9ba25368be166008855a80c5d30845
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This style worked well for ScopedUtfChars. It moves null-pointer checking
inside the class, thereby encouraging us to remember to check for the
unlikely out-of-memory failures too.
I've also broken up some tests that were trying to check multiple scoped
arrays at once. This idiom was broken because as soon as there's a pending
exception, it's a JNI error to even attempt to set up the next scoped
primitive array. In the absence of C++ exceptions, we have to check these
one by one.
Change-Id: I2f4b397ae2873597e309d86fcc5912f3fcf0f304
|
|
|
|
| |
Change-Id: I77d9841f7112235096c54ac70479ad09f2b0559d
|
|
|
|
|
|
|
|
|
|
| |
Also rewrite PlainDatagramSocketImpl.peek in terms of existing primitives
rather than requiring its own. I still don't see how it can get called, but
at least now it doesn't require its own native code.
Bug: 2686833
Change-Id: I0453add66dab4c7095ee2a3f51a49efbd1205598
|
|
|
|
|
|
|
|
|
|
|
| |
Also switch most non-users over to ScopedUtfChars.
Also ensure all users check that ScopedUtfChars was successful in getting the
chars.
Also rewrite ObjectInputStream and ObjectOutputStream without duplication.
Change-Id: I929d00fe3ff50b303cba4a2cf2269355e9fef5f9
|
|
|
|
|
|
|
|
| |
I've left the remaining Get/Release Critical calls in "NativeConverter.cpp"
for the next patch, even though getting into position to fix them is part of
the point of this patch.
Change-Id: I99e15a3cf3919008343ae4dc856c86ced233e07a
|
|
|
|
|
|
|
| |
Even though every reference type is a jobject, it's useful to be able to use
more specific types.
Change-Id: Id8056d0e18380675c90f08c4173a8b34b4d5d983
|
|
|
|
|
|
|
|
|
|
|
| |
Get/ReleaseCritical calls.
This adds Scoped*Array classes for all primitive types, and switches all
read-only users of arrays over. At the same time, all read-only users of
Get/ReleaseCritical get switched to non-critical access.
Bug: 2663177
Change-Id: I5542cea3e24faa987ced463fcb695b9598da94af
|
|
|
|
|
|
|
|
|
|
|
| |
ScopedGlobalRef caused more trouble that it was worth. Rather than
trying to fix it to require updating of the JNIEnv, remove it to
remove the temptation for others to use it.
Also update SSL_set_ciphers_lists to use ScopedLocalRef and add HTML
anchors to Standard names javadoc JSEE references.
Change-Id: Ic3ed1bae3f29ee971d4461de31395b78c4949090
|
|
|
|
|
| |
Bug: 2672057
Change-Id: I2f31ff3b5fbbf5cf8e16c89ef78a5246c6c3733a
|
|
|
|
| |
Change-Id: I51a2cdd80e910996f3143a7b699c3d4b408d105a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
- Finished consolidating OpenSSL native code into NativeCrypto
- fixing local vs global ref bug with AppData
Added new ScopedGlobalRef as part of this fix
- fixed many historical memory leaks identified during code review
- fixed lack of error checking on allcoation with OpenSSL *_new routines
- Added to_SSL_CTX and to_SSL_SESSION to match to_SSL (renamed from getSslPointer)
- Replaced most uses of GetByteArrayElements with ScopedByteArray
(including cases where we we using ReleaseByteArrayElements(..,...,0) instead of JNI_ABORT)
- Replaced uses of GetStringUTFChars with ScopedUtfChars
Details:
Finished consolidating OpenSSL native code into NativeCrypto
OpenSSLSocketImpl NativeCrypto
---------------------------------------
nativeread SSL_read_byte
nativeread SSL_read
nativewrite SSL_write_byte
nativewrite SSL_write
nativeinterrupt SSL_interrupt
nativeclose SSL_shutdown
nativeverifysignature verifysignature
Also removed dead code that was wrapping SSL_get1_session
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/NativeCrypto.java
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java
luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp
Fixed NativeCrypto_SSL_write and NativeCrypto_d2i_SSL_SESSION to use
JNI_ABORT on release to avoid copy back of unchanged data (via ScopedByteArray).
luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp
While running the usual tests:
adb shell run-core-tests tests.xnet.AllTests javax.net.ssl.AllTests
there was an abort from the JNI checking because in the recent
handshaking change, local refs were kept in AppData and then reused in
later calls. Added new ScopedGlobalRef to handle the book keeping of this.
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java
include/ScopedGlobalRef.h
Fixed various leaks on old error paths spotted by reviewer.
luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp
Tracking move of verifySignature, a non-SSL bit of code that was lurking in OpenSSLSocketImpl
luni/src/main/java/org/apache/harmony/security/provider/cert/X509CertImpl.java
Change-Id: If1e409782bc99dc684039cfe3f53f8244e29346e
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've also renamed ScopedUtfChars::data to ScopedUtfChars::c_str, by analogy
with std::string (since this method has always been more like c_str than data).
This also fixes a few leaks on error paths.
The old code used to go all the way into native code to return a constant hash
code of 1, so I've removed all that and switched to the idiomatic bogo hash
code (with the idiomatic comment).
Change-Id: I25da8c422155860b5ab348786d369c6c7598135c
|
|
|
|
|
| |
Bug: 754114
Change-Id: Iaa03def509c10cbaa12fd2128584b93d4be4a6b7
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the Java array allocation in InetAddress.cpp failed, we'd free NULL instead of the
previously-allocated structure. This is a new bug in froyo, but only happens in out of
memory situations, so doesn't seem worth fixing there.
Unrelatedly, let's disallow assignment and copying of all our RAII classes. This isn't
a mistake I've seen made, but it's easy to protect against, so we may as well do so
consistently.
Change-Id: I2433b31ff983d388788b09e59e08d661f1725ecd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was going to be https://issues.apache.org/jira/browse/HARMONY-6461,
but I couldn't resist cleaning up some of the surrounding code, and ended
up cleaning up some of our native code too. In the course of the afternoon
I spent on this, I lost my conviction that the upstream change makes
sense, so I reverted that, leaving this change just pure cleanup.
(Note that the cleanup work is incomplete. This is an improvement, but
there's plenty left to do. I just don't want to get too distracted until
all the Java 6 changes are done.)
Change-Id: I56841db5f6c038bbf7942e83a148dca546519269
|
|
|
|
|
|
|
| |
This is a functional equivalent of C++0x's std::unique_ptr.
(I'm not planning to use this in froyo, but I want it there in case I have to
backport changes from dalvik-dev.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When I improved the internals of java.io.File, I failed to keep
OSFileSystem.open (which uses the internals of java.io.File) in
sync, leading to misleading error reporting. java.io.File's
internals now include a trailing NUL, which is useful for the
native code but confuses Java if it tries to decode the byte[]
as a UTF-8 sequence.
This patch fixes the bug and also improves OSFileSystem.open's
error reporting to include the reason for the failure.
Bug: 2313271
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The old ioctl SIOCGIFCONF implementation of getNetworkInterfaces only returns
IPv4 addresses. Now we've switched everything over to IPv6, that's not good
enough. This change (a) implements glibc/BSD-like getifaddrs(3)/freeifaddrs(3)
for Android, and (b) rewrites our getNetworkInterfaces to use that method. Of
particular note is that we now do more of the work in Java. The JNI hands back
a Java equivalent of getifaddrs(3)'s linked list of ifaddrs structs. The new
package-private java.net.InterfaceAddress class serves as Java's "struct
ifaddrs".
The old implementation was also broken: SIOCGIFCONF doesn't actually return
interface indexes from the kernel as the old code believed, so we were
pulling the address family out of the IPv4 address it returned, leading
us to assign the index 2 to all network interfaces. This caused all kinds of
weird behavior later.
I also had to fix GenericIPMreq so that its interface index field is actually
set. The native code gets passed one of these objects when setNetworkInterface
is called, so it's kind of important that the object identify which interface
it's supposed to correspond to.
I've also added missing copyright headers.
This fixes all of the harmony tests on the simulator and on the device. It
fixes several but not all of the jtreg MulticastSocket and IPv6 tests.
|
|
A new LocalArray C++ class lets us specify a "reasonable" amount of stack to
use, but transparently fall back to using the heap if we need more space.
The three places I've chosen to use LocalArray in this patch are fairly
random; all they have in common is that they're the places where we call
GetStringUTFRegion. There are more places LocalArray will be useful: the
java.io.File JNI in particular.
Bug: 2257819
|