Don't use <filename> in docs
[platform/upstream/glib.git] / gio / gresource.c
index 7f0ddb9..2aacb01 100644 (file)
@@ -13,9 +13,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Authors: Alexander Larsson <alexl@redhat.com>
  */
@@ -38,7 +36,7 @@ struct _GResource
   GvdbTable *table;
 };
 
-static void register_lazy_static_resources ();
+static void register_lazy_static_resources (void);
 
 G_DEFINE_BOXED_TYPE (GResource, g_resource, g_resource_ref, g_resource_unref)
 
@@ -47,9 +45,10 @@ G_DEFINE_BOXED_TYPE (GResource, g_resource, g_resource_ref, g_resource_unref)
  * @short_description: Resource framework
  * @include: gio/gio.h
  *
- * Applications and libraries often contain binary or textual data that is really part of the
- * application, rather than user data. For instance #GtkBuilder .ui files, splashscreen images,
- * GMenu markup xml, CSS files, icons, etc. These are often shipped as files in <filename>$datadir/appname</filename>, or
+ * Applications and libraries often contain binary or textual data that is
+ * really part of the application, rather than user data. For instance
+ * #GtkBuilder .ui files, splashscreen images, GMenu markup xml, CSS files,
+ * icons, etc. These are often shipped as files in `$datadir/appname`, or
  * manually included as literal strings in the code.
  *
  * The #GResource API and the <link linkend="glib-compile-resources">glib-compile-resources</link> program
@@ -60,7 +59,7 @@ G_DEFINE_BOXED_TYPE (GResource, g_resource, g_resource_ref, g_resource_unref)
  * simple (no need to check for things like I/O errors or locate the files in the filesystem). It
  * also makes it easier to create relocatable applications.
  *
- * Resource files can also be marked as compresses. Such files will be included in the resource bundle
+ * Resource files can also be marked as compressed. Such files will be included in the resource bundle
  * in a compressed form, but will be automatically uncompressed when the resource is used. This
  * is very useful e.g. for larger text files that are parsed once (or rarely) and then thrown away.
  *
@@ -68,15 +67,16 @@ G_DEFINE_BOXED_TYPE (GResource, g_resource, g_resource_ref, g_resource_unref)
  * <literal>preprocess</literal> attribute to a comma-separated list of preprocessing options.
  * The only options currently supported are:
  *
- * <literal>xml-stripblanks</literal> which will use <command>xmllint</command> to strip
- * ignorable whitespace from the xml file. For this to work, the <envar>XMLLINT</envar>
- * environment variable must be set to the full path to the xmllint executable, or xmllint
- * must be in the PATH; otherwise the preprocessing step is skipped.
+ * <literal>xml-stripblanks</literal> which will use the xmllint command
+ * to strip ignorable whitespace from the xml file. For this to work,
+ * the `XMLLINT` environment variable must be set to the full path to
+ * the xmllint executable, or xmllint must be in the `PATH`; otherwise
+ * the preprocessing step is skipped.
  *
- * <literal>to-pixdata</literal> which will use <command>gdk-pixbuf-pixdata</command> to convert
+ * <literal>to-pixdata</literal> which will use the gdk-pixbuf-pixdata command to convert
  * images to the GdkPixdata format, which allows you to create pixbufs directly using the data inside
  * the resource file, rather than an (uncompressed) copy if it. For this, the gdk-pixbuf-pixdata
- * program must be in the PATH, or the <envar>GDK_PIXBUF_PIXDATA</envar> environment variable must be
+ * program must be in the PATH, or the `GDK_PIXBUF_PIXDATA` environment variable must be
  * set to the full path to the gdk-pixbuf-pixdata executable; otherwise the resource compiler will
  * abort.
  *
@@ -84,8 +84,8 @@ G_DEFINE_BOXED_TYPE (GResource, g_resource, g_resource_ref, g_resource_unref)
  * which takes an xml file that describes the bundle, and a set of files that the xml references. These
  * are combined into a binary resource bundle.
  *
- * <example id="resource-example"><title>Example resource description</title>
- * <programlisting><![CDATA[
+ * An example resource description:
+ * |[
  * <?xml version="1.0" encoding="UTF-8"?>
  * <gresources>
  *   <gresource prefix="/org/gtk/Example">
@@ -94,14 +94,14 @@ G_DEFINE_BOXED_TYPE (GResource, g_resource, g_resource_ref, g_resource_unref)
  *     <file preprocess="xml-stripblanks">menumarkup.xml</file>
  *   </gresource>
  * </gresources>
- * ]]></programlisting></example>
+ * ]|
  *
  * This will create a resource bundle with the following files:
- * <programlisting><![CDATA[
+ * |[
  * /org/gtk/Example/data/splashscreen.png
  * /org/gtk/Example/dialog.ui
  * /org/gtk/Example/menumarkup.xml
- * ]]></programlisting>
+ * ]|
  *
  * Note that all resources in the process share the same namespace, so use java-style
  * path prefixes (like in the above example) to avoid conflicts.
@@ -138,11 +138,7 @@ G_DEFINE_BOXED_TYPE (GResource, g_resource, g_resource_ref, g_resource_unref)
  *
  * Since: 2.32
  */
-GQuark
-g_resource_error_quark (void)
-{
-  return g_quark_from_static_string ("g-resource-error-quark");
-}
+G_DEFINE_QUARK (g-resource-error-quark, g_resource_error)
 
 /**
  * g_resource_ref:
@@ -287,7 +283,7 @@ gboolean do_lookup (GResource             *resource,
       free_path[path_len-1] = 0;
     }
 
-  value = gvdb_table_get_value (resource->table, path);
+  value = gvdb_table_get_raw_value (resource->table, path);
 
   if (value == NULL)
     {
@@ -305,6 +301,9 @@ gboolean do_lookup (GResource             *resource,
                      &_flags,
                      &array);
 
+      _size = GUINT32_FROM_LE (_size);
+      _flags = GUINT32_FROM_LE (_flags);
+
       if (size)
         *size = _size;
       if (flags)
@@ -580,7 +579,7 @@ g_resources_unregister_unlocked (GResource *resource)
 {
   if (g_list_find (registered_resources, resource) == NULL)
     {
-      g_warning ("Tried to remove not registred resource");
+      g_warning ("Tried to remove not registered resource");
     }
   else
     {
@@ -630,7 +629,7 @@ g_resources_unregister (GResource *resource)
  * @error: return location for a #GError, or %NULL
  *
  * Looks for a file at the specified @path in the set of
- * globally registred resources and returns a #GInputStream
+ * globally registered resources and returns a #GInputStream
  * that lets you read the data.
  *
  * @lookup_flags controls the behaviour of the lookup.
@@ -690,7 +689,7 @@ g_resources_open_stream (const gchar           *path,
  * @error: return location for a #GError, or %NULL
  *
  * Looks for a file at the specified @path in the set of
- * globally registred resources and returns a #GBytes that
+ * globally registered resources and returns a #GBytes that
  * lets you directly access the data in memory.
  *
  * The data is always followed by a zero byte, so you
@@ -759,7 +758,7 @@ g_resources_lookup_data (const gchar           *path,
  * @error: return location for a #GError, or %NULL
  *
  * Returns all the names of children at the specified @path in the set of
- * globally registred resources.
+ * globally registered resources.
  * The return result is a %NULL terminated list of strings which should
  * be released with g_strfreev().
  *
@@ -840,7 +839,7 @@ g_resources_enumerate_children (const gchar           *path,
  * @error: return location for a #GError, or %NULL
  *
  * Looks for a file at the specified @path in the set of
- * globally registred resources and if found returns information about it.
+ * globally registered resources and if found returns information about it.
  *
  * @lookup_flags controls the behaviour of the lookup.
  *
@@ -1010,7 +1009,7 @@ g_static_resource_fini (GStaticResource *static_resource)
  * g_static_resource_get_resource:
  * @static_resource: pointer to a static #GStaticResource
  *
- * Gets the GResource that was registred by a call to g_static_resource_init().
+ * Gets the GResource that was registered by a call to g_static_resource_init().
  *
  * This is normally used by code generated by
  * <link linkend="glib-compile-resources">glib-compile-resources</link>