/[cmucl]/src/code/fd-stream.lisp
ViewVC logotype

Diff of /src/code/fd-stream.lisp

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

revision 1.31 by ram, Mon Aug 30 21:19:53 1993 UTC revision 1.32 by ram, Thu Jan 6 19:50:20 1994 UTC
# Line 724  non-server method is also significantly Line 724  non-server method is also significantly
724          (declare (type index now-needed len))          (declare (type index now-needed len))
725          (cond          (cond
726           ((> now-needed len)           ((> now-needed len)
727              ;;
728              ;; If the desired amount is greater than the stream buffer size, then
729              ;; read directly into the destination, incrementing the start
730              ;; accordingly.  In this case, we never leave anything in the stream
731              ;; buffer.
732            (system:without-gcing            (system:without-gcing
733              (loop              (loop
734                (multiple-value-bind                (multiple-value-bind
# Line 738  non-server method is also significantly Line 743  non-server method is also significantly
743                  (unless count                  (unless count
744                    (error "Error reading ~S: ~A" stream                    (error "Error reading ~S: ~A" stream
745                           (unix:get-unix-error-msg err)))                           (unix:get-unix-error-msg err)))
746                  (when (< count now-needed)                  (when (zerop count)
747                    (return (eof-or-lose stream eof-error-p                    (return (eof-or-lose stream eof-error-p
748                                         (- requested now-needed))))                                         (- requested now-needed))))
749                  (decf now-needed count)                  (decf now-needed count)
750                  (when (zerop now-needed) (return requested))                  (when (zerop now-needed) (return requested))
751                  (incf offset count)))))                  (incf offset count)))))
752           (t           (t
753              ;;
754              ;; If we want less than the buffer size, then loop trying to fill the
755              ;; stream buffer and copying what we get into the destination.  When
756              ;; we have enough, we leave what's left in the stream buffer.
757            (loop            (loop
758              (multiple-value-bind              (multiple-value-bind
759                  (count err)                  (count err)
# Line 753  non-server method is also significantly Line 762  non-server method is also significantly
762                (unless count                (unless count
763                  (error "Error reading ~S: ~A" stream                  (error "Error reading ~S: ~A" stream
764                         (unix:get-unix-error-msg err)))                         (unix:get-unix-error-msg err)))
765                (incf (fd-stream-ibuf-tail stream) count)                (when (zerop count)
               (when (< count now-needed)  
766                  (return (eof-or-lose stream eof-error-p                  (return (eof-or-lose stream eof-error-p
767                                       (- requested now-needed))))                                       (- requested now-needed))))
768                (let* ((copy (min now-needed count))                (let* ((copy (min now-needed count))
# Line 771  non-server method is also significantly Line 779  non-server method is also significantly
779                                                       (* vm:vector-data-offset                                                       (* vm:vector-data-offset
780                                                          vm:word-bits))                                                          vm:word-bits))
781                                             copy-bits))                                             copy-bits))
782                  (incf (fd-stream-ibuf-head stream) copy)  
783                  (decf now-needed copy)                  (decf now-needed copy)
784                  (when (zerop now-needed) (return requested))                  (when (zerop now-needed)
785                      (setf (fd-stream-ibuf-head stream) copy)
786                      (setf (fd-stream-ibuf-tail stream) count)
787                      (return requested))
788                  (incf offset copy)))))))))))                  (incf offset copy)))))))))))
789    
790    

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32

  ViewVC Help
Powered by ViewVC 1.1.5