summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--icu/src/main/native/Resources.cpp4
-rw-r--r--icu/src/main/native/ScopedJavaUnicodeString.h4
-rw-r--r--include/LocalArray.h4
-rw-r--r--include/ScopedByteArray.h4
-rw-r--r--include/ScopedFd.h4
-rw-r--r--luni/src/main/native/ifaddrs-android.h5
-rw-r--r--luni/src/main/native/java_io_File.cpp8
-rw-r--r--luni/src/main/native/java_net_InetAddress.cpp23
-rw-r--r--luni/src/main/native/java_net_NetworkInterface.cpp5
-rw-r--r--xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp4
10 files changed, 50 insertions, 15 deletions
diff --git a/icu/src/main/native/Resources.cpp b/icu/src/main/native/Resources.cpp
index 9dbdb3d..1dd4bff 100644
--- a/icu/src/main/native/Resources.cpp
+++ b/icu/src/main/native/Resources.cpp
@@ -58,6 +58,10 @@ public:
private:
UResourceBundle* mBundle;
+
+ // Disallow copy and assignment.
+ ScopedResourceBundle(const ScopedResourceBundle&);
+ void operator=(const ScopedResourceBundle&);
};
static Locale getLocale(JNIEnv* env, jstring locale) {
diff --git a/icu/src/main/native/ScopedJavaUnicodeString.h b/icu/src/main/native/ScopedJavaUnicodeString.h
index 44952b4..69726fb 100644
--- a/icu/src/main/native/ScopedJavaUnicodeString.h
+++ b/icu/src/main/native/ScopedJavaUnicodeString.h
@@ -46,6 +46,10 @@ private:
jstring mString;
const UChar* mChars;
UnicodeString mUnicodeString;
+
+ // Disallow copy and assignment.
+ ScopedJavaUnicodeString(const ScopedJavaUnicodeString&);
+ void operator=(const ScopedJavaUnicodeString&);
};
#endif // SCOPED_JAVA_UNICODE_STRING_H_included
diff --git a/include/LocalArray.h b/include/LocalArray.h
index 74c9085..2ab708a 100644
--- a/include/LocalArray.h
+++ b/include/LocalArray.h
@@ -66,6 +66,10 @@ private:
char mOnStackBuffer[STACK_BYTE_COUNT];
char* mPtr;
size_t mSize;
+
+ // Disallow copy and assignment.
+ LocalArray(const LocalArray&);
+ void operator=(const LocalArray&);
};
#endif // LOCAL_ARRAY_H_included
diff --git a/include/ScopedByteArray.h b/include/ScopedByteArray.h
index bcbee99..6955b70 100644
--- a/include/ScopedByteArray.h
+++ b/include/ScopedByteArray.h
@@ -48,6 +48,10 @@ private:
JNIEnv* mEnv;
jbyteArray mByteArray;
jbyte* mBytes;
+
+ // Disallow copy and assignment.
+ ScopedByteArray(const ScopedByteArray&);
+ void operator=(const ScopedByteArray&);
};
#endif // SCOPED_BYTE_ARRAY_H_included
diff --git a/include/ScopedFd.h b/include/ScopedFd.h
index 30feabd..d2b7935 100644
--- a/include/ScopedFd.h
+++ b/include/ScopedFd.h
@@ -37,6 +37,10 @@ public:
private:
int fd;
+
+ // Disallow copy and assignment.
+ ScopedFd(const ScopedFd&);
+ void operator=(const ScopedFd&);
};
#endif // SCOPED_FD_H_included
diff --git a/luni/src/main/native/ifaddrs-android.h b/luni/src/main/native/ifaddrs-android.h
index de87b02..1b9a9ef 100644
--- a/luni/src/main/native/ifaddrs-android.h
+++ b/luni/src/main/native/ifaddrs-android.h
@@ -136,6 +136,11 @@ struct ifaddrs {
}
return NULL;
}
+
+private:
+ // Disallow copy and assignment.
+ ifaddrs(const ifaddrs&);
+ void operator=(const ifaddrs&);
};
// FIXME: use iovec instead.
diff --git a/luni/src/main/native/java_io_File.cpp b/luni/src/main/native/java_io_File.cpp
index 586ebbe..3006275 100644
--- a/luni/src/main/native/java_io_File.cpp
+++ b/luni/src/main/native/java_io_File.cpp
@@ -253,6 +253,10 @@ private:
DIR* mDirStream;
dirent mEntry;
bool mIsBad;
+
+ // Disallow copy and assignment.
+ ScopedReaddir(const ScopedReaddir&);
+ void operator=(const ScopedReaddir&);
};
// DirEntry and DirEntries is a minimal equivalent of std::forward_list
@@ -310,6 +314,10 @@ public:
private:
size_t mSize;
DirEntry* mHead;
+
+ // Disallow copy and assignment.
+ DirEntries(const DirEntries&);
+ void operator=(const DirEntries&);
};
// Reads the directory referred to by 'pathBytes', adding each directory entry
diff --git a/luni/src/main/native/java_net_InetAddress.cpp b/luni/src/main/native/java_net_InetAddress.cpp
index 04c18af..62318e9 100644
--- a/luni/src/main/native/java_net_InetAddress.cpp
+++ b/luni/src/main/native/java_net_InetAddress.cpp
@@ -83,8 +83,7 @@ static jobjectArray InetAddress_getaddrinfoImpl(JNIEnv* env, const char* name) {
// Count results so we know how to size the output array.
int addressCount = 0;
for (addrInfo = addressList; addrInfo; addrInfo = addrInfo->ai_next) {
- if (addrInfo->ai_family == AF_INET ||
- addrInfo->ai_family == AF_INET6) {
+ if (addrInfo->ai_family == AF_INET || addrInfo->ai_family == AF_INET6) {
addressCount++;
}
}
@@ -94,7 +93,7 @@ static jobjectArray InetAddress_getaddrinfoImpl(JNIEnv* env, const char* name) {
if (addressArray == NULL) {
// Appropriate exception will be thrown.
LOGE("getaddrinfo: could not allocate array of size %i", addressCount);
- freeaddrinfo(addrInfo);
+ freeaddrinfo(addressList);
return NULL;
}
@@ -109,20 +108,17 @@ static jobjectArray InetAddress_getaddrinfoImpl(JNIEnv* env, const char* name) {
// Find the raw address length and start pointer.
case AF_INET6:
addressLength = 16;
- rawAddress =
- &((struct sockaddr_in6*) address)->sin6_addr.s6_addr;
+ rawAddress = &((struct sockaddr_in6*) address)->sin6_addr.s6_addr;
logIpString(addrInfo, name);
break;
case AF_INET:
addressLength = 4;
- rawAddress =
- &((struct sockaddr_in*) address)->sin_addr.s_addr;
+ rawAddress = &((struct sockaddr_in*) address)->sin_addr.s_addr;
logIpString(addrInfo, name);
break;
default:
// Unknown address family. Skip this address.
- LOGE("getaddrinfo: Unknown address family %d",
- addrInfo->ai_family);
+ LOGE("getaddrinfo: Unknown address family %d", addrInfo->ai_family);
continue;
}
@@ -130,13 +126,11 @@ static jobjectArray InetAddress_getaddrinfoImpl(JNIEnv* env, const char* name) {
jbyteArray bytearray = env->NewByteArray(addressLength);
if (bytearray == NULL) {
// Out of memory error will be thrown on return.
- LOGE("getaddrinfo: Can't allocate %d-byte array",
- addressLength);
+ LOGE("getaddrinfo: Can't allocate %d-byte array", addressLength);
addressArray = NULL;
break;
}
- env->SetByteArrayRegion(bytearray, 0, addressLength,
- (jbyte*) rawAddress);
+ env->SetByteArrayRegion(bytearray, 0, addressLength, (jbyte*) rawAddress);
env->SetObjectArrayElement(addressArray, index, bytearray);
env->DeleteLocalRef(bytearray);
index++;
@@ -146,8 +140,7 @@ static jobjectArray InetAddress_getaddrinfoImpl(JNIEnv* env, const char* name) {
jniThrowException(env, "java/lang/SecurityException",
"Permission denied (maybe missing INTERNET permission)");
} else {
- jniThrowException(env, "java/net/UnknownHostException",
- gai_strerror(result));
+ jniThrowException(env, "java/net/UnknownHostException", gai_strerror(result));
}
if (addressList) {
diff --git a/luni/src/main/native/java_net_NetworkInterface.cpp b/luni/src/main/native/java_net_NetworkInterface.cpp
index 724e988..4aea781 100644
--- a/luni/src/main/native/java_net_NetworkInterface.cpp
+++ b/luni/src/main/native/java_net_NetworkInterface.cpp
@@ -53,6 +53,11 @@ public:
}
ifaddrs* list;
+
+private:
+ // Disallow copy and assignment.
+ ScopedInterfaceAddresses(const ScopedInterfaceAddresses&);
+ void operator=(const ScopedInterfaceAddresses&);
};
// TODO: add a header file for shared utilities like this.
diff --git a/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp b/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
index b893309..d4fc557 100644
--- a/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
+++ b/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
@@ -562,6 +562,10 @@ private:
mPrefix = "";
}
}
+
+ // Disallow copy and assignment.
+ ExpatElementName(const ExpatElementName&);
+ void operator=(const ExpatElementName&);
};
/**