diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:18:14 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:31:29 +0100 |
commit | 81da71b64098e3f0d5ebe61d0c94c73e316c21b3 (patch) | |
tree | 29ceb2cac30ccdcf57bdabd9627e9ad85e5e0b00 /jvmaccess | |
parent | 6794c2e44ede0da2772883fa53a7c935a2bae586 (diff) |
loplugin:nullptr (automatic rewrite)
Change-Id: I226aeb4787a4c30e17fb54dc7775a288aa09b760
Diffstat (limited to 'jvmaccess')
-rw-r--r-- | jvmaccess/source/classpath.cxx | 24 | ||||
-rw-r--r-- | jvmaccess/source/unovirtualmachine.cxx | 4 | ||||
-rw-r--r-- | jvmaccess/source/virtualmachine.cxx | 12 |
3 files changed, 20 insertions, 20 deletions
diff --git a/jvmaccess/source/classpath.cxx b/jvmaccess/source/classpath.cxx index abde60f81478..3f0a3e3c2c2a 100644 --- a/jvmaccess/source/classpath.cxx +++ b/jvmaccess/source/classpath.cxx @@ -43,15 +43,15 @@ jobjectArray jvmaccess::ClassPath::translateToUrls( JNIEnv * environment, OUString const & classPath) { assert(context.is()); - assert(environment != 0); + assert(environment != nullptr); jclass classUrl(environment->FindClass("java/net/URL")); - if (classUrl == 0) { - return 0; + if (classUrl == nullptr) { + return nullptr; } jmethodID ctorUrl( environment->GetMethodID(classUrl, "<init>", "(Ljava/lang/String;)V")); - if (ctorUrl == 0) { - return 0; + if (ctorUrl == nullptr) { + return nullptr; } ::std::vector< jobject > urls; for (::sal_Int32 i = 0; i != -1;) { @@ -76,22 +76,22 @@ jobjectArray jvmaccess::ClassPath::translateToUrls( arg.l = environment->NewString( static_cast< jchar const * >(url.getStr()), static_cast< jsize >(url.getLength())); - if (arg.l == 0) { - return 0; + if (arg.l == nullptr) { + return nullptr; } jobject o(environment->NewObjectA(classUrl, ctorUrl, &arg)); - if (o == 0) { - return 0; + if (o == nullptr) { + return nullptr; } urls.push_back(o); } } jobjectArray result = environment->NewObjectArray( - static_cast< jsize >(urls.size()), classUrl, 0); + static_cast< jsize >(urls.size()), classUrl, nullptr); // static_cast is ok, as each element of urls occupied at least one // character of the OUString classPath - if (result == 0) { - return 0; + if (result == nullptr) { + return nullptr; } jsize idx = 0; for (std::vector< jobject >::iterator i(urls.begin()); i != urls.end(); ++i) diff --git a/jvmaccess/source/unovirtualmachine.cxx b/jvmaccess/source/unovirtualmachine.cxx index 86be8b83e991..0a48b1ee3b07 100644 --- a/jvmaccess/source/unovirtualmachine.cxx +++ b/jvmaccess/source/unovirtualmachine.cxx @@ -45,14 +45,14 @@ UnoVirtualMachine::UnoVirtualMachine( rtl::Reference< jvmaccess::VirtualMachine > const & virtualMachine, void * classLoader): m_virtualMachine(virtualMachine), - m_classLoader(0) + m_classLoader(nullptr) { try { m_classLoader = jvmaccess::VirtualMachine::AttachGuard(m_virtualMachine). getEnvironment()->NewGlobalRef(static_cast< jobject >(classLoader)); } catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) {} - if (m_classLoader == 0) { + if (m_classLoader == nullptr) { throw CreationException(); } } diff --git a/jvmaccess/source/virtualmachine.cxx b/jvmaccess/source/virtualmachine.cxx index 3ff5dc7aaaf2..fb548adf2ce7 100644 --- a/jvmaccess/source/virtualmachine.cxx +++ b/jvmaccess/source/virtualmachine.cxx @@ -49,7 +49,7 @@ VirtualMachine::AttachGuard::AttachGuard( { assert(m_xMachine.is()); m_pEnvironment = m_xMachine->attachThread(&m_bDetach); - if (m_pEnvironment == 0) + if (m_pEnvironment == nullptr) throw CreationException(); } @@ -64,7 +64,7 @@ VirtualMachine::VirtualMachine(JavaVM * pVm, int nVersion, bool bDestroy, m_pVm(pVm), m_nVersion(nVersion), m_bDestroy(bDestroy) { (void) pMainThreadEnv; // avoid warnings - assert(pVm != 0); + assert(pVm != nullptr); assert(nVersion >= JNI_VERSION_1_2); assert(pMainThreadEnv); } @@ -86,12 +86,12 @@ VirtualMachine::~VirtualMachine() JNIEnv * VirtualMachine::attachThread(bool * pAttached) const { - assert(pAttached != 0 && "bad parameter"); + assert(pAttached != nullptr && "bad parameter"); JNIEnv * pEnv; jint n = m_pVm->GetEnv(reinterpret_cast< void ** >(&pEnv), m_nVersion); SAL_WARN_IF( n != JNI_OK && n != JNI_EDETACHED, "jvmaccess", "JNI: GetEnv failed"); - if (pEnv == 0) + if (pEnv == nullptr) { if (m_pVm->AttachCurrentThread ( @@ -102,9 +102,9 @@ JNIEnv * VirtualMachine::attachThread(bool * pAttached) const // JNIEnv** and not void ** &pEnv, #endif - 0) + nullptr) != JNI_OK) - return 0; + return nullptr; *pAttached = true; } else |