您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

30 行
886 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://www.wtfpl.net/ 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. }