/[classpath]/classpath/native/jni/java-io/FileDescriptor.c
ViewVC logotype

Diff of /classpath/native/jni/java-io/FileDescriptor.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by cbj, Sun Apr 27 22:05:37 2003 UTC revision 1.10 by cbj, Fri May 2 02:44:41 2003 UTC
# Line 79  exception statement from your version. * Line 79  exception statement from your version. *
79  #include "java_io_FileDescriptor.h"  #include "java_io_FileDescriptor.h"
80    
81  // FIXME: This can't be right.  Need converter macros  // FIXME: This can't be right.  Need converter macros
82  #define CONVERT_JLONG_TO_INT(x) ((int)(x & 0xFFFF))  #define CONVERT_JLONG_TO_INT(x) ((int)(x & 0xFFFFFFFF))
83    
84  // FIXME: This can't be right.  Need converter macros  // FIXME: This can't be right.  Need converter macros
85  #define CONVERT_JLONG_TO_OFF_T(x) (x)  #define CONVERT_JLONG_TO_OFF_T(x) (x)
86    
87  // FIXME: This can't be right.  Need converter macros  // FIXME: This can't be right.  Need converter macros
88  #define CONVERT_JINT_TO_INT(x) ((int)(x & 0xFFFF))  #define CONVERT_JINT_TO_INT(x) ((int)(x & 0xFFFFFFFF))
89    
90    // FIXME: This can't be right.  Need converter macros
91    #define CONVERT_SSIZE_T_TO_JINT(x) ((jint)(x & 0xFFFFFFFF))
92    
93  /* These values must be kept in sync with FileDescriptor.java.  */  /* These values must be kept in sync with FileDescriptor.java.  */
94  #define SET 0  #define SET 0
# Line 342  Java_java_io_FileDescriptor_nativeReadBu Line 345  Java_java_io_FileDescriptor_nativeReadBu
345            if (bytes_read == 0)            if (bytes_read == 0)
346              return(-1); /* Signal end of file to Java */              return(-1); /* Signal end of file to Java */
347            else            else
348              return((jint)(bytes_read & 0xFFFF));              return(CONVERT_SSIZE_T_TO_JINT(bytes_read));
349          }          }
350    
351        if ((rc == -1) && (errno != EINTR))        if ((rc == -1) && (errno != EINTR))
# Line 355  Java_java_io_FileDescriptor_nativeReadBu Line 358  Java_java_io_FileDescriptor_nativeReadBu
358      }      }
359    
360    (*env)->ReleaseByteArrayElements(env, buf, bufptr, 0);    (*env)->ReleaseByteArrayElements(env, buf, bufptr, 0);
361    return((jint)(bytes_read & 0xFFFF));    return(CONVERT_SSIZE_T_TO_JINT(bytes_read));
362  }  }
363    
364  /*************************************************************************/  /*************************************************************************/
# Line 430  Java_java_io_FileDescriptor_nativeAvaila Line 433  Java_java_io_FileDescriptor_nativeAvaila
433    if (!found)    if (!found)
434      return(0);      return(0);
435    else    else
436      return((jint)(num & 0xFFFF));      return(CONVERT_SSIZE_T_TO_JINT(num));
437    
438  #else /* defined FIONREAD, HAVE_SELECT, HAVE_FSTAT */  #else /* defined FIONREAD, HAVE_SELECT, HAVE_FSTAT */
439   /* FIXME: Probably operation isn't supported, but this exception   /* FIXME: Probably operation isn't supported, but this exception

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26