Author: cutting Date: Wed Jul 11 13:31:31 2007 New Revision: 555387 URL: http://svn.apache.org/viewvc?view=rev&rev=555387 Log: HADOOP-1582. Fix hdfslib to return 0 at EOF instead of -1, per C conventions. Contributed by Chistian Kunz.
Modified: lucene/hadoop/trunk/CHANGES.txt lucene/hadoop/trunk/src/c++/libhdfs/hdfs.c Modified: lucene/hadoop/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=555387&r1=555386&r2=555387 ============================================================================== --- lucene/hadoop/trunk/CHANGES.txt (original) +++ lucene/hadoop/trunk/CHANGES.txt Wed Jul 11 13:31:31 2007 @@ -309,6 +309,9 @@ 95. HADOOP-1473. Make job ids unique across jobtracker restarts. (omalley via cutting) + 96. HADOOP-1582. Fix hdfslib to return 0 instead of -1 at + end-of-file, per C conventions. (Christian Kunz via cutting) + Release 0.13.0 - 2007-06-08 Modified: lucene/hadoop/trunk/src/c++/libhdfs/hdfs.c URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/c%2B%2B/libhdfs/hdfs.c?view=diff&rev=555387&r1=555386&r2=555387 ============================================================================== --- lucene/hadoop/trunk/src/c++/libhdfs/hdfs.c (original) +++ lucene/hadoop/trunk/src/c++/libhdfs/hdfs.c Wed Jul 11 13:31:31 2007 @@ -481,8 +481,10 @@ noReadBytes = jVal.i; if (noReadBytes > 0) { (*env)->GetByteArrayRegion(env, jbRarray, 0, noReadBytes, buffer); + } else { + //This is a valid case: there aren't any bytes left to read! + noReadBytes = 0; } - //This is a valid case: there aren't any bytes left to read! errno = 0; } @@ -536,8 +538,10 @@ noReadBytes = jVal.i; if (noReadBytes > 0) { (*env)->GetByteArrayRegion(env, jbRarray, 0, noReadBytes, buffer); + } else { + //This is a valid case: there aren't any bytes left to read! + noReadBytes = 0; } - //This is a valid case: there aren't any bytes left to read! errno = 0; } destroyLocalReference(env, jbRarray);