libpurple/glibcompat.h

Thu, 17 Apr 2014 08:19:13 +0200

author
Tomasz Wasilczyk <twasilczyk@pidgin.im>
date
Thu, 17 Apr 2014 08:19:13 +0200
changeset 35867
b6f09494adda
parent 35804
e97d93132751
child 35872
4cd48601e1d1
permissions
-rw-r--r--

cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)

33368
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
1 /* pidgin
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
2 *
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
3 * Pidgin is the legal property of its developers, whose names are too numerous
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
5 * source distribution.
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
6 *
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
10 * (at your option) any later version.
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
11 *
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
15 * GNU General Public License for more details.
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
16 *
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
20 */
35487
494f09f7f331 Move section blocks inside inclusion guards -- otherwise g-ir-scanner yells
Ankit Vani <a@nevitus.org>
parents: 35460
diff changeset
21
494f09f7f331 Move section blocks inside inclusion guards -- otherwise g-ir-scanner yells
Ankit Vani <a@nevitus.org>
parents: 35460
diff changeset
22 #ifndef _GLIBCOMPAT_H_
494f09f7f331 Move section blocks inside inclusion guards -- otherwise g-ir-scanner yells
Ankit Vani <a@nevitus.org>
parents: 35460
diff changeset
23 #define _GLIBCOMPAT_H_
35460
96946e21fce5 Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents: 35440
diff changeset
24 /*
35440
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35306
diff changeset
25 * SECTION:glibcompat
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35306
diff changeset
26 * @section_id: libpurple-glibcompat
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35306
diff changeset
27 * @short_description: <filename>glibcompat.h</filename>
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35306
diff changeset
28 * @title: GLib version-dependent definitions
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35306
diff changeset
29 *
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35306
diff changeset
30 * This file is internal to libpurple. Do not use!
33368
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
31 * Also, any public API should not depend on this file.
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
32 */
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
33
35306
abc36dad1363 Include glib.h before messing with any defines
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35299
diff changeset
34 #include <glib.h>
abc36dad1363 Include glib.h before messing with any defines
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35299
diff changeset
35
35706
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
36 #if !GLIB_CHECK_VERSION(2, 36, 0)
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
37
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
38 #include <errno.h>
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
39 #include <fcntl.h>
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
40 #ifndef _WIN32
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
41 #include <unistd.h>
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
42 #endif
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
43
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
44 static inline gboolean g_close(gint fd, GError **error)
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
45 {
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
46 int res;
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
47 int errsv;
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
48
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
49 res = close(fd);
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
50
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
51 if (G_LIKELY(res == 0))
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
52 return TRUE;
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
53 if (G_UNLIKELY(errno == EINTR))
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
54 return TRUE;
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
55
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
56 errsv = errno;
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
57 g_set_error_literal(error, G_FILE_ERROR,
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
58 g_file_error_from_errno(errsv), g_strerror(errsv));
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
59 errno = errsv;
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
60
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
61 return FALSE;
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
62 }
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
63
33838
3c73956dbeca Ignore some deprecations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33593
diff changeset
64 #if !GLIB_CHECK_VERSION(2, 32, 0)
3c73956dbeca Ignore some deprecations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33593
diff changeset
65
35190
5986ee34c476 libpurple: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35081
diff changeset
66 #include <glib-object.h>
35194
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
67 #include <string.h>
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
68
33838
3c73956dbeca Ignore some deprecations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33593
diff changeset
69 #define G_GNUC_BEGIN_IGNORE_DEPRECATIONS
3c73956dbeca Ignore some deprecations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33593
diff changeset
70 #define G_GNUC_END_IGNORE_DEPRECATIONS
3c73956dbeca Ignore some deprecations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33593
diff changeset
71
35804
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
72 #define G_SOURCE_REMOVE FALSE
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
73 #define G_SOURCE_CONTINUE TRUE
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
74
35195
7f7d87c04ab1 Add g_signal_handlers_disconnect_by_data to glibcompat.h and use it
Ankit Vani <a@nevitus.org>
parents: 35194
diff changeset
75 #define g_signal_handlers_disconnect_by_data(instance, data) \
7f7d87c04ab1 Add g_signal_handlers_disconnect_by_data to glibcompat.h and use it
Ankit Vani <a@nevitus.org>
parents: 35194
diff changeset
76 g_signal_handlers_disconnect_matched((instance), G_SIGNAL_MATCH_DATA, \
7f7d87c04ab1 Add g_signal_handlers_disconnect_by_data to glibcompat.h and use it
Ankit Vani <a@nevitus.org>
parents: 35194
diff changeset
77 0, 0, NULL, NULL, (data))
7f7d87c04ab1 Add g_signal_handlers_disconnect_by_data to glibcompat.h and use it
Ankit Vani <a@nevitus.org>
parents: 35194
diff changeset
78
33883
8a0d96bd9cf4 Replace deprecated g_thread_create with g_thread_try_new
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33882
diff changeset
79 static inline GThread * g_thread_try_new(const gchar *name, GThreadFunc func,
8a0d96bd9cf4 Replace deprecated g_thread_create with g_thread_try_new
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33882
diff changeset
80 gpointer data, GError **error)
8a0d96bd9cf4 Replace deprecated g_thread_create with g_thread_try_new
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33882
diff changeset
81 {
8a0d96bd9cf4 Replace deprecated g_thread_create with g_thread_try_new
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33882
diff changeset
82 return g_thread_create(func, data, TRUE, error);
8a0d96bd9cf4 Replace deprecated g_thread_create with g_thread_try_new
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33882
diff changeset
83 }
8a0d96bd9cf4 Replace deprecated g_thread_create with g_thread_try_new
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33882
diff changeset
84
35194
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
85 #if !GLIB_CHECK_VERSION(2, 30, 0)
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
86
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
87 static inline gchar *g_utf8_substring(const gchar *str, glong start_pos,
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
88 glong end_pos)
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
89 {
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
90 gchar *start = g_utf8_offset_to_pointer(str, start_pos);
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
91 gchar *end = g_utf8_offset_to_pointer(start, end_pos - start_pos);
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
92 gchar *out = g_malloc(end - start + 1);
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
93
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
94 memcpy(out, start, end - start);
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
95 out[end - start] = 0;
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
96
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
97 return out;
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
98 }
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
99
33368
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
100 #if !GLIB_CHECK_VERSION(2, 28, 0)
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
101
33467
5d9c3ec722d6 Better compatibility with old glib versions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33369
diff changeset
102 static inline gint64 g_get_monotonic_time(void)
5d9c3ec722d6 Better compatibility with old glib versions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33369
diff changeset
103 {
5d9c3ec722d6 Better compatibility with old glib versions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33369
diff changeset
104 GTimeVal time_s;
5d9c3ec722d6 Better compatibility with old glib versions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33369
diff changeset
105
5d9c3ec722d6 Better compatibility with old glib versions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33369
diff changeset
106 g_get_current_time(&time_s);
5d9c3ec722d6 Better compatibility with old glib versions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33369
diff changeset
107
5d9c3ec722d6 Better compatibility with old glib versions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33369
diff changeset
108 return ((gint64)time_s.tv_sec << 32) | time_s.tv_usec;
5d9c3ec722d6 Better compatibility with old glib versions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33369
diff changeset
109 }
5d9c3ec722d6 Better compatibility with old glib versions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33369
diff changeset
110
33368
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
111 static inline void g_list_free_full(GList *list, GDestroyNotify free_func)
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
112 {
33467
5d9c3ec722d6 Better compatibility with old glib versions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33369
diff changeset
113 g_list_foreach(list, (GFunc)free_func, NULL);
33368
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
114 g_list_free(list);
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
115 }
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
116
33369
4a43f6a6326b Fix again, refs #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33368
diff changeset
117 static inline void g_slist_free_full(GSList *list, GDestroyNotify free_func)
4a43f6a6326b Fix again, refs #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33368
diff changeset
118 {
33467
5d9c3ec722d6 Better compatibility with old glib versions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33369
diff changeset
119 g_slist_foreach(list, (GFunc)free_func, NULL);
33369
4a43f6a6326b Fix again, refs #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33368
diff changeset
120 g_slist_free(list);
4a43f6a6326b Fix again, refs #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33368
diff changeset
121 }
4a43f6a6326b Fix again, refs #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33368
diff changeset
122
35073
46b7a39e45ec Added g_object_notify_by_pspec to glibcompat.h
Ankit Vani <a@nevitus.org>
parents: 34462
diff changeset
123 #if !GLIB_CHECK_VERSION(2, 26, 0)
46b7a39e45ec Added g_object_notify_by_pspec to glibcompat.h
Ankit Vani <a@nevitus.org>
parents: 34462
diff changeset
124
35190
5986ee34c476 libpurple: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35081
diff changeset
125 typedef struct stat GStatBuf;
5986ee34c476 libpurple: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35081
diff changeset
126
35073
46b7a39e45ec Added g_object_notify_by_pspec to glibcompat.h
Ankit Vani <a@nevitus.org>
parents: 34462
diff changeset
127 static inline void g_object_notify_by_pspec(GObject *object, GParamSpec *pspec)
46b7a39e45ec Added g_object_notify_by_pspec to glibcompat.h
Ankit Vani <a@nevitus.org>
parents: 34462
diff changeset
128 {
46b7a39e45ec Added g_object_notify_by_pspec to glibcompat.h
Ankit Vani <a@nevitus.org>
parents: 34462
diff changeset
129 g_object_notify(object, g_param_spec_get_name(pspec));
46b7a39e45ec Added g_object_notify_by_pspec to glibcompat.h
Ankit Vani <a@nevitus.org>
parents: 34462
diff changeset
130 }
46b7a39e45ec Added g_object_notify_by_pspec to glibcompat.h
Ankit Vani <a@nevitus.org>
parents: 34462
diff changeset
131
35081
eda7bae766d4 Added g_object_class_install_properties to glibcompat.h
Ankit Vani <a@nevitus.org>
parents: 35073
diff changeset
132 static inline void g_object_class_install_properties(GObjectClass *oclass,
eda7bae766d4 Added g_object_class_install_properties to glibcompat.h
Ankit Vani <a@nevitus.org>
parents: 35073
diff changeset
133 guint n_pspecs, GParamSpec **pspecs)
eda7bae766d4 Added g_object_class_install_properties to glibcompat.h
Ankit Vani <a@nevitus.org>
parents: 35073
diff changeset
134 {
35190
5986ee34c476 libpurple: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35081
diff changeset
135 guint i;
35081
eda7bae766d4 Added g_object_class_install_properties to glibcompat.h
Ankit Vani <a@nevitus.org>
parents: 35073
diff changeset
136 for (i = 1; i < n_pspecs; ++i)
eda7bae766d4 Added g_object_class_install_properties to glibcompat.h
Ankit Vani <a@nevitus.org>
parents: 35073
diff changeset
137 g_object_class_install_property(oclass, i, pspecs[i]);
eda7bae766d4 Added g_object_class_install_properties to glibcompat.h
Ankit Vani <a@nevitus.org>
parents: 35073
diff changeset
138 }
eda7bae766d4 Added g_object_class_install_properties to glibcompat.h
Ankit Vani <a@nevitus.org>
parents: 35073
diff changeset
139
35073
46b7a39e45ec Added g_object_notify_by_pspec to glibcompat.h
Ankit Vani <a@nevitus.org>
parents: 34462
diff changeset
140 #endif /* < 2.26.0 */
46b7a39e45ec Added g_object_notify_by_pspec to glibcompat.h
Ankit Vani <a@nevitus.org>
parents: 34462
diff changeset
141
33882
29a7df06f410 Fix a warning for glib 2.36 and g_type_init
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33838
diff changeset
142 #endif /* < 2.28.0 */
33368
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
143
35194
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
144 #endif /* < 2.30.0 */
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35190
diff changeset
145
33882
29a7df06f410 Fix a warning for glib 2.36 and g_type_init
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33838
diff changeset
146 #endif /* < 2.32.0 */
33838
3c73956dbeca Ignore some deprecations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33593
diff changeset
147
35706
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
148 #endif /* < 2.36.0 */
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
149
35804
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
150
35867
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
151 /* glib's definition of g_stat+GStatBuf seems to be broken on 32-bit windows,
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
152 * so instead of relying on it, we'll define our own macros.
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
153 */
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
154 #if defined(_WIN32) && !defined(_MSC_VER) && !defined(_WIN64)
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
155 # include <glib/gstdio.h>
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
156 typedef struct _stat64 GStatBuf64;
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
157 # define GStatBuf GStatBuf64
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
158 # undef g_stat
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
159 # define g_stat _stat64
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
160 #endif
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
161
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
162
35804
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
163 #ifdef __clang__
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
164
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
165 #undef G_GNUC_BEGIN_IGNORE_DEPRECATIONS
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
166 #define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
167 _Pragma ("clang diagnostic push") \
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
168 _Pragma ("clang diagnostic ignored \"-Wdeprecated-declarations\"")
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
169
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
170 #undef G_GNUC_END_IGNORE_DEPRECATIONS
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
171 #define G_GNUC_END_IGNORE_DEPRECATIONS \
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
172 _Pragma ("clang diagnostic pop")
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
173
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
174 #endif /* __clang__ */
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
175
35440
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35306
diff changeset
176 #endif /* _GLIBCOMPAT_H_ */

mercurial