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

C++ ptr_to_jlong函数代码示例

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

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



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

示例1: doeE_make

/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    cInitialize
 * Signature: (Lsun/dc/path/PathConsumer;)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_cInitialize
  (JNIEnv *env, jobject obj, jobject out)
{
    jclass	cls;
    jfieldID	fid;
    jmethodID	mid;

    PathStroker	cdata;

    doeE	cenv	= doeE_make();
    doeE_setPCtxt(cenv, env);

    cdata = (PathStroker)doeMem_malloc(cenv, sizeof(PathStrokerData));
    if (doeError_occurred(cenv)) {
	CJError_throw(cenv);
	return;
    }
    (*env)->SetLongField(env, obj, fidCData, ptr_to_jlong(cdata));

    /* __________________________
     * the c environment variable
     */
    cdata->env = cenv;

    /* Register the data for disposal */
    Disposer_AddRecord(env, obj, PathStroker_DisposeOps, ptr_to_jlong(cdata));

    /* __________________________________
     * the corresponding CJ path consumer
     * (always created so as to be able to deal with any type of
     *  incoming out path consumers)
     */
    cdata->cjout = CJPathConsumer_create(cenv, out);
    if (doeError_occurred(cenv)) {
	CJError_throw(cenv);
	return;
    }

    /* ________________________________________________
     * determines if "out" has a native implementation.
     */
    cls = (*env)->GetObjectClass(env, out);
    mid = (*env)->GetMethodID(env, cls, "getCPathConsumer", "()J");
    cdata->cout = (dcPathConsumer)
	jlong_to_ptr((*env)->CallLongMethod(env, out, mid));

    /* ________________________
     * the actual c PathStroker
     */
    if (cdata->cout) {
	cdata->stroker = dcPathStroker_create(cenv, cdata->cout);
    } else {
	cdata->stroker = dcPathStroker_create(cenv, (dcPathConsumer)cdata->cjout);
    }
    if (doeError_occurred(cenv)) {
	CJError_throw(cenv);
	return;
    }
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:64,代码来源:PathStroker.c


示例2: set_native_handle

void set_native_handle(JNIEnv *env, jclass_type_t type, jobject obj, void *handle)
{
         switch (type) {
                case JCLASS_DATAOBJECT:
                        return (*env)->SetLongField(env, obj, jc_dataobject.fid.native, ptr_to_jlong(handle));
                case JCLASS_NODE:
                        return (*env)->SetLongField(env, obj, jc_node.fid.native, ptr_to_jlong(handle));
                case JCLASS_ATTRIBUTE:
                        return (*env)->SetLongField(env, obj, jc_attribute.fid.native, ptr_to_jlong(handle));
                case JCLASS_HANDLE:
                        return (*env)->SetLongField(env, obj, jc_handle.fid.native, ptr_to_jlong(handle));
                case JCLASS_INTERFACE:
                        return (*env)->SetLongField(env, obj, jc_interface.fid.native, ptr_to_jlong(handle));
        }
}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:15,代码来源:javaclass.c


示例3: Java_java_util_zip_Inflater_init

JNIEXPORT jlong JNICALL
Java_java_util_zip_Inflater_init(JNIEnv *env, jclass cls, jboolean nowrap)
{
    z_stream *strm = calloc(1, sizeof(z_stream));

    if (strm == NULL) {
        JNU_ThrowOutOfMemoryError(env, 0);
        return jlong_zero;
    } else {
        const char *msg;
        int ret = inflateInit2(strm, nowrap ? -MAX_WBITS : MAX_WBITS);
        switch (ret) {
          case Z_OK:
            return ptr_to_jlong(strm);
          case Z_MEM_ERROR:
            free(strm);
            JNU_ThrowOutOfMemoryError(env, 0);
            return jlong_zero;
          default:
            msg = ((strm->msg != NULL) ? strm->msg :
                   (ret == Z_VERSION_ERROR) ?
                   "zlib returned Z_VERSION_ERROR: "
                   "compile time and runtime zlib implementations differ" :
                   (ret == Z_STREAM_ERROR) ?
                   "inflateInit2 returned Z_STREAM_ERROR" :
                   "unknown error initializing zlib library");
            free(strm);
            JNU_ThrowInternalError(env, msg);
            return jlong_zero;
        }
    }
}
开发者ID:sakeinntojiu,项目名称:openjdk8-jdk,代码行数:32,代码来源:Inflater.c


示例4: SocketStreamHandleBase

SocketStreamHandle::SocketStreamHandle(const KURL& url, Page* page,
                                       SocketStreamHandleClient* client)
    : SocketStreamHandleBase(url, client)
{
    String host = url.host();
    bool ssl = url.protocolIs("wss");
    int port = url.hasPort() ? url.port() : (ssl ? 443 : 80);

    JNIEnv* env = WebCore_GetJavaEnv();

    static jmethodID mid = env->GetStaticMethodID(
            GetSocketStreamHandleClass(env),
            "fwkCreate",
            "(Ljava/lang/String;IZLcom/sun/webkit/WebPage;J)"
            "Lcom/sun/webkit/network/SocketStreamHandle;");
    ASSERT(mid);

    m_ref = JLObject(env->CallStaticObjectMethod(
            GetSocketStreamHandleClass(env),
            mid,
            (jstring) host.toJavaString(env),
            port,
            bool_to_jbool(ssl),
            (jobject) WebPage::jobjectFromPage(page),
            ptr_to_jlong(this)));
    CheckAndClearException(env);
}
开发者ID:166MMX,项目名称:openjdk.java.net-openjfx-8u40-rt,代码行数:27,代码来源:SocketStreamHandleJava.cpp


示例5: Java_java_util_zip_ZipFile_getNextEntry

JNIEXPORT jlong JNICALL
Java_java_util_zip_ZipFile_getNextEntry(JNIEnv *env, jclass cls, jlong zfile,
                                        jint n)
{
    jzentry *ze = ZIP_GetNextEntry(jlong_to_ptr(zfile), n);
    return ptr_to_jlong(ze);
}
开发者ID:digideskio,项目名称:openjdk-fontfix,代码行数:7,代码来源:ZipFile.c


示例6: OGLSD_GetNativeConfigInfo

/**
 * Returns a pointer (as a jlong) to the native GLXGraphicsConfigInfo
 * associated with the given OGLSDOps.  This method can be called from
 * shared code to retrieve the native GraphicsConfig data in a platform-
 * independent manner.
 */
jlong
OGLSD_GetNativeConfigInfo(OGLSDOps *oglsdo)
{
    GLXSDOps *glxsdo;

    if (oglsdo == NULL) {
        J2dRlsTraceLn(J2D_TRACE_ERROR,
                      "OGLSD_GetNativeConfigInfo: ops are null");
        return 0L;
    }

    glxsdo = (GLXSDOps *)oglsdo->privOps;
    if (glxsdo == NULL) {
        J2dRlsTraceLn(J2D_TRACE_ERROR,
                      "OGLSD_GetNativeConfigInfo: glx ops are null");
        return 0L;
    }

    if (glxsdo->configData == NULL) {
        J2dRlsTraceLn(J2D_TRACE_ERROR,
                      "OGLSD_GetNativeConfigInfo: config data is null");
        return 0L;
    }

    return ptr_to_jlong(glxsdo->configData->glxInfo);
}
开发者ID:michalwarecki,项目名称:ManagedRuntimeInitiative,代码行数:32,代码来源:GLXSurfaceData.c


示例7: SendMessage

/*
 * Class:     sun_awt_shell_Win32ShellFolder2
 * Method:    getStandardViewButton0
 * Signature: (I)[I
 */
JNIEXPORT jintArray JNICALL Java_sun_awt_shell_Win32ShellFolder2_getStandardViewButton0
    (JNIEnv* env, jclass cls, jint iconIndex)
{
    jintArray result = NULL;

    // Create a toolbar
    HWND hWndToolbar = ::CreateWindowEx(0, TOOLBARCLASSNAME, NULL,
        0, 0, 0, 0, 0,
        NULL, NULL, NULL, NULL);

    if (hWndToolbar != NULL) {
        SendMessage(hWndToolbar, TB_LOADIMAGES, (WPARAM)IDB_VIEW_SMALL_COLOR, (LPARAM)HINST_COMMCTRL);

        HIMAGELIST hImageList = (HIMAGELIST) SendMessage(hWndToolbar, TB_GETIMAGELIST, 0, 0);

        if (hImageList != NULL) {
            HICON hIcon = ImageList_GetIcon(hImageList, iconIndex, ILD_TRANSPARENT);

            if (hIcon != NULL) {
                result = Java_sun_awt_shell_Win32ShellFolder2_getIconBits(env, cls, ptr_to_jlong(hIcon), 16);

                DestroyIcon(hIcon);
            }

            ImageList_Destroy(hImageList);
        }

        DestroyWindow(hWndToolbar);
    }

    return result;
}
开发者ID:JetBrains,项目名称:jdk8u_jdk,代码行数:37,代码来源:ShellFolder2.cpp


示例8: Java_java_util_zip_Deflater_init

JNIEXPORT jlong JNICALL
Java_java_util_zip_Deflater_init(JNIEnv *env, jclass cls, jint level,
				 jint strategy, jboolean nowrap)
{
    z_stream *strm = calloc(1, sizeof(z_stream));

    if (strm == 0) {
	JNU_ThrowOutOfMemoryError(env, 0);
	return jlong_zero;
    } else {
	char *msg;
	switch (deflateInit2(strm, level, Z_DEFLATED,
			     nowrap ? -MAX_WBITS : MAX_WBITS,
			     DEF_MEM_LEVEL, strategy)) {
	  case Z_OK:
	    return ptr_to_jlong(strm);
	  case Z_MEM_ERROR:
	    free(strm);
	    JNU_ThrowOutOfMemoryError(env, 0);
	    return jlong_zero;
	  case Z_STREAM_ERROR:
	    free(strm);
	    JNU_ThrowIllegalArgumentException(env, 0);
	    return jlong_zero;
	  default:
	    msg = strm->msg;
	    free(strm);
	    JNU_ThrowInternalError(env, msg);
	    return jlong_zero;
	}
    }
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:32,代码来源:Deflater.c


示例9: Java_java_lang_ProcessImpl_openForAtomicAppend

JNIEXPORT jlong JNICALL
Java_java_lang_ProcessImpl_openForAtomicAppend(JNIEnv *env, jclass ignored, jstring path)
{
    const DWORD access = (FILE_GENERIC_WRITE & ~FILE_WRITE_DATA);
    const DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE;
    const DWORD disposition = OPEN_ALWAYS;
    const DWORD flagsAndAttributes = FILE_ATTRIBUTE_NORMAL;
    HANDLE h;
    WCHAR *pathbuf = getPath(env, path);
    if (pathbuf == NULL) {
        /* Exception already pending */
        return -1;
    }
    h = CreateFileW(
        pathbuf,            /* Wide char path name */
        access,             /* Read and/or write permission */
        sharing,            /* File sharing flags */
        NULL,               /* Security attributes */
        disposition,        /* creation disposition */
        flagsAndAttributes, /* flags and attributes */
        NULL);
    free(pathbuf);
    if (h == INVALID_HANDLE_VALUE) {
        JNU_ThrowIOExceptionWithLastError(env, "CreateFileW");
    }
    return ptr_to_jlong(h);
}
开发者ID:lambdalab-mirror,项目名称:jdk7u-jdk,代码行数:27,代码来源:ProcessImpl_md.c


示例10: ptr_to_jlong

/*
 * Class:     com_sun_media_jfxmediaimpl_NativeVideoBuffer
 * Method:    nativeConvertToFormat
 * Signature: (JI)J
 */
JNIEXPORT jlong JNICALL Java_com_sun_media_jfxmediaimpl_NativeVideoBuffer_nativeConvertToFormat
    (JNIEnv *env, jobject obj, jlong nativeHandle, jint newFormat)
{
    CVideoFrame *frame = (CVideoFrame*)jlong_to_ptr(nativeHandle);
    if (frame) {
        return ptr_to_jlong(frame->ConvertToFormat((CVideoFrame::FrameType)newFormat));
    }
    return 0;
}
开发者ID:Anthony-Biget,项目名称:openjfx,代码行数:14,代码来源:NativeVideoBuffer.cpp


示例11: putModuleEntry

/*
 * Add the given pkcs11Implementation object to the list of present modules.
 * Attach the given data to the entry. If the given pkcs11Implementation is
 * already in the lsit, just override its old module data with the new one.
 * None of the arguments can be NULL. If one of the arguments is NULL, this
 * function does nothing.
 */
void putModuleEntry(JNIEnv *env, jobject pkcs11Implementation, ModuleData *moduleData) {
    if (pkcs11Implementation == NULL_PTR) {
        return ;
    }
    if (moduleData == NULL) {
        return ;
    }
    (*env)->SetLongField(env, pkcs11Implementation, pNativeDataID, ptr_to_jlong(moduleData));
}
开发者ID:Gustfh,项目名称:jdk8u-dev-jdk,代码行数:16,代码来源:p11_util.c


示例12: malloc

JNIEXPORT jlong JNICALL
Java_sun_font_NullFontScaler_getNullScalerContext
    (JNIEnv *env, jclass scalerClass) {

    if (theNullScalerContext == NULL) {
        theNullScalerContext = malloc(1);
    }
    return ptr_to_jlong(theNullScalerContext);
}
开发者ID:frohoff,项目名称:jdk6,代码行数:9,代码来源:sunFont.c


示例13: OGLSD_Dispose

/**
 * This is the implementation of the general DisposeFunc defined in
 * SurfaceData.h and used by the Disposer mechanism.  It first flushes all
 * native OpenGL resources and then frees any memory allocated within the
 * native OGLSDOps structure.
 */
void
OGLSD_Dispose(JNIEnv *env, SurfaceDataOps *ops)
{
    OGLSDOps *oglsdo = (OGLSDOps *)ops;
    jlong pConfigInfo = OGLSD_GetNativeConfigInfo(oglsdo);

    JNU_CallStaticMethodByName(env, NULL, "sun/java2d/opengl/OGLSurfaceData",
                               "dispose", "(JJ)V",
                               ptr_to_jlong(ops), pConfigInfo);
}
开发者ID:cncomkyle,项目名称:openjdk_7_b147,代码行数:16,代码来源:OGLSurfaceData.c


示例14: D3DSD_Dispose

void
D3DSD_Dispose(JNIEnv *env, SurfaceDataOps *ops)
{
    D3DSDOps *d3dsdo = (D3DSDOps *)ops;
    RETURN_IF_NULL(d3dsdo);

    JNU_CallStaticMethodByName(env, NULL, "sun/java2d/d3d/D3DSurfaceData",
                               "dispose", "(J)V",
                               ptr_to_jlong(ops));
}
开发者ID:ChenYao,项目名称:jdk7u-jdk,代码行数:10,代码来源:D3DSurfaceData.cpp


示例15: SurfaceData_SetOps

JNIEXPORT void JNICALL
SurfaceData_SetOps(JNIEnv *env, jobject sData, SurfaceDataOps *ops)
{
    if (JNU_GetLongFieldAsPtr(env, sData, pDataID) == NULL) {
        JNU_SetLongFieldFromPtr(env, sData, pDataID, ops);
        /* Register the data for disposal */
        Disposer_AddRecord(env, sData,
                           SurfaceData_DisposeOps,
                           ptr_to_jlong(ops));
    } else {
        JNU_ThrowInternalError(env, "Attempting to set SurfaceData ops twice");
    }
}
开发者ID:JetBrains,项目名称:jdk8u_jdk,代码行数:13,代码来源:SurfaceData.c


示例16: WebCore_GetJavaEnv

void PopupMenuJava::createPopupMenuJava(Page* page)
{
    JNIEnv* env = WebCore_GetJavaEnv();

    static jmethodID mid = env->GetStaticMethodID(getJPopupMenuClass(),
        "fwkCreatePopupMenu", "(J)Lcom/sun/webkit/PopupMenu;");
    ASSERT(mid);

    JLObject jPopupMenu(env->CallStaticObjectMethod(getJPopupMenuClass(), mid, ptr_to_jlong(this)));
    ASSERT(jPopupMenu);
    CheckAndClearException(env);

    m_popup = jPopupMenu;
}
开发者ID:166MMX,项目名称:openjdk.java.net-openjfx-8u40-rt,代码行数:14,代码来源:PopupMenuJava.cpp


示例17: J2dTraceLn

/*
 * Class:     sun_java2d_d3d_D3DSurfaceData
 * Method:    getNativeResourceNative
 * Signature: (JI)J
 */
JNIEXPORT jlong JNICALL
    Java_sun_java2d_d3d_D3DSurfaceData_getNativeResourceNative
        (JNIEnv *env, jclass d3sdc, jlong pData, jint resType)
{
    D3DSDOps *d3dsdo;

    J2dTraceLn(J2D_TRACE_INFO, "D3DSurfaceData_getNativeResourceNative")

    RETURN_STATUS_IF_NULL(d3dsdo = (D3DSDOps *)jlong_to_ptr(pData), 0L);

    if (resType == D3D_DEVICE_RESOURCE) {
        HRESULT res;
        D3DPipelineManager *pMgr;
        D3DContext *pCtx;

        RETURN_STATUS_IF_NULL(pMgr = D3DPipelineManager::GetInstance(), 0L);
        if (FAILED(res = pMgr->GetD3DContext(d3dsdo->adapter, &pCtx))) {
            D3DRQ_MarkLostIfNeeded(res, d3dsdo);
            return 0L;
        }
        return ptr_to_jlong(pCtx->Get3DDevice());
    }

    RETURN_STATUS_IF_NULL(d3dsdo->pResource, 0L);

    if (resType == RT_PLAIN || resType == RT_TEXTURE) {
        return ptr_to_jlong(d3dsdo->pResource->GetSurface());
    }
    if (resType == TEXTURE) {
        return ptr_to_jlong(d3dsdo->pResource->GetTexture());
    }
    if (resType == FLIP_BACKBUFFER) {
        return ptr_to_jlong(d3dsdo->pResource->GetSwapChain());
    }

    return 0L;
}
开发者ID:ChenYao,项目名称:jdk7u-jdk,代码行数:42,代码来源:D3DSurfaceData.cpp


示例18: Java_java_util_zip_ZipFile_open

JNIEXPORT jlong JNICALL
Java_java_util_zip_ZipFile_open(JNIEnv *env, jclass cls, jstring name,
                                        jint mode, jlong lastModified,
                                        jboolean usemmap)
{
    const char *path = JNU_GetStringPlatformChars(env, name, 0);
    char *msg = 0;
    jlong result = 0;
    int flag = 0;
    jzfile *zip = 0;

    if (mode & OPEN_READ) flag |= O_RDONLY;
    if (mode & OPEN_DELETE) flag |= JVM_O_DELETE;

    if (path != 0) {
        zip = ZIP_Get_From_Cache(path, &msg, lastModified);
        if (zip == 0 && msg == 0) {
            ZFILE zfd = 0;
#ifdef WIN32
            zfd = winFileHandleOpen(env, name, flag);
            if (zfd == -1) {
                /* Exception already pending. */
                goto finally;
            }
#else
            zfd = JVM_Open(path, flag, 0);
            if (zfd < 0) {
                throwFileNotFoundException(env, name);
                goto finally;
            }
#endif
            zip = ZIP_Put_In_Cache0(path, zfd, &msg, lastModified, usemmap);
        }

        if (zip != 0) {
            result = ptr_to_jlong(zip);
        } else if (msg != 0) {
            ThrowZipException(env, msg);
            free(msg);
        } else if (errno == ENOMEM) {
            JNU_ThrowOutOfMemoryError(env, 0);
        } else {
            ThrowZipException(env, "error in opening zip file");
        }
finally:
        JNU_ReleaseStringPlatformChars(env, name, path);
    }
    return result;
}
开发者ID:digideskio,项目名称:openjdk-fontfix,代码行数:49,代码来源:ZipFile.c


示例19: JNU_CHECK_EXCEPTION_RETURN

/*
 * Class:     sun_awt_shell_Win32ShellFolder2
 * Method:    getIconResource
 * Signature: (Ljava/lang/String;IIIZ)J
 */
JNIEXPORT jlong JNICALL Java_sun_awt_shell_Win32ShellFolder2_getIconResource
    (JNIEnv* env, jclass cls, jstring libName, jint iconID,
     jint cxDesired, jint cyDesired, jboolean useVGAColors)
{
    const char *pLibName = env->GetStringUTFChars(libName, NULL);
    JNU_CHECK_EXCEPTION_RETURN(env, 0);
    HINSTANCE libHandle = (HINSTANCE)JDK_LoadSystemLibrary(pLibName);
    if (libHandle != NULL) {
        UINT fuLoad = (useVGAColors && !IS_WINXP) ? LR_VGACOLOR : 0;
        return ptr_to_jlong(LoadImage(libHandle, MAKEINTRESOURCE(iconID),
                                      IMAGE_ICON, cxDesired, cyDesired,
                                      fuLoad));
    }
    return 0;
}
开发者ID:JetBrains,项目名称:jdk8u_jdk,代码行数:20,代码来源:ShellFolder2.cpp


示例20: JSC_GETJAVAENV_CHKRET

void Watchdog::initTimer()
{
    JSC_GETJAVAENV_CHKRET(env);

    static jmethodID mid = env->GetStaticMethodID(
            GetWatchdogTimerClass(env),
            "fwkCreate",
            "(J)Lcom/sun/webkit/WatchdogTimer;");
    ASSERT(mid);

    m_timer = JLObject(env->CallStaticObjectMethod(
            GetWatchdogTimerClass(env),
            mid,
            ptr_to_jlong(timerDidFireAddress())));
    CheckAndClearException(env);
}
开发者ID:mjparme,项目名称:openjdk-jfx,代码行数:16,代码来源:WatchdogJava.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ptrace_event_enabled函数代码示例发布时间:2022-05-30
下一篇:
C++ ptr_to_compat函数代码示例发布时间: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