discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=41cb2fa161f4d5dc154717dd8b8c2b325329777c

commit 41cb2fa161f4d5dc154717dd8b8c2b325329777c
Author: Derek Foreman <der...@osg.samsung.com>
Date:   Wed Jul 15 18:09:15 2015 -0400

    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
---
 src/modules/shot/e_mod_main.c   |  5 +++--
 src/modules/wl_drm/e_mod_main.c | 10 +++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/modules/shot/e_mod_main.c b/src/modules/shot/e_mod_main.c
index 1ab6c48..96ed891 100644
--- a/src/modules/shot/e_mod_main.c
+++ b/src/modules/shot/e_mod_main.c
@@ -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;
                }
diff --git a/src/modules/wl_drm/e_mod_main.c b/src/modules/wl_drm/e_mod_main.c
index 7314b07..468f674 100644
--- a/src/modules/wl_drm/e_mod_main.c
+++ b/src/modules/wl_drm/e_mod_main.c
@@ -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;
      }
 }
 

-- 


Reply via email to