• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ KNI_DeclareHandle函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中KNI_DeclareHandle函数的典型用法代码示例。如果您正苦于以下问题:C++ KNI_DeclareHandle函数的具体用法?C++ KNI_DeclareHandle怎么用?C++ KNI_DeclareHandle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了KNI_DeclareHandle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: 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


示例2: KNIDECL

/*  private native boolean nCheckFileExist ( String path ) ; */
KNIEXPORT KNI_RETURNTYPE_BOOLEAN
KNIDECL(com_sun_mmedia_protocol_FileDS_nCheckFileExist) {
#define MAX_FILENAME_SIZE 100

    jboolean returnValue = KNI_FALSE;
    jsize length;
    jchar uFileName[MAX_FILENAME_SIZE + 1] = {0};

    KNI_StartHandles(1);
    KNI_DeclareHandle(pathHandle);

    /*
    KNI_GetParameterAsObject(1, pathHandle);
    length = KNI_GetStringLength(pathHandle);
    if (length < MAX_FILENAME_SIZE) {
        KNI_GetStringRegion(pathHandle, 0, length, uFileName);
        if (JAVACALL_OK == javacall_file_exist(uFileName, length)) {
            returnValue = KNI_TRUE;
        }
    } 
    */
 
    KNI_EndHandles();
    KNI_ReturnBoolean(returnValue);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:26,代码来源:KNIFileDS.c


示例3: 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:jiangxilong,项目名称:yari,代码行数:41,代码来源:midp_connection_registry_kni.c


示例4: Java_javax_microedition_khronos_egl_EGL10Impl__1eglInitialize

/*  private native int _eglInitialize ( int display , int [ ] major_minor ) ; */
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_khronos_egl_EGL10Impl__1eglInitialize() {

    jint display = KNI_GetParameterAsInt(1);
    EGLint major, minor;

    jint returnValue;

    KNI_StartHandles(1);
    KNI_DeclareHandle(major_minorHandle);

    KNI_GetParameterAsObject(2, major_minorHandle);

    returnValue = (jint) eglInitialize((EGLDisplay)display, &major, &minor);
#ifdef DEBUG
    printf("eglInitialize(0x%x, major<-%d, minor<-%d) = %d\n",
	   display, major, minor, returnValue);
#endif
    if ((returnValue == EGL_TRUE) && !KNI_IsNullHandle(major_minorHandle)) {
        KNI_SetIntArrayElement(major_minorHandle, 0, major);
        KNI_SetIntArrayElement(major_minorHandle, 1, minor);
    }

    KNI_EndHandles();
    KNI_ReturnInt(returnValue);
}
开发者ID:jiangxilong,项目名称:yari,代码行数:27,代码来源:JSR239-KNIEGL11Impl.c


示例5: Java_com_sun_midp_events_EventQueue_finalize

/**
 * Native finalizer to reset the native peer event queue when
 * the Isolate ends.
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_events_EventQueue_finalize(void) {
   jint queueId;
   EventQueue* pEventQueue;

   KNI_StartHandles(1);
   KNI_DeclareHandle(thisObject);
   KNI_GetThisPointer(thisObject);

   SNI_BEGIN_RAW_POINTERS;
   queueId = getEventQueuePtr(thisObject)->queueId;
   SNI_END_RAW_POINTERS;

   KNI_EndHandles();

   if (queueId >= 0) {
       resetEventQueue(queueId);

       /* Mark queue as inactive */
       GET_EVENT_QUEUE_BY_ID(pEventQueue, queueId);
       pEventQueue->isActive = KNI_FALSE;
   }

   KNI_ReturnVoid();
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:29,代码来源:midpEvents.c


示例6: Java_com_sun_midp_links_Link_init0

/**
 * private native void init0(int sender, int receiver);
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_links_Link_init0(void)
{
    int sender;
    int receiver;
    rendezvous *rp;

    KNI_StartHandles(1);
    KNI_DeclareHandle(thisObj);

    sender = KNI_GetParameterAsInt(1);
    receiver = KNI_GetParameterAsInt(2);
    KNI_GetThisPointer(thisObj);

    rp = rp_create(sender, receiver);
    if (rp == NULL) {
        KNI_ThrowNew(midpOutOfMemoryError, NULL);
    } else {
        setNativePointer(thisObj, rp);
        rp_incref(rp);
    }

    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:28,代码来源:midp_link.c


示例7: Java_javax_microedition_khronos_egl_EGL10Impl__1eglQueryContext

/*  private native int _eglQueryContext ( int display , int ctx , int attribute , int [ ] value ) ; */
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_khronos_egl_EGL10Impl__1eglQueryContext() {

    jint display = KNI_GetParameterAsInt(1);
    jint ctx = KNI_GetParameterAsInt(2);
    jint attribute = KNI_GetParameterAsInt(3);
    EGLint value;

    jint returnValue = EGL_FALSE;

    KNI_StartHandles(1);
    KNI_DeclareHandle(valueHandle);

    KNI_GetParameterAsObject(4, valueHandle);

    returnValue = (jint)eglQueryContext((EGLDisplay)display,
					(EGLContext)ctx,
					attribute,
					&value);
#ifdef DEBUG
    printf("eglQueryContext(0x%x, 0x%x, %d, value<-%d) = %d\n",
	   display, ctx, attribute, value, returnValue);
#endif
    if ((returnValue == EGL_TRUE) && !KNI_IsNullHandle(valueHandle)) {
        KNI_SetIntArrayElement(valueHandle, 0, value);
    }

    KNI_EndHandles();
    KNI_ReturnInt(returnValue);
}
开发者ID:jiangxilong,项目名称:yari,代码行数:31,代码来源:JSR239-KNIEGL11Impl.c


示例8: 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


示例9: 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


示例10: KNIDECL

KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(javax_microedition_lcdui_TextFieldLFImpl_mallocToJavaChars) {
    KNI_StartHandles(1);
    KNI_DeclareHandle(temp);
    KNI_ReleaseHandle(temp);
    KNI_EndHandlesAndReturnObject(temp);
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:7,代码来源:imgapi_image_kni.c


示例11: Java_com_sun_mmedia_DirectRecord_nSetLocator

/*  private native int nSetLocator ( int handle , String locator ) ; */
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_sun_mmedia_DirectRecord_nSetLocator() {
    jint handle = KNI_GetParameterAsInt(1);
    KNIPlayerInfo* pKniInfo = (KNIPlayerInfo*)handle;
    jint locatorLength;
    jchar* locator = NULL;
    jint returnValue = 0;
    javacall_result ret;

    KNI_StartHandles(1);
    KNI_DeclareHandle(locatorHandle);
    KNI_GetParameterAsObject(2, locatorHandle);
    
    locatorLength = KNI_GetStringLength(locatorHandle);
    locator = MMP_MALLOC(locatorLength * sizeof(jchar));
    if (locator) {
        KNI_GetStringRegion(locatorHandle, 0, locatorLength, locator);
        if (pKniInfo && pKniInfo->pNativeHandle) {
            ret = javacall_media_recording_handled_by_native(pKniInfo->pNativeHandle, locator, locatorLength);
            if (JAVACALL_INVALID_ARGUMENT == ret) {
                returnValue = -1;
                REPORT_ERROR1(LC_MMAPI, "[kni_record] Set recording location \
                    return JAVACALL_INVALID_ARGUMENT handle=%d\n", pKniInfo->pNativeHandle);
            } else {
                if (JAVACALL_OK == ret) {
开发者ID:sfsy1989,项目名称:j2me,代码行数:26,代码来源:KNIDirectRecord.c


示例12: Java_com_sun_midp_io_j2me_socket_Protocol_setSockOpt0

/**
 * Sets the requested socket option.
 * <p>
 * Java declaration:
 * <pre>
 *     setSockOpt(II)V
 * </pre>
 *
 * @param option socket option to set
 * @param value the value to set <tt>option</tt> to
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_io_j2me_socket_Protocol_setSockOpt0(void) {
    int option;
    int value;
    void *pcslHandle;
    int status = PCSL_NET_INVALID;
    
    value  = (int)KNI_GetParameterAsInt(2);
    option = (int)KNI_GetParameterAsInt(1);

    KNI_StartHandles(1);
    KNI_DeclareHandle(thisObject);
    KNI_GetThisPointer(thisObject);

    pcslHandle = (void *)(getMidpSocketProtocolPtr(thisObject)->handle);

    KNI_EndHandles();

    if (INVALID_HANDLE == pcslHandle) {
        KNI_ThrowNew(midpIOException, 
                     "invalid handle during socket::getPort");
    } else {
        status = pcsl_network_setsockopt(pcslHandle, option, value);
        if (status == PCSL_NET_IOERROR) {
            KNI_ThrowNew(midpIllegalArgumentException, "Unsupported Socket Option");
        } else if (PCSL_NET_INVALID == status) {
            KNI_ThrowNew(midpIllegalArgumentException, "Illegal Socket Option Value");
        }
    }

    KNI_ReturnVoid();
}
开发者ID:jiangxilong,项目名称:yari,代码行数:43,代码来源:socketProtocol.c


示例13: Java_com_sun_midp_io_j2me_socket_Protocol_getPort0

/**
 * Gets the requested port number.
 * <p>
 * Java declaration:
 * <pre>
 *     getPort(Z)I
 * </pre>
 *
 * @param local <tt>true</tt> to get the local port number, or
 *              <tt>false</tt> to get the remote port number
 *
 * @return the port number
 */
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_sun_midp_io_j2me_socket_Protocol_getPort0(void) {
    int local;
    void *pcslHandle;
    int port = 0;
    int status = PCSL_NET_INVALID;

    local = (int)KNI_GetParameterAsInt(1);

    KNI_StartHandles(1);
    KNI_DeclareHandle(thisObject);
    KNI_GetThisPointer(thisObject);

    pcslHandle = (void *)(getMidpSocketProtocolPtr(thisObject)->handle);

    KNI_EndHandles();

    if (INVALID_HANDLE == pcslHandle) {
        KNI_ThrowNew(midpIOException, 
                     "invalid handle during socket::getPort");
    } else {
        if (local == 1) {
            status = pcsl_network_getlocalport(pcslHandle, &port);
        } else {
            status = pcsl_network_getremoteport(pcslHandle, &port);
        }

        if (status == PCSL_NET_IOERROR) {
            KNI_ThrowNew(midpIOException, NULL);
        }
    }

    KNI_ReturnInt((jint)port);
}
开发者ID:jiangxilong,项目名称:yari,代码行数:47,代码来源:socketProtocol.c


示例14: initializeSurfaceFieldIds

static jboolean
initializeSurfaceFieldIds(jobject objectHandle) {
    static const FieldDesc surfaceFieldDesc[] = {
                { "nativePtr", "J" },
                { NULL, NULL }
            };

    jboolean retVal;

    if (fieldIdsInitialized) {
        return KNI_TRUE;
    }

    retVal = KNI_FALSE;

    KNI_StartHandles(1);
    KNI_DeclareHandle(classHandle);

    KNI_GetObjectClass(objectHandle, classHandle);

    if (initializeFieldIds(fieldIds, classHandle, surfaceFieldDesc)) {
        retVal = KNI_TRUE;
        fieldIdsInitialized = KNI_TRUE;
    }

    KNI_EndHandles();
    return retVal;
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:28,代码来源:JAbstractSurface.c


示例15: 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


示例16: Java_com_sun_midp_links_Link_close

/**
 * public native void close();
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_links_Link_close(void)
{
    rendezvous *rp;
    KNI_StartHandles(1);
    KNI_DeclareHandle(thisObj);

    KNI_GetThisPointer(thisObj);
    rp = getNativePointer(thisObj);

    /* ignore if closed twice */
    if (rp != NULL) {
        if (rp->sender == JVM_CurrentIsolateID()
                && rp->msg != INVALID_REFERENCE_ID) {
            /* we're the sender, make sure to clean out our message */
            SNI_DeleteReference(rp->msg);
            rp->msg = INVALID_REFERENCE_ID;
        }

        rp->state = CLOSED;
        midp_thread_signal(LINK_READY_SIGNAL, (int)rp, 0);
        setNativePointer(thisObj, NULL);
        rp_decref(rp);
    }

    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:31,代码来源:midp_link.c


示例17: Java_javax_microedition_lcdui_ImageData_finalize

/**
 * Releases any native resources used by this immutable <tt>ImageData</tt>.
 * <p>
 * Java declaration:
 * <pre>
 *     finalize()V
 * </pre>
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_lcdui_ImageData_finalize() {
    java_imagedata * imageDataPtr = NULL;
    gxpport_image_native_handle h;

    KNI_StartHandles(1);
    KNI_DeclareHandle(thisObject);
    KNI_GetThisPointer(thisObject);

    imageDataPtr = IMGAPI_GET_IMAGEDATA_PTR(thisObject);

    /*
     * Image objects with NULL nativeImageData could exist when loading
     * romized image but failed.
     */
    h = (gxpport_image_native_handle)imageDataPtr->nativeImageData;
    if (h != NULL) {
        if (imageDataPtr->isMutable) {
            gxpport_destroy_mutable(h);
        } else {
            gxpport_destroy_immutable(h);
        }
    }

    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:35,代码来源:imgp_imagedata_kni.c


示例18: KNIDECL

/**
 * Initializes the native peer of this <tt>Font</tt>.
 * <p>
 * Java declaration:
 * <pre>
 *     init(III)V
 * </pre>
 *
 * @param face The face of the font to initialize
 * @param style The style of the font to initialize
 * @param size The point size of the font to initialize
 */
KNIEXPORT KNI_RETURNTYPE_VOID
KNIDECL(javax_microedition_lcdui_Font_init) {
    jboolean free_size = KNI_GetParameterAsBoolean(4);
    int size  = (int)KNI_GetParameterAsInt(3);
    int style = (int)KNI_GetParameterAsInt(2);
    int face  = (int)KNI_GetParameterAsInt(1);
    int ascent, descent, leading;

    KNI_StartHandles(1);
    KNI_DeclareHandle(thisObject);

    if (free_size == KNI_FALSE) {
        /* size is one of the SIZE_XXX constants */
        size = OEM_FONT_SIZE(size);
    }

    KNI_GetParameterAsObject(0, thisObject);

    gx_get_fontinfo(face, style, size, &ascent, &descent, &leading);

    SNI_BEGIN_RAW_POINTERS;

    GET_FONT_PTR(thisObject)->baseline = (jint)ascent;
    GET_FONT_PTR(thisObject)->height = (jint)(ascent + descent + leading);
    GET_FONT_PTR(thisObject)->size = (jint)size;
    GET_FONT_PTR(thisObject)->sizeRounded = (jint) LCDUI_FONT_SIZE(size);

    SNI_END_RAW_POINTERS;

    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:44,代码来源:gxapi_font_kni.c


示例19: Java_com_sun_midp_jsr82emul_ConnectionEmul_getOutData

KNIEXPORT KNI_RETURNTYPE_BOOLEAN
Java_com_sun_midp_jsr82emul_ConnectionEmul_getOutData() {
    int  myHandle = (int)KNI_GetParameterAsInt(1);
    connection_info_t *info = &emul_data.handled_info[myHandle].conn;
    jboolean ret = KNI_TRUE;
    int buflen;
    
    LOG1("ConnectionEmul_getOutData(%d)", myHandle);    
    
    if (info->flags & IN_USE) {
        KNI_StartHandles(1);
        KNI_DeclareHandle(buf);
        KNI_GetParameterAsObject(2, buf);
        buflen = KNI_GetArrayLength(buf);
        
        if (info->out_len < buflen) {
            LOG1("ConnectionEmul_getOutData(%d) requests too much data", myHandle);
            ret = KNI_FALSE;
        } else {
            memcpy(JavaByteArray(buf), info->out, buflen);
            info->out_len -= buflen;
            memmove(info->out, &info->out[buflen], info->out_len);
            info->out = midpRealloc(info->out, info->out_len);
            if (info->out_len == 0) {
                info->out = NULL;
            }
        }
        
        KNI_EndHandles();
    } else {
        ret = KNI_FALSE;
    }
    
    KNI_ReturnBoolean(ret);
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:35,代码来源:emul.c


示例20: Java_javax_microedition_khronos_egl_EGL10Impl__1eglCopyBuffers

/*  private native int _eglCopyBuffers ( int display , int surface , Graphics target ) ; */
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_khronos_egl_EGL10Impl__1eglCopyBuffers() {
    EGLDisplay display = (EGLDisplay) KNI_GetParameterAsInt(1);
    EGLSurface surface = (EGLSurface) KNI_GetParameterAsInt(2);
    jint width = KNI_GetParameterAsInt(4);
    jint height = KNI_GetParameterAsInt(5);
    jint flip = 0;

    JSR239_Pixmap *pixmap = (JSR239_Pixmap *) 0;
    EGLBoolean returnValue = EGL_FALSE;
    
    KNI_StartHandles(1);
    KNI_DeclareHandle(graphicsHandle);
    KNI_GetParameterAsObject(3, graphicsHandle);

    returnValue = (jint)eglCopyBuffers((EGLDisplay) display,
                                       (EGLSurface) surface,
                                       (NativePixmapType) pixmap);

#ifdef DEBUG
    printf("eglCopyBuffers(0x%x, 0x%x, 0x%x) = %d\n",
           display, surface, pixmap, returnValue);
#endif
        
    /* Workaround - use glReadPixels if eglCopyBuffers fails. */
    if (returnValue == EGL_FALSE) {
    
        pixmap = JSR239_getImagePixmap(graphicsHandle,
                                   width, height,
                                   4, 8, 8, 8, 8);
        if (!pixmap) {
            KNI_ThrowNew("java.lang.OutOfMemoryException", "eglCopyBuffers");
            goto exit;
        }
    
        // Enforce RGBA order of glReadPixels
        pixmap->aOffset = 24;
        pixmap->bOffset = 16;
        pixmap->gOffset = 8;
        pixmap->rOffset = 0;
    
        returnValue = eglCopyBuffersWorkaround((EGLDisplay) display,
                                               (EGLSurface) surface,
                                               pixmap);
        flip = 1;
    }
    
    if (returnValue == EGL_TRUE) {
        JSR239_putWindowContents(graphicsHandle, pixmap, flip);
    }

    if (pixmap) {
        JSR239_destroyPixmap(pixmap);
    }

 exit:
        
    KNI_EndHandles();
    KNI_ReturnInt((jint)returnValue);
}
开发者ID:jiangxilong,项目名称:yari,代码行数:61,代码来源:JSR239-KNIEGL11Impl.c



注:本文中的KNI_DeclareHandle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ KNI_EndHandles函数代码示例发布时间:2022-05-30
下一篇:
C++ KMakeTrace函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap