harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r996147 - in /harmony/enhanced/java/trunk/classlib/modules/luni/src/main/native/luni/unix: OSFileSystemLinux32.c OSMemoryLinux32.c
Date Sat, 11 Sep 2010 13:44:59 GMT
Author: hindessm
Date: Sat Sep 11 13:44:58 2010
New Revision: 996147

URL: http://svn.apache.org/viewvc?rev=996147&view=rev
Log:
Applied patches (Mohan's and all but the duplicate chunk from Cath's)
from "[#HARMONY-6639] [classlib][luni]fd's passed c
functions needs casting from long to int to avoid potential problems".

Modified:
    harmony/enhanced/java/trunk/classlib/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
    harmony/enhanced/java/trunk/classlib/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c

Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c?rev=996147&r1=996146&r2=996147&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
Sat Sep 11 13:44:58 2010
@@ -177,7 +177,7 @@ JNIEXPORT jlong JNICALL Java_org_apache_
     vectors[i].iov_len = lengths[i];
     i++;
   }
-  totalRead = readv(fd - FD_BIAS, vectors, size);
+  totalRead = readv((int)fd - FD_BIAS, vectors, size);
   if(bufsCopied){
     (*env)->ReleaseLongArrayElements(env, jbuffers, bufs, JNI_ABORT);
   }
@@ -259,11 +259,12 @@ Java_org_apache_harmony_luni_platform_OS
     (*env)->ReleasePrimitiveArrayCritical(env, counts, cts, JNI_ABORT);
   }
 
-  result = writev(fd - FD_BIAS, vect, length);
+  result = writev((int)fd - FD_BIAS, vect, length);
 
   if (0 > result) {
     if (errno != EAGAIN) {
-      throwJavaIoIOException(env, "");
+      hyerror_set_last_error(errno, HYPORT_ERROR_OPFAILED);
+      throwJavaIoIOException(env, hyerror_last_error_message());
     }
     result = 0;
   }
@@ -352,7 +353,8 @@ JNIEXPORT jlong JNICALL Java_org_apache_
 (JNIEnv *env, jobject thiz, jlong fd)
 {
   struct stat statbuf;
-  if (fstat(fd - FD_BIAS, &statbuf) < 0) {
+  // cast long handler to int to avoid potential problems
+  if (fstat((int)fd - FD_BIAS, &statbuf) < 0) {
     return -1;
   }
   return (jlong)statbuf.st_size;

Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c?rev=996147&r1=996146&r2=996147&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c
Sat Sep 11 13:44:58 2010
@@ -181,7 +181,7 @@ JNIEXPORT jlong JNICALL Java_org_apache_
         return -1;
     }
 
-  mapAddress = mmap(0, (size_t)(size&0x7fffffff), prot, flags, fd-FD_BIAS, (off_t)(alignment&0x7fffffff));
+  mapAddress = mmap(0, (size_t)(size&0x7fffffff), prot, flags, (int)fd-FD_BIAS, (off_t)(alignment&0x7fffffff));
   if (mapAddress == MAP_FAILED)
     {
       hyerror_set_last_error(errno, HYPORT_ERROR_OPFAILED);



Mime
View raw message