aboutsummaryrefslogtreecommitdiffstats
path: root/src/gnutls.c
diff options
context:
space:
mode:
authorPaul Eggert2012-09-23 12:36:31 -0700
committerPaul Eggert2012-09-23 12:36:31 -0700
commit18e27ea822e42697a32a9757e7931004b86b1188 (patch)
tree075e0a04fbc1b55f37037c5be8ee50f2b672339d /src/gnutls.c
parent67d63151f28c1188dc22a525138198dd0ea81d8a (diff)
downloademacs-18e27ea822e42697a32a9757e7931004b86b1188.tar.gz
emacs-18e27ea822e42697a32a9757e7931004b86b1188.zip
gnutls.c, gtkutil.c: Use bool for boolean.
* gnutls.c (gnutls_global_initialized, init_gnutls_functions) (emacs_gnutls_handle_error): * gtkutil.c (xg_check_special_colors, xg_prepare_tooltip) (xg_hide_tooltip, xg_create_frame_widgets) (create_dialog, xg_uses_old_file_dialog) (xg_get_file_with_chooser, xg_get_file_with_selection) (xg_get_file_name, xg_have_tear_offs, create_menus, xg_create_widget) (xg_item_label_same_p, xg_update_menubar) (xg_modify_menubar_widgets, xg_event_is_for_menubar) (xg_ignore_gtk_scrollbar, xg_set_toolkit_scroll_bar_thumb) (xg_event_is_for_scrollbar, xg_pack_tool_bar, xg_make_tool_item) (is_box_type, xg_tool_item_stale_p, xg_update_tool_bar_sizes) (update_frame_tool_bar, free_frame_tool_bar): * gtkutil.c, w32term.c, xterm.c (x_wm_set_size_hint): * nsmenu.m (ns_update_menubar): * nsmenu.m, w32menu.c, xmenu.c (set_frame_menubar): * xfns.c (Fx_show_tip) [USE_GTK]: Use bool for boolean. * gtkutil.c (xg_update_frame_menubar): * xmenu.c (update_frame_menubar): Return void, not int, since caller ignores return value. * gtkutil.c (xg_change_toolbar_position): Return void, not 1.
Diffstat (limited to 'src/gnutls.c')
-rw-r--r--src/gnutls.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/gnutls.c b/src/gnutls.c
index cfe7d97aa59..e3d84a0b61b 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -30,15 +30,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30#include "w32.h" 30#include "w32.h"
31#endif 31#endif
32 32
33static int 33static bool emacs_gnutls_handle_error (gnutls_session_t, int);
34emacs_gnutls_handle_error (gnutls_session_t, int err);
35 34
36static Lisp_Object Qgnutls_dll; 35static Lisp_Object Qgnutls_dll;
37static Lisp_Object Qgnutls_code; 36static Lisp_Object Qgnutls_code;
38static Lisp_Object Qgnutls_anon, Qgnutls_x509pki; 37static Lisp_Object Qgnutls_anon, Qgnutls_x509pki;
39static Lisp_Object Qgnutls_e_interrupted, Qgnutls_e_again, 38static Lisp_Object Qgnutls_e_interrupted, Qgnutls_e_again,
40 Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake; 39 Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake;
41static int gnutls_global_initialized; 40static bool gnutls_global_initialized;
42 41
43/* The following are for the property list of `gnutls-boot'. */ 42/* The following are for the property list of `gnutls-boot'. */
44static Lisp_Object QCgnutls_bootprop_priority; 43static Lisp_Object QCgnutls_bootprop_priority;
@@ -141,7 +140,7 @@ DEF_GNUTLS_FN (int, gnutls_x509_crt_import,
141 gnutls_x509_crt_fmt_t)); 140 gnutls_x509_crt_fmt_t));
142DEF_GNUTLS_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *)); 141DEF_GNUTLS_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *));
143 142
144static int 143static bool
145init_gnutls_functions (void) 144init_gnutls_functions (void)
146{ 145{
147 HMODULE library; 146 HMODULE library;
@@ -438,7 +437,7 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte)
438 else if (rtnval == GNUTLS_E_UNEXPECTED_PACKET_LENGTH) 437 else if (rtnval == GNUTLS_E_UNEXPECTED_PACKET_LENGTH)
439 /* The peer closed the connection. */ 438 /* The peer closed the connection. */
440 return 0; 439 return 0;
441 else if (emacs_gnutls_handle_error (state, rtnval) == 0) 440 else if (emacs_gnutls_handle_error (state, rtnval))
442 /* non-fatal error */ 441 /* non-fatal error */
443 return -1; 442 return -1;
444 else { 443 else {
@@ -447,19 +446,19 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte)
447 } 446 }
448} 447}
449 448
450/* report a GnuTLS error to the user. 449/* Report a GnuTLS error to the user.
451 Returns zero if the error code was successfully handled. */ 450 Return true if the error code was successfully handled. */
452static int 451static bool
453emacs_gnutls_handle_error (gnutls_session_t session, int err) 452emacs_gnutls_handle_error (gnutls_session_t session, int err)
454{ 453{
455 int max_log_level = 0; 454 int max_log_level = 0;
456 455
457 int ret; 456 bool ret;
458 const char *str; 457 const char *str;
459 458
460 /* TODO: use a Lisp_Object generated by gnutls_make_error? */ 459 /* TODO: use a Lisp_Object generated by gnutls_make_error? */
461 if (err >= 0) 460 if (err >= 0)
462 return 0; 461 return 1;
463 462
464 max_log_level = global_gnutls_log_level; 463 max_log_level = global_gnutls_log_level;
465 464
@@ -471,12 +470,12 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err)
471 470
472 if (fn_gnutls_error_is_fatal (err)) 471 if (fn_gnutls_error_is_fatal (err))
473 { 472 {
474 ret = err; 473 ret = 0;
475 GNUTLS_LOG2 (0, max_log_level, "fatal error:", str); 474 GNUTLS_LOG2 (0, max_log_level, "fatal error:", str);
476 } 475 }
477 else 476 else
478 { 477 {
479 ret = 0; 478 ret = 1;
480 GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str); 479 GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str);
481 /* TODO: EAGAIN AKA Qgnutls_e_again should be level 2. */ 480 /* TODO: EAGAIN AKA Qgnutls_e_again should be level 2. */
482 } 481 }