clouseau: no need to handle unknow type at all in clouseau.
SVN revision: 75065
This commit is contained in:
parent
c96acc433a
commit
55f4e9d5d5
|
@ -928,7 +928,7 @@ _data(void *data, int type EINA_UNUSED, void *event)
|
|||
v = packet_info_get(ev->data, ev->size);
|
||||
if (!v) return ECORE_CALLBACK_RENEW;
|
||||
|
||||
switch (clouseau_packet_mapping_type_get(v->t.type))
|
||||
switch (clouseau_packet_mapping_type_get(v->type))
|
||||
{
|
||||
case CLOUSEAU_APP_ADD: /* Add info to list of APPs */
|
||||
_add_app(data, v); /* v->data is (app_info_st *) */
|
||||
|
|
|
@ -218,7 +218,7 @@ _data(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_Ipc_Event_Client_Data
|
|||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
switch(clouseau_packet_mapping_type_get(v->t.type))
|
||||
switch(clouseau_packet_mapping_type_get(v->type))
|
||||
{
|
||||
case CLOUSEAU_APP_CLIENT_CONNECT:
|
||||
{ /* Register APP then notify GUI about it */
|
||||
|
|
|
@ -183,7 +183,7 @@ _data(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_Ipc_Event_Server_Data
|
|||
Variant_st *v;
|
||||
|
||||
v = packet_info_get(ev->data, ev->size);
|
||||
switch (clouseau_packet_mapping_type_get(v->t.type))
|
||||
switch (clouseau_packet_mapping_type_get(v->type))
|
||||
{
|
||||
case CLOUSEAU_DATA_REQ:
|
||||
{ /* data req includes ptr to GUI, to tell which client asking */
|
||||
|
|
|
@ -108,33 +108,26 @@ _clouseau_packet_mapping_type_str_get(Clouseau_Message_Type t)
|
|||
}
|
||||
|
||||
static const char *
|
||||
_clouseau_variant_type_get(const void *data, Eina_Bool *unknow)
|
||||
_clouseau_variant_type_get(const void *data, Eina_Bool *unknow EINA_UNUSED)
|
||||
{
|
||||
const Variant_Type_st *type = data;
|
||||
const char * const *type = data;
|
||||
int i;
|
||||
|
||||
if (unknow)
|
||||
*unknow = type->unknow;
|
||||
|
||||
for (i = 0; eet_mapping[i].name != NULL; ++i)
|
||||
if (strcmp(type->type, eet_mapping[i].name) == 0)
|
||||
if (strcmp(*type, eet_mapping[i].name) == 0)
|
||||
return eet_mapping[i].name;
|
||||
|
||||
if (unknow)
|
||||
*unknow = EINA_FALSE;
|
||||
|
||||
return type->type;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_clouseau_variant_type_set(const char *type,
|
||||
void *data,
|
||||
Eina_Bool unknow)
|
||||
Eina_Bool unknow EINA_UNUSED)
|
||||
{
|
||||
Variant_Type_st *vt = data;
|
||||
const char **t = data;
|
||||
|
||||
vt->type = type;
|
||||
vt->unknow = unknow;
|
||||
*t = type;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
@ -158,7 +151,7 @@ clouseau_variant_alloc(Clouseau_Message_Type t, size_t size, void *info)
|
|||
v = malloc(sizeof(Variant_st));
|
||||
v->data = malloc(size);
|
||||
_clouseau_variant_type_set(_clouseau_packet_mapping_type_str_get(t),
|
||||
&v->t, EINA_FALSE);
|
||||
&v->type, EINA_FALSE);
|
||||
memcpy(v->data, info, size);
|
||||
|
||||
return v;
|
||||
|
@ -635,7 +628,7 @@ clouseau_data_descriptors_init(void)
|
|||
EET_DATA_DESCRIPTOR_ADD_MAPPING(clouseau_variant_edd,
|
||||
"BMP_DATA", clouseau_bmp_info_edd);
|
||||
EET_DATA_DESCRIPTOR_ADD_VARIANT(clouseau_protocol_edd, Variant_st,
|
||||
"data", data, t, clouseau_variant_edd);
|
||||
"data", data, type, clouseau_variant_edd);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -28,16 +28,11 @@ enum _Clouseau_Message_Type
|
|||
};
|
||||
typedef enum _Clouseau_Message_Type Clouseau_Message_Type;
|
||||
|
||||
struct _Variant_Type_st
|
||||
/* This is used for composing message and encoding/decoding with EET */
|
||||
struct _Variant_st
|
||||
{
|
||||
const char *type;
|
||||
Eina_Bool unknow : 1;
|
||||
};
|
||||
typedef struct _Variant_Type_st Variant_Type_st;
|
||||
|
||||
struct _Variant_st
|
||||
{ /* This is used for composing message and encoding/decoding with EET */
|
||||
Variant_Type_st t;
|
||||
void *data;
|
||||
};
|
||||
typedef struct _Variant_st Variant_st;
|
||||
|
|
Loading…
Reference in New Issue