(named-lambda (g-input-stream-read-finish-callback source result)
(let ((bytes (C-call "g_input_stream_read_finish" source result gerror*)))
(if (fix:= bytes -1)
- (let ((message (gerror->message gerror*)))
+ (let ((message (gerror-message gerror*)))
(%trace ";g-input-stream-read-finish-callback "message" "queue"\n")
(%queue! queue message))
(begin
(%trace ";g-input-stream-read-finish-callback "bytes" "queue"\n")
(%queue! queue bytes)))))))
+(define-integrable (gerror-message pointer)
+ (let* ((GError (C-> pointer "* GError"))
+ (message (or (and (not (alien-null? GError))
+ (c-peek-cstring (C-> GError "GError message")))
+ "GError pointer not set.")))
+ (C->= pointer "* GError" 0)
+ message))
+
(define-integrable (%queue! queue value)
;; The GIO finish callbacks use this procedure to queue a value on a
;; g-stream's queue AND signal the main loop if Scheme has become
(named-lambda (g-input-stream-skip-finish-callback source result)
(let ((bytes (C-call "g_input_stream_skip_finish" source result gerror*)))
(if (fix:= bytes -1)
- (let ((message (gerror->message gerror*)))
+ (let ((message (gerror-message gerror*)))
(%trace ";g-input-stream-skip-finish-callback "message" "queue"\n")
(%queue! queue message))
(begin
(named-lambda (g-input-stream-close-finish-callback source result)
(if (fix:zero?
(C-call "g_input_stream_close_finish" source result gerror*))
- (let ((message (gerror->message gerror*)))
+ (let ((message (gerror-message gerror*)))
(%trace ";g-input-stream-close-finish-callback "message" "queue"\n")
(%queue! queue message))
(begin
(let ((bytes
(C-call "g_output_stream_write_finish" source result gerror*)))
(if (fix:= bytes -1)
- (let ((message (gerror->message gerror*)))
+ (let ((message (gerror-message gerror*)))
(%trace ";g-output-stream-write-finish-callback "message
" "queue"\n")
(%queue! queue message))
(named-lambda (g-output-stream-flush-finish-callback source result)
(if (fix:zero?
(C-call "g_output_stream_flush_finish" source result gerror*))
- (let ((message (gerror->message gerror*)))
+ (let ((message (gerror-message gerror*)))
(%trace ";g-output-stream-flush-finish-callback "message" "queue"\n")
(%queue! queue message))
(begin
(named-lambda (g-output-stream-close-finish-callback source result)
(if (fix:zero?
(C-call "g_output_stream_close_finish" source result gerror*))
- (let ((message (gerror->message gerror*)))
+ (let ((message (gerror-message gerror*)))
(%trace ";g-output-stream-close-finish-callback "message" "queue"\n")
(%queue! queue message))
(begin
(named-lambda (gfile-read-finish-callback source result)
(let ((bytes (C-call "g_file_read_finish" alien source result gerror*)))
(if (fix:= bytes -1)
- (let ((message (gerror->message gerror*)))
+ (let ((message (gerror-message gerror*)))
(%trace ";g-file-read-finish-callback \""message"\" "queue"\n")
(%queue! queue message))
(begin
(define-integrable (g-output-stream-finish alien queue gerror* op)
(if (alien-null? alien)
- (let ((message (gerror->message gerror*)))
+ (let ((message (gerror-message gerror*)))
(%trace ";g-output-stream-"op"-callback "message" "queue"\n")
(%queue! queue message))
(begin