本文整理汇总了C++中ptr_to_jlong函数的典型用法代码示例。如果您正苦于以下问题:C++ ptr_to_jlong函数的具体用法?C++ ptr_to_jlong怎么用?C++ ptr_to_jlong使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ptr_to_jlong函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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));
}
}
示例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;
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
}
}
示例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);
}
示例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;
}
示例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));
}
示例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);
}
示例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);
}
示例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));
}
示例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");
}
}