From 9ef4192f716956c6a056637202ac945e47a0ace9 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Wed, 1 Feb 2017 18:18:24 -0700 Subject: [PATCH] glib: Update GIO ports to upstream internal changes. --- src/glib/gio.scm | 43 +++++++++++++++++++++++-------------------- src/glib/glib.pkg | 5 +++-- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/glib/gio.scm b/src/glib/gio.scm index a0430724a..272bc665a 100644 --- a/src/glib/gio.scm +++ b/src/glib/gio.scm @@ -30,7 +30,8 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (let* ((uri* (->uri* uri 'open-input-gfile)) (gfile (make-gfile uri*)) (gstream (gfile-read gfile)) - (port (make-generic-i/o-port (make-g-stream-source gstream) #f))) + (port (make-generic-i/o-port (make-g-stream-source gstream) #f + 'open-input-gfile))) ;;(port/set-coding port 'ISO-8859-1) ;;(port/set-line-ending port 'NEWLINE) (gobject-unref! gfile) @@ -56,15 +57,15 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (else (loop again (fix:1+ count))))))) (define (make-g-stream-source gstream) - ;; Not unlike make-non-channel-port-source in genio.scm. + ;; Not unlike make-non-channel-ss in genio.scm. (let ((port #f) (open? #t)) - (make-gsource - (named-lambda (g-stream-source/get-channel) - #f) + (make-source/sink + 'source + #f (named-lambda (g-stream-source/get-port) port) - (named-lambda (g-stream-source/set-port port*) + (named-lambda (g-stream-source/set-port! port*) (set! port port*)) (named-lambda (g-stream-source/open?) open?) @@ -73,31 +74,33 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (let ((value (g-input-stream-close gstream))) (set! open? #f) value))) - (named-lambda (g-stream-source/has-bytes?) - #t) - (named-lambda (g-stream-source/read-bytes buffer start end) - (g-input-stream-read gstream buffer start end))))) + (vector + (named-lambda (g-stream-source/has-bytes?) + #t) + (named-lambda (g-stream-source/read-bytes buffer start end) + (g-input-stream-read gstream buffer start end)))))) (define (open-output-gfile uri) (let* ((uri* (->uri* uri 'open-output-gfile)) (gfile (make-gfile uri*)) (gstream (gfile-replace gfile #f #t 'private)) - (port (make-generic-i/o-port #f (make-g-stream-sink gstream)))) + (port (make-generic-i/o-port #f (make-g-stream-sink gstream) + 'open-output-gfile))) ;;(port/set-coding port 'ISO-8859-1) ;;(port/set-line-ending port 'NEWLINE) (gobject-unref! gfile) port)) (define (make-g-stream-sink gstream) - ;; Not unlike make-non-channel-port-sink in genio.scm. + ;; Not unlike make-non-channel-ss in genio.scm. (let ((port #f) (open? #t)) - (make-gsink - (named-lambda (g-stream-sink/get-channel) - #f) + (make-source/sink + 'sink + #f (named-lambda (g-stream-sink/get-port) port) - (named-lambda (g-stream-sink/set-port port*) + (named-lambda (g-stream-sink/set-port! port*) (set! port port*)) (named-lambda (g-stream-sink/open?) open?) @@ -106,8 +109,9 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (let ((value (g-output-stream-close gstream))) (set! open? #f) value))) - (named-lambda (g-stream-sink/write-bytes buffer start end) - (g-output-stream-write gstream buffer start end))))) + (vector + (named-lambda (g-stream-sink/write-bytes buffer start end) + (g-output-stream-write gstream buffer start end)))))) (define (gdirectory-read uri) (let* ((uri* (->uri* uri 'gdirectory-read)) @@ -1173,9 +1177,8 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (define-method initialize-instance ((gfile )) (call-next-method gfile) (let ((alien (gobject-alien gfile)) - (uri (uri->string (gfile-uri gfile)))) + (uri (string->utf8 (uri->string (gfile-uri gfile))))) (set-alien/ctype! alien '|GFile|) - (guarantee-utf8-string uri) (C-call "g_file_new_for_uri" alien uri) (error-if-null alien "Could not create:" gfile uri))) diff --git a/src/glib/glib.pkg b/src/glib/glib.pkg index e527d932c..b8d6ec722 100644 --- a/src/glib/glib.pkg +++ b/src/glib/glib.pkg @@ -52,8 +52,9 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (import (runtime ffi) %set-alien/address!) (import (runtime generic-i/o-port) - make-gsource - make-gsink) + make-generic-i/o-port) + (import (runtime binary-port) + make-source/sink) (import (glib main) maybe-yield-glib) (export () -- 2.25.1