X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/d69621ccc6e29c793efd767c5595e2b2413350f4..32ac3a6ba32f947a8d6b81ef7609dc69fd6a5d48:/src/gnutls.c diff --git a/src/gnutls.c b/src/gnutls.c index cf47131484..5189f2098c 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -322,6 +322,7 @@ emacs_gnutls_handshake (struct Lisp_Process *proc) { ret = fn_gnutls_handshake (state); emacs_gnutls_handle_error (state, ret); + QUIT; } while (ret < 0 && fn_gnutls_error_is_fatal (ret) == 0); @@ -351,11 +352,11 @@ emacs_gnutls_transport_set_errno (gnutls_session_t state, int err) fn_gnutls_transport_set_errno (state, err); } -EMACS_INT -emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, EMACS_INT nbyte) +ptrdiff_t +emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte) { ssize_t rtnval = 0; - EMACS_INT bytes_written; + ptrdiff_t bytes_written; gnutls_session_t state = proc->gnutls_state; if (proc->gnutls_initstage != GNUTLS_STAGE_READY) @@ -406,8 +407,8 @@ emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, EMACS_INT nbyte) return (bytes_written); } -EMACS_INT -emacs_gnutls_read (struct Lisp_Process *proc, char *buf, EMACS_INT nbyte) +ptrdiff_t +emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte) { ssize_t rtnval; gnutls_session_t state = proc->gnutls_state; @@ -599,7 +600,7 @@ usage: (gnutls-error-fatalp ERROR) */) } } - if (!NUMBERP (err)) + if (! TYPE_RANGED_INTEGERP (int, err)) error ("Not an error symbol or code"); if (0 == fn_gnutls_error_is_fatal (XINT (err))) @@ -631,7 +632,7 @@ usage: (gnutls-error-string ERROR) */) } } - if (!NUMBERP (err)) + if (! TYPE_RANGED_INTEGERP (int, err)) return build_string ("Not an error symbol or code"); return build_string (fn_gnutls_strerror (XINT (err))); @@ -804,7 +805,10 @@ one trustfile (usually a CA bundle). */) error ("gnutls-boot: invalid :hostname parameter"); c_hostname = SSDATA (hostname); - if (NUMBERP (loglevel)) + state = XPROCESS (proc)->gnutls_state; + XPROCESS (proc)->gnutls_p = 1; + + if (TYPE_RANGED_INTEGERP (int, loglevel)) { fn_gnutls_global_set_log_function (gnutls_log_function); fn_gnutls_global_set_log_level (XINT (loglevel)); @@ -826,7 +830,7 @@ one trustfile (usually a CA bundle). */) XPROCESS (proc)->gnutls_state = NULL; XPROCESS (proc)->gnutls_x509_cred = NULL; XPROCESS (proc)->gnutls_anon_cred = NULL; - XPROCESS (proc)->gnutls_cred_type = type; + PSET (XPROCESS (proc), gnutls_cred_type, type); GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_EMPTY; GNUTLS_LOG (1, max_log_level, "allocating credentials"); @@ -867,9 +871,9 @@ one trustfile (usually a CA bundle). */) int file_format = GNUTLS_X509_FMT_PEM; Lisp_Object tail; - for (tail = trustfiles; !NILP (tail); tail = Fcdr (tail)) + for (tail = trustfiles; CONSP (tail); tail = XCDR (tail)) { - Lisp_Object trustfile = Fcar (tail); + Lisp_Object trustfile = XCAR (tail); if (STRINGP (trustfile)) { GNUTLS_LOG2 (1, max_log_level, "setting the trustfile: ", @@ -889,9 +893,9 @@ one trustfile (usually a CA bundle). */) } } - for (tail = crlfiles; !NILP (tail); tail = Fcdr (tail)) + for (tail = crlfiles; CONSP (tail); tail = XCDR (tail)) { - Lisp_Object crlfile = Fcar (tail); + Lisp_Object crlfile = XCAR (tail); if (STRINGP (crlfile)) { GNUTLS_LOG2 (1, max_log_level, "setting the CRL file: ", @@ -909,10 +913,10 @@ one trustfile (usually a CA bundle). */) } } - for (tail = keylist; !NILP (tail); tail = Fcdr (tail)) + for (tail = keylist; CONSP (tail); tail = XCDR (tail)) { - Lisp_Object keyfile = Fcar (Fcar (tail)); - Lisp_Object certfile = Fcar (Fcdr (tail)); + Lisp_Object keyfile = Fcar (XCAR (tail)); + Lisp_Object certfile = Fcar (Fcdr (XCAR (tail))); if (STRINGP (keyfile) && STRINGP (certfile)) { GNUTLS_LOG2 (1, max_log_level, "setting the client key file: ",