Fix two compiler warnings.
Signed/unsigned comparison in "File.cpp", and && and || without parentheses
in "OpenSSLSocketImpl.cpp". There's another signed/unsigned comparison in
"ifaddrs-android.h" but that isn't fixable (http://b/2417132), which is
going to stand in the way of turning on -Werror.
diff --git a/luni/src/main/native/java_io_File.cpp b/luni/src/main/native/java_io_File.cpp
index ed25ce7..bd81361 100644
--- a/luni/src/main/native/java_io_File.cpp
+++ b/luni/src/main/native/java_io_File.cpp
@@ -128,7 +128,7 @@
// An error occurred.
return pathBytes;
}
- if (len < buf.size() - 1) {
+ if (static_cast<size_t>(len) < buf.size() - 1) {
// The buffer was big enough.
// TODO: why do we bother with the NUL termination? (if you change this, remove the "- 1"s above.)
buf[len] = '\0'; // readlink(2) doesn't NUL-terminate.
diff --git a/x-net/src/main/native/org_apache_harmony_xnet_provider_jsse_OpenSSLSocketImpl.cpp b/x-net/src/main/native/org_apache_harmony_xnet_provider_jsse_OpenSSLSocketImpl.cpp
index a3c86d6..20bb8a5 100644
--- a/x-net/src/main/native/org_apache_harmony_xnet_provider_jsse_OpenSSLSocketImpl.cpp
+++ b/x-net/src/main/native/org_apache_harmony_xnet_provider_jsse_OpenSSLSocketImpl.cpp
@@ -1327,12 +1327,12 @@
*/
int sslErrorCode = SSL_get_error(ssl, ret);
if (sslErrorCode == SSL_ERROR_NONE ||
- sslErrorCode == SSL_ERROR_SYSCALL && errno == 0) {
- throwIOExceptionStr(env, "Connection closed by peer");
+ (sslErrorCode == SSL_ERROR_SYSCALL && errno == 0)) {
+ throwIOExceptionStr(env, "Connection closed by peer");
} else {
- throwIOExceptionWithSslErrors(env, ret, sslErrorCode,
- "Trouble accepting connection");
- }
+ throwIOExceptionWithSslErrors(env, ret, sslErrorCode,
+ "Trouble accepting connection");
+ }
free_ssl(env, object);
return;
} else if (ret < 0) {