Fix compatibility for x64 arch. 01/4001/1
authorBaptiste DURAND <baptiste.durand@eurogiciel.fr>
Fri, 14 Jun 2013 08:20:26 +0000 (10:20 +0200)
committerBaptiste DURAND <baptiste.durand@eurogiciel.fr>
Fri, 14 Jun 2013 08:20:26 +0000 (10:20 +0200)
- Fix Warning about cast int to pointer.

intptr type is used because there are  only ID value that casted in pointer.

Store an ID on integer make sense, and cast is used only to permits a call function.

- Remove warning around variable set but not used.

CMakeLists.txt
src/framework/engine-controller/queuing_rule_spec_pool.c
src/framework/engine-controller/task.c
src/framework/engine-controller/task_info_pool.c
src/framework/engine-controller/task_pool.c
src/framework/engine-controller/task_spec.c
src/fw-plugins/common-public/calendar/src/plugin_interface.c
src/fw-plugins/common-public/task/src/plugin_interface.c

index 342b34e..b85c4b4 100755 (executable)
@@ -15,7 +15,7 @@ MESSAGE(STATUS "Package version is ${VERSION} (major: ${VERSION_MAJOR}) from cha
 # pass macro defition to source files
 ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
 ADD_DEFINITIONS("-DPLUGINDIR=\"${PLUGINDIR}\"")
-
+ADD_DEFINITIONS("-Wno-unused-but-set-variable")
 # log tag integration
 ADD_DEFINITIONS("-DCOMPONENT_TAG=SYSTEM")
 ADD_DEFINITIONS("-DSYNC_AGENT_LOG")
index 23bfd75..cddf8c7 100755 (executable)
@@ -19,7 +19,7 @@
 #include <assert.h>
 #include "utility/sync_util.h"
 #include "engine-controller/queuing_rule_spec_pool.h"
-
+#include <stdint.h>
 #ifndef SYNC_AGENT_LOG
 #undef LOG_TAG
 #define LOG_TAG "AF_EC"
@@ -135,7 +135,7 @@ sync_agent_ec_error_e ec_queuing_rule_spec_pool_add_queuing_rule_spec(ec_queuing
                }
        }
 
-       g_hash_table_insert(pool->queuing_rule_spec_hash, (gpointer) new_id, spec);
+       g_hash_table_insert(pool->queuing_rule_spec_hash, (gpointer) ((intptr_t)new_id), spec);
 
        *queuing_rule_id = new_id;
 
@@ -150,7 +150,7 @@ sync_agent_ec_queuing_rule_spec_s *ec_queueing_rule_spec_pool_search_queuing_rul
 
        retvm_if(pool == NULL, NULL, "ec_queuing_rule_spec_pool_t is NULL !!");
 
-       sync_agent_ec_queuing_rule_spec_s *queuing_rule_spec = g_hash_table_lookup(pool->queuing_rule_spec_hash, (gconstpointer) queuing_rule_id);
+       sync_agent_ec_queuing_rule_spec_s *queuing_rule_spec = g_hash_table_lookup(pool->queuing_rule_spec_hash, (gconstpointer) ((intptr_t)queuing_rule_id));
 
        _EXTERN_FUNC_EXIT;
 
index 6ca75ed..6f302d2 100755 (executable)
@@ -26,7 +26,7 @@
 #include "engine-controller/task_spec_internal.h"
 #include "engine-controller/param_spec_internal.h"
 #include "engine-controller/param_value_internal.h"
-
+#include <stdint.h>
 #ifndef SYNC_AGENT_LOG
 #undef LOG_TAG
 #define LOG_TAG "AF_EC"
@@ -895,14 +895,14 @@ GSList *ec_collect_become_runnable_child_tasks_by_remove_control_flow(ec_task_t
 
        /* get to node list from child_index */
        /* note that to nodes_list containing sync_agent_ec_int */
-       GList *to_node_list = ec_graph_edge_pool_query_to_node_list(control_edge_pool, (sync_agent_ec_constpointer) from_child_task_index);
+       GList *to_node_list = ec_graph_edge_pool_query_to_node_list(control_edge_pool, (sync_agent_ec_constpointer) ((intptr_t)from_child_task_index));
 
        /* remove control flow from child task at child_index of parent task */
        GList *iter = NULL;
        sync_agent_ec_int to_child_task_index = 0;
        ec_task_t *to_child_task = NULL;
        for (iter = to_node_list; iter != NULL; iter = g_list_next(iter)) {
-               to_child_task_index = (sync_agent_ec_int) (iter->data);
+               to_child_task_index = (sync_agent_ec_int) ((intptr_t)(iter->data));
                ec_task_remove_control_flow(parent_task, from_child_task_index, to_child_task_index);
 
                /* if zero in-degree of control flow detected, make child task and append runnable_child_task_list */
index 7a36418..6ea27dc 100755 (executable)
@@ -20,7 +20,7 @@
 #include "engine-controller/task_info_pool.h"
 #include "engine-controller/queuing_rule_spec.h"
 #include "engine-controller/task_spec_internal.h"
-
+#include <stdint.h>
 #ifndef SYNC_AGENT_LOG
 #undef LOG_TAG
 #define LOG_TAG "AF_EC"
@@ -200,14 +200,14 @@ sync_agent_ec_boolean ec_task_info_pool_add_task_info(ec_task_info_pool_t * task
 
        GHashTable *hash = task_info_pool->task_info_pool;
        if (replace) {
-               g_hash_table_replace(hash, (gpointer) (task_info->task_spec_id), task_info);    /* TODO : check free well done */
+               g_hash_table_replace(hash, (gpointer) ((intptr_t)(task_info->task_spec_id)), task_info);        /* TODO : check free well done */
                success = true;
        } else {
-               gpointer tmp = g_hash_table_lookup(hash, (gpointer) (task_info->task_spec_id));
+               gpointer tmp = g_hash_table_lookup(hash, (gpointer) ((intptr_t)(task_info->task_spec_id)));
                if (tmp != NULL) {
                        success = false;
                } else {
-                       g_hash_table_insert(hash, (gpointer) (task_info->task_spec_id), task_info);
+                       g_hash_table_insert(hash, (gpointer) ((intptr_t)(task_info->task_spec_id)), task_info);
                }
        }
 
@@ -234,7 +234,7 @@ ec_task_info_t *ec_task_info_pool_search_task_info(ec_task_info_pool_t * task_in
        GHashTable *hash = task_info_pool->task_info_pool;
        ec_task_info_t *task_info = NULL;
 
-       task_info = (ec_task_info_t *) g_hash_table_lookup(hash, (gpointer) msg_type);
+       task_info = (ec_task_info_t *) g_hash_table_lookup(hash, (gpointer) ((intptr_t)msg_type));
 
        _EXTERN_FUNC_EXIT;
 
index fcdf659..5b6e88c 100755 (executable)
@@ -20,7 +20,7 @@
 #include <stdlib.h>
 #include "utility/sync_util.h"
 #include "engine-controller/task_pool.h"
-
+#include <stdint.h>
 #ifndef SYNC_AGENT_LOG
 #undef LOG_TAG
 #define LOG_TAG "AF_EC"
@@ -81,7 +81,7 @@ void ec_task_pool_add_task(ec_task_pool_t * task_pool, sync_agent_ec_uint reques
 
        retm_if(task_pool == NULL, "ec_task_pool_t is NULL !!");
 
-       g_hash_table_insert(task_pool->task_hash, (gpointer) request_id, (gpointer) ec_task_ref_task(task));
+       g_hash_table_insert(task_pool->task_hash, (gpointer) ((intptr_t)(request_id)), (gpointer) ec_task_ref_task(task));
 
        _EXTERN_FUNC_EXIT;
 }
@@ -93,7 +93,7 @@ ec_task_t *ec_task_pool_fetch_task(ec_task_pool_t * task_pool, sync_agent_ec_uin
        retvm_if(task_pool == NULL, NULL, "ec_task_pool_t is NULL !!");
 
        GHashTable *task_hash = task_pool->task_hash;
-       ec_task_t *task = (ec_task_t *) g_hash_table_lookup(task_hash, (gconstpointer) request_id);
+       ec_task_t *task = (ec_task_t *) g_hash_table_lookup(task_hash, (gconstpointer) ((intptr_t)request_id));
 
        if (task != NULL) {
                _EXTERN_FUNC_EXIT;
@@ -129,10 +129,10 @@ void ec_task_pool_remove_task(ec_task_pool_t * task_pool, sync_agent_ec_uint req
        retm_if(task_pool == NULL, "ec_task_pool_t is NULL !!");
 
        GHashTable *task_hash = task_pool->task_hash;
-       ec_task_t *task = (ec_task_t *) g_hash_table_lookup(task_hash, (gconstpointer) request_id);
+       ec_task_t *task = (ec_task_t *) g_hash_table_lookup(task_hash, (gconstpointer) ((intptr_t)request_id));
        if (task != NULL) {
                ec_task_unref_task(task);
-               g_hash_table_remove(task_hash, (gconstpointer) request_id);
+               g_hash_table_remove(task_hash, (gconstpointer) ((intptr_t)request_id));
        }
 
        _EXTERN_FUNC_EXIT;
index af34ad0..043ec06 100755 (executable)
@@ -21,7 +21,7 @@
 #include "engine-controller/task_spec.h"
 #include "engine-controller/task_spec_internal.h"
 #include "engine-controller/param_spec_internal.h"
-
+#include <stdint.h>
 #ifndef EXPORT_API
 #define EXPORT_API __attribute__ ((visibility("default")))
 #endif
@@ -1196,7 +1196,7 @@ sync_agent_ec_error_e ec_set_control_flow(sync_agent_ec_task_spec_s * container_
        sync_agent_ec_uint *control_flow_in_degree_array = child_task_info->child_task_control_flow_in_degree;
 
        /* add edge and in_degree count */
-       if (ec_graph_edge_pool_add_edge(control_edge_pool, (sync_agent_ec_constpointer) from_task_index, (sync_agent_ec_constpointer) to_task_index)) {
+       if (ec_graph_edge_pool_add_edge(control_edge_pool, (sync_agent_ec_constpointer) ((intptr_t)from_task_index), (sync_agent_ec_constpointer) ((intptr_t)to_task_index))) {
                control_flow_in_degree_array[to_task_index]++;
        }
 
@@ -1228,7 +1228,7 @@ sync_agent_ec_error_e ec_task_spec_set_control_flow_on_dynamic_case(sync_agent_e
        sync_agent_ec_uint *control_flow_in_degree_array = child_task_info->child_task_control_flow_in_degree;
 
        /* add edge and in_degree count */
-       if (ec_graph_edge_pool_add_edge(control_edge_pool, (sync_agent_ec_constpointer) from_task_index, (sync_agent_ec_constpointer) to_task_index)) {
+       if (ec_graph_edge_pool_add_edge(control_edge_pool, (sync_agent_ec_constpointer) ((intptr_t)from_task_index), (sync_agent_ec_constpointer) ((intptr_t)to_task_index))) {
                control_flow_in_degree_array[to_task_index]++;
        }
 
index ac8ba8c..13bd8c1 100755 (executable)
@@ -20,7 +20,7 @@
 #include <pthread.h>
 #include <calendar2.h>
 #include <account.h>
-
+#include <stdint.h>
 #include "extern_info.h"
 #include "item_change_info.h"
 #include "ext_datastore_info_calendar.h"
@@ -1567,15 +1567,15 @@ EXPORT_API int sync_agent_plugin_get_field_value(int field_name, int child_field
        case CALENDAR_FIELD_TIMEZONE:
                switch (child_field_name) {
                case CALENDAR_CHILD_FIELD_BIAS:
-                       *num_val1 = (int)VAL_TZ_BIAS;
+                       *num_val1 = (intptr_t)VAL_TZ_BIAS;
                        _EXTERN_FUNC_EXIT;
                        return 1;
                case CALENDAR_CHILD_FIELD_DAYLIGHT:
-                       *num_val1 = (int)VAL_TZ_DAYLIGHT;
+                       *num_val1 = (intptr_t)VAL_TZ_DAYLIGHT;
                        _EXTERN_FUNC_EXIT;
                        return 1;
                case CALENDAR_CHILD_FIELD_DAYLIGHT_BIAS:
-                       *num_val1 = (int)VAL_TZ_DAYLIGHT_BIAS;
+                       *num_val1 = (intptr_t)VAL_TZ_DAYLIGHT_BIAS;
                        _EXTERN_FUNC_EXIT;
                        return 1;
                case CALENDAR_CHILD_FIELD_DAYLIGHT_BEGIN:
index 27a86dc..6ce1463 100755 (executable)
@@ -20,7 +20,7 @@
 #include <pthread.h>
 #include <calendar2.h>
 #include <account.h>
-
+#include <stdint.h>
 #include "extern_info.h"
 #include "item_change_info.h"
 #include "ext_datastore_info_task.h"
@@ -1307,15 +1307,15 @@ EXPORT_API int sync_agent_plugin_get_field_value(int field_name, int child_field
        case CALENDAR_FIELD_TIMEZONE:
                switch (child_field_name) {
                case CALENDAR_CHILD_FIELD_BIAS:
-                       *num_val1 = (int)VAL_TZ_BIAS;
+                       *num_val1 = (intptr_t)VAL_TZ_BIAS;
                        _EXTERN_FUNC_EXIT;
                        return 1;
                case CALENDAR_CHILD_FIELD_DAYLIGHT:
-                       *num_val1 = (int)VAL_TZ_DAYLIGHT;
+                       *num_val1 = (intptr_t)VAL_TZ_DAYLIGHT;
                        _EXTERN_FUNC_EXIT;
                        return 1;
                case CALENDAR_CHILD_FIELD_DAYLIGHT_BIAS:
-                       *num_val1 = (int)VAL_TZ_DAYLIGHT_BIAS;
+                       *num_val1 = (intptr_t)VAL_TZ_DAYLIGHT_BIAS;
                        _EXTERN_FUNC_EXIT;
                        return 1;
                case CALENDAR_CHILD_FIELD_DAYLIGHT_BEGIN: