changeset 15859:0e393e744e5e

ov-java.cc: Replace instances of comma operator for code clarity. * libinterp/octave-value/ov-java.cc: Replace instances of comma operator for code clarity.
author Rik <rik@octave.org>
date Thu, 27 Dec 2012 23:04:46 -0800
parents fb756e8d6620
children feba9ff6e6a8
files libinterp/octave-value/ov-java.cc
diffstat 1 files changed, 28 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-java.cc	Thu Dec 27 21:43:35 2012 -0800
+++ b/libinterp/octave-value/ov-java.cc	Thu Dec 27 23:04:46 2012 -0800
@@ -178,21 +178,6 @@
   std::list<std::string> java_opts;
 };
 
-void
-octave_java::print (std::ostream& os, bool) const
-{
-  print_raw (os);
-  newline (os);
-}
-
-void
-octave_java::print_raw (std::ostream& os, bool) const
-{
-  os << "<Java object: " << java_classname << ">";
-}
-
-static dim_vector compute_array_dimensions (JNIEnv* jni_env, jobject obj);
-
 #ifdef __WIN32__
 static std::string
 read_registry_string (const std::string& key, const std::string& value)
@@ -739,8 +724,8 @@
   jobjectArray_ref jobj (jni_env, reinterpret_cast<jobjectArray> (obj));
   jclass_ref jcls (jni_env, jni_env->GetObjectClass (obj));
   jclass_ref ccls (jni_env, jni_env->GetObjectClass (jcls));
-  jmethodID isArray_ID = jni_env->GetMethodID (ccls, "isArray", "()Z"),
-            getComponentType_ID = jni_env->GetMethodID (ccls, "getComponentType", "()Ljava/lang/Class;");
+  jmethodID isArray_ID = jni_env->GetMethodID (ccls, "isArray", "()Z");
+  jmethodID getComponentType_ID = jni_env->GetMethodID (ccls, "getComponentType", "()Ljava/lang/Class;");
 
   dim_vector dv (1, 1);
   int idx = 0;
@@ -823,7 +808,8 @@
   octave_value retval;
 
   jclass_ref rhsCls (jni_env);
-  jobject_ref resObj (jni_env), rhsObj (jni_env);
+  jobject_ref resObj (jni_env);
+  jobject_ref rhsObj (jni_env);
   jobject_ref java_idx (jni_env, make_java_index (jni_env, idx));
 
   if (! error_state && unbox (jni_env, rhs, rhsObj, rhsCls))
@@ -852,15 +838,16 @@
     {
       jclass_ref cls (jni_env, jni_env->GetObjectClass (jobj));
       jclass_ref ccls (jni_env, jni_env->GetObjectClass (cls));
-      jmethodID getMethods_ID = jni_env->GetMethodID (ccls, "getMethods", "()[Ljava/lang/reflect/Method;"),
-        getFields_ID = jni_env->GetMethodID (ccls, "getFields", "()[Ljava/lang/reflect/Field;");
-      jobjectArray_ref mList (jni_env, reinterpret_cast<jobjectArray> (jni_env->CallObjectMethod (cls, getMethods_ID))),
-        fList (jni_env, reinterpret_cast<jobjectArray> (jni_env->CallObjectMethod (cls, getFields_ID)));
-      int mLen = jni_env->GetArrayLength (mList), fLen = jni_env->GetArrayLength (fList);
-      jclass_ref mCls (jni_env, jni_env->FindClass ("java/lang/reflect/Method")),
-        fCls (jni_env, jni_env->FindClass ("java/lang/reflect/Field"));
-      jmethodID m_getName_ID = jni_env->GetMethodID (mCls, "getName", "()Ljava/lang/String;"),
-        f_getName_ID = jni_env->GetMethodID (fCls, "getName", "()Ljava/lang/String;");
+      jmethodID getMethods_ID = jni_env->GetMethodID (ccls, "getMethods", "()[Ljava/lang/reflect/Method;");
+      jmethodID getFields_ID = jni_env->GetMethodID (ccls, "getFields", "()[Ljava/lang/reflect/Field;");
+      jobjectArray_ref mList (jni_env, reinterpret_cast<jobjectArray> (jni_env->CallObjectMethod (cls, getMethods_ID)));
+      jobjectArray_ref fList (jni_env, reinterpret_cast<jobjectArray> (jni_env->CallObjectMethod (cls, getFields_ID)));
+      int mLen = jni_env->GetArrayLength (mList);
+      int fLen = jni_env->GetArrayLength (fList);
+      jclass_ref mCls (jni_env, jni_env->FindClass ("java/lang/reflect/Method"));
+      jclass_ref fCls (jni_env, jni_env->FindClass ("java/lang/reflect/Field"));
+      jmethodID m_getName_ID = jni_env->GetMethodID (mCls, "getName", "()Ljava/lang/String;");
+      jmethodID f_getName_ID = jni_env->GetMethodID (fCls, "getName", "()Ljava/lang/String;");
 
       for (int i = 0; i < mLen; i++)
         {
@@ -1243,8 +1230,7 @@
     {
       Matrix m = val.matrix_value ();
       jdoubleArray dv = jni_env->NewDoubleArray (m.length ());
-      //for (int i = 0; i < m.length (); i++)
-        jni_env->SetDoubleArrayRegion (dv, 0, m.length (), m.fortran_vec ());
+      jni_env->SetDoubleArrayRegion (dv, 0, m.length (), m.fortran_vec ());
       jobj = dv;
       jcls = jni_env->GetObjectClass (jobj);
     }
@@ -1749,6 +1735,19 @@
     return octave_value ("");
 }
 
+void
+octave_java::print (std::ostream& os, bool) const
+{
+  print_raw (os);
+  newline (os);
+}
+
+void
+octave_java::print_raw (std::ostream& os, bool) const
+{
+  os << "<Java object: " << java_classname << ">";
+}
+
 octave_value
 octave_java::do_javaMethod (JNIEnv* jni_env, const std::string& name,
                              const octave_value_list& args)