Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/screen.c @ 1225:0e9e9724d643
Fix a bad type cast in buffer_purge()
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 17 May 2007 12:00:18 +0200 |
parents | 47579e8c73d0 |
children | 2521efbf3b72 |
comparison
equal
deleted
inserted
replaced
1224:fb0460a3cf4b | 1225:0e9e9724d643 |
---|---|
1882 // value: winbuf structure | 1882 // value: winbuf structure |
1883 // data: int, set to 1 if the buffer should be closed. | 1883 // data: int, set to 1 if the buffer should be closed. |
1884 // NOTE: does not work for special buffers. | 1884 // NOTE: does not work for special buffers. |
1885 static void buffer_purge(gpointer key, gpointer value, gpointer data) | 1885 static void buffer_purge(gpointer key, gpointer value, gpointer data) |
1886 { | 1886 { |
1887 int closebuf = (gint)data; // XXX GPOINTER_TO_INT? | 1887 int *p_closebuf = data; |
1888 winbuf *win_entry = value; | 1888 winbuf *win_entry = value; |
1889 | 1889 |
1890 // Delete the current hbuf | 1890 // Delete the current hbuf |
1891 hbuf_free(&win_entry->bd->hbuf); | 1891 hbuf_free(&win_entry->bd->hbuf); |
1892 | 1892 |
1893 if (closebuf) { | 1893 if (*p_closebuf) { |
1894 g_hash_table_remove(winbufhash, key); | 1894 g_hash_table_remove(winbufhash, key); |
1895 } else { | 1895 } else { |
1896 win_entry->bd->cleared = FALSE; | 1896 win_entry->bd->cleared = FALSE; |
1897 win_entry->bd->top = NULL; | 1897 win_entry->bd->top = NULL; |
1898 } | 1898 } |
1903 // If closebuf is 1, close the buffer. | 1903 // If closebuf is 1, close the buffer. |
1904 void scr_BufferPurge(int closebuf) | 1904 void scr_BufferPurge(int closebuf) |
1905 { | 1905 { |
1906 winbuf *win_entry; | 1906 winbuf *win_entry; |
1907 guint isspe; | 1907 guint isspe; |
1908 guint *p_closebuf; | |
1908 | 1909 |
1909 // Get win_entry | 1910 // Get win_entry |
1910 if (!current_buddy) return; | 1911 if (!current_buddy) return; |
1911 isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; | 1912 isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; |
1912 win_entry = scr_SearchWindow(CURRENT_JID, isspe); | 1913 win_entry = scr_SearchWindow(CURRENT_JID, isspe); |
1913 if (!win_entry) return; | 1914 if (!win_entry) return; |
1914 | 1915 |
1915 if (!isspe) { | 1916 if (!isspe) { |
1916 buffer_purge((gpointer)CURRENT_JID, win_entry, (gpointer)closebuf); | 1917 p_closebuf = g_new(guint, 1); |
1917 // XXX GINT_TO_POINTER? | 1918 *p_closebuf = closebuf; |
1919 buffer_purge((gpointer)CURRENT_JID, win_entry, p_closebuf); | |
1920 g_free(p_closebuf); | |
1918 if (closebuf) { | 1921 if (closebuf) { |
1919 scr_set_chatmode(FALSE); | 1922 scr_set_chatmode(FALSE); |
1920 currentWindow = NULL; | 1923 currentWindow = NULL; |
1921 } | 1924 } |
1922 } else { | 1925 } else { |
1937 update_panels(); | 1940 update_panels(); |
1938 } | 1941 } |
1939 | 1942 |
1940 void scr_BufferPurgeAll(int closebuf) | 1943 void scr_BufferPurgeAll(int closebuf) |
1941 { | 1944 { |
1942 g_hash_table_foreach(winbufhash, buffer_purge, (gpointer)closebuf); | 1945 guint *p_closebuf; |
1943 // XXX GINT_TO_POINTER? | 1946 p_closebuf = g_new(guint, 1); |
1947 | |
1948 *p_closebuf = closebuf; | |
1949 g_hash_table_foreach(winbufhash, buffer_purge, p_closebuf); | |
1950 g_free(p_closebuf); | |
1944 | 1951 |
1945 if (closebuf) { | 1952 if (closebuf) { |
1946 scr_set_chatmode(FALSE); | 1953 scr_set_chatmode(FALSE); |
1947 currentWindow = NULL; | 1954 currentWindow = NULL; |
1948 } | 1955 } |