Opened 13 years ago

Closed 13 years ago

#678 closed defect (worksforme)

bug in specialized-io egg

Reported by: felix winkelmann Owned by: Jeronimo Pellegrini
Priority: major Milestone:
Component: extensions Version: 4.7.x
Keywords: specialized-io Cc:
Estimated difficulty:

Description

The foreign code should probably be declared to return int:

(define write-one-char
  (lambda (c port)
    (if (fx= 1 ((foreign-lambda* void ((char var)
                                       (scheme-object port))
                                 "#include <stdio.h> \n"
                                 "if (fputc (var, C_port_file(port)) == EOF)"
                                 "     return(1);"
                                 "else"
                                 "     return(0);")
                c port))
        (specialized-io-error "write-one-char: failed!"))))

Change History (2)

comment:1 Changed 13 years ago by Mario Domenech Goulart

Owner: set to Jeronimo Pellegrini
Status: newassigned

comment:2 Changed 13 years ago by Jeronimo Pellegrini

Resolution: worksforme
Status: assignedclosed

Hi,

Indeed, the void declaration made no sense!
It's fixed in trunk and in version 1.2.

However, specialized-io is unsafe in order to be fast, and trying to write to
something that is not a port will crash the program.

The verification done is for the case when one tries to write to a closed port
or to an input port.

Note: See TracTickets for help on using tickets.