[tracker/rss-enclosures] libtracker-extract: Fixed a number of documentation issues
- From: Roberto Guido <rguido src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/rss-enclosures] libtracker-extract: Fixed a number of documentation issues
- Date: Mon, 3 May 2010 00:34:29 +0000 (UTC)
commit 501b9608b8d9a16dcd3d3bc9888c9baac320de06
Author: Martyn Russell <martyn lanedo com>
Date: Wed Apr 14 11:30:45 2010 +0100
libtracker-extract: Fixed a number of documentation issues
- Make sure we don't compile deprecated code
- Fixed documentation errors with missing or additional parameters
- Fixed XMP test case which was using deprecated functions
- Added missing functions to sections gtkdoc file
- Added deprecation information to the documentation
.../libtracker-extract-sections.txt | 9 ++-
src/libtracker-extract/tracker-exif.c | 12 +-
src/libtracker-extract/tracker-exif.h | 10 +-
src/libtracker-extract/tracker-iptc.c | 14 ++-
src/libtracker-extract/tracker-iptc.h | 18 ++--
src/libtracker-extract/tracker-xmp.c | 12 +-
src/libtracker-extract/tracker-xmp.h | 16 ++--
tests/libtracker-extract/tracker-xmp-test.c | 116 ++++++++++---------
8 files changed, 113 insertions(+), 94 deletions(-)
---
diff --git a/docs/reference/libtracker-extract/libtracker-extract-sections.txt b/docs/reference/libtracker-extract/libtracker-extract-sections.txt
index 966237f..84b4234 100644
--- a/docs/reference/libtracker-extract/libtracker-extract-sections.txt
+++ b/docs/reference/libtracker-extract/libtracker-extract-sections.txt
@@ -1,6 +1,8 @@
<SECTION>
<FILE>tracker-xmp</FILE>
TrackerXmpData
+tracker_xmp_new
+tracker_xmp_free
tracker_xmp_read
tracker_xmp_apply
</SECTION>
@@ -8,6 +10,8 @@ tracker_xmp_apply
<SECTION>
<FILE>tracker-iptc</FILE>
TrackerIptcData
+tracker_iptc_new
+tracker_iptc_free
tracker_iptc_read
</SECTION>
@@ -22,7 +26,9 @@ tracker_extract_get_data
<SECTION>
<FILE>tracker-utils</FILE>
tracker_coalesce
+tracker_coalesce_strip
tracker_merge
+tracker_merge_const
tracker_text_normalize
tracker_date_format_to_iso8601
tracker_date_guess
@@ -31,6 +37,7 @@ tracker_date_guess
<SECTION>
<FILE>tracker-exif</FILE>
TrackerExifData
+tracker_exif_new
+tracker_exif_free
tracker_exif_read
</SECTION>
-
diff --git a/src/libtracker-extract/tracker-exif.c b/src/libtracker-extract/tracker-exif.c
index 32c4f8e..704c633 100644
--- a/src/libtracker-extract/tracker-exif.c
+++ b/src/libtracker-extract/tracker-exif.c
@@ -398,6 +398,8 @@ parse_exif (const unsigned char *buffer,
return TRUE;
}
+#ifndef TRACKER_DISABLE_DEPRECATED
+
/**
* tracker_exif_read:
* @buffer: a chunk of data with exif data in it.
@@ -430,6 +432,8 @@ tracker_exif_read (const unsigned char *buffer,
return parse_exif (buffer, len, uri, data);
}
+#endif /* TRACKER_DISABLE_DEPRECATED */
+
/**
* tracker_exif_new:
* @buffer: a chunk of data with exif data in it.
@@ -440,8 +444,7 @@ tracker_exif_read (const unsigned char *buffer,
* EXIF library.
*
* Returns: a newly allocated #TrackerExifData struct if EXIF data was
- * found, %NULL otherwise. Free the returned struct with
- * tracker_exif_free().
+ * found, %NULL otherwise. Free the returned struct with tracker_exif_free().
*
* Since: 0.9
**/
@@ -469,10 +472,9 @@ tracker_exif_new (const guchar *buffer,
/**
* tracker_exif_free:
* @data: a #TrackerExifData
- * @free_members: %TRUE to free all struct members.
*
- * Frees @data, and optionally all struct members if @free_members
- * is %TRUE.
+ * Frees @data and all #TrackerExifData members. %NULL will produce a
+ * a warning.
*
* Since: 0.9
**/
diff --git a/src/libtracker-extract/tracker-exif.h b/src/libtracker-extract/tracker-exif.h
index 35276be..96bdd23 100644
--- a/src/libtracker-extract/tracker-exif.h
+++ b/src/libtracker-extract/tracker-exif.h
@@ -55,6 +55,11 @@ typedef struct {
gint resolution_unit;
} TrackerExifData;
+TrackerExifData * tracker_exif_new (const guchar *buffer,
+ size_t len,
+ const gchar *uri);
+void tracker_exif_free (TrackerExifData *data);
+
#ifndef TRACKER_DISABLE_DEPRECATED
gboolean tracker_exif_read (const unsigned char *buffer,
@@ -64,11 +69,6 @@ gboolean tracker_exif_read (const unsigned char *buffer,
#endif /* TRACKER_DISABLE_DEPRECATED */
-TrackerExifData * tracker_exif_new (const guchar *buffer,
- size_t len,
- const gchar *uri);
-void tracker_exif_free (TrackerExifData *data);
-
G_END_DECLS
#endif /* __LIBTRACKER_EXTRACT_EXIF_H__ */
diff --git a/src/libtracker-extract/tracker-iptc.c b/src/libtracker-extract/tracker-iptc.c
index deefddd..4df1bf2 100644
--- a/src/libtracker-extract/tracker-iptc.c
+++ b/src/libtracker-extract/tracker-iptc.c
@@ -214,6 +214,8 @@ parse_iptc (const unsigned char *buffer,
return TRUE;
}
+#ifndef TRACKER_DISABLE_DEPRECATED
+
/**
* tracker_iptc_read:
* @buffer: a chunk of data with iptc data in it.
@@ -246,19 +248,20 @@ tracker_iptc_read (const unsigned char *buffer,
return parse_iptc (buffer, len, uri, data);
}
+#endif /* TRACKER_DISABLE_DEPRECATED */
+
/**
* tracker_iptc_new:
* @buffer: a chunk of data with iptc data in it.
* @len: the size of @buffer.
* @uri: the URI this is related to.
- * @data: a pointer to a TrackerIptcData struture to populate.
*
* This function takes @len bytes of @buffer and runs it through the
* IPTC library.
*
* Returns: a newly allocated #TrackerIptcData struct if IPTC data was
- * found, %NULL otherwise. Free the returned struct with
- * tracker_iptc_free().
+ * found, %NULL otherwise. Free the returned struct with
+ * tracker_iptc_free().
*
* Since: 0.9
**/
@@ -286,10 +289,9 @@ tracker_iptc_new (const guchar *buffer,
/**
* tracker_iptc_free:
* @data: a #TrackerIptcData
- * @free_members: %TRUE to free all struct members.
*
- * Frees @data, and optionally all struct members if @free_members
- * is %TRUE.
+ * Frees @data and all #TrackerIptcData members. %NULL will produce a
+ * a warning.
*
* Since: 0.9
**/
diff --git a/src/libtracker-extract/tracker-iptc.h b/src/libtracker-extract/tracker-iptc.h
index b8ed67a..c38dc7e 100644
--- a/src/libtracker-extract/tracker-iptc.h
+++ b/src/libtracker-extract/tracker-iptc.h
@@ -45,20 +45,20 @@ typedef struct {
gchar *contact;
} TrackerIptcData;
+TrackerIptcData *tracker_iptc_new (const guchar *buffer,
+ gsize len,
+ const gchar *uri);
+void tracker_iptc_free (TrackerIptcData *data);
+
#ifndef TRACKER_DISABLE_DEPRECATED
-gboolean tracker_iptc_read (const unsigned char *buffer,
- size_t len,
- const gchar *uri,
- TrackerIptcData *data) G_GNUC_DEPRECATED;
+gboolean tracker_iptc_read (const unsigned char *buffer,
+ size_t len,
+ const gchar *uri,
+ TrackerIptcData *data) G_GNUC_DEPRECATED;
#endif /* TRACKER_DISABLE_DEPRECATED */
-TrackerIptcData * tracker_iptc_new (const guchar *buffer,
- gsize len,
- const gchar *uri);
-void tracker_iptc_free (TrackerIptcData *data);
-
G_END_DECLS
#endif /* __LIBTRACKER_EXTRACT_IPTC_H__ */
diff --git a/src/libtracker-extract/tracker-xmp.c b/src/libtracker-extract/tracker-xmp.c
index 191a043..87c9bad 100644
--- a/src/libtracker-extract/tracker-xmp.c
+++ b/src/libtracker-extract/tracker-xmp.c
@@ -483,6 +483,8 @@ parse_xmp (const gchar *buffer,
return TRUE;
}
+#ifndef TRACKER_DISABLE_DEPRECATED
+
/**
* tracker_xmp_read:
* @buffer: a chunk of data with xmp data in it.
@@ -515,6 +517,8 @@ tracker_xmp_read (const gchar *buffer,
return parse_xmp (buffer, len, uri, data);
}
+#endif /* TRACKER_DISABLE_DEPRECATED */
+
/**
* tracker_xmp_new:
* @buffer: a chunk of data with xmp data in it.
@@ -525,8 +529,7 @@ tracker_xmp_read (const gchar *buffer,
* XMP library.
*
* Returns: a newly allocated #TrackerXmpData struct if XMP data was
- * found, %NULL otherwise. Free the returned struct with
- * tracker_xmp_free().
+ * found, %NULL otherwise. Free the returned struct with tracker_xmp_free().
*
* Since: 0.9
**/
@@ -554,10 +557,9 @@ tracker_xmp_new (const gchar *buffer,
/**
* tracker_xmp_free:
* @data: a #TrackerXmpData struct
- * @free_members: %TRUE to free all struct members
*
- * Frees @data, and optionally all struct members if @free_members
- * is %TRUE.
+ * Frees @data and all #TrackerXmpData members. %NULL will produce a
+ * a warning.
*
* Since: 0.9
**/
diff --git a/src/libtracker-extract/tracker-xmp.h b/src/libtracker-extract/tracker-xmp.h
index 0661aec..c9059c6 100644
--- a/src/libtracker-extract/tracker-xmp.h
+++ b/src/libtracker-extract/tracker-xmp.h
@@ -84,14 +84,6 @@ typedef struct {
gchar *city;
} TrackerXmpData;
-#ifndef TRACKER_DISABLE_DEPRECATED
-
-gboolean tracker_xmp_read (const gchar *buffer,
- size_t len,
- const gchar *uri,
- TrackerXmpData *data) G_GNUC_DEPRECATED;
-#endif /* TRACKER_DISABLE_DEPRECATED */
-
TrackerXmpData * tracker_xmp_new (const gchar *buffer,
gsize len,
const gchar *uri);
@@ -100,6 +92,14 @@ gboolean tracker_xmp_apply (TrackerSparqlBuilder *metadata,
const gchar *uri,
TrackerXmpData *data);
+#ifndef TRACKER_DISABLE_DEPRECATED
+
+gboolean tracker_xmp_read (const gchar *buffer,
+ size_t len,
+ const gchar *uri,
+ TrackerXmpData *data) G_GNUC_DEPRECATED;
+#endif /* TRACKER_DISABLE_DEPRECATED */
+
G_END_DECLS
#endif /* __LIBTRACKER_EXTRACT_XMP_H__ */
diff --git a/tests/libtracker-extract/tracker-xmp-test.c b/tests/libtracker-extract/tracker-xmp-test.c
index 9668da8..9e821cd 100644
--- a/tests/libtracker-extract/tracker-xmp-test.c
+++ b/tests/libtracker-extract/tracker-xmp-test.c
@@ -88,7 +88,7 @@
" </rdf:RDF></x:xmpmeta> "
static TrackerXmpData *
-get_example_expected ()
+get_example_expected (void)
{
TrackerXmpData *data;
@@ -182,71 +182,73 @@ ExifNepomuk ORIENTATIONS [] = {
static void
test_parsing_xmp ()
{
- TrackerXmpData data;
+ TrackerXmpData *data;
TrackerXmpData *expected;
- gboolean result;
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) {
- result = tracker_xmp_read (BROKEN_XMP, strlen (BROKEN_XMP), "test://file", &data);
- /* Catch io and check error message ("XML parsing failure") */
+ data = tracker_xmp_new (BROKEN_XMP, strlen (BROKEN_XMP), "test://file");
+ g_assert (data != NULL);
+
+ tracker_xmp_free (data);
}
g_test_trap_assert_stderr ("*parsing failure*");
- result = tracker_xmp_read (EXAMPLE_XMP, strlen (EXAMPLE_XMP), "test://file", &data);
-
+ data = tracker_xmp_new (EXAMPLE_XMP, strlen (EXAMPLE_XMP), "test://file");
expected = get_example_expected ();
+
/* NS_DC */
- g_assert_cmpstr (data.format, ==, expected->format);
- g_assert_cmpstr (data.title, ==, expected->title);
- g_assert_cmpstr (data.rights, ==, expected->rights);
- g_assert_cmpstr (data.description, ==, expected->description);
- g_assert_cmpstr (data.date, ==, expected->date);
- g_assert_cmpstr (data.keywords, ==, expected->keywords);
- g_assert_cmpstr (data.subject, ==, expected->subject);
- g_assert_cmpstr (data.publisher, ==, expected->publisher);
- g_assert_cmpstr (data.contributor, ==, expected->contributor);
- g_assert_cmpstr (data.identifier, ==, expected->identifier);
- g_assert_cmpstr (data.source, ==, expected->source);
- g_assert_cmpstr (data.language, ==, expected->language);
- g_assert_cmpstr (data.relation, ==, expected->relation);
- g_assert_cmpstr (data.coverage, ==, expected->coverage);
- g_assert_cmpstr (data.creator, ==, expected->creator);
+ g_assert_cmpstr (data->format, ==, expected->format);
+ g_assert_cmpstr (data->title, ==, expected->title);
+ g_assert_cmpstr (data->rights, ==, expected->rights);
+ g_assert_cmpstr (data->description, ==, expected->description);
+ g_assert_cmpstr (data->date, ==, expected->date);
+ g_assert_cmpstr (data->keywords, ==, expected->keywords);
+ g_assert_cmpstr (data->subject, ==, expected->subject);
+ g_assert_cmpstr (data->publisher, ==, expected->publisher);
+ g_assert_cmpstr (data->contributor, ==, expected->contributor);
+ g_assert_cmpstr (data->identifier, ==, expected->identifier);
+ g_assert_cmpstr (data->source, ==, expected->source);
+ g_assert_cmpstr (data->language, ==, expected->language);
+ g_assert_cmpstr (data->relation, ==, expected->relation);
+ g_assert_cmpstr (data->coverage, ==, expected->coverage);
+ g_assert_cmpstr (data->creator, ==, expected->creator);
/* NS_EXIF*/
- g_assert_cmpstr (data.title2, ==, expected->title2);
- g_assert_cmpstr (data.time_original, ==, expected->time_original);
- g_assert_cmpstr (data.artist, ==, expected->artist);
- g_assert_cmpstr (data.make, ==, expected->make);
- g_assert_cmpstr (data.model, ==, expected->model);
- g_assert_cmpstr (data.orientation, ==, expected->orientation);
- g_assert_cmpstr (data.flash, ==, expected->flash);
- g_assert_cmpstr (data.metering_mode, ==, expected->metering_mode);
- g_assert_cmpstr (data.exposure_time, ==, expected->exposure_time);
- g_assert_cmpstr (data.fnumber, ==, expected->fnumber);
- g_assert_cmpstr (data.focal_length, ==, expected->focal_length);
-
- g_assert_cmpstr (data.iso_speed_ratings, ==, expected->iso_speed_ratings);
- g_assert_cmpstr (data.white_balance, ==, expected->white_balance);
- g_assert_cmpstr (data.copyright, ==, expected->copyright);
-
- g_assert (result);
- g_free (expected);
+ g_assert_cmpstr (data->title2, ==, expected->title2);
+ g_assert_cmpstr (data->time_original, ==, expected->time_original);
+ g_assert_cmpstr (data->artist, ==, expected->artist);
+ g_assert_cmpstr (data->make, ==, expected->make);
+ g_assert_cmpstr (data->model, ==, expected->model);
+ g_assert_cmpstr (data->orientation, ==, expected->orientation);
+ g_assert_cmpstr (data->flash, ==, expected->flash);
+ g_assert_cmpstr (data->metering_mode, ==, expected->metering_mode);
+ g_assert_cmpstr (data->exposure_time, ==, expected->exposure_time);
+ g_assert_cmpstr (data->fnumber, ==, expected->fnumber);
+ g_assert_cmpstr (data->focal_length, ==, expected->focal_length);
+
+ g_assert_cmpstr (data->iso_speed_ratings, ==, expected->iso_speed_ratings);
+ g_assert_cmpstr (data->white_balance, ==, expected->white_balance);
+ g_assert_cmpstr (data->copyright, ==, expected->copyright);
+
+ tracker_xmp_free (expected);
+ tracker_xmp_free (data);
}
static void
test_xmp_metering_mode (void)
{
gint i;
- gchar *xmp;
- TrackerXmpData data;
for (i = 0; METERING_MODES[i].exif_value != NULL; i++) {
+ TrackerXmpData *data;
+ gchar *xmp;
+
xmp = g_strdup_printf (METERING_MODE_XMP, i);
- tracker_xmp_read (xmp, strlen (xmp), "local://file", &data);
-
- g_assert_cmpstr (data.metering_mode, ==, METERING_MODES[i].nepomuk_translation);
-
+ data = tracker_xmp_new (xmp, strlen (xmp), "local://file");
g_free (xmp);
+
+ g_assert_cmpstr (data->metering_mode, ==, METERING_MODES[i].nepomuk_translation);
+ tracker_xmp_free (data);
}
}
@@ -254,16 +256,17 @@ static void
test_xmp_orientation (void)
{
gint i;
- gchar *xmp;
- TrackerXmpData data;
for (i = 0; ORIENTATIONS[i].exif_value != NULL; i++) {
+ TrackerXmpData *data;
+ gchar *xmp;
+
xmp = g_strdup_printf (ORIENTATION_XMP, ORIENTATIONS[i].exif_value);
- tracker_xmp_read (xmp, strlen (xmp), "local://file", &data);
-
- g_assert_cmpstr (data.orientation, ==, ORIENTATIONS[i].nepomuk_translation);
-
+ data = tracker_xmp_new (xmp, strlen (xmp), "local://file");
g_free (xmp);
+
+ g_assert_cmpstr (data->orientation, ==, ORIENTATIONS[i].nepomuk_translation);
+ tracker_xmp_free (data);
}
}
@@ -271,21 +274,24 @@ static void
test_xmp_apply ()
{
TrackerSparqlBuilder *metadata;
- TrackerXmpData data;
+ TrackerXmpData *data;
metadata = tracker_sparql_builder_new_update ();;
- g_assert (tracker_xmp_read (EXAMPLE_XMP, strlen (EXAMPLE_XMP), "urn:uuid:test", &data));
+ data = tracker_xmp_new (EXAMPLE_XMP, strlen (EXAMPLE_XMP), "urn:uuid:test");
+ g_assert (data != NULL);
tracker_sparql_builder_insert_open (metadata, NULL);
tracker_sparql_builder_subject_iri (metadata, "urn:uuid:test");
- g_assert (tracker_xmp_apply (metadata, "urn:uuid:test", &data));
+ g_assert (tracker_xmp_apply (metadata, "urn:uuid:test", data));
tracker_sparql_builder_insert_close (metadata);
/* This is the only way to check the sparql is kinda correct */
g_assert_cmpint (tracker_sparql_builder_get_length (metadata), ==, 50);
+
+ tracker_xmp_free (data);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]