jdouble stream_encodeDouble(jdouble d) { union { jdouble d; jlong l; } sD; sD.d = d; sD.l = HOST_TO_JAVA_LONG(sD.l); return sD.d; }
jdwpError outStream_writeObjectRef(JNIEnv *env, PacketOutputStream *stream, jobject val) { jlong id; jlong *idPtr; if (stream->error) { return stream->error; } if (val == NULL) { id = NULL_OBJECT_ID; } else { /* Convert the object to an object id */ id = commonRef_refToID(env, val); if (id == NULL_OBJECT_ID) { stream->error = JDWP_ERROR(OUT_OF_MEMORY); return stream->error; } /* Track the common ref in case we need to release it on a future error */ idPtr = bagAdd(stream->ids); if (idPtr == NULL) { commonRef_release(env, id); stream->error = JDWP_ERROR(OUT_OF_MEMORY); return stream->error; } else { *idPtr = id; } /* Add the encoded object id to the stream */ id = HOST_TO_JAVA_LONG(id); } return writeBytes(stream, &id, sizeof(id)); }
jdwpError outStream_writeLong(PacketOutputStream *stream, jlong val) { val = HOST_TO_JAVA_LONG(val); return writeBytes(stream, &val, sizeof(val)); }