Changeset 40449 in project


Ignore:
Timestamp:
09/08/21 06:02:13 (2 weeks ago)
Author:
Kon Lovett
Message:

fix output-digest return

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/5/message-digest-utils/trunk/message-digest-port.scm

    r40448 r40449  
    2323  with-output-to-digest)
    2424
    25 (import scheme)
    26 (import (chicken base))
    27 (import (chicken type))
    28 (import (only (chicken string) ->string))
    29 (import (only (chicken port)
    30   make-output-port with-input-from-port))
    31 (import (only (srfi 13) string-suffix-length-ci))
    32 (import (only type-checks
    33   define-check+error-type
    34   check-output-port check-procedure))
    35 (import (only type-errors
    36   error-argument-type make-error-type-message signal-type-error))
    37 (import message-digest-primitive)
    38 (import message-digest-type)
    39 (import message-digest-byte-vector)
     25(import scheme
     26  (chicken base)
     27  (chicken type)
     28  (only (chicken string) ->string)
     29  (only (chicken port) make-output-port with-output-to-port)
     30  (only (srfi 13) string-suffix-length-ci)
     31  (only type-checks define-check+error-type check-output-port check-procedure)
     32  (only type-errors error-argument-type make-error-type-message signal-type-error)
     33  message-digest-primitive
     34  message-digest-type
     35  message-digest-byte-vector)
    4036
    4137;; Support
     
    150146(define (*close-output-digest loc port restyp)
    151147  (check-open-digest-output-port loc port 'digest-port)
     148  ;must be restyp
    152149  (let (
    153     ;must be restyp
    154     (res '||) )
    155     (dynamic-wind
    156       (lambda () (set! res (finalize-message-digest (%port-data port) restyp)))
    157       (lambda () res)
    158       (lambda () (close-output-port port))) ) )
     150    (res (finalize-message-digest (%port-data port) restyp)) )
     151    (close-output-port port)
     152    res ) )
    159153
    160154(define (get-output-digest port . opts)
     
    174168      (dynamic-wind
    175169        void
    176         (lambda () (proc port))
    177         (lambda () (*close-output-digest 'call-with-output-digest port restyp))) ) ) )
     170        (lambda () (proc port) (finalize-message-digest (%port-data port) restyp))
     171        (lambda () (close-output-port port))) ) ) )
    178172
    179173(define (with-output-to-digest mdp thunk . opts)
     
    182176    (call-with-output-digest
    183177      mdp #;(check-message-digest-primitive 'with-output-to-digest mdp)
    184       (cut with-input-from-port <> thunk) restyp) ) )
     178      (cut with-output-to-port <> thunk)
     179      restyp) ) )
    185180
    186181) ;module message-digest
Note: See TracChangeset for help on using the changeset viewer.