本文整理汇总了C++中KNI_ThrowNew函数的典型用法代码示例。如果您正苦于以下问题:C++ KNI_ThrowNew函数的具体用法?C++ KNI_ThrowNew怎么用?C++ KNI_ThrowNew使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KNI_ThrowNew函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Java_javax_microedition_lcdui_ImageDataFactory_loadRomizedImage
/**
* boolean loadRomizedImage(IamgeData imageData, int imageDataArrayPtr,
* int imageDataArrayLength);
*/
KNIEXPORT KNI_RETURNTYPE_BOOLEAN
Java_javax_microedition_lcdui_ImageDataFactory_loadRomizedImage() {
int status = KNI_FALSE;
int imageDataArrayPtr = KNI_GetParameterAsInt(2);
int imageDataArrayLength = KNI_GetParameterAsInt(3);
int imgWidth, imgHeight;
img_native_error_codes creationError = IMG_NATIVE_IMAGE_NO_ERROR;
/* pointer to native image structure */
gxpport_image_native_handle newImagePtr;
KNI_StartHandles(1);
KNI_DeclareHandle(imageData);
KNI_GetParameterAsObject(1, imageData);
do {
unsigned char* buffer = (unsigned char*)imageDataArrayPtr;
gxpport_loadimmutable_from_platformbuffer(
buffer, imageDataArrayLength,
KNI_TRUE,
&imgWidth, &imgHeight,
&newImagePtr,
&creationError);
if (IMG_NATIVE_IMAGE_NO_ERROR == creationError) {
java_imagedata * dstImageDataPtr = IMGAPI_GET_IMAGEDATA_PTR(imageData);
dstImageDataPtr->width = (jint)imgWidth;
dstImageDataPtr->height = (jint)imgHeight;
dstImageDataPtr->nativeImageData = (jint)newImagePtr;
status = KNI_TRUE;
break;
} else if (IMG_NATIVE_IMAGE_OUT_OF_MEMORY_ERROR == creationError) {
KNI_ThrowNew(midpOutOfMemoryError, NULL);
break;
} else if (IMG_NATIVE_IMAGE_RESOURCE_LIMIT == creationError) {
KNI_ThrowNew(midpOutOfMemoryError,
"Resource limit exceeded for immutable image");
break;
} else {
KNI_ThrowNew(midpIllegalArgumentException, NULL);
break;
}
} while (0);
KNI_EndHandles();
KNI_ReturnBoolean(status);
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:55,代码来源:imgp_imagedatafactory_kni.c
示例2: Java_com_sun_j2me_global_StringComparatorImpl_compare0
/**
* Compare two strings using locale- and level-specific rules.
* <p>
* Java declaration:
* <pre>
* compare0(Ljava/lang/String;Ljava/lang/String;II)I
* </pre>
*
* @param locale_index the locale index in supported locales list
* @param hstr1 first string to compare
* @param hstr2 second string to compare
* @param level the collation level to use
* @return negative if <code>s1</code> belongs before <code>s2</code>,
* zero if the strings are equal, positive if <code>s1</code> belongs
* after <code>s2</code>
*/
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_sun_j2me_global_StringComparatorImpl_compare0() {
jint locale_index = KNI_GetParameterAsInt(1);
jint level = KNI_GetParameterAsInt(4);
jchar *s1, *s2;
jsize s1_len, s2_len;
jint res, compare_result = 0;
KNI_StartHandles(2);
KNI_DeclareHandle(hstr1);
KNI_DeclareHandle(hstr2);
KNI_GetParameterAsObject(2, hstr1);
KNI_GetParameterAsObject(3, hstr2);
s1_len = KNI_GetStringLength(hstr1);
if (s1_len == -1){
KNI_ThrowNew(midpNullPointerException, NULL);
} else {
s1 = (jchar *)midpMalloc(s1_len * sizeof(jchar));
if (NULL == s1) {
KNI_ThrowNew(midpOutOfMemoryError,
"Cannot allocate string for collation");
} else {
s2_len = KNI_GetStringLength(hstr2);
if (s2_len == -1){
KNI_ThrowNew(midpNullPointerException, NULL);
} else {
s2 = (jchar *)midpMalloc(s2_len * sizeof(jchar));
if (NULL == s2) {
KNI_ThrowNew(midpOutOfMemoryError,
"Cannot allocate string for collation");
} else {
KNI_GetStringRegion(hstr1, 0, s1_len, s1);
KNI_GetStringRegion(hstr2, 0, s2_len, s2);
res = jsr238_compare_strings(locale_index, s1, s1_len, s2, s2_len,
level, &compare_result);
if (res < 0){
KNI_ThrowNew(midpRuntimeException,"Error comparing strings");
}
midpFree(s2);
}
}
midpFree(s1);
}
}
KNI_EndHandles();
KNI_ReturnInt(compare_result);
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:65,代码来源:jsr238_collation_kni.c
示例3: Java_com_sun_midp_content_RegistryStore_getValues0
/**
* java call:
* private native String getValues0(String callerId, int searchBy);
*/
KNIEXPORT KNI_RETURNTYPE_OBJECT
Java_com_sun_midp_content_RegistryStore_getValues0(void) {
jsr211_field searchBy;
pcsl_string callerId = PCSL_STRING_NULL_INITIALIZER;
JSR211_RESULT_STRARRAY result = _JSR211_RESULT_INITIALIZER_;
KNI_StartHandles(1);
KNI_DeclareHandle(strObj); // String object
do {
KNI_GetParameterAsObject(1, strObj); // callerId
if (PCSL_STRING_OK != midp_jstring_to_pcsl_string(strObj, &callerId)) {
KNI_ThrowNew(midpOutOfMemoryError,
"RegistryStore_getValues0 no memory for string arguments");
break;
}
searchBy = (jsr211_field) KNI_GetParameterAsInt(2);
jsr211_get_all(&callerId, searchBy, &result);
} while (0);
pcsl_string_free(&callerId);
result2string((_JSR211_INTERNAL_RESULT_BUFFER_*)&result, strObj);
KNI_EndHandlesAndReturnObject(strObj);
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:30,代码来源:regstore.c
示例4: KNIDECL
/*
* Returns the number of bytes available to be read from the connection
* without blocking.
*
* Note: the method gets native connection handle directly from
* <code>handle<code> field of <code>BTSPPConnectionImpl</code> object.
*
* @return the number of available bytes
* @throws IOException if any I/O error occurs
*/
KNIEXPORT KNI_RETURNTYPE_INT
KNIDECL(com_sun_jsr082_bluetooth_btspp_BTSPPConnectionImpl_available0) {
javacall_handle handle;
int count = -1;
char* pError;
REPORT_INFO(LC_PROTOCOL, "btspp::available");
KNI_StartHandles(1);
KNI_DeclareHandle(thisHandle);
KNI_GetThisPointer(thisHandle);
handle = (javacall_handle)KNI_GetIntField(thisHandle, connHandleID);
switch (javacall_bt_rfcomm_get_available(handle, &count)) {
case JAVACALL_OK:
REPORT_INFO(LC_PROTOCOL, "btspp::available done!");
break;
case JAVACALL_FAIL:
javacall_bt_rfcomm_get_error(handle, &pError);
JAVAME_SNPRINTF(gBtBuffer, BT_BUFFER_SIZE,
"IO error during btspp::::available (%s)", pError);
REPORT_ERROR(LC_PROTOCOL, gBtBuffer);
KNI_ThrowNew(jsropIOException, EXCEPTION_MSG(gBtBuffer));
break;
default: /* illegal argument */
REPORT_ERROR(LC_PROTOCOL, "Internal error in btspp::available");
}
KNI_EndHandles();
KNI_ReturnInt(count);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:42,代码来源:btSPPConnectionGlue_c.c
示例5: KNIDECL
/**
* Gets the total advance width of the given <tt>String</tt> in this
* <tt>Font</tt>.
* <p>
* Java declaration:
* <pre>
* stringWidth(Ljava/lang/String;)I
* </pre>
*
* @param str the <tt>String</tt> to be measured
*
* @return the total advance width of the <tt>String</tt> in pixels
*/
KNIEXPORT KNI_RETURNTYPE_INT
KNIDECL(javax_microedition_lcdui_Font_stringWidth) {
int strLen;
jint result = 0;
KNI_StartHandles(2);
KNI_DeclareHandle(str);
KNI_DeclareHandle(thisObject);
KNI_GetParameterAsObject(1, str);
KNI_GetParameterAsObject(0, thisObject);
if ((strLen = KNI_GetStringLength(str)) == -1) {
KNI_ThrowNew(midpNullPointerException, NULL);
} else {
int face, style, size;
_JavaString *jstr;
DECLARE_FONT_PARAMS(thisObject);
SNI_BEGIN_RAW_POINTERS;
jstr = GET_STRING_PTR(str);
result = gx_get_charswidth(face, style, size,
jstr->value->elements + jstr->offset,
strLen);
SNI_END_RAW_POINTERS;
}
KNI_EndHandles();
KNI_ReturnInt(result);
}
开发者ID:jiangxilong,项目名称:yari,代码行数:48,代码来源:gxapi_font_kni.c
示例6: KNIDECL
/**
* Adds a connection to the push registry.
* <p>
* Java declaration:
* <pre>
* add0([B)I
* </pre>
*
* @param connection The connection to add to the push registry
*
* @return <tt>0</tt> upon successfully adding the connection, otherwise
* <tt>-1</tt> if connection already exists
*/
KNIEXPORT KNI_RETURNTYPE_INT
KNIDECL(com_sun_midp_io_j2me_push_ConnectionRegistry_add0) {
char *szConn = NULL;
int connLen;
int ret = -1;
KNI_StartHandles(1);
KNI_DeclareHandle(conn);
KNI_GetParameterAsObject(1, conn);
connLen = KNI_GetArrayLength(conn);
szConn = midpMalloc(connLen);
if (szConn != NULL) {
KNI_GetRawArrayRegion(conn, 0, connLen, (jbyte*)szConn);
ret = pushadd(szConn);
midpFree(szConn);
}
if ((szConn == NULL) || (ret == -2)) {
KNI_ThrowNew(midpOutOfMemoryError, NULL);
}
KNI_EndHandles();
KNI_ReturnInt(ret);
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:41,代码来源:midp_connection_registry_kni.c
示例7: Java_com_sun_j2me_location_PlatformLocationProvider_resetImpl
/* JAVADOC COMMENT ELIDED */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_j2me_location_PlatformLocationProvider_resetImpl() {
MidpReentryData *info = NULL;
ProviderInfo *pInfo = NULL;
jint provider = KNI_GetParameterAsInt(1);
jsr179_result res;
info = (MidpReentryData*)SNI_GetReentryData(NULL);
if (info == NULL) {
/* reset provider */
res = jsr179_update_cancel((jsr179_handle)provider);
switch (res) {
case JSR179_STATUSCODE_OK:
case JSR179_STATUSCODE_FAIL:
break;
case JSR179_STATUSCODE_INVALID_ARGUMENT:
/* wrong provider name */
KNI_ThrowNew(midpIllegalArgumentException, "wrong provider");
break;
case JSR179_STATUSCODE_WOULD_BLOCK:
/* wait for javanotify */
pInfo = getProviderInfo(provider);
if(pInfo != NULL) {
pInfo->locked = KNI_FALSE;
}
lock_thread(JSR179_EVENT_UPDATE_ONCE, provider);
break;
default:
break;
}
}
KNI_ReturnVoid();
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:36,代码来源:jsr179_locationProvider_kni.c
示例8: KNIDECL
/*
* Retrieves service record from the service search result.
*
* @param recHandle native handle of the service record
* @param array byte array which will receive the data,
* or null for size query
* @return size of the data read/required
*/
KNIEXPORT KNI_RETURNTYPE_INT
KNIDECL(com_sun_jsr082_bluetooth_SDPTransaction_getServiceRecord0)
{
jint retval = 0;
javacall_handle id = 0;
javacall_uint8 *data = NULL;
javacall_uint16 size = 0;
KNI_StartHandles(1);
KNI_DeclareHandle(dataHandle);
KNI_GetParameterAsObject(2, dataHandle);
id = (javacall_handle)KNI_GetParameterAsInt(1);
if (!KNI_IsNullHandle(dataHandle))
size = KNI_GetArrayLength(dataHandle);
data = JAVAME_MALLOC(size);
if (data == NULL) {
KNI_ThrowNew(jsropOutOfMemoryError, "Out of memory inside SDDB.readRecord()");
} else {
if (javacall_bt_sdp_get_service(id, data, &size) == JAVACALL_OK) {
retval = size;
if (!KNI_IsNullHandle(dataHandle)) {
KNI_SetRawArrayRegion(dataHandle, 0, size, data);
}
} else {
retval = 0;
}
JAVAME_FREE(data);
}
KNI_EndHandles();
KNI_ReturnInt(retval);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:42,代码来源:NativeSDPGlue_c.c
示例9: KNIDECL
/* JAVADOC COMMENT ELIDED */
KNIEXPORT KNI_RETURNTYPE_INT
KNIDECL(com_sun_j2me_location_LocationPersistentStorage_openLandmarkList) {
javacall_handle hndl = 0;
javacall_result res;
KNI_StartHandles(2);
GET_PARAMETER_AS_UTF16_STRING(1, storeName)
GET_PARAMETER_AS_UTF16_STRING(2, categoryName)
res = javacall_landmarkstore_landmarklist_open(storeName, categoryName, &hndl);
switch (res) {
case JAVACALL_OK:
/* Category list open successfully */
break;
case JAVACALL_INVALID_ARGUMENT:
/* wrong category name */
break;
default:
/* operation Failed */
KNI_ThrowNew(jsropIOException, "I/O error");
break;
}
RELEASE_UTF16_STRING_PARAMETER
RELEASE_UTF16_STRING_PARAMETER
KNI_EndHandles();
KNI_ReturnInt((jint)hndl);
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:30,代码来源:locationPersistentStorage_kni.c
示例10: Java_javax_microedition_lcdui_CustomItemLFImpl_setContentBuffer0
/**
* Sets the content buffer. All paints are done to that buffer.
* When paint is processed snapshot of the buffer is flushed to
* the native resource content area.
* Native implementation of Java function:
* private static native int setContentBuffer0 ( int nativeId, Image img );
* @param nativeId native resource is for this CustomItem
* @param img mutable image that serves as an offscreen buffer
*/
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_lcdui_CustomItemLFImpl_setContentBuffer0() {
MidpError err = KNI_OK;
unsigned char* imgPtr = NULL;
MidpItem *ciPtr = (MidpItem *)KNI_GetParameterAsInt(1);
KNI_StartHandles(1);
KNI_DeclareHandle(image);
KNI_GetParameterAsObject(2, image);
if (KNI_IsNullHandle(image) != KNI_TRUE) {
imgPtr = gxp_get_imagedata(image);
}
KNI_EndHandles();
err = lfpport_customitem_set_content_buffer(ciPtr, imgPtr);
if (err != KNI_OK) {
KNI_ThrowNew(midpOutOfMemoryError, NULL);
}
KNI_ReturnVoid();
}
开发者ID:jiangxilong,项目名称:yari,代码行数:35,代码来源:lfp_customitem.c
示例11: KNIDECL
/**
* Perform a platform-defined procedure for obtaining random bytes and
* store the obtained bytes into b, starting from index 0.
* (see IETF RFC 1750, Randomness Recommendations for Security,
* http://www.ietf.org/rfc/rfc1750.txt)
* @param b array that receives random bytes
* @param nbytes the number of random bytes to receive, must not be less than size of b
* @return the number of actually obtained random bytes, -1 in case of an error
*/
KNIEXPORT KNI_RETURNTYPE_BOOLEAN
KNIDECL(com_sun_midp_crypto_PRand_getRandomBytes) {
jint size;
jboolean res = KNI_FALSE;
unsigned char* buffer;
KNI_StartHandles(1);
KNI_DeclareHandle(hBytes);
KNI_GetParameterAsObject(1, hBytes);
size = KNI_GetParameterAsInt(2);
buffer = pcsl_mem_malloc(size);
if (0 == buffer) {
KNI_ThrowNew(midpOutOfMemoryError, NULL);
} else {
int i;
res = get_random_bytes_port(buffer, size);
for(i=0; i<size; i++) {
KNI_SetByteArrayElement(hBytes,i,(jbyte)buffer[i]);
}
pcsl_mem_free(buffer);
}
KNI_EndHandles();
KNI_ReturnBoolean(res);
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:36,代码来源:prand.c
示例12: Java_com_sun_cldc_i18n_j2me_Conv_sizeOfUnicodeInByte
/**
* Gets the length of a specific converted string as an array of
* Unicode characters.
* <p>
* Java declaration:
* <pre>
* sizeOfUnicodeInByte(I[CII)I
* </pre>
*
* @param handler handle returned from getHandler
* @param c buffer of characters to be converted
* @param offset offset into the provided buffer
* @param length length of data to be processed
*
* @return length of the converted string, or zero if the
* arguments were not valid
*/
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_sun_cldc_i18n_j2me_Conv_sizeOfUnicodeInByte() {
int length = KNI_GetParameterAsInt(4);
int offset = KNI_GetParameterAsInt(3);
int id = KNI_GetParameterAsInt(1);
jchar *buf;
jint result = 0;
KNI_StartHandles(1);
KNI_DeclareHandle(c);
KNI_GetParameterAsObject(2, c);
/* Instead of always multiplying the length by sizeof(jchar),
* we shift left by 1. This can be done because jchar has a
* size of 2 bytes.
*/
buf = (jchar*)midpMalloc(length<<1);
if (buf == NULL) {
KNI_ThrowNew(midpOutOfMemoryError, NULL);
} else {
KNI_GetRawArrayRegion(c, offset<<1, length<<1, (jbyte*)buf);
result = lcConv[id]
? lcConv[id]->sizeOfUnicodeInByte((const jchar *)buf,
offset, length)
: 0;
midpFree(buf);
}
KNI_EndHandles();
KNI_ReturnInt(result);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:51,代码来源:conv.c
示例13: Java_com_sun_cldc_i18n_j2me_Conv_sizeOfByteInUnicode
/**
* Gets the length of a specific converted string as an array of
* Unicode bytes.
* <p>
* Java declaration:
* <pre>
* sizeOfByteInUnicode(I[BII)I
* </pre>
*
* @param handler handle returned from getHandler
* @param b buffer of bytes to be converted
* @param offset offset into the provided buffer
* @param length length of data to be processed
*
* @return length of the converted string, or zero if the
* arguments were not valid
*/
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_sun_cldc_i18n_j2me_Conv_sizeOfByteInUnicode() {
int length = KNI_GetParameterAsInt(4);
int offset = KNI_GetParameterAsInt(3);
int id = KNI_GetParameterAsInt(1);
char *buf;
jint result = 0;
KNI_StartHandles(1);
KNI_DeclareHandle(b);
KNI_GetParameterAsObject(2, b);
buf = (char*)midpMalloc(length);
if (buf == NULL) {
KNI_ThrowNew(midpOutOfMemoryError, NULL);
} else {
KNI_GetRawArrayRegion(b, offset, length, (jbyte*)buf);
result = lcConv[id]
? lcConv[id]->sizeOfByteInUnicode((const unsigned char *)buf,
offset, length)
: 0;
midpFree(buf);
}
KNI_EndHandles();
KNI_ReturnInt(result);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:47,代码来源:conv.c
示例14: Java_com_sun_cldc_i18n_j2me_Conv_getHandler
/**
* Gets a handle to specific character encoding conversion routine.
* <p>
* Java declaration:
* <pre>
* getHandler(Ljava/lang/String;)I
* </pre>
*
* @param encoding character encoding
*
* @return identifier for requested handler, or <tt>-1</tt> if
* the encoding was not supported.
*/
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_sun_cldc_i18n_j2me_Conv_getHandler() {
jint result = 0;
KNI_StartHandles(1);
KNI_DeclareHandle(str);
KNI_GetParameterAsObject(1, str);
if (!KNI_IsNullHandle(str)) {
int strLen = KNI_GetStringLength(str);
jchar* strBuf;
/* Instead of always multiplying the length by sizeof(jchar),
* we shift left by 1. This can be done because jchar has a
* size of 2 bytes.
*/
strBuf = (jchar*)midpMalloc(strLen<<1);
if (strBuf != NULL) {
KNI_GetStringRegion(str, 0, strLen, strBuf);
result = getLcConvMethodsID(strBuf, strLen);
midpFree(strBuf);
} else {
KNI_ThrowNew(midpOutOfMemoryError, NULL);
}
}
KNI_EndHandles();
KNI_ReturnInt(result);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:43,代码来源:conv.c
示例15: Java_com_sun_midp_content_RegistryStore_getHandler0
/**
* java call:
* private native String getHandler0(String callerId, String id, int mode);
*/
KNIEXPORT KNI_RETURNTYPE_OBJECT
Java_com_sun_midp_content_RegistryStore_getHandler0(void) {
int mode;
pcsl_string callerId = PCSL_STRING_NULL_INITIALIZER;
pcsl_string id = PCSL_STRING_NULL_INITIALIZER;
JSR211_RESULT_CH handler = _JSR211_RESULT_INITIALIZER_;
KNI_StartHandles(2);
KNI_DeclareHandle(callerObj);
KNI_DeclareHandle(handlerObj);
do {
KNI_GetParameterAsObject(1, callerObj);
KNI_GetParameterAsObject(2, handlerObj);
if (PCSL_STRING_OK != midp_jstring_to_pcsl_string(callerObj, &callerId) ||
PCSL_STRING_OK != midp_jstring_to_pcsl_string(handlerObj, &id)) {
KNI_ThrowNew(midpOutOfMemoryError,
"RegistryStore_getHandler0 no memory for string arguments");
break;
}
mode = KNI_GetParameterAsInt(3);
jsr211_get_handler(&callerId, &id, mode, &handler);
} while (0);
pcsl_string_free(&callerId);
pcsl_string_free(&id);
result2string((_JSR211_INTERNAL_RESULT_BUFFER_*)&handler, handlerObj);
KNI_EndHandlesAndReturnObject(handlerObj);
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:35,代码来源:regstore.c
示例16: Java_javax_microedition_lcdui_StringItemLFImpl_setContent0
/**
* KNI function that sets new content on the native resource corresponding to
* the current StringItem.
*
* Class: javax.microedition.lcdui.StringLFImpl
* Java prototype:
* private native int setContent0(int nativeId, Image image, altText,
* appearanceMode)
*
* INTERFACE (operand stack manipulation):
* parameters: nativeId pointer to the native resource of the StringItem
* text the new string set in the StringItem
* appearanceMode the appearance mode of the passed in text
* returns: <nothing>
*/
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_lcdui_StringItemLFImpl_setContent0() {
MidpError err = KNI_OK;
MidpItem *itemPtr = (MidpItem *)KNI_GetParameterAsInt(1);
int appearanceMode = KNI_GetParameterAsInt(3);
pcsl_string text;
pcsl_string_status rc;
KNI_StartHandles(1);
KNI_DeclareHandle(textJString);
KNI_GetParameterAsObject(2, textJString);
rc = midp_kjstring_to_pcsl_string(textJString, &text);
KNI_EndHandles();
if (PCSL_STRING_OK != rc) {
err = KNI_ENOMEM;
} else {
err = lfpport_stringitem_set_content(itemPtr, &text, appearanceMode);
}
pcsl_string_free(&text);
if (err == KNI_ENOMEM) {
KNI_ThrowNew(midpOutOfMemoryError, NULL);
}
KNI_ReturnVoid();
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:46,代码来源:lfp_stringitem.c
示例17: KNIDECL
KNI_RETURNTYPE_OBJECT
KNIDECL(com_sun_midp_security_Permissions_loadGroupList)
{
int lines, i1;
void* array;
KNI_StartHandles(2);
KNI_DeclareHandle(groups);
KNI_DeclareHandle(tmpString);
lines = permissions_load_group_list(&array);
if (lines > 0) {
char** list = (char**)array;
SNI_NewArray(SNI_STRING_ARRAY, lines, groups);
if (KNI_IsNullHandle(groups))
KNI_ThrowNew(midpOutOfMemoryError, NULL);
else
for (i1 = 0; i1 < lines; i1++) {
KNI_NewStringUTF(list[i1], tmpString);
KNI_SetObjectArrayElement(groups, (jint)i1, tmpString);
}
permissions_dealloc(array);
} else
KNI_ReleaseHandle(groups); /* set object to NULL */
KNI_EndHandlesAndReturnObject(groups);
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:27,代码来源:LoadPolicy_kni.c
示例18: KNIDECL
/**
* Gets the value of the specified property key in the internal
* property set. If the key is not found in the internal property
* set, the application property set is then searched.
* <p>
* Java declaration:
* <pre>
* getProperty0(Ljava.lang.String;)Ljava.lang.String;
* <pre>
*
* @param key The key to search for
*
* @return The value associated with <tt>key<tt> if found, otherwise
* <tt>null<tt>
*/
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(com_sun_midp_main_Configuration_getProperty0) {
jchar* uStr;
const char* key;
const char* value;
int strLen;
KNI_StartHandles(2);
KNI_DeclareHandle(str);
KNI_DeclareHandle(result);
KNI_GetParameterAsObject(1, str);
strLen = KNI_GetStringLength(str);
if (strLen <= 0 || (uStr = (jchar*) midpMalloc(strLen * sizeof(jchar))) == NULL) {
KNI_ThrowNew(midpOutOfMemoryError, NULL);
} else {
KNI_GetStringRegion(str, 0, strLen, uStr);
key = UnicodeToCString(uStr, strLen);
midpFree(uStr);
/* Look up the property value */
value = getInternalProperty(key);
midpFree((void *)key);
if (value != NULL) {
KNI_NewStringUTF(value, result);
} else {
KNI_ReleaseHandle(result);
}
}
KNI_EndHandlesAndReturnObject(result);
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:48,代码来源:properties_kni.c
示例19: KNIDECL
/**
* Get index of supported locales for device resources by its name.
* <p>
* Java declaration:
* <pre>
* getDevLocaleIndex(Ljava/lang/String)I
* </pre>
*
* @param locale name
* @return internal index of locale or -1 if locale is not supported
*/
KNIEXPORT KNI_RETURNTYPE_INT
KNIDECL(com_sun_j2me_global_DevResourceManagerFactory_getDevLocaleIndex) {
jint result =-1, index = 0;
jsize len = 0;
int error = 0;
jchar* locale_name;
KNI_StartHandles(1);
KNI_DeclareHandle(hstr1);
KNI_GetParameterAsObject(1, hstr1);
if (KNI_IsNullHandle(hstr1)) {
locale_name = NULL;
} else {
len = KNI_GetStringLength(hstr1);
locale_name = (jchar *)JAVAME_MALLOC((len + 1) * sizeof(jchar));
if (NULL == locale_name) {
KNI_ThrowNew(jsropOutOfMemoryError,
"Out of memory");
error = 1;
} else {
KNI_GetStringRegion(hstr1, 0, len, locale_name);
locale_name[len]=0;
}
}
if (!error){
result = jsr238_get_resource_locale_index(locale_name, &index);
if (result < 0) index =-1;
JAVAME_FREE(locale_name);
}
KNI_EndHandles();
KNI_ReturnInt(index);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:46,代码来源:jsr238_resources_kni.c
示例20: Java_com_sun_midp_content_InvocationStore_setParams0
/**
* Updates the parameters of the invocation in the native store.
* The ID, URL, Type, arguments, and data are stored again in native.
* The key into the native store is the TID;
*
* @param invoc the InvocationImpl to update the native params
* @see StoredInvoc
* @see #invocQueue
*/
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_content_InvocationStore_setParams0(void) {
StoredLink* link;
StoredInvoc* invoc;
int tid;
KNI_StartHandles(3);
KNI_DeclareHandle(invocObj);
KNI_DeclareHandle(obj1);
KNI_DeclareHandle(obj2);
KNI_GetParameterAsObject(1, invocObj);
init(invocObj, obj1);
/* Find the matching entry in the queue */
tid = KNI_GetIntField(invocObj, tidFid);
link = invocFindTid(tid);
if (link != NULL) {
invoc = link->invoc;
if (KNI_TRUE != setParamsFromObj(invoc, invocObj, obj1, obj2)) {
KNI_ThrowNew(midpOutOfMemoryError,
"invocStore.c: setParam0() allocation failed");
}
} else {
#if REPORT_LEVEL <= LOG_CRITICAL
REPORT_CRIT(LC_NONE,
"invocStore.c: setParam0() no entry for tid");
#endif
}
KNI_EndHandles();
KNI_ReturnVoid();
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:43,代码来源:invocStore.c
注:本文中的KNI_ThrowNew函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论