linphone-PresenceNoteImpl文件对应的JNI层文件分析
来源:互联网 发布:清华大学研究生 知乎 编辑:程序博客网 时间:2024/05/23 07:24
说明
这个很短, 自己看。
native函数
private native long newPresenceNoteImpl(String content, String lang); private native void unref(long nativePtr); private native String getContent(long nativePtr); private native int setContent(long nativePtr, String content); private native String getLang(long nativePtr); private native int setLang(long nativePtr, String lang);
具体的函数分析
newPresenceNoteImpl
/* * Class: org_linphone_core_PresenceNoteImpl * Method: newPresenceNoteImpl * Signature: (Ljava/lang/String;Ljava/lang/String;)J */JNIEXPORT jlong JNICALL Java_org_linphone_core_PresenceNoteImpl_newPresenceNoteImpl(JNIEnv *env, jobject jobj, jstring content, jstring lang) { LinphonePresenceNote *note; const char *ccontent = content ? env->GetStringUTFChars(content, NULL) : NULL; const char *clang = lang ? env->GetStringUTFChars(lang, NULL) : NULL; note = linphone_presence_note_new(ccontent, clang); note = linphone_presence_note_ref(note); if (clang) env->ReleaseStringUTFChars(lang, clang); if (ccontent) env->ReleaseStringUTFChars(content, ccontent); return (jlong)note;}
linphone_presence_note_new
LinphonePresenceNote * linphone_presence_note_new(const char *content, const char *lang) { LinphonePresenceNote *note; if (content == NULL) return NULL; note = ms_new0(LinphonePresenceNote, 1); note->refcnt = 1; note->content = ms_strdup(content); if (lang != NULL) { note->lang = ms_strdup(lang); } return note;}
linphone_presence_note_ref
LinphonePresenceNote * linphone_presence_note_ref(LinphonePresenceNote *note) { note->refcnt++; return note;}
unref
/* * Class: org_linphone_core_PresenceNoteImpl * Method: unref * Signature: (J)V */JNIEXPORT void JNICALL Java_org_linphone_core_PresenceNoteImpl_unref(JNIEnv *env, jobject jobj, jlong ptr) { LinphonePresenceNote *note = (LinphonePresenceNote *)ptr; linphone_presence_note_unref(note);}
linphone_presence_note_unref
LinphonePresenceNote * linphone_presence_note_unref(LinphonePresenceNote *note) { note->refcnt--; if (note->refcnt == 0) { presence_note_delete(note); return NULL; } return note;}
presence_note_delete
static void presence_note_delete(LinphonePresenceNote *note) { ms_free(note->content); if (note->lang != NULL) { ms_free(note->lang); } ms_free(note);}
getContent
/* * Class: org_linphone_core_PresenceNoteImpl * Method: getContent * Signature: (J)Ljava/lang/String; */JNIEXPORT jstring JNICALL Java_org_linphone_core_PresenceNoteImpl_getContent(JNIEnv *env, jobject jobj, jlong ptr) { LinphonePresenceNote *note = (LinphonePresenceNote *)ptr; const char *ccontent = linphone_presence_note_get_content(note); return ccontent ? env->NewStringUTF(ccontent) : NULL;}
linphone_presence_note_get_content
const char * linphone_presence_note_get_content(const LinphonePresenceNote *note) { if (note == NULL) return NULL; return note->content;}
setContent
/* * Class: org_linphone_core_PresenceNoteImpl * Method: setContent * Signature: (JLjava/lang/String;)I */JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceNoteImpl_setContent(JNIEnv *env, jobject jobj, jlong ptr, jstring content) { LinphonePresenceNote *note = (LinphonePresenceNote *)ptr; const char *ccontent = content ? env->GetStringUTFChars(content, NULL) : NULL; linphone_presence_note_set_content(note, ccontent); if (ccontent) env->ReleaseStringUTFChars(content, ccontent); return (jint)0;}
linphone_presence_note_set_content
int linphone_presence_note_set_content(LinphonePresenceNote *note, const char *content) { if (content == NULL) return -1; if (note->content != NULL) { ms_free(note->content); } note->content = ms_strdup(content); return 0;}
getLang
/* * Class: org_linphone_core_PresenceNoteImpl * Method: getLang * Signature: (J)Ljava/lang/String; */JNIEXPORT jstring JNICALL Java_org_linphone_core_PresenceNoteImpl_getLang(JNIEnv *env, jobject jobj, jlong ptr) { LinphonePresenceNote *note = (LinphonePresenceNote *)ptr; const char *clang = linphone_presence_note_get_lang(note); return clang ? env->NewStringUTF(clang) : NULL;}
linphone_presence_note_get_lang
const char * linphone_presence_note_get_lang(const LinphonePresenceNote *note) { if (note == NULL) return NULL; return note->lang;}
setLang
/* * Class: org_linphone_core_PresenceNoteImpl * Method: setLang * Signature: (JLjava/lang/String;)I */JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceNoteImpl_setLang(JNIEnv *env, jobject jobj, jlong ptr, jstring lang) { LinphonePresenceNote *note = (LinphonePresenceNote *)ptr; const char *clang = lang ? env->GetStringUTFChars(lang, NULL) : NULL; linphone_presence_note_set_lang(note, clang); if (clang) env->ReleaseStringUTFChars(lang, clang); return (jint)0;}
linphone_presence_note_set_lang
int linphone_presence_note_set_lang(LinphonePresenceNote *note, const char *lang) { if (note->lang != NULL) { ms_free(note->lang); note->lang = NULL; } if (lang != NULL) { note->lang = ms_strdup(lang); } return 0;}
0 0
- linphone-PresenceNoteImpl文件对应的JNI层文件分析
- linphone-LinphoneAddressImpl文件对应的JNI层文件分析
- linphone-LinphoneProxyConfigImpl文件对应的JNI层文件分析
- linphone-LinphoneCallLogImpl文件对应的JNI层文件分析
- linphone-LinphoneCallParamsImpl文件对应的JNI层文件分析
- linphone-LinphoneChatMessageImpl文件对应的JNI层文件分析
- linphone-LinphoneChatRoomImpl文件对应的JNI层文件分析
- linphone-LinphoneCoreFactoryImpl文件对应的JNI层文件分析
- linphone-LinphoneFriendImpl文件对应的JNI层文件分析
- linphone-PayloadTypeImpl文件对应的JNI层文件分析
- linphone-LpConfigImpl文件对应的JNI层文件分析
- linphone-LinphoneInfoMessageImpl文件对应的JNI层文件分析
- linphone-LinphoneEventImpl文件对应的JNI层文件分析
- linphone-PresenceActivityImpl文件对应的JNI层文件分析
- linphone-PresenceModelImpl文件对应的JNI层文件分析
- linphone-PresencePersonImpl文件对应的JNI层文件分析
- linphone-PresenceServiceImpl文件对应的JNI层文件分析
- linphone-ErrorInfoImpl文件对应的JNI层文件分析
- 【DRP】——servlet
- UGUI之Text对齐至格子
- Javascript算法练习(七)
- Hdu 3694 Fermat Point in Quadrangle(三分)
- hdu 3966 Aragorn's Story 树链剖分 bfs实现(不知道为什么会RE)
- linphone-PresenceNoteImpl文件对应的JNI层文件分析
- 数据查看表结构的三种方式
- Unity触摸操作
- 量化分析师的Python日记【第4天:一大波金融Library来袭之scipy篇】
- 或许,我渐渐懂了父亲
- ByteBuffer的心得
- Linux下的C语言学习笔记(3)
- 理解一般指针和指向指针的指针
- Groovy