Project

General

Profile

Revision 198

Recharging updated.

View differences:

sensor_matrix.c
19 19
	SensorMatrix* m;
20 20
	int i;
21 21
	
22
	m = malloc(sizeof(SensorMatrix));
22
	m = (SensorMatrix*)malloc(sizeof(SensorMatrix));
23 23
	if (!m)
24 24
	{
25 25
		WL_DEBUG_PRINT("Out of memory - create sensor matrix.\r\n");
26 26
		return NULL;
27 27
	}
28 28
	m->size = DEFAULT_SENSOR_MATRIX_SIZE;
29
	m->matrix = malloc(m->size * sizeof(int*));
30
	m->joined = malloc(m->size * sizeof(int));
29
	m->matrix = (int**)malloc(m->size * sizeof(int*));
30
	m->joined = (int*)malloc(m->size * sizeof(int));
31 31
	m->numJoined = 0;
32 32
	if (!(m->matrix) || !(m->joined))
33 33
	{
......
73 73
	if (m->matrix[id] != NULL)
74 74
		return;
75 75
	
76
	m->matrix[id] = malloc(m->size * sizeof(int));
76
	m->matrix[id] = (int*)malloc(m->size * sizeof(int));
77 77
	if (!(m->matrix[id]))
78 78
	{
79 79
		WL_DEBUG_PRINT("Out of memory - add robot.\r\n");
......
125 125
	int i, j;
126 126
	WL_DEBUG_PRINT("Expanding sensor matrix.\r\n");
127 127
	
128
	int** tempMatrix = malloc(nextSize * sizeof(int*));
128
	int** tempMatrix = (int**)malloc(nextSize * sizeof(int*));
129 129
	if (!tempMatrix)
130 130
	{
131 131
		WL_DEBUG_PRINT("Out of memory - expand matrix.\r\n");
......
139 139
	for (i = 0; i < m->size; i++)
140 140
		if (m->matrix[i] != NULL)
141 141
		{
142
			tempMatrix[i] = malloc(nextSize * sizeof(int));
142
		  tempMatrix[i] = (int *)malloc(nextSize * sizeof(int));
143 143
			if (!tempMatrix[i])
144 144
			{
145 145
				WL_DEBUG_PRINT("Out of memory - expand matrix 2.\r\n");
......
158 158
	m->size = nextSize;
159 159

  
160 160
	//expand the size of joined
161
	int* tempJoined = malloc(nextSize * sizeof(int));
161
	int* tempJoined = (int *)malloc(nextSize * sizeof(int));
162 162
	if (!tempJoined)
163 163
	{
164 164
		WL_DEBUG_PRINT("Out of memory - expand matrix 3.\r\n");

Also available in: Unified diff