}
}
-int
-emacs_gnutls_write (int fildes, struct Lisp_Process *proc, char *buf,
- unsigned int nbyte)
+EMACS_INT
+emacs_gnutls_write (int fildes, struct Lisp_Process *proc, const char *buf,
+ EMACS_INT nbyte)
{
- register int rtnval, bytes_written;
+ ssize_t rtnval;
+ EMACS_INT bytes_written;
gnutls_session_t state = proc->gnutls_state;
if (proc->gnutls_initstage != GNUTLS_STAGE_READY) {
#ifdef EAGAIN
errno = EAGAIN;
#endif
- return -1;
+ return 0;
}
bytes_written = 0;
if (rtnval == GNUTLS_E_AGAIN || rtnval == GNUTLS_E_INTERRUPTED)
continue;
else
- return (bytes_written ? bytes_written : -1);
+ break;
}
buf += rtnval;
return (bytes_written);
}
-int
+EMACS_INT
emacs_gnutls_read (int fildes, struct Lisp_Process *proc, char *buf,
- unsigned int nbyte)
+ EMACS_INT nbyte)
{
- register int rtnval;
+ ssize_t rtnval;
gnutls_session_t state = proc->gnutls_state;
if (proc->gnutls_initstage != GNUTLS_STAGE_READY)
simply the integer value of the error. GNUTLS_E_SUCCESS is mapped
to Qt. */
static Lisp_Object
-gnutls_make_error (int error)
+gnutls_make_error (int err)
{
- switch (error)
+ switch (err)
{
case GNUTLS_E_SUCCESS:
return Qt;
return Qgnutls_e_invalid_session;
}
- return make_number (error);
+ return make_number (err);
}
DEFUN ("gnutls-get-initstage", Fgnutls_get_initstage, Sgnutls_get_initstage, 1, 1, 0,
return gnutls_make_error (ret);
}
+#if 0
/* Deinitializes global GnuTLS state.
See also `gnutls-global-init'. */
static Lisp_Object
return gnutls_make_error (GNUTLS_E_SUCCESS);
}
+#endif
static void
gnutls_log_function (int level, const char* string)
gnutls_certificate_credentials_t x509_cred;
gnutls_anon_client_credentials_t anon_cred;
Lisp_Object global_init;
- char* priority_string_ptr = "NORMAL"; /* default priority string. */
+ char const *priority_string_ptr = "NORMAL"; /* default priority string. */
Lisp_Object tail;
/* Placeholders for the property list elements. */
Lisp_Object priority_string;
Lisp_Object trustfiles;
Lisp_Object keyfiles;
- Lisp_Object callbacks;
+ /* Lisp_Object callbacks; */
Lisp_Object loglevel;
CHECK_PROCESS (proc);
priority_string = Fplist_get (proplist, Qgnutls_bootprop_priority);
trustfiles = Fplist_get (proplist, Qgnutls_bootprop_trustfiles);
keyfiles = Fplist_get (proplist, Qgnutls_bootprop_keyfiles);
- callbacks = Fplist_get (proplist, Qgnutls_bootprop_callbacks);
+ /* callbacks = Fplist_get (proplist, Qgnutls_bootprop_callbacks); */
loglevel = Fplist_get (proplist, Qgnutls_bootprop_loglevel);
state = XPROCESS (proc)->gnutls_state;
if (STRINGP (trustfile))
{
GNUTLS_LOG2 (1, max_log_level, "setting the trustfile: ",
- SDATA (trustfile));
+ SSDATA (trustfile));
ret = gnutls_certificate_set_x509_trust_file
(x509_cred,
- SDATA (trustfile),
+ SSDATA (trustfile),
file_format);
if (ret < GNUTLS_E_SUCCESS)
else
{
error ("Sorry, GnuTLS can't use non-string trustfile %s",
- trustfile);
+ SDATA (trustfile));
}
}
if (STRINGP (keyfile))
{
GNUTLS_LOG2 (1, max_log_level, "setting the keyfile: ",
- SDATA (keyfile));
+ SSDATA (keyfile));
ret = gnutls_certificate_set_x509_crl_file
(x509_cred,
- SDATA (keyfile),
+ SSDATA (keyfile),
file_format);
if (ret < GNUTLS_E_SUCCESS)
else
{
error ("Sorry, GnuTLS can't use non-string keyfile %s",
- keyfile);
+ SDATA (keyfile));
}
}
}