mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 03:46:17 +01:00
183 lines
4.8 KiB
XML
183 lines
4.8 KiB
XML
<?xml version="1.0"?>
|
|
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
|
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
|
]>
|
|
<refentry id="glib-changes" revision="17 Jan 2002">
|
|
<refmeta>
|
|
<refentrytitle>Changes to GLib</refentrytitle>
|
|
<manvolnum>3</manvolnum>
|
|
<refmiscinfo>Changes to GLib</refmiscinfo>
|
|
</refmeta>
|
|
|
|
<refnamediv>
|
|
<refname>Changes to GLib</refname>
|
|
<refpurpose>
|
|
Incompatible changes made between successing versions of GLib
|
|
</refpurpose>
|
|
</refnamediv>
|
|
|
|
|
|
<refsect1>
|
|
<title>Incompatible changes from 2.0 to 2.2</title>
|
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
|
<para>
|
|
GLib changed the seeding algorithm for the pseudo-random number
|
|
generator Mersenne Twister, as used by <structname>GRand</structname>
|
|
and <structname>GRandom</structname>. This was necessary, because some
|
|
seeds would yield very bad pseudo-random streams. Also the
|
|
pseudo-random integers generated by
|
|
<function>g_rand*_int_range()</function> will have a
|
|
slightly better equal distribution with the new version of GLib.
|
|
</para>
|
|
|
|
<para>
|
|
Further information can be found at the website of the Mersenne
|
|
Twister random number generator at <ulink
|
|
url="http://www.math.keio.ac.jp/~matumoto/emt.html">http://www.math.keio.ac.jp/~matumoto/emt.html</ulink>.
|
|
</para>
|
|
|
|
<para>
|
|
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 <envar>G_RANDOM_VERSION</envar> 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.
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1>
|
|
<title>Incompatible changes from 1.2 to 2.0</title>
|
|
|
|
<para>
|
|
The <ulink url="http://developer.gnome.org/dotplan/porting/">GNOME 2.0
|
|
porting guide</ulink> on <ulink
|
|
url="http://developer.gnome.org">http://developer.gnome.org</ulink>
|
|
has some more detailed discussion of porting from 1.2 to 2.0.
|
|
See the section on GLib.
|
|
</para>
|
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
|
<para>
|
|
The event loop functionality <structname>GMain</structname> has extensively
|
|
been revised to support multiple separate main loops in separate threads.
|
|
All sources (timeouts, idle functions, etc.) are associated with a
|
|
<structname>GMainContext</structname>.
|
|
</para>
|
|
|
|
<para>
|
|
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.
|
|
</para>
|
|
|
|
<para>
|
|
The main changes here are:
|
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
|
<para>
|
|
Sources are now exposed as <type>GSource *</type>, rather than simply as
|
|
numeric ids.
|
|
</para>
|
|
</listitem>
|
|
|
|
<listitem>
|
|
<para>
|
|
New types of sources are created by structure "derivation" from
|
|
<structname>GSource</structname>, so the <literal>source_data</literal>
|
|
parameter to the <structname>GSource</structname> virtual functions has been
|
|
replaced with a <type>GSource *</type>.
|
|
</para>
|
|
</listitem>
|
|
|
|
<listitem>
|
|
<para>
|
|
Sources are first created, then later added to a specific
|
|
<structname>GMainContext</structname>.
|
|
</para>
|
|
</listitem>
|
|
|
|
<listitem>
|
|
<para>
|
|
Dispatching has been modified so both the callback and data are passed
|
|
in to the <function>dispatch()</function> virtual function.
|
|
</para>
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
To go along with this change, the vtable for
|
|
<structname>GIOChannel</structname> has changed and
|
|
<function>add_watch()</function> has been replaced by
|
|
<function>create_watch()</function>.
|
|
</para>
|
|
</listitem>
|
|
|
|
<listitem>
|
|
<para>
|
|
<function>g_list_foreach()</function> and
|
|
<function>g_slist_foreach()</function> have been changed so they
|
|
are now safe against removal of the current item, not the next item.
|
|
</para>
|
|
|
|
<para>
|
|
It's not recommended to mutate the list in the callback to these
|
|
functions in any case.
|
|
</para>
|
|
</listitem>
|
|
|
|
<listitem>
|
|
<para>
|
|
<structname>GDate</structname> 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 <function>g_locale_to_utf8()</function> first.
|
|
</para>
|
|
</listitem>
|
|
|
|
<listitem>
|
|
<para>
|
|
<function>g_strsplit()</function> has been fixed to:
|
|
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>
|
|
include trailing empty tokens, rather than stripping them
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
split into a maximum of <literal>max_tokens</literal> tokens, rather
|
|
than <literal>max_tokens + 1</literal>
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
|
|
Code depending on either of these bugs will need to be fixed.
|
|
</para>
|
|
</listitem>
|
|
|
|
<listitem>
|
|
<para>
|
|
Deprecated functions that got removed:
|
|
<function>g_set_error_handler()</function>,
|
|
<function>g_set_warning_handler()</function>,
|
|
<function>g_set_message_handler()</function>, use
|
|
<function>g_log_set_handler()</function> instead.
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|