| <!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: GLib Reference Manual</title> |
| <meta name="generator" content="DocBook XSL Stylesheets V1.79.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.25.1 (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="5"><tr valign="middle"> |
| <td width="100%" align="left" class="shortcuts"></td> |
| <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> |
| <td><a accesskey="u" href="glib.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> |
| <td><a accesskey="p" href="glib-running.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> |
| <td><a accesskey="n" href="glib-resources.html"><img src="right.png" width="16" height="16" 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 class="gallery_image" 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.25.1</div> |
| </body> |
| </html> |