screenshooting: Avoid void pointer arithmetic

Summary:
If we use unsigned char pointers instead of void pointers we actually
conform to the C standard.

This patch removes a reliance on a gcc extension and, as an added bonus,
also quiets a warning in the default build.

Reviewers: zmike

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2820
This commit is contained in:
Derek Foreman 2015-07-15 18:09:15 -04:00 committed by Mike Blumenkrantz
parent 7859787f73
commit 41cb2fa161
2 changed files with 8 additions and 7 deletions

View File

@ -932,7 +932,7 @@ _wl_shot_now(E_Zone *zone, E_Client *ec, const char *params)
struct wl_shm *shm;
int x, y, sw, sh, i;
int ostride, bstride;
void *dst, *d, *s;
unsigned char *dst, *d, *s;
if ((win) || (url_up)) return;
if ((!zone) && (!ec)) return;
@ -998,7 +998,8 @@ _wl_shot_now(E_Zone *zone, E_Client *ec, const char *params)
d = dst;
for (i = y; i < (y + sh); i++)
{
s = output->data + (i * ostride) + (x * sizeof(int));
s = output->data;
s += (i * ostride) + (x * sizeof(int));
memcpy(d, s, bstride);
d += bstride;
}

View File

@ -623,7 +623,7 @@ _drm_read_pixels(E_Comp_Wl_Output *output, void *pixels)
Ecore_Drm_Fb *fb;
const Eina_List *drm_devs, *l;
int i = 0, bstride;
void *s;
unsigned char *s, *d = pixels;
drm_devs = ecore_drm_devices_get();
EINA_LIST_FOREACH(drm_devs, l, dev)
@ -636,13 +636,13 @@ _drm_read_pixels(E_Comp_Wl_Output *output, void *pixels)
if (!fb) return;
bstride = output->w * sizeof(int);
s = fb->mmap;
for (i = output->y; i < output->y + output->h; i++)
{
s = fb->mmap + (fb->stride * i) + (output->x * sizeof(int));
memcpy(pixels, s, (output->w * sizeof(int)));
pixels += bstride;
s = fb->mmap;
s += (fb->stride * i) + (output->x * sizeof(int));
memcpy(d, s, (output->w * sizeof(int)));
d += bstride;
}
}