eina inarray accessor - use right type in parameter
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Fri, 28 Jul 2017 10:54:13 +0000 (19:54 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Fri, 28 Jul 2017 23:55:27 +0000 (08:55 +0900)
this actually wasn't a bug that would cause a crash. cloning an array
access would fail as the magic check would find its an accessor not an
array. indeed a bug... but we never used this anywhere i can find.

this was cast to the correct func ptr callabck in the accessor struct
as the clone method though.. thus everyhting was happy with it
seemingly.

found by PVS studio

@fix

src/lib/eina/eina_array.c

index 99891ad..e439450 100644 (file)
@@ -173,17 +173,16 @@ eina_array_accessor_free(Eina_Accessor_Array *it)
 }
 
 static Eina_Accessor *
-eina_array_accessor_clone(const Eina_Array *array)
+eina_array_accessor_clone(const Eina_Accessor_Array *it)
 {
    Eina_Accessor_Array *ac;
 
-   EINA_SAFETY_ON_NULL_RETURN_VAL(array, NULL);
-   EINA_MAGIC_CHECK_ARRAY(array);
+   EINA_MAGIC_CHECK_ARRAY_ACCESSOR(it, NULL);
 
    ac = calloc(1, sizeof (Eina_Accessor_Array));
    if (!ac) return NULL;
 
-   memcpy(ac, array, sizeof(Eina_Accessor_Array));
+   memcpy(ac, it, sizeof(Eina_Accessor_Array));
 
    return &ac->accessor;
 }