選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

30 行
897 B

  1. /*
  2. * libcaca Java bindings for libcaca
  3. * Copyright (c) 2009 Adrien Grand <jpountz@dinauz.org>
  4. *
  5. * This library is free software. It comes without any warranty, to
  6. * the extent permitted by applicable law. You can redistribute it
  7. * and/or modify it under the terms of the Do What The Fuck You Want
  8. * To Public License, Version 2, as published by Sam Hocevar. See
  9. * http://sam.zoy.org/wtfpl/COPYING for more details.
  10. */
  11. #include "caca_java_common.h"
  12. jobjectArray caca_java_to_string_array(JNIEnv *env, const char *const *v)
  13. {
  14. jclass java_lang_string = (*env)->FindClass(env, "java/lang/String");
  15. jsize size;
  16. jsize i;
  17. for (size = 0; v[size]; ++size);
  18. jobjectArray ret = (*env)->NewObjectArray(env, size, java_lang_string, NULL);
  19. for (i = 0; i < size; ++i)
  20. {
  21. (*env)->SetObjectArrayElement(env, ret, i, (*env)->NewStringUTF(env, v[i]));
  22. }
  23. return ret;
  24. }