[libgdata] contacts: Use guint8 instead of gchar for image data
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] contacts: Use guint8 instead of gchar for image data
- Date: Fri, 10 Dec 2010 20:02:25 +0000 (UTC)
commit fd5f10453b6456ad55d707327a24f14d3df57d95
Author: Philip Withnall <philip tecnocode co uk>
Date: Fri Dec 10 18:41:22 2010 +0000
contacts: Use guint8 instead of gchar for image data
When handling contacts' photos, we should use guint8 representations rather
than gchar ones, as the data isn't textual, and for consistency with
GDataBuffer and friends.
This changes the types of the following methods, which is an API break on
weird platforms where sizeof(gchar) != sizeof(guint8):
â?¢ gdata_contacts_contact_get_photo()
â?¢ gdata_contacts_contact_set_photo()
gdata/services/contacts/gdata-contacts-contact.c | 6 +++---
gdata/services/contacts/gdata-contacts-contact.h | 6 +++---
gdata/tests/contacts.c | 7 ++++---
3 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/gdata/services/contacts/gdata-contacts-contact.c b/gdata/services/contacts/gdata-contacts-contact.c
index 4cc5ec9..a3c4490 100644
--- a/gdata/services/contacts/gdata-contacts-contact.c
+++ b/gdata/services/contacts/gdata-contacts-contact.c
@@ -2939,14 +2939,14 @@ gdata_contacts_contact_has_photo (GDataContactsContact *self)
*
* Since: 0.4.0
**/
-gchar *
+guint8 *
gdata_contacts_contact_get_photo (GDataContactsContact *self, GDataContactsService *service, gsize *length, gchar **content_type,
GCancellable *cancellable, GError **error)
{
GDataLink *_link;
SoupMessage *message;
guint status;
- gchar *data;
+ guint8 *data;
/* TODO: async version */
g_return_val_if_fail (GDATA_IS_CONTACTS_CONTACT (self), NULL);
@@ -3019,7 +3019,7 @@ gdata_contacts_contact_get_photo (GDataContactsContact *self, GDataContactsServi
* Since: 0.4.0
**/
gboolean
-gdata_contacts_contact_set_photo (GDataContactsContact *self, GDataService *service, const gchar *data, gsize length,
+gdata_contacts_contact_set_photo (GDataContactsContact *self, GDataService *service, const guint8 *data, gsize length,
GCancellable *cancellable, GError **error)
{
GDataLink *_link;
diff --git a/gdata/services/contacts/gdata-contacts-contact.h b/gdata/services/contacts/gdata-contacts-contact.h
index 1c2f999..627819d 100644
--- a/gdata/services/contacts/gdata-contacts-contact.h
+++ b/gdata/services/contacts/gdata-contacts-contact.h
@@ -278,9 +278,9 @@ GList *gdata_contacts_contact_get_groups (GDataContactsContact *self) G_GNUC_WAR
#include <gdata/services/contacts/gdata-contacts-service.h>
gboolean gdata_contacts_contact_has_photo (GDataContactsContact *self) G_GNUC_PURE;
-gchar *gdata_contacts_contact_get_photo (GDataContactsContact *self, GDataContactsService *service, gsize *length, gchar **content_type,
- GCancellable *cancellable, GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
-gboolean gdata_contacts_contact_set_photo (GDataContactsContact *self, GDataService *service, const gchar *data, gsize length,
+guint8 *gdata_contacts_contact_get_photo (GDataContactsContact *self, GDataContactsService *service, gsize *length, gchar **content_type,
+ GCancellable *cancellable, GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
+gboolean gdata_contacts_contact_set_photo (GDataContactsContact *self, GDataService *service, const guint8 *data, gsize length,
GCancellable *cancellable, GError **error);
G_END_DECLS
diff --git a/gdata/tests/contacts.c b/gdata/tests/contacts.c
index 7c14106..76d9c0e 100644
--- a/gdata/tests/contacts.c
+++ b/gdata/tests/contacts.c
@@ -1569,13 +1569,13 @@ static void
test_photo_add (gconstpointer service)
{
GDataContactsContact *contact;
- gchar *data;
+ guint8 *data;
gsize length;
gboolean retval;
GError *error = NULL;
/* Get the photo */
- g_assert (g_file_get_contents (TEST_FILE_DIR "photo.jpg", &data, &length, NULL) == TRUE);
+ g_assert (g_file_get_contents (TEST_FILE_DIR "photo.jpg", (gchar**) &data, &length, NULL) == TRUE);
/* Add it to the contact */
contact = get_contact (service);
@@ -1592,7 +1592,8 @@ static void
test_photo_get (gconstpointer service)
{
GDataContactsContact *contact;
- gchar *data, *content_type = NULL;
+ guint8 *data;
+ gchar *content_type = NULL;
gsize length = 0;
GError *error = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]