diff options
| author | Andreas Schwab | 2005-02-17 12:49:34 +0000 |
|---|---|---|
| committer | Andreas Schwab | 2005-02-17 12:49:34 +0000 |
| commit | a3db4b26919bd467a30b9658b5f84aec06b2b35e (patch) | |
| tree | b6fa60071db6889f8b5527b8678c1a6cdbf37c19 | |
| parent | 6dbbc01d66ca76eb6f353245a26bdba131ae3df2 (diff) | |
| download | emacs-a3db4b26919bd467a30b9658b5f84aec06b2b35e.tar.gz emacs-a3db4b26919bd467a30b9658b5f84aec06b2b35e.zip | |
(hack_wm_protocols): Use correct type for last parameter
of XGetWindowProperty to avoid aliasing issues.
(Fx_window_property): Likewise.
| -rw-r--r-- | src/xfns.c | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/src/xfns.c b/src/xfns.c index c126d6ad361..2be52a49670 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -1880,7 +1880,8 @@ hack_wm_protocols (f, widget) | |||
| 1880 | 1880 | ||
| 1881 | BLOCK_INPUT; | 1881 | BLOCK_INPUT; |
| 1882 | { | 1882 | { |
| 1883 | Atom type, *atoms = 0; | 1883 | Atom type; |
| 1884 | unsigned char *catoms; | ||
| 1884 | int format = 0; | 1885 | int format = 0; |
| 1885 | unsigned long nitems = 0; | 1886 | unsigned long nitems = 0; |
| 1886 | unsigned long bytes_after; | 1887 | unsigned long bytes_after; |
| @@ -1889,20 +1890,27 @@ hack_wm_protocols (f, widget) | |||
| 1889 | FRAME_X_DISPLAY_INFO (f)->Xatom_wm_protocols, | 1890 | FRAME_X_DISPLAY_INFO (f)->Xatom_wm_protocols, |
| 1890 | (long)0, (long)100, False, XA_ATOM, | 1891 | (long)0, (long)100, False, XA_ATOM, |
| 1891 | &type, &format, &nitems, &bytes_after, | 1892 | &type, &format, &nitems, &bytes_after, |
| 1892 | (unsigned char **) &atoms) | 1893 | &catoms) |
| 1893 | == Success) | 1894 | == Success) |
| 1894 | && format == 32 && type == XA_ATOM) | 1895 | && format == 32 && type == XA_ATOM) |
| 1895 | while (nitems > 0) | 1896 | { |
| 1896 | { | 1897 | Atom *atoms = (Atom *) catoms; |
| 1897 | nitems--; | 1898 | while (nitems > 0) |
| 1898 | if (atoms[nitems] == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_delete_window) | 1899 | { |
| 1899 | need_delete = 0; | 1900 | nitems--; |
| 1900 | else if (atoms[nitems] == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_take_focus) | 1901 | if (atoms[nitems] |
| 1901 | need_focus = 0; | 1902 | == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_delete_window) |
| 1902 | else if (atoms[nitems] == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_save_yourself) | 1903 | need_delete = 0; |
| 1903 | need_save = 0; | 1904 | else if (atoms[nitems] |
| 1904 | } | 1905 | == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_take_focus) |
| 1905 | if (atoms) XFree ((char *) atoms); | 1906 | need_focus = 0; |
| 1907 | else if (atoms[nitems] | ||
| 1908 | == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_save_yourself) | ||
| 1909 | need_save = 0; | ||
| 1910 | } | ||
| 1911 | } | ||
| 1912 | if (catoms) | ||
| 1913 | XFree (catoms); | ||
| 1906 | } | 1914 | } |
| 1907 | { | 1915 | { |
| 1908 | Atom props [10]; | 1916 | Atom props [10]; |
| @@ -4156,7 +4164,7 @@ no value of TYPE. */) | |||
| 4156 | Atom prop_atom; | 4164 | Atom prop_atom; |
| 4157 | int rc; | 4165 | int rc; |
| 4158 | Lisp_Object prop_value = Qnil; | 4166 | Lisp_Object prop_value = Qnil; |
| 4159 | char *tmp_data = NULL; | 4167 | unsigned char *tmp_data = NULL; |
| 4160 | Atom actual_type; | 4168 | Atom actual_type; |
| 4161 | Atom target_type = XA_STRING; | 4169 | Atom target_type = XA_STRING; |
| 4162 | int actual_format; | 4170 | int actual_format; |
| @@ -4196,7 +4204,7 @@ no value of TYPE. */) | |||
| 4196 | rc = XGetWindowProperty (FRAME_X_DISPLAY (f), target_window, | 4204 | rc = XGetWindowProperty (FRAME_X_DISPLAY (f), target_window, |
| 4197 | prop_atom, 0, 0, False, target_type, | 4205 | prop_atom, 0, 0, False, target_type, |
| 4198 | &actual_type, &actual_format, &actual_size, | 4206 | &actual_type, &actual_format, &actual_size, |
| 4199 | &bytes_remaining, (unsigned char **) &tmp_data); | 4207 | &bytes_remaining, &tmp_data); |
| 4200 | if (rc == Success) | 4208 | if (rc == Success) |
| 4201 | { | 4209 | { |
| 4202 | int size = bytes_remaining; | 4210 | int size = bytes_remaining; |
| @@ -4209,7 +4217,7 @@ no value of TYPE. */) | |||
| 4209 | ! NILP (delete_p), target_type, | 4217 | ! NILP (delete_p), target_type, |
| 4210 | &actual_type, &actual_format, | 4218 | &actual_type, &actual_format, |
| 4211 | &actual_size, &bytes_remaining, | 4219 | &actual_size, &bytes_remaining, |
| 4212 | (unsigned char **) &tmp_data); | 4220 | &tmp_data); |
| 4213 | if (rc == Success && tmp_data) | 4221 | if (rc == Success && tmp_data) |
| 4214 | { | 4222 | { |
| 4215 | /* The man page for XGetWindowProperty says: | 4223 | /* The man page for XGetWindowProperty says: |
| @@ -4233,14 +4241,14 @@ no value of TYPE. */) | |||
| 4233 | long *ldata = (long *) tmp_data; | 4241 | long *ldata = (long *) tmp_data; |
| 4234 | 4242 | ||
| 4235 | for (i = 0; i < actual_size; ++i) | 4243 | for (i = 0; i < actual_size; ++i) |
| 4236 | idata[i]= (int) ldata[i]; | 4244 | idata[i] = (int) ldata[i]; |
| 4237 | } | 4245 | } |
| 4238 | 4246 | ||
| 4239 | if (NILP (vector_ret_p)) | 4247 | if (NILP (vector_ret_p)) |
| 4240 | prop_value = make_string (tmp_data, size); | 4248 | prop_value = make_string (tmp_data, size); |
| 4241 | else | 4249 | else |
| 4242 | prop_value = x_property_data_to_lisp (f, | 4250 | prop_value = x_property_data_to_lisp (f, |
| 4243 | (unsigned char *) tmp_data, | 4251 | tmp_data, |
| 4244 | actual_type, | 4252 | actual_type, |
| 4245 | actual_format, | 4253 | actual_format, |
| 4246 | actual_size); | 4254 | actual_size); |