[lasem/lasem-0-4] build: don't use void * pointer arithmetic.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [lasem/lasem-0-4] build: don't use void * pointer arithmetic.
- Date: Thu, 4 Apr 2013 21:20:38 +0000 (UTC)
commit 35d33628d379f21eb1f01a7c8f38e5bb1ef74c0c
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Thu Apr 4 23:18:23 2013 +0200
build: don't use void * pointer arithmetic.
It's a non portable gcc extension.
src/lsmattributes.c | 10 +++++-----
src/lsmproperties.c | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/lsmattributes.c b/src/lsmattributes.c
index d4798ed..ce08dfd 100644
--- a/src/lsmattributes.c
+++ b/src/lsmattributes.c
@@ -35,7 +35,7 @@ lsm_attribute_is_defined (const LsmAttribute *attribute)
return attribute->value != NULL;
}
-#define ATTRIBUTE_TRAIT(attribute) ((void *) (((void *) attribute) + sizeof (LsmAttribute)))
+#define ATTRIBUTE_TRAIT(attribute) ((void *) (((char *) attribute) + sizeof (LsmAttribute)))
struct _LsmAttributeManager {
GHashTable * hash_by_name;
@@ -146,7 +146,7 @@ lsm_attribute_manager_set_attribute (LsmAttributeManager *manager,
if (attribute_infos == NULL)
return FALSE;
- attribute = (void *)(instance + attribute_infos->attribute_offset);
+ attribute = (void *)(((char *) instance) + attribute_infos->attribute_offset);
g_return_val_if_fail (attribute != NULL, FALSE);
trait_class = attribute_infos->trait_class;
@@ -199,7 +199,7 @@ lsm_attribute_manager_get_attribute (LsmAttributeManager *manager,
if (attribute_infos == NULL)
return NULL;
- attribute = (void *)(instance + attribute_infos->attribute_offset);
+ attribute = (void *)(((char *)instance) + attribute_infos->attribute_offset);
g_return_val_if_fail (attribute != NULL, NULL);
return attribute->value;
@@ -222,7 +222,7 @@ lsm_attribute_manager_clean_attributes (LsmAttributeManager *manager,
attribute_infos = value;
trait_class = attribute_infos->trait_class;
- attribute = (void *)(instance + attribute_infos->attribute_offset);
+ attribute = (void *)(((char *)instance) + attribute_infos->attribute_offset);
g_free (attribute->value);
attribute->value = NULL;
@@ -251,7 +251,7 @@ lsm_attribute_manager_serialize (LsmAttributeManager *manager,
g_hash_table_iter_init (&iter, manager->hash_by_name);
while (g_hash_table_iter_next (&iter, &key, &value)) {
attribute_infos = value;
- attribute = (void *)(instance + attribute_infos->attribute_offset);
+ attribute = (void *)(((char *)instance) + attribute_infos->attribute_offset);
if (attribute->value != NULL) {
if (!attribute_found) {
diff --git a/src/lsmproperties.c b/src/lsmproperties.c
index b8d824b..4f78055 100644
--- a/src/lsmproperties.c
+++ b/src/lsmproperties.c
@@ -26,7 +26,7 @@
#include <lsmstr.h>
#include <string.h>
-#define PROPERTY_TRAIT(property) ((void *) (((void *) property) + sizeof (LsmProperty)))
+#define PROPERTY_TRAIT(property) ((void *) (((char *) property) + sizeof (LsmProperty)))
#define PROPERTY_SIZE(trait_class) (trait_class->size + sizeof (LsmProperty))
struct _LsmPropertyManager {
@@ -341,13 +341,13 @@ lsm_property_manager_apply_property_bag (LsmPropertyManager *manager,
if (property->id < manager->n_properties) {
if (manager->property_check[property->id] != manager->property_check_count) {
if (g_strcmp0 (property->value, "inherit") != 0)
- *((LsmProperty **) ((void*) style
+ *((LsmProperty **) ((char *) style
+ LSM_PROPERTY_ID_TO_OFFSET (property->id))) =
property;
else {
if (parent_style != NULL)
- *((LsmProperty **) ((void*) style
+ *((LsmProperty **) ((char *) style
+ LSM_PROPERTY_ID_TO_OFFSET
(property->id))) =
- *((LsmProperty **) ((void*) parent_style
+ *((LsmProperty **) ((char *) parent_style
+ LSM_PROPERTY_ID_TO_OFFSET
(property->id)));
}
@@ -404,7 +404,7 @@ void lsm_property_manager_init_default_style (LsmPropertyManager *property_manag
trait_class->from_string (PROPERTY_TRAIT (property),
(char *) property_infos->trait_default);
- *((LsmProperty **) ((void*) style
+ *((LsmProperty **) ((char *) style
+ LSM_PROPERTY_ID_TO_OFFSET (property->id))) = property;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]