1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Changes to GLib</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib.html" title="GLib Overview">
<link rel="prev" href="glib-running.html" title="Running GLib Applications">
<link rel="next" href="glib-resources.html" title="Mailing lists and bug reports">
<meta name="generator" content="GTK-Doc V1.19 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="glib-running.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="glib.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GLib Reference Manual</th>
<td><a accesskey="n" href="glib-resources.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="glib-changes"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle">Changes to GLib</span></h2>
<p>Changes to GLib —
Incompatible changes made between successing versions of GLib
</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="id-1.2.8.3"></a><h2>Incompatible changes from 2.0 to 2.2</h2>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
<p>
GLib changed the seeding algorithm for the pseudo-random number
generator Mersenne Twister, as used by <span class="structname">GRand</span>
and <span class="structname">GRandom</span>. This was necessary, because some
seeds would yield very bad pseudo-random streams. Also the
pseudo-random integers generated by
<code class="function">g_rand*_int_range()</code> will have a
slightly better equal distribution with the new version of GLib.
</p>
<p>
Further information can be found at the website of the Mersenne
Twister random number generator at <a class="ulink" href="http://www.math.keio.ac.jp/~matumoto/emt.html" target="_top">http://www.math.keio.ac.jp/~matumoto/emt.html</a>.
</p>
<p>
The original seeding and generation algorithms, as found in GLib
2.0.x, can be used instead of the new ones by setting the environment
variable <code class="envar">G_RANDOM_VERSION</code> to the value of '2.0'. Use
the GLib-2.0 algorithms only if you have sequences of numbers generated
with Glib-2.0 that you need to reproduce exactly.
</p>
</li></ul></div>
</div>
<div class="refsect1">
<a name="id-1.2.8.4"></a><h2>Incompatible changes from 1.2 to 2.0</h2>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The event loop functionality <span class="structname">GMain</span> has extensively
been revised to support multiple separate main loops in separate threads.
All sources (timeouts, idle functions, etc.) are associated with a
<span class="structname">GMainContext</span>.
</p>
<p>
Compatibility functions exist so that most application code dealing with
the main loop will continue to work. However, code that creates new custom
types of sources will require modification.
</p>
<p>
The main changes here are:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem"><p>
Sources are now exposed as <span class="type">GSource *</span>, rather than simply as
numeric ids.
</p></li>
<li class="listitem"><p>
New types of sources are created by structure "derivation" from
<span class="structname">GSource</span>, so the <code class="literal">source_data</code>
parameter to the <span class="structname">GSource</span> virtual functions has been
replaced with a <span class="type">GSource *</span>.
</p></li>
<li class="listitem"><p>
Sources are first created, then later added to a specific
<span class="structname">GMainContext</span>.
</p></li>
<li class="listitem"><p>
Dispatching has been modified so both the callback and data are passed
in to the <code class="function">dispatch()</code> virtual function.
</p></li>
</ul></div>
<p>
To go along with this change, the vtable for
<span class="structname">GIOChannel</span> has changed and
<code class="function">add_watch()</code> has been replaced by
<code class="function">create_watch()</code>.
</p>
</li>
<li class="listitem">
<p>
<code class="function">g_list_foreach()</code> and
<code class="function">g_slist_foreach()</code> have been changed so they
are now safe against removal of the current item, not the next item.
</p>
<p>
It's not recommended to mutate the list in the callback to these
functions in any case.
</p>
</li>
<li class="listitem"><p>
<span class="structname">GDate</span> now works in UTF-8, not in the current locale.
If you want to use it with the encoding of the locale, you need to convert
strings using <code class="function">g_locale_to_utf8()</code> first.
</p></li>
<li class="listitem">
<p>
<code class="function">g_strsplit()</code> has been fixed to:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem"><p>
include trailing empty tokens, rather than stripping them
</p></li>
<li class="listitem"><p>
split into a maximum of <code class="literal">max_tokens</code> tokens, rather
than <code class="literal">max_tokens + 1</code>
</p></li>
</ul></div>
<p>
Code depending on either of these bugs will need to be fixed.
</p>
</li>
<li class="listitem"><p>
Deprecated functions that got removed:
<code class="function">g_set_error_handler()</code>,
<code class="function">g_set_warning_handler()</code>,
<code class="function">g_set_message_handler()</code>, use
<code class="function">g_log_set_handler()</code> instead.
</p></li>
</ul></div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.19</div>
</body>
</html>
|