aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Schwab2011-08-14 11:08:01 +0200
committerAndreas Schwab2011-08-14 11:08:01 +0200
commitb5f0301637acf044455c3ab39d214631f59e0d7b (patch)
tree86a3da944c1aa16f976ac20f43127519da2e789e /src
parenta29eb766a697b646103c4cc8ab56795acce7beab (diff)
downloademacs-b5f0301637acf044455c3ab39d214631f59e0d7b.tar.gz
emacs-b5f0301637acf044455c3ab39d214631f59e0d7b.zip
Whitespace cleanup
Diffstat (limited to 'src')
-rw-r--r--src/gnutls.c350
-rw-r--r--src/xfaces.c128
2 files changed, 251 insertions, 227 deletions
diff --git a/src/gnutls.c b/src/gnutls.c
index fc651d2c7e4..62382abc437 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -72,41 +72,41 @@ static void gnutls_log_function2 (int, const char*, const char*);
72 } 72 }
73 73
74DEF_GNUTLS_FN (gnutls_alert_description_t, gnutls_alert_get, 74DEF_GNUTLS_FN (gnutls_alert_description_t, gnutls_alert_get,
75 (gnutls_session_t)); 75 (gnutls_session_t));
76DEF_GNUTLS_FN (const char *, gnutls_alert_get_name, 76DEF_GNUTLS_FN (const char *, gnutls_alert_get_name,
77 (gnutls_alert_description_t)); 77 (gnutls_alert_description_t));
78DEF_GNUTLS_FN (int, gnutls_alert_send_appropriate, (gnutls_session_t, int)); 78DEF_GNUTLS_FN (int, gnutls_alert_send_appropriate, (gnutls_session_t, int));
79DEF_GNUTLS_FN (int, gnutls_anon_allocate_client_credentials, 79DEF_GNUTLS_FN (int, gnutls_anon_allocate_client_credentials,
80 (gnutls_anon_client_credentials_t *)); 80 (gnutls_anon_client_credentials_t *));
81DEF_GNUTLS_FN (void, gnutls_anon_free_client_credentials, 81DEF_GNUTLS_FN (void, gnutls_anon_free_client_credentials,
82 (gnutls_anon_client_credentials_t)); 82 (gnutls_anon_client_credentials_t));
83DEF_GNUTLS_FN (int, gnutls_bye, (gnutls_session_t, gnutls_close_request_t)); 83DEF_GNUTLS_FN (int, gnutls_bye, (gnutls_session_t, gnutls_close_request_t));
84DEF_GNUTLS_FN (int, gnutls_certificate_allocate_credentials, 84DEF_GNUTLS_FN (int, gnutls_certificate_allocate_credentials,
85 (gnutls_certificate_credentials_t *)); 85 (gnutls_certificate_credentials_t *));
86DEF_GNUTLS_FN (void, gnutls_certificate_free_credentials, 86DEF_GNUTLS_FN (void, gnutls_certificate_free_credentials,
87 (gnutls_certificate_credentials_t)); 87 (gnutls_certificate_credentials_t));
88DEF_GNUTLS_FN (const gnutls_datum_t *, gnutls_certificate_get_peers, 88DEF_GNUTLS_FN (const gnutls_datum_t *, gnutls_certificate_get_peers,
89 (gnutls_session_t, unsigned int *)); 89 (gnutls_session_t, unsigned int *));
90DEF_GNUTLS_FN (void, gnutls_certificate_set_verify_flags, 90DEF_GNUTLS_FN (void, gnutls_certificate_set_verify_flags,
91 (gnutls_certificate_credentials_t, unsigned int)); 91 (gnutls_certificate_credentials_t, unsigned int));
92DEF_GNUTLS_FN (int, gnutls_certificate_set_x509_crl_file, 92DEF_GNUTLS_FN (int, gnutls_certificate_set_x509_crl_file,
93 (gnutls_certificate_credentials_t, const char *, 93 (gnutls_certificate_credentials_t, const char *,
94 gnutls_x509_crt_fmt_t)); 94 gnutls_x509_crt_fmt_t));
95DEF_GNUTLS_FN (int, gnutls_certificate_set_x509_key_file, 95DEF_GNUTLS_FN (int, gnutls_certificate_set_x509_key_file,
96 (gnutls_certificate_credentials_t, const char *, const char *, 96 (gnutls_certificate_credentials_t, const char *, const char *,
97 gnutls_x509_crt_fmt_t)); 97 gnutls_x509_crt_fmt_t));
98DEF_GNUTLS_FN (int, gnutls_certificate_set_x509_trust_file, 98DEF_GNUTLS_FN (int, gnutls_certificate_set_x509_trust_file,
99 (gnutls_certificate_credentials_t, const char *, 99 (gnutls_certificate_credentials_t, const char *,
100 gnutls_x509_crt_fmt_t)); 100 gnutls_x509_crt_fmt_t));
101DEF_GNUTLS_FN (gnutls_certificate_type_t, gnutls_certificate_type_get, 101DEF_GNUTLS_FN (gnutls_certificate_type_t, gnutls_certificate_type_get,
102 (gnutls_session_t)); 102 (gnutls_session_t));
103DEF_GNUTLS_FN (int, gnutls_certificate_verify_peers2, 103DEF_GNUTLS_FN (int, gnutls_certificate_verify_peers2,
104 (gnutls_session_t, unsigned int *)); 104 (gnutls_session_t, unsigned int *));
105DEF_GNUTLS_FN (int, gnutls_credentials_set, 105DEF_GNUTLS_FN (int, gnutls_credentials_set,
106 (gnutls_session_t, gnutls_credentials_type_t, void *)); 106 (gnutls_session_t, gnutls_credentials_type_t, void *));
107DEF_GNUTLS_FN (void, gnutls_deinit, (gnutls_session_t)); 107DEF_GNUTLS_FN (void, gnutls_deinit, (gnutls_session_t));
108DEF_GNUTLS_FN (void, gnutls_dh_set_prime_bits, 108DEF_GNUTLS_FN (void, gnutls_dh_set_prime_bits,
109 (gnutls_session_t, unsigned int)); 109 (gnutls_session_t, unsigned int));
110DEF_GNUTLS_FN (int, gnutls_error_is_fatal, (int)); 110DEF_GNUTLS_FN (int, gnutls_error_is_fatal, (int));
111DEF_GNUTLS_FN (int, gnutls_global_init, (void)); 111DEF_GNUTLS_FN (int, gnutls_global_init, (void));
112DEF_GNUTLS_FN (void, gnutls_global_set_log_function, (gnutls_log_func)); 112DEF_GNUTLS_FN (void, gnutls_global_set_log_function, (gnutls_log_func));
@@ -118,27 +118,27 @@ DEF_GNUTLS_FN (void, gnutls_global_set_mem_functions,
118DEF_GNUTLS_FN (int, gnutls_handshake, (gnutls_session_t)); 118DEF_GNUTLS_FN (int, gnutls_handshake, (gnutls_session_t));
119DEF_GNUTLS_FN (int, gnutls_init, (gnutls_session_t *, gnutls_connection_end_t)); 119DEF_GNUTLS_FN (int, gnutls_init, (gnutls_session_t *, gnutls_connection_end_t));
120DEF_GNUTLS_FN (int, gnutls_priority_set_direct, 120DEF_GNUTLS_FN (int, gnutls_priority_set_direct,
121 (gnutls_session_t, const char *, const char **)); 121 (gnutls_session_t, const char *, const char **));
122DEF_GNUTLS_FN (size_t, gnutls_record_check_pending, (gnutls_session_t)); 122DEF_GNUTLS_FN (size_t, gnutls_record_check_pending, (gnutls_session_t));
123DEF_GNUTLS_FN (ssize_t, gnutls_record_recv, (gnutls_session_t, void *, size_t)); 123DEF_GNUTLS_FN (ssize_t, gnutls_record_recv, (gnutls_session_t, void *, size_t));
124DEF_GNUTLS_FN (ssize_t, gnutls_record_send, 124DEF_GNUTLS_FN (ssize_t, gnutls_record_send,
125 (gnutls_session_t, const void *, size_t)); 125 (gnutls_session_t, const void *, size_t));
126DEF_GNUTLS_FN (const char *, gnutls_strerror, (int)); 126DEF_GNUTLS_FN (const char *, gnutls_strerror, (int));
127DEF_GNUTLS_FN (void, gnutls_transport_set_errno, (gnutls_session_t, int)); 127DEF_GNUTLS_FN (void, gnutls_transport_set_errno, (gnutls_session_t, int));
128DEF_GNUTLS_FN (void, gnutls_transport_set_lowat, (gnutls_session_t, int)); 128DEF_GNUTLS_FN (void, gnutls_transport_set_lowat, (gnutls_session_t, int));
129DEF_GNUTLS_FN (void, gnutls_transport_set_ptr2, 129DEF_GNUTLS_FN (void, gnutls_transport_set_ptr2,
130 (gnutls_session_t, gnutls_transport_ptr_t, 130 (gnutls_session_t, gnutls_transport_ptr_t,
131 gnutls_transport_ptr_t)); 131 gnutls_transport_ptr_t));
132DEF_GNUTLS_FN (void, gnutls_transport_set_pull_function, 132DEF_GNUTLS_FN (void, gnutls_transport_set_pull_function,
133 (gnutls_session_t, gnutls_pull_func)); 133 (gnutls_session_t, gnutls_pull_func));
134DEF_GNUTLS_FN (void, gnutls_transport_set_push_function, 134DEF_GNUTLS_FN (void, gnutls_transport_set_push_function,
135 (gnutls_session_t, gnutls_push_func)); 135 (gnutls_session_t, gnutls_push_func));
136DEF_GNUTLS_FN (int, gnutls_x509_crt_check_hostname, 136DEF_GNUTLS_FN (int, gnutls_x509_crt_check_hostname,
137 (gnutls_x509_crt_t, const char *)); 137 (gnutls_x509_crt_t, const char *));
138DEF_GNUTLS_FN (void, gnutls_x509_crt_deinit, (gnutls_x509_crt_t)); 138DEF_GNUTLS_FN (void, gnutls_x509_crt_deinit, (gnutls_x509_crt_t));
139DEF_GNUTLS_FN (int, gnutls_x509_crt_import, 139DEF_GNUTLS_FN (int, gnutls_x509_crt_import,
140 (gnutls_x509_crt_t, const gnutls_datum_t *, 140 (gnutls_x509_crt_t, const gnutls_datum_t *,
141 gnutls_x509_crt_fmt_t)); 141 gnutls_x509_crt_fmt_t));
142DEF_GNUTLS_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *)); 142DEF_GNUTLS_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *));
143 143
144static int 144static int
@@ -196,7 +196,7 @@ init_gnutls_functions (Lisp_Object libraries)
196 max_log_level = global_gnutls_log_level; 196 max_log_level = global_gnutls_log_level;
197 197
198 GNUTLS_LOG2 (1, max_log_level, "GnuTLS library loaded:", 198 GNUTLS_LOG2 (1, max_log_level, "GnuTLS library loaded:",
199 SDATA (Fget (Qgnutls_dll, QCloaded_from))); 199 SDATA (Fget (Qgnutls_dll, QCloaded_from)));
200 return 1; 200 return 1;
201} 201}
202 202
@@ -267,29 +267,29 @@ emacs_gnutls_handshake (struct Lisp_Process *proc)
267 { 267 {
268#ifdef WINDOWSNT 268#ifdef WINDOWSNT
269 /* On W32 we cannot transfer socket handles between different runtime 269 /* On W32 we cannot transfer socket handles between different runtime
270 libraries, so we tell GnuTLS to use our special push/pull 270 libraries, so we tell GnuTLS to use our special push/pull
271 functions. */ 271 functions. */
272 fn_gnutls_transport_set_ptr2 (state, 272 fn_gnutls_transport_set_ptr2 (state,
273 (gnutls_transport_ptr_t) proc, 273 (gnutls_transport_ptr_t) proc,
274 (gnutls_transport_ptr_t) proc); 274 (gnutls_transport_ptr_t) proc);
275 fn_gnutls_transport_set_push_function (state, &emacs_gnutls_push); 275 fn_gnutls_transport_set_push_function (state, &emacs_gnutls_push);
276 fn_gnutls_transport_set_pull_function (state, &emacs_gnutls_pull); 276 fn_gnutls_transport_set_pull_function (state, &emacs_gnutls_pull);
277 277
278 /* For non blocking sockets or other custom made pull/push 278 /* For non blocking sockets or other custom made pull/push
279 functions the gnutls_transport_set_lowat must be called, with 279 functions the gnutls_transport_set_lowat must be called, with
280 a zero low water mark value. (GnuTLS 2.10.4 documentation) 280 a zero low water mark value. (GnuTLS 2.10.4 documentation)
281 281
282 (Note: this is probably not strictly necessary as the lowat 282 (Note: this is probably not strictly necessary as the lowat
283 value is only used when no custom pull/push functions are 283 value is only used when no custom pull/push functions are
284 set.) */ 284 set.) */
285 fn_gnutls_transport_set_lowat (state, 0); 285 fn_gnutls_transport_set_lowat (state, 0);
286#else 286#else
287 /* This is how GnuTLS takes sockets: as file descriptors passed 287 /* This is how GnuTLS takes sockets: as file descriptors passed
288 in. For an Emacs process socket, infd and outfd are the 288 in. For an Emacs process socket, infd and outfd are the
289 same but we use this two-argument version for clarity. */ 289 same but we use this two-argument version for clarity. */
290 fn_gnutls_transport_set_ptr2 (state, 290 fn_gnutls_transport_set_ptr2 (state,
291 (gnutls_transport_ptr_t) (long) proc->infd, 291 (gnutls_transport_ptr_t) (long) proc->infd,
292 (gnutls_transport_ptr_t) (long) proc->outfd); 292 (gnutls_transport_ptr_t) (long) proc->outfd);
293#endif 293#endif
294 294
295 proc->gnutls_initstage = GNUTLS_STAGE_TRANSPORT_POINTERS_SET; 295 proc->gnutls_initstage = GNUTLS_STAGE_TRANSPORT_POINTERS_SET;
@@ -352,12 +352,12 @@ emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, EMACS_INT nbyte)
352 rtnval = fn_gnutls_record_send (state, buf, nbyte); 352 rtnval = fn_gnutls_record_send (state, buf, nbyte);
353 353
354 if (rtnval < 0) 354 if (rtnval < 0)
355 { 355 {
356 if (rtnval == GNUTLS_E_AGAIN || rtnval == GNUTLS_E_INTERRUPTED) 356 if (rtnval == GNUTLS_E_AGAIN || rtnval == GNUTLS_E_INTERRUPTED)
357 continue; 357 continue;
358 else 358 else
359 break; 359 break;
360 } 360 }
361 361
362 buf += rtnval; 362 buf += rtnval;
363 nbyte -= rtnval; 363 nbyte -= rtnval;
@@ -756,26 +756,26 @@ one trustfile (usually a CA bundle). */)
756 756
757 if (EQ (type, Qgnutls_x509pki)) 757 if (EQ (type, Qgnutls_x509pki))
758 { 758 {
759 GNUTLS_LOG (2, max_log_level, "deallocating x509 credentials"); 759 GNUTLS_LOG (2, max_log_level, "deallocating x509 credentials");
760 x509_cred = XPROCESS (proc)->gnutls_x509_cred; 760 x509_cred = XPROCESS (proc)->gnutls_x509_cred;
761 fn_gnutls_certificate_free_credentials (x509_cred); 761 fn_gnutls_certificate_free_credentials (x509_cred);
762 } 762 }
763 else if (EQ (type, Qgnutls_anon)) 763 else if (EQ (type, Qgnutls_anon))
764 { 764 {
765 GNUTLS_LOG (2, max_log_level, "deallocating anon credentials"); 765 GNUTLS_LOG (2, max_log_level, "deallocating anon credentials");
766 anon_cred = XPROCESS (proc)->gnutls_anon_cred; 766 anon_cred = XPROCESS (proc)->gnutls_anon_cred;
767 fn_gnutls_anon_free_client_credentials (anon_cred); 767 fn_gnutls_anon_free_client_credentials (anon_cred);
768 } 768 }
769 else 769 else
770 { 770 {
771 error ("unknown credential type"); 771 error ("unknown credential type");
772 ret = GNUTLS_EMACS_ERROR_INVALID_TYPE; 772 ret = GNUTLS_EMACS_ERROR_INVALID_TYPE;
773 } 773 }
774 774
775 if (GNUTLS_INITSTAGE (proc) >= GNUTLS_STAGE_INIT) 775 if (GNUTLS_INITSTAGE (proc) >= GNUTLS_STAGE_INIT)
776 { 776 {
777 GNUTLS_LOG (1, max_log_level, "deallocating x509 credentials"); 777 GNUTLS_LOG (1, max_log_level, "deallocating x509 credentials");
778 Fgnutls_deinit (proc); 778 Fgnutls_deinit (proc);
779 } 779 }
780 } 780 }
781 781
@@ -790,20 +790,20 @@ one trustfile (usually a CA bundle). */)
790 fn_gnutls_certificate_allocate_credentials (&x509_cred); 790 fn_gnutls_certificate_allocate_credentials (&x509_cred);
791 791
792 if (NUMBERP (verify_flags)) 792 if (NUMBERP (verify_flags))
793 { 793 {
794 gnutls_verify_flags = XINT (verify_flags); 794 gnutls_verify_flags = XINT (verify_flags);
795 GNUTLS_LOG (2, max_log_level, "setting verification flags"); 795 GNUTLS_LOG (2, max_log_level, "setting verification flags");
796 } 796 }
797 else if (NILP (verify_flags)) 797 else if (NILP (verify_flags))
798 { 798 {
799 /* The default is already GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT. */ 799 /* The default is already GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT. */
800 GNUTLS_LOG (2, max_log_level, "using default verification flags"); 800 GNUTLS_LOG (2, max_log_level, "using default verification flags");
801 } 801 }
802 else 802 else
803 { 803 {
804 /* The default is already GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT. */ 804 /* The default is already GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT. */
805 GNUTLS_LOG (2, max_log_level, "ignoring invalid verify-flags"); 805 GNUTLS_LOG (2, max_log_level, "ignoring invalid verify-flags");
806 } 806 }
807 fn_gnutls_certificate_set_verify_flags (x509_cred, gnutls_verify_flags); 807 fn_gnutls_certificate_set_verify_flags (x509_cred, gnutls_verify_flags);
808 } 808 }
809 else if (EQ (type, Qgnutls_anon)) 809 else if (EQ (type, Qgnutls_anon))
@@ -828,76 +828,76 @@ one trustfile (usually a CA bundle). */)
828 for (tail = trustfiles; !NILP (tail); tail = Fcdr (tail)) 828 for (tail = trustfiles; !NILP (tail); tail = Fcdr (tail))
829 { 829 {
830 Lisp_Object trustfile = Fcar (tail); 830 Lisp_Object trustfile = Fcar (tail);
831 if (STRINGP (trustfile)) 831 if (STRINGP (trustfile))
832 { 832 {
833 GNUTLS_LOG2 (1, max_log_level, "setting the trustfile: ", 833 GNUTLS_LOG2 (1, max_log_level, "setting the trustfile: ",
834 SSDATA (trustfile)); 834 SSDATA (trustfile));
835 ret = fn_gnutls_certificate_set_x509_trust_file 835 ret = fn_gnutls_certificate_set_x509_trust_file
836 (x509_cred, 836 (x509_cred,
837 SSDATA (trustfile), 837 SSDATA (trustfile),
838 file_format); 838 file_format);
839 839
840 if (ret < GNUTLS_E_SUCCESS) 840 if (ret < GNUTLS_E_SUCCESS)
841 return gnutls_make_error (ret); 841 return gnutls_make_error (ret);
842 } 842 }
843 else 843 else
844 { 844 {
845 error ("Sorry, GnuTLS can't use non-string trustfile %s", 845 error ("Sorry, GnuTLS can't use non-string trustfile %s",
846 SDATA (trustfile)); 846 SDATA (trustfile));
847 } 847 }
848 } 848 }
849 849
850 for (tail = crlfiles; !NILP (tail); tail = Fcdr (tail)) 850 for (tail = crlfiles; !NILP (tail); tail = Fcdr (tail))
851 { 851 {
852 Lisp_Object crlfile = Fcar (tail); 852 Lisp_Object crlfile = Fcar (tail);
853 if (STRINGP (crlfile)) 853 if (STRINGP (crlfile))
854 { 854 {
855 GNUTLS_LOG2 (1, max_log_level, "setting the CRL file: ", 855 GNUTLS_LOG2 (1, max_log_level, "setting the CRL file: ",
856 SSDATA (crlfile)); 856 SSDATA (crlfile));
857 ret = fn_gnutls_certificate_set_x509_crl_file 857 ret = fn_gnutls_certificate_set_x509_crl_file
858 (x509_cred, 858 (x509_cred,
859 SSDATA (crlfile), 859 SSDATA (crlfile),
860 file_format); 860 file_format);
861 861
862 if (ret < GNUTLS_E_SUCCESS) 862 if (ret < GNUTLS_E_SUCCESS)
863 return gnutls_make_error (ret); 863 return gnutls_make_error (ret);
864 } 864 }
865 else 865 else
866 { 866 {
867 error ("Sorry, GnuTLS can't use non-string CRL file %s", 867 error ("Sorry, GnuTLS can't use non-string CRL file %s",
868 SDATA (crlfile)); 868 SDATA (crlfile));
869 } 869 }
870 } 870 }
871 871
872 for (tail = keylist; !NILP (tail); tail = Fcdr (tail)) 872 for (tail = keylist; !NILP (tail); tail = Fcdr (tail))
873 { 873 {
874 Lisp_Object keyfile = Fcar (Fcar (tail)); 874 Lisp_Object keyfile = Fcar (Fcar (tail));
875 Lisp_Object certfile = Fcar (Fcdr (tail)); 875 Lisp_Object certfile = Fcar (Fcdr (tail));
876 if (STRINGP (keyfile) && STRINGP (certfile)) 876 if (STRINGP (keyfile) && STRINGP (certfile))
877 { 877 {
878 GNUTLS_LOG2 (1, max_log_level, "setting the client key file: ", 878 GNUTLS_LOG2 (1, max_log_level, "setting the client key file: ",
879 SSDATA (keyfile)); 879 SSDATA (keyfile));
880 GNUTLS_LOG2 (1, max_log_level, "setting the client cert file: ", 880 GNUTLS_LOG2 (1, max_log_level, "setting the client cert file: ",
881 SSDATA (certfile)); 881 SSDATA (certfile));
882 ret = fn_gnutls_certificate_set_x509_key_file 882 ret = fn_gnutls_certificate_set_x509_key_file
883 (x509_cred, 883 (x509_cred,
884 SSDATA (certfile), 884 SSDATA (certfile),
885 SSDATA (keyfile), 885 SSDATA (keyfile),
886 file_format); 886 file_format);
887 887
888 if (ret < GNUTLS_E_SUCCESS) 888 if (ret < GNUTLS_E_SUCCESS)
889 return gnutls_make_error (ret); 889 return gnutls_make_error (ret);
890 } 890 }
891 else 891 else
892 { 892 {
893 if (STRINGP (keyfile)) 893 if (STRINGP (keyfile))
894 error ("Sorry, GnuTLS can't use non-string client cert file %s", 894 error ("Sorry, GnuTLS can't use non-string client cert file %s",
895 SDATA (certfile)); 895 SDATA (certfile));
896 else 896 else
897 error ("Sorry, GnuTLS can't use non-string client key file %s", 897 error ("Sorry, GnuTLS can't use non-string client key file %s",
898 SDATA (keyfile)); 898 SDATA (keyfile));
899 } 899 }
900 } 900 }
901 } 901 }
902 902
903 GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_FILES; 903 GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_FILES;
@@ -925,19 +925,19 @@ one trustfile (usually a CA bundle). */)
925 { 925 {
926 priority_string_ptr = SSDATA (priority_string); 926 priority_string_ptr = SSDATA (priority_string);
927 GNUTLS_LOG2 (1, max_log_level, "got non-default priority string:", 927 GNUTLS_LOG2 (1, max_log_level, "got non-default priority string:",
928 priority_string_ptr); 928 priority_string_ptr);
929 } 929 }
930 else 930 else
931 { 931 {
932 GNUTLS_LOG2 (1, max_log_level, "using default priority string:", 932 GNUTLS_LOG2 (1, max_log_level, "using default priority string:",
933 priority_string_ptr); 933 priority_string_ptr);
934 } 934 }
935 935
936 GNUTLS_LOG (1, max_log_level, "setting the priority string"); 936 GNUTLS_LOG (1, max_log_level, "setting the priority string");
937 937
938 ret = fn_gnutls_priority_set_direct (state, 938 ret = fn_gnutls_priority_set_direct (state,
939 priority_string_ptr, 939 priority_string_ptr,
940 NULL); 940 NULL);
941 941
942 if (ret < GNUTLS_E_SUCCESS) 942 if (ret < GNUTLS_E_SUCCESS)
943 return gnutls_make_error (ret); 943 return gnutls_make_error (ret);
@@ -990,44 +990,44 @@ one trustfile (usually a CA bundle). */)
990 990
991 if (XINT (loglevel) > 0 && peer_verification & GNUTLS_CERT_INVALID) 991 if (XINT (loglevel) > 0 && peer_verification & GNUTLS_CERT_INVALID)
992 message ("%s certificate could not be verified.", 992 message ("%s certificate could not be verified.",
993 c_hostname); 993 c_hostname);
994 994
995 if (peer_verification & GNUTLS_CERT_REVOKED) 995 if (peer_verification & GNUTLS_CERT_REVOKED)
996 GNUTLS_LOG2 (1, max_log_level, "certificate was revoked (CRL):", 996 GNUTLS_LOG2 (1, max_log_level, "certificate was revoked (CRL):",
997 c_hostname); 997 c_hostname);
998 998
999 if (peer_verification & GNUTLS_CERT_SIGNER_NOT_FOUND) 999 if (peer_verification & GNUTLS_CERT_SIGNER_NOT_FOUND)
1000 GNUTLS_LOG2 (1, max_log_level, "certificate signer was not found:", 1000 GNUTLS_LOG2 (1, max_log_level, "certificate signer was not found:",
1001 c_hostname); 1001 c_hostname);
1002 1002
1003 if (peer_verification & GNUTLS_CERT_SIGNER_NOT_CA) 1003 if (peer_verification & GNUTLS_CERT_SIGNER_NOT_CA)
1004 GNUTLS_LOG2 (1, max_log_level, "certificate signer is not a CA:", 1004 GNUTLS_LOG2 (1, max_log_level, "certificate signer is not a CA:",
1005 c_hostname); 1005 c_hostname);
1006 1006
1007 if (peer_verification & GNUTLS_CERT_INSECURE_ALGORITHM) 1007 if (peer_verification & GNUTLS_CERT_INSECURE_ALGORITHM)
1008 GNUTLS_LOG2 (1, max_log_level, 1008 GNUTLS_LOG2 (1, max_log_level,
1009 "certificate was signed with an insecure algorithm:", 1009 "certificate was signed with an insecure algorithm:",
1010 c_hostname); 1010 c_hostname);
1011 1011
1012 if (peer_verification & GNUTLS_CERT_NOT_ACTIVATED) 1012 if (peer_verification & GNUTLS_CERT_NOT_ACTIVATED)
1013 GNUTLS_LOG2 (1, max_log_level, "certificate is not yet activated:", 1013 GNUTLS_LOG2 (1, max_log_level, "certificate is not yet activated:",
1014 c_hostname); 1014 c_hostname);
1015 1015
1016 if (peer_verification & GNUTLS_CERT_EXPIRED) 1016 if (peer_verification & GNUTLS_CERT_EXPIRED)
1017 GNUTLS_LOG2 (1, max_log_level, "certificate has expired:", 1017 GNUTLS_LOG2 (1, max_log_level, "certificate has expired:",
1018 c_hostname); 1018 c_hostname);
1019 1019
1020 if (peer_verification != 0) 1020 if (peer_verification != 0)
1021 { 1021 {
1022 if (NILP (verify_hostname_error)) 1022 if (NILP (verify_hostname_error))
1023 { 1023 {
1024 GNUTLS_LOG2 (1, max_log_level, "certificate validation failed:", 1024 GNUTLS_LOG2 (1, max_log_level, "certificate validation failed:",
1025 c_hostname); 1025 c_hostname);
1026 } 1026 }
1027 else 1027 else
1028 { 1028 {
1029 error ("Certificate validation failed %s, verification code %d", 1029 error ("Certificate validation failed %s, verification code %d",
1030 c_hostname, peer_verification); 1030 c_hostname, peer_verification);
1031 } 1031 }
1032 } 1032 }
1033 1033
@@ -1039,41 +1039,41 @@ one trustfile (usually a CA bundle). */)
1039 ret = fn_gnutls_x509_crt_init (&gnutls_verify_cert); 1039 ret = fn_gnutls_x509_crt_init (&gnutls_verify_cert);
1040 1040
1041 if (ret < GNUTLS_E_SUCCESS) 1041 if (ret < GNUTLS_E_SUCCESS)
1042 return gnutls_make_error (ret); 1042 return gnutls_make_error (ret);
1043 1043
1044 gnutls_verify_cert_list = 1044 gnutls_verify_cert_list =
1045 fn_gnutls_certificate_get_peers (state, &gnutls_verify_cert_list_size); 1045 fn_gnutls_certificate_get_peers (state, &gnutls_verify_cert_list_size);
1046 1046
1047 if (NULL == gnutls_verify_cert_list) 1047 if (NULL == gnutls_verify_cert_list)
1048 { 1048 {
1049 error ("No x509 certificate was found!\n"); 1049 error ("No x509 certificate was found!\n");
1050 } 1050 }
1051 1051
1052 /* We only check the first certificate in the given chain. */ 1052 /* We only check the first certificate in the given chain. */
1053 ret = fn_gnutls_x509_crt_import (gnutls_verify_cert, 1053 ret = fn_gnutls_x509_crt_import (gnutls_verify_cert,
1054 &gnutls_verify_cert_list[0], 1054 &gnutls_verify_cert_list[0],
1055 GNUTLS_X509_FMT_DER); 1055 GNUTLS_X509_FMT_DER);
1056 1056
1057 if (ret < GNUTLS_E_SUCCESS) 1057 if (ret < GNUTLS_E_SUCCESS)
1058 { 1058 {
1059 fn_gnutls_x509_crt_deinit (gnutls_verify_cert); 1059 fn_gnutls_x509_crt_deinit (gnutls_verify_cert);
1060 return gnutls_make_error (ret); 1060 return gnutls_make_error (ret);
1061 } 1061 }
1062 1062
1063 if (!fn_gnutls_x509_crt_check_hostname (gnutls_verify_cert, c_hostname)) 1063 if (!fn_gnutls_x509_crt_check_hostname (gnutls_verify_cert, c_hostname))
1064 { 1064 {
1065 if (NILP (verify_hostname_error)) 1065 if (NILP (verify_hostname_error))
1066 { 1066 {
1067 GNUTLS_LOG2 (1, max_log_level, "x509 certificate does not match:", 1067 GNUTLS_LOG2 (1, max_log_level, "x509 certificate does not match:",
1068 c_hostname); 1068 c_hostname);
1069 } 1069 }
1070 else 1070 else
1071 { 1071 {
1072 fn_gnutls_x509_crt_deinit (gnutls_verify_cert); 1072 fn_gnutls_x509_crt_deinit (gnutls_verify_cert);
1073 error ("The x509 certificate does not match \"%s\"", 1073 error ("The x509 certificate does not match \"%s\"",
1074 c_hostname); 1074 c_hostname);
1075 } 1075 }
1076 } 1076 }
1077 1077
1078 fn_gnutls_x509_crt_deinit (gnutls_verify_cert); 1078 fn_gnutls_x509_crt_deinit (gnutls_verify_cert);
1079 } 1079 }
@@ -1105,7 +1105,7 @@ This function may also return `gnutls-e-again', or
1105 state = XPROCESS (proc)->gnutls_state; 1105 state = XPROCESS (proc)->gnutls_state;
1106 1106
1107 ret = fn_gnutls_bye (state, 1107 ret = fn_gnutls_bye (state,
1108 NILP (cont) ? GNUTLS_SHUT_RDWR : GNUTLS_SHUT_WR); 1108 NILP (cont) ? GNUTLS_SHUT_RDWR : GNUTLS_SHUT_WR);
1109 1109
1110 return gnutls_make_error (ret); 1110 return gnutls_make_error (ret);
1111} 1111}
@@ -1133,19 +1133,19 @@ syms_of_gnutls (void)
1133 1133
1134 DEFSYM (Qgnutls_e_interrupted, "gnutls-e-interrupted"); 1134 DEFSYM (Qgnutls_e_interrupted, "gnutls-e-interrupted");
1135 Fput (Qgnutls_e_interrupted, Qgnutls_code, 1135 Fput (Qgnutls_e_interrupted, Qgnutls_code,
1136 make_number (GNUTLS_E_INTERRUPTED)); 1136 make_number (GNUTLS_E_INTERRUPTED));
1137 1137
1138 DEFSYM (Qgnutls_e_again, "gnutls-e-again"); 1138 DEFSYM (Qgnutls_e_again, "gnutls-e-again");
1139 Fput (Qgnutls_e_again, Qgnutls_code, 1139 Fput (Qgnutls_e_again, Qgnutls_code,
1140 make_number (GNUTLS_E_AGAIN)); 1140 make_number (GNUTLS_E_AGAIN));
1141 1141
1142 DEFSYM (Qgnutls_e_invalid_session, "gnutls-e-invalid-session"); 1142 DEFSYM (Qgnutls_e_invalid_session, "gnutls-e-invalid-session");
1143 Fput (Qgnutls_e_invalid_session, Qgnutls_code, 1143 Fput (Qgnutls_e_invalid_session, Qgnutls_code,
1144 make_number (GNUTLS_E_INVALID_SESSION)); 1144 make_number (GNUTLS_E_INVALID_SESSION));
1145 1145
1146 DEFSYM (Qgnutls_e_not_ready_for_handshake, "gnutls-e-not-ready-for-handshake"); 1146 DEFSYM (Qgnutls_e_not_ready_for_handshake, "gnutls-e-not-ready-for-handshake");
1147 Fput (Qgnutls_e_not_ready_for_handshake, Qgnutls_code, 1147 Fput (Qgnutls_e_not_ready_for_handshake, Qgnutls_code,
1148 make_number (GNUTLS_E_APPLICATION_ERROR_MIN)); 1148 make_number (GNUTLS_E_APPLICATION_ERROR_MIN));
1149 1149
1150 defsubr (&Sgnutls_get_initstage); 1150 defsubr (&Sgnutls_get_initstage);
1151 defsubr (&Sgnutls_errorp); 1151 defsubr (&Sgnutls_errorp);
diff --git a/src/xfaces.c b/src/xfaces.c
index 063cb1b11c2..ae78a67519f 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -458,11 +458,11 @@ struct table_entry;
458struct named_merge_point; 458struct named_merge_point;
459 459
460static void map_tty_color (struct frame *, struct face *, 460static void map_tty_color (struct frame *, struct face *,
461 enum lface_attribute_index, int *); 461 enum lface_attribute_index, int *);
462static Lisp_Object resolve_face_name (Lisp_Object, int); 462static Lisp_Object resolve_face_name (Lisp_Object, int);
463static void set_font_frame_param (Lisp_Object, Lisp_Object); 463static void set_font_frame_param (Lisp_Object, Lisp_Object);
464static int get_lface_attributes (struct frame *, Lisp_Object, Lisp_Object *, 464static int get_lface_attributes (struct frame *, Lisp_Object, Lisp_Object *,
465 int, struct named_merge_point *); 465 int, struct named_merge_point *);
466static ptrdiff_t load_pixmap (struct frame *, Lisp_Object, 466static ptrdiff_t load_pixmap (struct frame *, Lisp_Object,
467 unsigned *, unsigned *); 467 unsigned *, unsigned *);
468static struct frame *frame_or_selected_frame (Lisp_Object, int); 468static struct frame *frame_or_selected_frame (Lisp_Object, int);
@@ -470,9 +470,9 @@ static void load_face_colors (struct frame *, struct face *, Lisp_Object *);
470static void free_face_colors (struct frame *, struct face *); 470static void free_face_colors (struct frame *, struct face *);
471static int face_color_gray_p (struct frame *, const char *); 471static int face_color_gray_p (struct frame *, const char *);
472static struct face *realize_face (struct face_cache *, Lisp_Object *, 472static struct face *realize_face (struct face_cache *, Lisp_Object *,
473 int); 473 int);
474static struct face *realize_non_ascii_face (struct frame *, Lisp_Object, 474static struct face *realize_non_ascii_face (struct frame *, Lisp_Object,
475 struct face *); 475 struct face *);
476static struct face *realize_x_face (struct face_cache *, Lisp_Object *); 476static struct face *realize_x_face (struct face_cache *, Lisp_Object *);
477static struct face *realize_tty_face (struct face_cache *, Lisp_Object *); 477static struct face *realize_tty_face (struct face_cache *, Lisp_Object *);
478static int realize_basic_faces (struct frame *); 478static int realize_basic_faces (struct frame *);
@@ -488,11 +488,11 @@ static void clear_face_gcs (struct face_cache *);
488static void free_face_cache (struct face_cache *); 488static void free_face_cache (struct face_cache *);
489static int face_fontset (Lisp_Object *); 489static int face_fontset (Lisp_Object *);
490static void merge_face_vectors (struct frame *, Lisp_Object *, Lisp_Object*, 490static void merge_face_vectors (struct frame *, Lisp_Object *, Lisp_Object*,
491 struct named_merge_point *); 491 struct named_merge_point *);
492static int merge_face_ref (struct frame *, Lisp_Object, Lisp_Object *, 492static int merge_face_ref (struct frame *, Lisp_Object, Lisp_Object *,
493 int, struct named_merge_point *); 493 int, struct named_merge_point *);
494static int set_lface_from_font (struct frame *, Lisp_Object, Lisp_Object, 494static int set_lface_from_font (struct frame *, Lisp_Object, Lisp_Object,
495 int); 495 int);
496static Lisp_Object lface_from_face_name (struct frame *, Lisp_Object, int); 496static Lisp_Object lface_from_face_name (struct frame *, Lisp_Object, int);
497static struct face *make_realized_face (Lisp_Object *); 497static struct face *make_realized_face (Lisp_Object *);
498static void cache_face (struct face_cache *, struct face *, unsigned); 498static void cache_face (struct face_cache *, struct face *, unsigned);
@@ -623,7 +623,8 @@ x_free_colors (struct frame *f, long unsigned int *pixels, int npixels)
623 is called. */ 623 is called. */
624 624
625void 625void
626x_free_dpy_colors (Display *dpy, Screen *screen, Colormap cmap, long unsigned int *pixels, int npixels) 626x_free_dpy_colors (Display *dpy, Screen *screen, Colormap cmap,
627 long unsigned int *pixels, int npixels)
627{ 628{
628 struct x_display_info *dpyinfo = x_display_info_for_display (dpy); 629 struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
629 int class = dpyinfo->visual->class; 630 int class = dpyinfo->visual->class;
@@ -698,8 +699,8 @@ x_free_gc (struct frame *f, GC gc)
698 699
699static inline GC 700static inline GC
700x_create_gc (struct frame *f, 701x_create_gc (struct frame *f,
701 unsigned long mask, 702 unsigned long mask,
702 XGCValues *xgcv) 703 XGCValues *xgcv)
703{ 704{
704 GC gc = xmalloc (sizeof (*gc)); 705 GC gc = xmalloc (sizeof (*gc));
705 if (gc) 706 if (gc)
@@ -792,7 +793,7 @@ init_frame_faces (struct frame *f)
792 if (!FRAME_NS_P (f) || FRAME_NS_WINDOW (f)) 793 if (!FRAME_NS_P (f) || FRAME_NS_WINDOW (f))
793#endif 794#endif
794 if (!realize_basic_faces (f)) 795 if (!realize_basic_faces (f))
795 abort (); 796 abort ();
796} 797}
797 798
798 799
@@ -963,7 +964,8 @@ the pixmap. Bits are stored row by row, each row occupies
963 if these pointers are not null. */ 964 if these pointers are not null. */
964 965
965static ptrdiff_t 966static ptrdiff_t
966load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr, unsigned int *h_ptr) 967load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr,
968 unsigned int *h_ptr)
967{ 969{
968 ptrdiff_t bitmap_id; 970 ptrdiff_t bitmap_id;
969 971
@@ -1057,7 +1059,8 @@ parse_rgb_list (Lisp_Object rgb_list, XColor *color)
1057 returned in it. */ 1059 returned in it. */
1058 1060
1059static int 1061static int
1060tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, XColor *std_color) 1062tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color,
1063 XColor *std_color)
1061{ 1064{
1062 Lisp_Object frame, color_desc; 1065 Lisp_Object frame, color_desc;
1063 1066
@@ -1153,7 +1156,8 @@ tty_defined_color (struct frame *f, const char *color_name,
1153 This does the right thing for any type of frame. */ 1156 This does the right thing for any type of frame. */
1154 1157
1155static int 1158static int
1156defined_color (struct frame *f, const char *color_name, XColor *color_def, int alloc) 1159defined_color (struct frame *f, const char *color_name, XColor *color_def,
1160 int alloc)
1157{ 1161{
1158 if (!FRAME_WINDOW_P (f)) 1162 if (!FRAME_WINDOW_P (f))
1159 return tty_defined_color (f, color_name, color_def, alloc); 1163 return tty_defined_color (f, color_name, color_def, alloc);
@@ -1240,7 +1244,8 @@ face_color_gray_p (struct frame *f, const char *color_name)
1240 color. */ 1244 color. */
1241 1245
1242static int 1246static int
1243face_color_supported_p (struct frame *f, const char *color_name, int background_p) 1247face_color_supported_p (struct frame *f, const char *color_name,
1248 int background_p)
1244{ 1249{
1245 Lisp_Object frame; 1250 Lisp_Object frame;
1246 XColor not_used; 1251 XColor not_used;
@@ -1313,7 +1318,8 @@ COLOR must be a valid color name. */)
1313 these colors. */ 1318 these colors. */
1314 1319
1315unsigned long 1320unsigned long
1316load_color (struct frame *f, struct face *face, Lisp_Object name, enum lface_attribute_index target_index) 1321load_color (struct frame *f, struct face *face, Lisp_Object name,
1322 enum lface_attribute_index target_index)
1317{ 1323{
1318 XColor color; 1324 XColor color;
1319 1325
@@ -1721,7 +1727,8 @@ fonts to match. The first MAXIMUM fonts are reported.
1721The optional fifth argument WIDTH, if specified, is a number of columns 1727The optional fifth argument WIDTH, if specified, is a number of columns
1722occupied by a character of a font. In that case, return only fonts 1728occupied by a character of a font. In that case, return only fonts
1723the WIDTH times as wide as FACE on FRAME. */) 1729the WIDTH times as wide as FACE on FRAME. */)
1724 (Lisp_Object pattern, Lisp_Object face, Lisp_Object frame, Lisp_Object maximum, Lisp_Object width) 1730 (Lisp_Object pattern, Lisp_Object face, Lisp_Object frame,
1731 Lisp_Object maximum, Lisp_Object width)
1725{ 1732{
1726 struct frame *f; 1733 struct frame *f;
1727 int size, avgwidth IF_LINT (= 0); 1734 int size, avgwidth IF_LINT (= 0);
@@ -2059,7 +2066,8 @@ resolve_face_name (Lisp_Object face_name, int signal_p)
2059 signal an error if FACE_NAME is not a valid face name. If SIGNAL_P 2066 signal an error if FACE_NAME is not a valid face name. If SIGNAL_P
2060 is zero, value is nil if FACE_NAME is not a valid face name. */ 2067 is zero, value is nil if FACE_NAME is not a valid face name. */
2061static inline Lisp_Object 2068static inline Lisp_Object
2062lface_from_face_name_no_resolve (struct frame *f, Lisp_Object face_name, int signal_p) 2069lface_from_face_name_no_resolve (struct frame *f, Lisp_Object face_name,
2070 int signal_p)
2063{ 2071{
2064 Lisp_Object lface; 2072 Lisp_Object lface;
2065 2073
@@ -2101,7 +2109,8 @@ lface_from_face_name (struct frame *f, Lisp_Object face_name, int signal_p)
2101 Otherwise, value is zero if FACE_NAME is not a face. */ 2109 Otherwise, value is zero if FACE_NAME is not a face. */
2102 2110
2103static inline int 2111static inline int
2104get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, Lisp_Object *attrs, int signal_p) 2112get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name,
2113 Lisp_Object *attrs, int signal_p)
2105{ 2114{
2106 Lisp_Object lface; 2115 Lisp_Object lface;
2107 2116
@@ -2122,7 +2131,9 @@ get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, Lisp_Obje
2122 Otherwise, value is zero if FACE_NAME is not a face. */ 2131 Otherwise, value is zero if FACE_NAME is not a face. */
2123 2132
2124static inline int 2133static inline int
2125get_lface_attributes (struct frame *f, Lisp_Object face_name, Lisp_Object *attrs, int signal_p, struct named_merge_point *named_merge_points) 2134get_lface_attributes (struct frame *f, Lisp_Object face_name,
2135 Lisp_Object *attrs, int signal_p,
2136 struct named_merge_point *named_merge_points)
2126{ 2137{
2127 Lisp_Object face_remapping; 2138 Lisp_Object face_remapping;
2128 2139
@@ -2165,7 +2176,7 @@ lface_fully_specified_p (Lisp_Object *attrs)
2165 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) 2176 for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
2166 if (i != LFACE_FONT_INDEX && i != LFACE_INHERIT_INDEX) 2177 if (i != LFACE_FONT_INDEX && i != LFACE_INHERIT_INDEX)
2167 if ((UNSPECIFIEDP (attrs[i]) || IGNORE_DEFFACE_P (attrs[i]))) 2178 if ((UNSPECIFIEDP (attrs[i]) || IGNORE_DEFFACE_P (attrs[i])))
2168 break; 2179 break;
2169 2180
2170 return i == LFACE_VECTOR_SIZE; 2181 return i == LFACE_VECTOR_SIZE;
2171} 2182}
@@ -2178,7 +2189,8 @@ lface_fully_specified_p (Lisp_Object *attrs)
2178 of FORCE_P. */ 2189 of FORCE_P. */
2179 2190
2180static int 2191static int
2181set_lface_from_font (struct frame *f, Lisp_Object lface, Lisp_Object font_object, int force_p) 2192set_lface_from_font (struct frame *f, Lisp_Object lface,
2193 Lisp_Object font_object, int force_p)
2182{ 2194{
2183 Lisp_Object val; 2195 Lisp_Object val;
2184 struct font *font = XFONT_OBJECT (font_object); 2196 struct font *font = XFONT_OBJECT (font_object);
@@ -2288,7 +2300,8 @@ merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid)
2288 other places. */ 2300 other places. */
2289 2301
2290static inline void 2302static inline void
2291merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to, struct named_merge_point *named_merge_points) 2303merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to,
2304 struct named_merge_point *named_merge_points)
2292{ 2305{
2293 int i; 2306 int i;
2294 2307
@@ -2355,7 +2368,8 @@ merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to, struct
2355 merging succeeded. */ 2368 merging succeeded. */
2356 2369
2357static int 2370static int
2358merge_named_face (struct frame *f, Lisp_Object face_name, Lisp_Object *to, struct named_merge_point *named_merge_points) 2371merge_named_face (struct frame *f, Lisp_Object face_name, Lisp_Object *to,
2372 struct named_merge_point *named_merge_points)
2359{ 2373{
2360 struct named_merge_point named_merge_point; 2374 struct named_merge_point named_merge_point;
2361 2375
@@ -2405,7 +2419,8 @@ merge_named_face (struct frame *f, Lisp_Object face_name, Lisp_Object *to, struc
2405 specifications. */ 2419 specifications. */
2406 2420
2407static int 2421static int
2408merge_face_ref (struct frame *f, Lisp_Object face_ref, Lisp_Object *to, int err_msgs, struct named_merge_point *named_merge_points) 2422merge_face_ref (struct frame *f, Lisp_Object face_ref, Lisp_Object *to,
2423 int err_msgs, struct named_merge_point *named_merge_points)
2409{ 2424{
2410 int ok = 1; /* Succeed without an error? */ 2425 int ok = 1; /* Succeed without an error? */
2411 2426
@@ -2838,7 +2853,7 @@ FRAME 0 means change the face on all frames, and change the default
2838 The value of that attribute will be inherited from some other 2853 The value of that attribute will be inherited from some other
2839 face during face merging. See internal_merge_in_global_face. */ 2854 face during face merging. See internal_merge_in_global_face. */
2840 if (UNSPECIFIEDP (value)) 2855 if (UNSPECIFIEDP (value))
2841 value = Qignore_defface; 2856 value = Qignore_defface;
2842 } 2857 }
2843 else 2858 else
2844 { 2859 {
@@ -2885,7 +2900,8 @@ FRAME 0 means change the face on all frames, and change the default
2885 { 2900 {
2886 /* The default face must have an absolute size. */ 2901 /* The default face must have an absolute size. */
2887 if (!INTEGERP (value) || XINT (value) <= 0) 2902 if (!INTEGERP (value) || XINT (value) <= 0)
2888 signal_error ("Default face height not absolute and positive", value); 2903 signal_error ("Default face height not absolute and positive",
2904 value);
2889 } 2905 }
2890 else 2906 else
2891 { 2907 {
@@ -2895,7 +2911,8 @@ FRAME 0 means change the face on all frames, and change the default
2895 make_number (10), 2911 make_number (10),
2896 Qnil); 2912 Qnil);
2897 if (!INTEGERP (test) || XINT (test) <= 0) 2913 if (!INTEGERP (test) || XINT (test) <= 0)
2898 signal_error ("Face height does not produce a positive integer", value); 2914 signal_error ("Face height does not produce a positive integer",
2915 value);
2899 } 2916 }
2900 } 2917 }
2901 2918
@@ -2974,7 +2991,7 @@ FRAME 0 means change the face on all frames, and change the default
2974 int valid_p; 2991 int valid_p;
2975 2992
2976 /* Allow t meaning a simple box of width 1 in foreground color 2993 /* Allow t meaning a simple box of width 1 in foreground color
2977 of the face. */ 2994 of the face. */
2978 if (EQ (value, Qt)) 2995 if (EQ (value, Qt))
2979 value = make_number (1); 2996 value = make_number (1);
2980 2997
@@ -3319,7 +3336,8 @@ FRAME 0 means change the face on all frames, and change the default
3319 has been assigned the value NEW_VALUE. */ 3336 has been assigned the value NEW_VALUE. */
3320 3337
3321void 3338void
3322update_face_from_frame_parameter (struct frame *f, Lisp_Object param, Lisp_Object new_value) 3339update_face_from_frame_parameter (struct frame *f, Lisp_Object param,
3340 Lisp_Object new_value)
3323{ 3341{
3324 Lisp_Object face = Qnil; 3342 Lisp_Object face = Qnil;
3325 Lisp_Object lface; 3343 Lisp_Object lface;
@@ -4052,7 +4070,7 @@ lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2)
4052 xassert (lface_fully_specified_p (lface1) 4070 xassert (lface_fully_specified_p (lface1)
4053 && lface_fully_specified_p (lface2)); 4071 && lface_fully_specified_p (lface2));
4054 return (xstrcasecmp (SSDATA (lface1[LFACE_FAMILY_INDEX]), 4072 return (xstrcasecmp (SSDATA (lface1[LFACE_FAMILY_INDEX]),
4055 SSDATA (lface2[LFACE_FAMILY_INDEX])) == 0 4073 SSDATA (lface2[LFACE_FAMILY_INDEX])) == 0
4056 && xstrcasecmp (SSDATA (lface1[LFACE_FOUNDRY_INDEX]), 4074 && xstrcasecmp (SSDATA (lface1[LFACE_FOUNDRY_INDEX]),
4057 SSDATA (lface2[LFACE_FOUNDRY_INDEX])) == 0 4075 SSDATA (lface2[LFACE_FOUNDRY_INDEX])) == 0
4058 && EQ (lface1[LFACE_HEIGHT_INDEX], lface2[LFACE_HEIGHT_INDEX]) 4076 && EQ (lface1[LFACE_HEIGHT_INDEX], lface2[LFACE_HEIGHT_INDEX])
@@ -4064,7 +4082,7 @@ lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2)
4064 || (STRINGP (lface1[LFACE_FONTSET_INDEX]) 4082 || (STRINGP (lface1[LFACE_FONTSET_INDEX])
4065 && STRINGP (lface2[LFACE_FONTSET_INDEX]) 4083 && STRINGP (lface2[LFACE_FONTSET_INDEX])
4066 && ! xstrcasecmp (SSDATA (lface1[LFACE_FONTSET_INDEX]), 4084 && ! xstrcasecmp (SSDATA (lface1[LFACE_FONTSET_INDEX]),
4067 SSDATA (lface2[LFACE_FONTSET_INDEX])))) 4085 SSDATA (lface2[LFACE_FONTSET_INDEX]))))
4068 ); 4086 );
4069} 4087}
4070 4088
@@ -4169,10 +4187,10 @@ color_distance (XColor *x, XColor *y)
4169 /* This formula is from a paper title `Colour metric' by Thiadmer Riemersma. 4187 /* This formula is from a paper title `Colour metric' by Thiadmer Riemersma.
4170 Quoting from that paper: 4188 Quoting from that paper:
4171 4189
4172 This formula has results that are very close to L*u*v* (with the 4190 This formula has results that are very close to L*u*v* (with the
4173 modified lightness curve) and, more importantly, it is a more even 4191 modified lightness curve) and, more importantly, it is a more even
4174 algorithm: it does not have a range of colours where it suddenly 4192 algorithm: it does not have a range of colours where it suddenly
4175 gives far from optimal results. 4193 gives far from optimal results.
4176 4194
4177 See <http://www.compuphase.com/cmetric.htm> for more info. */ 4195 See <http://www.compuphase.com/cmetric.htm> for more info. */
4178 4196
@@ -4702,7 +4720,8 @@ face_with_height (struct frame *f, int face_id, int height)
4702 default face. FACE_ID is assumed to be already realized. */ 4720 default face. FACE_ID is assumed to be already realized. */
4703 4721
4704int 4722int
4705lookup_derived_face (struct frame *f, Lisp_Object symbol, int face_id, int signal_p) 4723lookup_derived_face (struct frame *f, Lisp_Object symbol, int face_id,
4724 int signal_p)
4706{ 4725{
4707 Lisp_Object attrs[LFACE_VECTOR_SIZE]; 4726 Lisp_Object attrs[LFACE_VECTOR_SIZE];
4708 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; 4727 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
@@ -4758,7 +4777,8 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector,
4758 \(2) `close in spirit' to what the attributes specify, if not exact. */ 4777 \(2) `close in spirit' to what the attributes specify, if not exact. */
4759 4778
4760static int 4779static int
4761x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face *def_face) 4780x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs,
4781 struct face *def_face)
4762{ 4782{
4763 Lisp_Object *def_attrs = def_face->lface; 4783 Lisp_Object *def_attrs = def_face->lface;
4764 4784
@@ -4859,7 +4879,8 @@ x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face *
4859 substitution of a `dim' face for italic. */ 4879 substitution of a `dim' face for italic. */
4860 4880
4861static int 4881static int
4862tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face *def_face) 4882tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs,
4883 struct face *def_face)
4863{ 4884{
4864 int weight; 4885 int weight;
4865 Lisp_Object val, fg, bg; 4886 Lisp_Object val, fg, bg;
@@ -5011,7 +5032,8 @@ tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face
5011 /* See if the capabilities we selected above are supported, with the 5032 /* See if the capabilities we selected above are supported, with the
5012 given colors. */ 5033 given colors. */
5013 if (test_caps != 0 && 5034 if (test_caps != 0 &&
5014 ! tty_capable_p (FRAME_TTY (f), test_caps, fg_tty_color.pixel, bg_tty_color.pixel)) 5035 ! tty_capable_p (FRAME_TTY (f), test_caps, fg_tty_color.pixel,
5036 bg_tty_color.pixel))
5015 return 0; 5037 return 0;
5016 5038
5017 5039
@@ -5283,8 +5305,8 @@ realize_basic_faces (struct frame *f)
5283 { 5305 {
5284 FRAME_FACE_CACHE (f)->menu_face_changed_p = 0; 5306 FRAME_FACE_CACHE (f)->menu_face_changed_p = 0;
5285#ifdef USE_X_TOOLKIT 5307#ifdef USE_X_TOOLKIT
5286 if (FRAME_WINDOW_P (f)) 5308 if (FRAME_WINDOW_P (f))
5287 x_update_menu_appearance (f); 5309 x_update_menu_appearance (f);
5288#endif 5310#endif
5289 } 5311 }
5290 5312
@@ -5404,14 +5426,14 @@ realize_default_face (struct frame *f)
5404 if (FRAME_X_P (f) && face->font != FRAME_FONT (f)) 5426 if (FRAME_X_P (f) && face->font != FRAME_FONT (f))
5405 { 5427 {
5406 /* This can happen when making a frame on a display that does 5428 /* This can happen when making a frame on a display that does
5407 not support the default font. */ 5429 not support the default font. */
5408 if (!face->font) 5430 if (!face->font)
5409 return 0; 5431 return 0;
5410 5432
5411 /* Otherwise, the font specified for the frame was not 5433 /* Otherwise, the font specified for the frame was not
5412 acceptable as a font for the default face (perhaps because 5434 acceptable as a font for the default face (perhaps because
5413 auto-scaled fonts are rejected), so we must adjust the frame 5435 auto-scaled fonts are rejected), so we must adjust the frame
5414 font. */ 5436 font. */
5415 x_set_font (f, LFACE_FONT (lface), Qnil); 5437 x_set_font (f, LFACE_FONT (lface), Qnil);
5416 } 5438 }
5417#endif /* HAVE_X_WINDOWS */ 5439#endif /* HAVE_X_WINDOWS */
@@ -5502,7 +5524,8 @@ realize_face (struct face_cache *cache, Lisp_Object *attrs, int former_face_id)
5502 no-font. */ 5524 no-font. */
5503 5525
5504static struct face * 5526static struct face *
5505realize_non_ascii_face (struct frame *f, Lisp_Object font_object, struct face *base_face) 5527realize_non_ascii_face (struct frame *f, Lisp_Object font_object,
5528 struct face *base_face)
5506{ 5529{
5507 struct face_cache *cache = FRAME_FACE_CACHE (f); 5530 struct face_cache *cache = FRAME_FACE_CACHE (f);
5508 struct face *face; 5531 struct face *face;
@@ -5621,7 +5644,7 @@ realize_x_face (struct face_cache *cache, Lisp_Object *attrs)
5621 else if (INTEGERP (box)) 5644 else if (INTEGERP (box))
5622 { 5645 {
5623 /* Simple box of specified line width in foreground color of the 5646 /* Simple box of specified line width in foreground color of the
5624 face. */ 5647 face. */
5625 xassert (XINT (box) != 0); 5648 xassert (XINT (box) != 0);
5626 face->box = FACE_SIMPLE_BOX; 5649 face->box = FACE_SIMPLE_BOX;
5627 face->box_line_width = XINT (box); 5650 face->box_line_width = XINT (box);
@@ -5743,7 +5766,8 @@ realize_x_face (struct face_cache *cache, Lisp_Object *attrs)
5743 default foreground/background colors. */ 5766 default foreground/background colors. */
5744 5767
5745static void 5768static void
5746map_tty_color (struct frame *f, struct face *face, enum lface_attribute_index idx, int *defaulted) 5769map_tty_color (struct frame *f, struct face *face,
5770 enum lface_attribute_index idx, int *defaulted)
5747{ 5771{
5748 Lisp_Object frame, color, def; 5772 Lisp_Object frame, color, def;
5749 int foreground_p = idx == LFACE_FOREGROUND_INDEX; 5773 int foreground_p = idx == LFACE_FOREGROUND_INDEX;
@@ -5799,7 +5823,7 @@ map_tty_color (struct frame *f, struct face *face, enum lface_attribute_index id
5799 face->lface[idx] = tty_color_name (f, pixel); 5823 face->lface[idx] = tty_color_name (f, pixel);
5800 *defaulted = 1; 5824 *defaulted = 1;
5801 } 5825 }
5802 } 5826 }
5803#endif /* MSDOS */ 5827#endif /* MSDOS */
5804 } 5828 }
5805 5829
@@ -6598,7 +6622,7 @@ face definitions. For instance, the mode my-mode could define a face
6598`my-mode-default', and then in the mode setup function, do: 6622`my-mode-default', and then in the mode setup function, do:
6599 6623
6600 (set (make-local-variable 'face-remapping-alist) 6624 (set (make-local-variable 'face-remapping-alist)
6601 '((default my-mode-default)))). 6625 '((default my-mode-default)))).
6602 6626
6603Because Emacs normally only redraws screen areas when the underlying 6627Because Emacs normally only redraws screen areas when the underlying
6604buffer contents change, you may need to call `redraw-display' after 6628buffer contents change, you may need to call `redraw-display' after