Esempio n. 1
0
/**
 * java call:
 *  private native String getByURL0(String callerId, String url, String action);
 */
KNIEXPORT KNI_RETURNTYPE_OBJECT
Java_com_sun_midp_content_RegistryStore_getByURL0(void) {
    pcsl_string callerId = PCSL_STRING_NULL_INITIALIZER;
    pcsl_string url = PCSL_STRING_NULL_INITIALIZER;
    pcsl_string action = PCSL_STRING_NULL_INITIALIZER;
    JSR211_RESULT_CH result = _JSR211_RESULT_INITIALIZER_;

    KNI_StartHandles(4);
    KNI_DeclareHandle(callerObj);
    KNI_DeclareHandle(urlObj);
    KNI_DeclareHandle(actionObj);
    KNI_DeclareHandle(resultObj);

    do {
        KNI_GetParameterAsObject(1, callerObj);
        KNI_GetParameterAsObject(2, urlObj);
        KNI_GetParameterAsObject(3, actionObj);
        if (PCSL_STRING_OK != midp_jstring_to_pcsl_string(callerObj, &callerId) ||
            PCSL_STRING_OK != midp_jstring_to_pcsl_string(urlObj, &url) ||
            PCSL_STRING_OK != midp_jstring_to_pcsl_string(actionObj, &action)) {
            KNI_ThrowNew(midpOutOfMemoryError, 
                   "RegistryStore_getByURL0 no memory for string arguments");
            break;
        }

        jsr211_handler_by_URL(&callerId, &url, &action, &result);
    } while (0);

    pcsl_string_free(&action);
    pcsl_string_free(&url);
    pcsl_string_free(&callerId);
    result2string((_JSR211_INTERNAL_RESULT_BUFFER_*)&result, resultObj);

    KNI_EndHandlesAndReturnObject(resultObj);
}
/* JAVADOC COMMENT ELIDED */
KNIEXPORT KNI_RETURNTYPE_OBJECT
    KNIDECL(com_sun_j2me_location_LocationPersistentStorage_landmarkStoreGetNext) {
    
    javacall_handle hndl;
    javacall_result res;
    javacall_utf16_string storeName;

    KNI_StartHandles(1);
    KNI_DeclareHandle(stringObj);
    hndl = (javacall_handle)KNI_GetParameterAsInt(1);

    res = javacall_landmarkstore_list_next(hndl, &storeName);
    switch (res) {
        case JAVACALL_OK:
            /* LandmarkStore name returned successfully */
            if (storeName != NULL) {
                jsrop_jstring_from_utf16_string(KNIPASSARGS storeName, stringObj);
            } else {
                /* Category name returned successfully */
                KNI_ReleaseHandle(stringObj);
            }
            break;
        default:
            /* operation Failed */
            KNI_ThrowNew(jsropIOException, "I/O error");
            break;
    }

    KNI_EndHandlesAndReturnObject(stringObj);    
}
Esempio n. 3
0
 /**
  * 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);
}
Esempio n. 4
0
/**
 * java call:
 *   private native String findHandler0(String callerId, int searchBy, 
 *                                      String value);
 */
KNIEXPORT KNI_RETURNTYPE_OBJECT
Java_com_sun_midp_content_RegistryStore_findHandler0(void) {
    pcsl_string callerId = PCSL_STRING_NULL_INITIALIZER;
    jsr211_field searchBy;
    pcsl_string value = PCSL_STRING_NULL_INITIALIZER;
    JSR211_RESULT_CHARRAY result = _JSR211_RESULT_INITIALIZER_;

    KNI_StartHandles(2);
    KNI_DeclareHandle(callerObj);
    KNI_DeclareHandle(valueObj);

    do {
        KNI_GetParameterAsObject(1, callerObj);
        KNI_GetParameterAsObject(3, valueObj);
        if (PCSL_STRING_OK != midp_jstring_to_pcsl_string(callerObj, &callerId) ||
            PCSL_STRING_OK != midp_jstring_to_pcsl_string(valueObj, &value)) {
            KNI_ThrowNew(midpOutOfMemoryError, 
                   "RegistryStore_register0 no memory for string arguments");
            break;
        }

        searchBy = (jsr211_field) KNI_GetParameterAsInt(2);
        jsr211_find_handler(&callerId, searchBy, &value, &result);

    } while (0);

    pcsl_string_free(&value);
    pcsl_string_free(&callerId);
    result2string((_JSR211_INTERNAL_RESULT_BUFFER_*)&result, valueObj);

    KNI_EndHandlesAndReturnObject(valueObj);
}
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);
}
Esempio n. 6
0
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(javax_microedition_lcdui_TextFieldLFImpl_getNativeEditorContent) {
    KNI_StartHandles(1);
    KNI_DeclareHandle(temp);
    KNI_ReleaseHandle(temp);
    KNI_EndHandlesAndReturnObject(temp);
}
/**
 * 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);
}
Esempio n. 8
0
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(KNITest_returnThis) {
    KNI_StartHandles(1);
    KNI_DeclareHandle(this);
    KNI_GetThisPointer(this);
    KNI_EndHandlesAndReturnObject(this);
}
Esempio n. 9
0
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(KNITest_newString) {
    KNI_StartHandles(1);
    KNI_DeclareHandle(newStr);
    KNI_NewString(NULL, -1, newStr);
    KNI_EndHandlesAndReturnObject(newStr);
}
Esempio n. 10
0
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(javax_microedition_lcdui_TextFieldLFImpl_mallocToJavaChars) {
    KNI_StartHandles(1);
    KNI_DeclareHandle(temp);
    KNI_ReleaseHandle(temp);
    KNI_EndHandlesAndReturnObject(temp);
}
Esempio n. 11
0
/**
 * 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);
}
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(com_sun_midp_chameleon_skins_resources_SkinResourcesImpl_getSharedSkinData) {
    
#if ENABLE_MULTIPLE_ISOLATES
    KNI_StartHandles(1);
    KNI_DeclareHandle(obj);
    if (skinProperties >= 0) {
        SNI_GetReference(skinProperties, obj);
    }
    KNI_EndHandlesAndReturnObject(obj);
#else
    KNI_StartHandles(1);
    KNI_DeclareHandle(tempHandle);
    KNI_EndHandlesAndReturnObject(tempHandle);
#endif

}
Esempio n. 13
0
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(KNITest_newStringArray) {
    jint len = KNI_GetParameterAsInt(1);
    KNI_StartHandles(1);
    KNI_DeclareHandle(newStrArray);
    SNI_NewArray(SNI_STRING_ARRAY, len, newStrArray);
    KNI_EndHandlesAndReturnObject(newStrArray);
}
Esempio n. 14
0
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(KNITest_newStringUTF) {
    const char* buf = "hello";
    KNI_StartHandles(1);
    KNI_DeclareHandle(newStr);
    KNI_NewStringUTF(buf, newStr);
    KNI_EndHandlesAndReturnObject(newStr);
}
Esempio n. 15
0
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(KNITest_getSuperClass) {
    KNI_StartHandles(2);
    KNI_DeclareHandle(class);
    KNI_DeclareHandle(superClass);
    KNI_GetParameterAsObject(1, class);
    KNI_GetSuperClass(class, superClass);
    KNI_EndHandlesAndReturnObject(superClass);
}
Esempio n. 16
0
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(com_sun_mmedia_DefaultConfiguration_nListProtocolsNext) {
    ListIterator *iterator;
    char *p;
    unsigned int len;
    char stack_string_buffer[MAX_PROTOCOLNAME_LEN], *proto = NULL;
    
    KNI_StartHandles(1);
    KNI_DeclareHandle(stringObj);
    iterator = (ListIterator *)KNI_GetParameterAsInt(1);
    KNI_ReleaseHandle(stringObj);

    do {
        if (iterator == NULL || iterator->current == NULL) { /* Wrong parameter */
            KNI_ThrowNew(jsropIllegalArgumentException, "Illegal iterator");
            break;
        }
        /* finding next item in the list */
        if ((p = strchr(iterator->current, ' ')) != NULL) {
            len = (int)(p - iterator->current);
        } else {
            len = strlen(iterator->current);
        }
        if (len == 0) { /* End of list */
            break;
        }
        
        /* is the stack buffer enough for the item? */
        if (len >= sizeof stack_string_buffer / sizeof stack_string_buffer[0]) {
            proto = MMP_MALLOC(len + 1);
            if (proto == NULL) {
                KNI_ThrowNew(jsropOutOfMemoryError, NULL);
                break;
            }
        } else {
            proto = stack_string_buffer;
        }

        /* shift to next item in the list */
        memcpy(proto, iterator->current, len);
        proto[len] = '\0';
        iterator->current += len;
        while (*iterator->current == ' ') {
            iterator->current++;
        }
    } while (0);
    
    if (proto != NULL) {
        KNI_NewStringUTF(proto, stringObj);
        if (proto != stack_string_buffer) {
            MMP_FREE(proto);
        }
    }
    KNI_EndHandlesAndReturnObject(stringObj);
}
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(com_sun_midp_automation_AutoScreenshotTaker_getScreenshotRGB8880) {
    KNI_StartHandles(1); 
    KNI_DeclareHandle(objectHandle); 
 
    /* Set the handle explicitly to null */
    KNI_ReleaseHandle(objectHandle); 
 
    /* Return the null reference to the calling Java method */
    KNI_EndHandlesAndReturnObject(objectHandle); 
}
Esempio n. 18
0
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(KNITest_newObjectArray) {
    jint len;
    KNI_StartHandles(2);
    KNI_DeclareHandle(newArr);
    KNI_DeclareHandle(clazz);
    KNI_GetParameterAsObject(1, clazz);
    len = KNI_GetParameterAsInt(2);
    SNI_NewObjectArray(clazz, len, newArr);
    KNI_EndHandlesAndReturnObject(newArr);
}
Esempio n. 19
0
/**
 * Retrives error message clears error state.
 * <p>Java declaration:
 * <pre>
 * private native String getErrorMessage0();
 * </pre>
 * @return Error message string
 */
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(com_sun_cardreader_PlatformCardDevice_getErrorMessage0) {
    jbyte err_msg[1024];
    
    KNI_StartHandles(1);
    KNI_DeclareHandle(err_msg_handle);
    
    if (javacall_carddevice_get_error(err_msg, sizeof err_msg) == JAVACALL_TRUE) {
        KNI_NewStringUTF(err_msg, err_msg_handle);
    }
    
    KNI_EndHandlesAndReturnObject(err_msg_handle);
}
Esempio n. 20
0
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(KNITest_getStringRegion) {
    jchar buf[20];
    jint offset = KNI_GetParameterAsInt(2);
    jint len = KNI_GetParameterAsInt(3);
    KNI_StartHandles(2);
    KNI_DeclareHandle(str);
    KNI_DeclareHandle(newStr);
    KNI_GetParameterAsObject(1, str);
    KNI_GetStringRegion(str, offset, len, buf);
    KNI_NewString(buf, len, newStr);
    KNI_EndHandlesAndReturnObject(newStr);
}
Esempio n. 21
0
/**
 * java call:
 *   private native String forSuite0(int suiteId);
 */
KNIEXPORT KNI_RETURNTYPE_OBJECT
Java_com_sun_midp_content_RegistryStore_forSuite0(void) {
    JSR211_RESULT_CHARRAY result = _JSR211_RESULT_INITIALIZER_;
    SuiteIdType suiteId;

    KNI_StartHandles(1);
    KNI_DeclareHandle(strObj);   // Result String object

    suiteId = (jsr211_field) KNI_GetParameterAsInt(1);
    jsr211_find_for_suite(suiteId, &result);
    result2string((_JSR211_INTERNAL_RESULT_BUFFER_*)&result, strObj);

    KNI_EndHandlesAndReturnObject(strObj);
}
Esempio n. 22
0
File: emul.c Progetto: sfsy1989/j2me
KNIEXPORT KNI_RETURNTYPE_OBJECT
Java_com_sun_midp_jsr82emul_EmulationClient_getLocalIP() {
    char value[4 * 4];

    KNI_StartHandles(1);
    KNI_DeclareHandle(result);

    if (JAVACALL_OK == javacall_network_get_local_ip_address_as_string(value)) {
        KNI_NewStringUTF(value, result);
    } else {
        KNI_ReleaseHandle(result);
    }
    
    KNI_EndHandlesAndReturnObject(result); 
}
Esempio n. 23
0
File: emul.c Progetto: sfsy1989/j2me
KNIEXPORT KNI_RETURNTYPE_OBJECT
Java_com_sun_midp_jsr82emul_EmulationClient_getServerIP() {
    char *value = getenv("JSR82_EMUL_IP");
    
    KNI_StartHandles(1);
    KNI_DeclareHandle(result);

    if (NULL != value) {
        KNI_NewStringUTF(value, result);
    } else {
        KNI_ReleaseHandle(result);
    }
    
    KNI_EndHandlesAndReturnObject(result); 
}
Esempio n. 24
0
/* JAVADOC COMMENT ELIDED */
KNIEXPORT KNI_RETURNTYPE_OBJECT
Java_com_sun_j2me_location_PlatformLocationProvider_getListOfLocationProviders() {

    pcsl_string listOfProviders = PCSL_STRING_NULL;

    KNI_StartHandles(1);
    KNI_DeclareHandle(tempHandle);

    if (jsr179_property_get(JSR179_PROVIDER_LIST, 
        &listOfProviders) == JSR179_STATUSCODE_OK) {
        midp_jstring_from_pcsl_string(&listOfProviders, tempHandle);
    }
	pcsl_string_free(&listOfProviders);
    KNI_EndHandlesAndReturnObject(tempHandle);
}
Esempio n. 25
0
/* This is called by the last active TextFieldLFImpl to retrieve
 * the contents of the native editor, which was saved by
 * MIDPWindow.disableAndSyncNativeEditor() into a malloc'ed buffer above.
 * See disableAndSyncNativeEditor above for more info.
 */
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(javax_microedition_lcdui_TextFieldLFImpl_mallocToJavaChars) {
    int strLen = KNI_GetParameterAsInt(2);
    jchar *tmp = (jchar*)KNI_GetParameterAsInt(1);

    KNI_StartHandles(1);
    KNI_DeclareHandle(chars);
#if 0
    SNI_NewArray(SNI_CHAR_ARRAY, strLen, chars);
    if (!KNI_IsNullHandle(chars)) {
        memcpy(JavaCharArray(chars), tmp, strLen*sizeof(jchar));
    }
#endif
    midpFree((void*)tmp);
    KNI_EndHandlesAndReturnObject(chars);
}
Esempio n. 26
0
/**
 * Get one of supported locales (by number).
 * <p>
 * Java declaration:
 * <pre>
 *     getCollationLocale(I)Ljava/lang/String
 * </pre>
 *
 * @param index  index of locale to select
 * @return locale
 */
KNIEXPORT KNI_RETURNTYPE_OBJECT
Java_com_sun_j2me_global_CollationAbstractionLayerImpl_getCollationLocaleName() {
	jint len=MAX_LOCALE_LENGTH, res;
    jint index = KNI_GetParameterAsInt(1);
    jchar locale_name[MAX_LOCALE_LENGTH];

    KNI_StartHandles(1);
    KNI_DeclareHandle(hloc);
	res = jsr238_get_collation_locale_name(index,locale_name,&len);
    if (res < 0 ) {
        KNI_ReleaseHandle(hloc);
		KNI_ThrowNew(midpRuntimeException,"Get locale name");
    } else {
        KNI_NewString(locale_name, len - 1, hloc);
    }
    KNI_EndHandlesAndReturnObject(hloc);
}
Esempio n. 27
0
/**
 * Get one of supported device locales (by number).
 * <p>
 * Java declaration:
 * <pre>
 *     getDevLocaleName(I)Ljava/lang/String
 * </pre>
 *
 * @param index  index of locale to select
 * @return locale name
 */
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(com_sun_j2me_global_DevResourceManagerFactory_getDevLocaleName) {
	jint len=MAX_LOCALE_LENGTH, res;
    jint index = KNI_GetParameterAsInt(1);
    jchar locale_name[MAX_LOCALE_LENGTH];

    KNI_StartHandles(1);
    KNI_DeclareHandle(hloc);
	res = jsr238_get_resource_locale_name(index,locale_name,&len);
    if (res < 0 ) {
        KNI_ReleaseHandle(hloc);
		KNI_ThrowNew(jsropRuntimeException,"Get locale name");
    } else {
        KNI_NewString(locale_name, len - 1, hloc);
    }
    KNI_EndHandlesAndReturnObject(hloc);
}
Esempio n. 28
0
/**
 * Gets the local IP number.
 * <p>
 * Java declaration:
 * <pre>
 *     static getHost0(V)Ljava/lang/String;
 * </pre>
 *
 * @return the local IP address as a dotted-quad <tt>String</tt>
 */
KNIEXPORT KNI_RETURNTYPE_OBJECT
Java_com_sun_midp_io_j2me_datagram_Protocol_getHost0(void) {
    char value[MAX_HOST_LENGTH];
    int status;

    KNI_StartHandles(1);
    KNI_DeclareHandle(result);

    status = pcsl_network_getLocalIPAddressAsString(value);

    if ((status == PCSL_NET_SUCCESS) && (value != NULL)) {
        KNI_NewStringUTF(value, result);
    } else {
        KNI_ReleaseHandle(result);
    }

    KNI_EndHandlesAndReturnObject(result);
}
KNI_RETURNTYPE_OBJECT
KNIDECL(com_sun_midp_security_Permissions_loadGroupPermissions)
{
    int lines, i1;
	unsigned int str_len;
    void *array;
    jchar jbuff[64];
    char  group_name[64];

    KNI_StartHandles(3);
    KNI_DeclareHandle(members);
    KNI_DeclareHandle(tmpString);
    KNI_DeclareHandle(group);

    KNI_GetParameterAsObject(1, group);
    if (!KNI_IsNullHandle(group)) {
        str_len = KNI_GetStringLength(group);
        if (str_len <= sizeof(group_name)-1) {
            KNI_GetStringRegion(group, 0, str_len, jbuff);
            jchar_to_char(jbuff, group_name, str_len);
            lines = permissions_load_group_permissions(&array, group_name);
            if (lines > 0) {
                char **list = (char**)array;
                SNI_NewArray(SNI_STRING_ARRAY,  lines, members);
                if (KNI_IsNullHandle(members))
                    KNI_ThrowNew(midpOutOfMemoryError, NULL);
                else
                    for (i1 = 0; i1 < lines; i1++) {
                        KNI_NewStringUTF(list[i1], tmpString);
                        KNI_SetObjectArrayElement(members, (jint)i1,
                                                            tmpString);
                    }
                permissions_dealloc(array);
            } else
                KNI_ReleaseHandle(members);  /* set object to NULL */
        }
    } else
        KNI_ThrowNew(midpNullPointerException, "null group parameter");


    KNI_EndHandlesAndReturnObject(members);
}
Esempio n. 30
0
/* Return the content of the editor in a Java string. */
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(javax_microedition_lcdui_TextFieldLFImpl_getNativeEditorContent) {
    KNI_StartHandles(1);
    KNI_DeclareHandle(chars);
#if 0
    if (editBoxShown) {
        int strLen = GetWindowTextLength(hwndTextActive);
        jchar *tmp = (jchar*)midpMalloc((strLen + 1) * sizeof(jchar));
        if (tmp) {
            GetWindowText(hwndTextActive, (LPTSTR)tmp, strLen+1); /* 0-terminated */
            SNI_NewArray(SNI_CHAR_ARRAY, strLen, chars);
            if (!KNI_IsNullHandle(chars)) {
                memcpy(JavaCharArray(chars), tmp, strLen*sizeof(jchar));
            }
            midpFree((void*)tmp);
        }
    }
#endif
    KNI_EndHandlesAndReturnObject(chars);
}