Hi,
I am trying to add a component to an open-source software. I was able to integrate the two successfully and it was working properly all these days. I am pretty sure that I havent modified the file "peruse.c" which is a part of my component, recently. But, the error is pointing to a line which appears to be normal. Will try to include everything that is relevant, hope someone can give me some suggestions as to what has gone wrong :
Prototype of the function in question in the peruse.h file.
Code:
int PERUSE_Query_supported_events( int* num_supported,
char*** event_names,
int** events );
The corresponding peruse.c file which houses the function in question :
Code:
typedef struct {
const char* name;
const int id;
} peruse_event_associations_t;
/**
* The associations between the peruse event name and id. This array
* should be ended by the tuple {NULL, PERUSE_CUSTOM_EVENT}.
*/
static const peruse_event_associations_t PERUSE_events[] = {
/* Point-to-point request events */
{ "PERUSE_COMM_REQ_ACTIVATE", PERUSE_COMM_REQ_ACTIVATE },
{ ..................................................................................................................................... },
{ NULL , PERUSE_CUSTOM_EVENT}
};
const int PERUSE_num_events = (sizeof(PERUSE_events) /sizeof(peruse_event_associations_t));
/* Query all implemented events */
int PERUSE_Query_supported_events( int* num_supported,
char*** event_names,
int** events )
{
int i;
*num_supported = PERUSE_num_events;
*event_names = (char**) malloc (PERUSE_num_events * sizeof (char *));
*events = (int*) malloc (PERUSE_num_events * sizeof (int));
for (i = 0; i < PERUSE_num_events; i++) {
(*event_names)[i] = strdup (PERUSE_events[i].name);
(*events)[i] = PERUSE_events[i].id;
}
return PERUSE_SUCCESS;
}
The error that I am getting :
Code:
peruse.c:60:72: warning: character constant too long for its type
peruse.c: In function ‘PERUSE_Query_supported_events’:
peruse.c:60: error: expected ‘;’ before ‘:’ token
It is pointing to the line :
Code:
*event_names = (char**) malloc (PERUSE_num_events * sizeof (char *));
What could be wrong ?