[libgdata] media: Fix a strict aliasing problem with a cast
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] media: Fix a strict aliasing problem with a cast
- Date: Thu, 30 Apr 2015 20:34:25 +0000 (UTC)
commit 2fe7f6305063b6c300cac15e3abff738d41dba0c
Author: Philip Withnall <philip withnall collabora co uk>
Date: Thu Apr 30 19:38:15 2015 +0100
media: Fix a strict aliasing problem with a cast
Fixes a compiler warning. Potentially unbreaks libgdata on architectures
which care about pointer alignment. (I’m looking at you, ARM.)
gdata/media/gdata-media-thumbnail.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/gdata/media/gdata-media-thumbnail.c b/gdata/media/gdata-media-thumbnail.c
index be55c12..e358bbe 100644
--- a/gdata/media/gdata-media-thumbnail.c
+++ b/gdata/media/gdata-media-thumbnail.c
@@ -304,18 +304,23 @@ parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data,
GError **error)
{
gboolean success;
+ gint64 width, height;
GDataMediaThumbnail *self = GDATA_MEDIA_THUMBNAIL (parsable);
GDataMediaThumbnailPrivate *priv = self->priv;
if (gdata_parser_string_from_json_member (reader, "url", P_DEFAULT,
&priv->uri, &success,
- error) ||
- gdata_parser_int_from_json_member (reader, "width", P_DEFAULT,
- (gint64 *) &priv->width,
- &success, error) ||
- gdata_parser_int_from_json_member (reader, "height", P_DEFAULT,
- (gint64 *) &priv->height,
- &success, error)) {
+ error)) {
+ return success;
+ } else if (gdata_parser_int_from_json_member (reader, "width",
+ P_DEFAULT, &width,
+ &success, error)) {
+ priv->width = width;
+ return success;
+ } else if (gdata_parser_int_from_json_member (reader, "height",
+ P_DEFAULT, &height,
+ &success, error)) {
+ priv->height = height;
return success;
} else {
return GDATA_PARSABLE_CLASS (gdata_media_thumbnail_parent_class)->parse_json (parsable,
reader, user_data, error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]