summaryrefslogtreecommitdiffstats
path: root/luni/src/main/native/java_io_ObjectInputStream.c
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2010-05-07 16:58:16 -0700
committerBrian Carlstrom <bdc@google.com>2010-05-07 20:54:17 -0700
commitec2f5930802944b7e418bb97849071f538b2523c (patch)
treebcc9e6794d55cc8c44fa4b9e405f7900c8dc6753 /luni/src/main/native/java_io_ObjectInputStream.c
parent0356c447b30e092bdc12a4b7288c08f5ef87534c (diff)
downloadlibcore-ec2f5930802944b7e418bb97849071f538b2523c.zip
libcore-ec2f5930802944b7e418bb97849071f538b2523c.tar.gz
libcore-ec2f5930802944b7e418bb97849071f538b2523c.tar.bz2
Moving most libcore .c files to .cpp
This change moves most of the libcore .c files to .cpp enough for them to compile. This was largely motivated by the desire to avoid using things like __attribute__ ((unused)) in .c files to supress warnings in a recent change. Change-Id: Ib967d9e16764ff805764e81362f945332080a06c
Diffstat (limited to 'luni/src/main/native/java_io_ObjectInputStream.c')
-rw-r--r--luni/src/main/native/java_io_ObjectInputStream.c281
1 files changed, 0 insertions, 281 deletions
diff --git a/luni/src/main/native/java_io_ObjectInputStream.c b/luni/src/main/native/java_io_ObjectInputStream.c
deleted file mode 100644
index 1f47742..0000000
--- a/luni/src/main/native/java_io_ObjectInputStream.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "JNIHelp.h"
-
-static void java_setFieldBool (JNIEnv* env, jclass clazz __attribute__ ((unused)),
- jobject targetObject,
- jclass declaringClass,
- jstring fieldName,
- jboolean newValue) {
- const char *fieldNameInC;
- jfieldID fid;
- if(targetObject == NULL) {
- return;
- }
- fieldNameInC = (*env)->GetStringUTFChars(env, fieldName, NULL);
- fid = (*env)->GetFieldID(env, declaringClass, fieldNameInC, "Z");
- (*env)->ReleaseStringUTFChars(env, fieldName, fieldNameInC);
-
- /*
- * Two options now. Maybe getFieldID caused an exception,
- * or maybe it returned the real value
- */
- if(fid != 0) {
- (*env)->SetBooleanField(env, targetObject, fid, newValue);
- }
-}
-
-static void java_setFieldChar (JNIEnv* env, jclass clazz __attribute__ ((unused)),
- jobject targetObject,
- jclass declaringClass,
- jstring fieldName,
- jchar newValue) {
- const char *fieldNameInC;
- jfieldID fid;
- if(targetObject == NULL) {
- return;
- }
- fieldNameInC = (*env)->GetStringUTFChars(env, fieldName, NULL);
- fid = (*env)->GetFieldID(env, declaringClass, fieldNameInC, "C");
- (*env)->ReleaseStringUTFChars(env, fieldName, fieldNameInC);
-
- /*
- * Two options now. Maybe getFieldID caused an exception,
- * or maybe it returned the real value
- */
- if(fid != 0) {
- (*env)->SetCharField(env, targetObject, fid, newValue);
- }
-}
-
-static void java_setFieldInt (JNIEnv* env, jclass clazz __attribute__ ((unused)),
- jobject targetObject,
- jclass declaringClass,
- jstring fieldName,
- jint newValue) {
- const char *fieldNameInC;
- jfieldID fid;
- if(targetObject == NULL) {
- return;
- }
- fieldNameInC = (*env)->GetStringUTFChars(env, fieldName, NULL);
- fid = (*env)->GetFieldID(env, declaringClass, fieldNameInC, "I");
- (*env)->ReleaseStringUTFChars(env, fieldName, fieldNameInC);
-
- /*
- * Two options now. Maybe getFieldID caused an exception,
- * or maybe it returned the real value
- */
- if(fid != 0) {
- (*env)->SetIntField(env, targetObject, fid, newValue);
- }
-}
-
-static void java_setFieldFloat (JNIEnv* env, jclass clazz __attribute__ ((unused)),
- jobject targetObject,
- jclass declaringClass,
- jstring fieldName,
- jfloat newValue) {
- const char *fieldNameInC;
- jfieldID fid;
- if(targetObject == NULL) {
- return;
- }
- fieldNameInC = (*env)->GetStringUTFChars(env, fieldName, NULL);
- fid = (*env)->GetFieldID(env, declaringClass, fieldNameInC, "F");
- (*env)->ReleaseStringUTFChars(env, fieldName, fieldNameInC);
-
- /*
- * Two options now. Maybe getFieldID caused an exception,
- * or maybe it returned the real value
- */
- if(fid != 0) {
- (*env)->SetFloatField(env, targetObject, fid, newValue);
- }
-}
-
-static void java_setFieldDouble (JNIEnv* env, jclass clazz __attribute__ ((unused)),
- jobject targetObject,
- jclass declaringClass,
- jstring fieldName,
- jdouble newValue) {
- const char *fieldNameInC;
- jfieldID fid;
- if(targetObject == NULL) {
- return;
- }
- fieldNameInC = (*env)->GetStringUTFChars(env, fieldName, NULL);
- fid = (*env)->GetFieldID(env, declaringClass, fieldNameInC, "D");
- (*env)->ReleaseStringUTFChars(env, fieldName, fieldNameInC);
-
- /*
- * Two options now. Maybe getFieldID caused an exception,
- * or maybe it returned the real value
- */
- if(fid != 0) {
- (*env)->SetDoubleField(env, targetObject, fid, newValue);
- }
-
-}
-
-static void java_setFieldShort (JNIEnv* env, jclass clazz __attribute__ ((unused)),
- jobject targetObject,
- jclass declaringClass,
- jstring fieldName,
- jshort newValue) {
- const char *fieldNameInC;
- jfieldID fid;
- if(targetObject == NULL) {
- return;
- }
- fieldNameInC = (*env)->GetStringUTFChars(env, fieldName, NULL);
- fid = (*env)->GetFieldID(env, declaringClass, fieldNameInC, "S");
- (*env)->ReleaseStringUTFChars(env, fieldName, fieldNameInC);
-
- /*
- * Two options now. Maybe getFieldID caused an exception,
- * or maybe it returned the real value
- */
- if(fid != 0) {
- (*env)->SetShortField(env, targetObject, fid, newValue);
- }
-
-}
-
-static void java_setFieldLong (JNIEnv* env, jclass clazz __attribute__ ((unused)),
- jobject targetObject,
- jclass declaringClass,
- jstring fieldName,
- jlong newValue) {
- const char *fieldNameInC;
- jfieldID fid;
- if(targetObject == NULL) {
- return;
- }
- fieldNameInC = (*env)->GetStringUTFChars(env, fieldName, NULL);
- fid = (*env)->GetFieldID(env, declaringClass, fieldNameInC, "J");
- (*env)->ReleaseStringUTFChars(env, fieldName, fieldNameInC);
-
- /*
- * Two options now. Maybe getFieldID caused an exception,
- * or maybe it returned the real value
- */
- if(fid != 0) {
- (*env)->SetLongField(env, targetObject, fid, newValue);
- }
-}
-
-static jobject java_newInstance (JNIEnv* env, jclass clazz __attribute__ ((unused)),
- jclass instantiationClass,
- jclass constructorClass) {
- jmethodID mid =
- (*env)->GetMethodID(env, constructorClass, "<init>", "()V");
-
- if(mid == 0) {
- /* Cant newInstance,No empty constructor... */
- return (jobject) 0;
- } else {
- /* Instantiate an object of a given class */
- return (jobject) (*env)->NewObject(env, instantiationClass, mid);
- }
-
-}
-
-static void java_setFieldByte (JNIEnv* env, jclass clazz __attribute__ ((unused)),
- jobject targetObject,
- jclass declaringClass,
- jstring fieldName,
- jbyte newValue){
- const char *fieldNameInC;
- jfieldID fid;
- if(targetObject == NULL) {
- return;
- }
- fieldNameInC = (*env)->GetStringUTFChars(env, fieldName, NULL);
- fid = (*env)->GetFieldID(env, declaringClass, fieldNameInC, "B");
- (*env)->ReleaseStringUTFChars(env, fieldName, fieldNameInC);
-
- /* Two options now. Maybe getFieldID caused an exception, or maybe it returned the real value */
- if(fid != 0) {
- (*env)->SetByteField(env, targetObject, fid, newValue);
- }
-}
-
-static void java_setFieldObj (JNIEnv* env, jclass clazz __attribute__ ((unused)),
- jobject targetObject,
- jclass declaringClass,
- jstring fieldName,
- jstring fieldTypeName,
- jobject newValue) {
- const char *fieldNameInC, *fieldTypeNameInC;
- jfieldID fid;
- if(targetObject == NULL) {
- return;
- }
- fieldNameInC = (*env)->GetStringUTFChars(env, fieldName, NULL);
- fieldTypeNameInC = (*env)->GetStringUTFChars(env, fieldTypeName, NULL);
- fid = (*env)->GetFieldID(env, declaringClass,
- fieldNameInC, fieldTypeNameInC);
- (*env)->ReleaseStringUTFChars(env, fieldName, fieldNameInC);
- (*env)->ReleaseStringUTFChars(env, fieldTypeName, fieldTypeNameInC);
-
- /*
- * Two options now. Maybe getFieldID caused an exception,
- * or maybe it returned the real value
- */
- if(fid != 0) {
- (*env)->SetObjectField(env, targetObject, fid, newValue);
- }
-}
-
-static JNINativeMethod gMethods[] = {
- { "setField",
- "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/String;J)V",
- (void*) java_setFieldLong },
- { "setField",
- "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/String;S)V",
- (void*) java_setFieldShort },
- { "setField",
- "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/String;D)V",
- (void*) java_setFieldDouble },
- { "setField",
- "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/String;Z)V",
- (void*) java_setFieldBool },
- { "setField",
- "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/String;B)V",
- (void*) java_setFieldByte },
- { "setField",
- "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/String;F)V",
- (void*) java_setFieldFloat },
- { "setField",
- "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/String;C)V",
- (void*) java_setFieldChar },
- { "setField",
- "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/String;I)V",
- (void*) java_setFieldInt },
- { "newInstance",
- "(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Object;",
- (void*) java_newInstance },
- { "objSetField",
- "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V",
- (void*) java_setFieldObj }
-
-};
-int register_java_io_ObjectInputStream(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/io/ObjectInputStream", gMethods, NELEM(gMethods));
-}