summaryrefslogtreecommitdiff
path: root/src/lib/eina/eina_accessor.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-05-12 16:55:59 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2020-05-12 16:55:59 +0200
commitef3a09499f918d575493915fd80f0d6bb232fb88 (patch)
tree4e068017a5ed9fc3269981cc5fff825e714eb8a7 /src/lib/eina/eina_accessor.c
parent6417b35ad46060f5ad5ebb42a19409d67e785714 (diff)
build: fix void* use in pointer maths
Summary: void* is an invalid type for calculating pointer offsets, so ensure that this is always cast to something else (e.g., char*) in the few cases where it's been misused Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11816
Diffstat (limited to '')
-rw-r--r--src/lib/eina/eina_accessor.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/eina/eina_accessor.c b/src/lib/eina/eina_accessor.c
index 67494987a9..812da5c9c1 100644
--- a/src/lib/eina/eina_accessor.c
+++ b/src/lib/eina/eina_accessor.c
@@ -205,20 +205,20 @@ struct _Eina_Accessor_CArray_Length
205static Eina_Bool 205static Eina_Bool
206eina_carray_length_accessor_get_at(Eina_Accessor_CArray_Length *accessor, unsigned int idx, void **data) 206eina_carray_length_accessor_get_at(Eina_Accessor_CArray_Length *accessor, unsigned int idx, void **data)
207{ 207{
208 if (accessor->array + idx*accessor->step >= accessor->end) 208 if ((char*)accessor->array + idx*accessor->step >= (char*)accessor->end)
209 return EINA_FALSE; 209 return EINA_FALSE;
210 210
211 memcpy(data, (void*) accessor->array + idx*accessor->step, accessor->step); 211 memcpy(data, (char*) accessor->array + idx*accessor->step, accessor->step);
212 212
213 return EINA_TRUE; 213 return EINA_TRUE;
214} 214}
215static Eina_Bool 215static Eina_Bool
216eina_carray_length_accessor_ptr_get_at(Eina_Accessor_CArray_Length *accessor, unsigned int idx, void **data) 216eina_carray_length_accessor_ptr_get_at(Eina_Accessor_CArray_Length *accessor, unsigned int idx, void **data)
217{ 217{
218 if (accessor->array + idx*accessor->step >= accessor->end) 218 if ((char*)accessor->array + idx*accessor->step >= (char*)accessor->end)
219 return EINA_FALSE; 219 return EINA_FALSE;
220 220
221 *data = (((void*)accessor->array) + idx*accessor->step); 221 *data = (((char*)accessor->array) + idx*accessor->step);
222 222
223 return EINA_TRUE; 223 return EINA_TRUE;
224} 224}
@@ -246,7 +246,7 @@ eina_carray_length_accessor_new(void** array, unsigned int step, unsigned int le
246 EINA_MAGIC_SET(&accessor->accessor, EINA_MAGIC_ACCESSOR); 246 EINA_MAGIC_SET(&accessor->accessor, EINA_MAGIC_ACCESSOR);
247 247
248 accessor->array = array; 248 accessor->array = array;
249 accessor->end = accessor->array + length * step; 249 accessor->end = (void**)((char*)accessor->array + length * step);
250 accessor->step = step; 250 accessor->step = step;
251 251
252 accessor->accessor.version = EINA_ACCESSOR_VERSION; 252 accessor->accessor.version = EINA_ACCESSOR_VERSION;
@@ -269,7 +269,7 @@ eina_carray_length_ptr_accessor_new(void** array, unsigned int step, unsigned in
269 EINA_MAGIC_SET(&accessor->accessor, EINA_MAGIC_ACCESSOR); 269 EINA_MAGIC_SET(&accessor->accessor, EINA_MAGIC_ACCESSOR);
270 270
271 accessor->array = array; 271 accessor->array = array;
272 accessor->end = accessor->array + length * step; 272 accessor->end = (void**)((char*)accessor->array + length * step);
273 accessor->step = step; 273 accessor->step = step;
274 274
275 accessor->accessor.version = EINA_ACCESSOR_VERSION; 275 accessor->accessor.version = EINA_ACCESSOR_VERSION;