ExternalStream.st
branchjv
changeset 21251 32f12bea6608
parent 21242 19fabe339f8b
parent 21221 086752a8ec62
child 21252 1b7c2d5523d5
--- a/ExternalStream.st	Sat Jan 07 17:09:04 2017 +0000
+++ b/ExternalStream.st	Tue Jan 10 13:26:39 2017 +0000
@@ -5567,23 +5567,15 @@
      (see NonPositionableExternalStream)"
 
 %{
-    OBJ fp, pos, lim;
+    OBJ fp, lim;
     char c;
 
     if (__INST(hitEOF) == true) {
         RETURN (true);
     }
-    pos = __INST(position);
     lim = __INST(readLimit);
-    if (lim != nil) {
-        off_t _pos, _readLimit;
-
-        _pos = __signedLongIntVal(pos);
-        _pos = _pos - __intVal( @global(PositionableStream:ZeroPosition)) + 1;
-        _readLimit = __signedLongIntVal(lim);
-        if (_pos > _readLimit) {
-            RETURN (true);
-        }
+    if (lim != nil && __signedLongIntVal(__INST(position)) >= __signedLongIntVal(lim)) {
+        RETURN (true);
     }
 
     __INST(lastErrorNumber) = nil;
@@ -5600,10 +5592,8 @@
 
             if (_buffered) {
                 __READING__(f);
-            } else {
-                if (__INST(readAhead) != nil) {
-                    RETURN (false);
-                }
+            } else if (__INST(readAhead) != nil) {
+                RETURN (false);
             }
 
             /*
@@ -5616,7 +5606,7 @@
                 __BEGIN_INTERRUPTABLE__
                 __READBYTE__(ret, f, &c, _buffered, __INST(handleType));
                 __END_INTERRUPTABLE__
-#endif
+#endif /* not __win32__ */
             } while ((ret < 0) && (__threadErrno == EINTR));
             if (ret > 0) {
                 __UNGETC__(c&0xff, f, _buffered);