/[libvob]/libvob/src/jni/Floats.cxx
ViewVC logotype

Diff of /libvob/src/jni/Floats.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by mudyc, Fri Aug 22 09:36:34 2003 UTC revision 1.2 by mudyc, Fri Aug 22 11:43:01 2003 UTC
# Line 29  Lines.cxx Line 29  Lines.cxx
29    
30  namespace Vob {  namespace Vob {
31    
32    vector<float> jfloats2floatvector(JNIEnv *env, jfloatArray in) {    void jfloats2floatvector(JNIEnv *env, jfloatArray in, vector<float>& out) {
33      jsize len = env->GetArrayLength(in);      jsize len = env->GetArrayLength(in);
34      int i = 0;      out.resize(len);
     std::vector<float> floats;  
35      jfloat *f = env->GetFloatArrayElements(in, 0);      jfloat *f = env->GetFloatArrayElements(in, 0);
36      for (i=0; i<len; i++) {      std::copy(f, f+len, out.begin());
       floats.push_back(f[i]);  
     }  
37      env->ReleaseFloatArrayElements(in, f, 0);      env->ReleaseFloatArrayElements(in, f, 0);
     return floats;  
38    }    }
39    
40  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26