java-errno-header-20090526
[openafs.git] / src / JAVA / libjafs / FileInputStream.c
index 7c1b7fc..180992f 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "Internal.h"
 #include "org_openafs_jafs_FileInputStream.h"
+#include <errno.h>
 
 #include <fcntl.h>
 
 #include "dmalloc.h"
 #endif
 
-extern int errno;
-
 /**
  * Be carefull with the memory management:
  *
- * - For every getNativeString call the corresponding free().
+ * - For every GetStringUTFChars call the corresponding ReleaseStringUTFChars.
  * - For every Get<type>ArrayElements call the corresponding
  *   Release<type>ArrayElements
  * - For every malloc call the corresponding free.
@@ -91,13 +90,13 @@ JNIEXPORT jint JNICALL Java_org_openafs_jafs_FileInputStream_read
   jfieldID fid;
 
   /* If we have to read 0 bytes just return */
-  if (length == 0) return 0;
+  if(length == 0) return 0;
 
   thisClass = (*env)->GetObjectClass(env, obj);
   fid = (*env)->GetFieldID(env, thisClass, "fileDescriptor", "I");
   fd = (*env)->GetIntField(env, obj, fid);
 
-  if (fd < 0) {
+  if(fd < 0) {
     fprintf(stderr, "FileInputStream::read(): invalid file state\n");
     throwAFSFileException(env, 0, "Invalid file state");
     return -1;
@@ -136,7 +135,7 @@ JNIEXPORT void JNICALL Java_org_openafs_jafs_FileInputStream_close
   fid = (*env)->GetFieldID(env, thisClass, "fileDescriptor", "I");
   fd = (*env)->GetIntField(env, obj, fid);
 
-  if (fd < 0) {
+  if(fd < 0) {
     fprintf(stderr, "FileInputStream::close(): invalid file state\n");
     throwAFSFileException(env, 0, "Invalid file state");
     return;
@@ -148,3 +147,6 @@ JNIEXPORT void JNICALL Java_org_openafs_jafs_FileInputStream_close
     throwAFSFileException(env, errno, NULL);
   }
 }
+
+
+