cleanup: simple clean of "comparison between signed and unsigned errors"
authorbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 18 Sep 2010 23:07:31 +0000 (23:07 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 18 Sep 2010 23:07:31 +0000 (23:07 +0000)
not much to see here, please review but these are simple changes.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@52426 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

16 files changed:
src/lib/Evas.h
src/lib/cserve/evas_cs_client.c
src/lib/cserve/evas_cs_server.c
src/lib/engines/common/evas_image_load.c
src/lib/engines/common/evas_image_scalecache.c
src/lib/engines/common/evas_line_main.c
src/lib/engines/common_8/evas_soft8_dither_mask.c
src/lib/file/evas_module.c
src/lib/include/evas_common_soft8.h
src/modules/engines/buffer/evas_engine.h
src/modules/engines/gl_x11/evas_x_main.c
src/modules/engines/software_8_x11/evas_x_buffer.c
src/modules/engines/software_x11/evas_xlib_outbuf.c
src/modules/engines/xrender_x11/evas_engine_xlib_render.c
src/modules/loaders/tiff/evas_image_load_tiff.c
src/modules/loaders/xpm/evas_image_load_xpm.c

index d133474..a13e94f 100644 (file)
@@ -324,7 +324,7 @@ struct _Evas_Native_Surface
    union {
       struct {
          void *visual;
-         long  pixmap;
+         unsigned long  pixmap;
       } x11;
       struct { /* padding data for future use - have space for 8 pointers */
          void *d[8];
index 654955e..6fe8b9f 100644 (file)
@@ -515,7 +515,8 @@ evas_cserve_raw_info_get(void)
    if (!cserve) return NULL;
    if (!server_send(cserve, 0, OP_GETINFO, 0, NULL)) return NULL;
    rep = (Op_Getinfo_Reply *)server_read(cserve, 0, &opcode, &size);
-   if ((rep) && (opcode == OP_GETINFO) && (size >= sizeof(Op_Getinfo_Reply)))
+   if ((rep) && (opcode == OP_GETINFO) &&
+       (size >= (int)sizeof(Op_Getinfo_Reply)))
      {
         return rep;
      }
index 2076059..ce428aa 100644 (file)
@@ -214,11 +214,11 @@ server_parse(Server *s, Client *c)
    int *ints;
    unsigned char *data, *newbuf;
 
-   if (c->inbufsize < sizeof(int)) return 0;
+   if (c->inbufsize < (int)sizeof(int)) return 0;
    ints = (int *)((c->inbuf));
    if ((ints[0] < 0) || (ints[0] > (1024 * 1024)))
      return 0;
-   if (c->inbufsize < (ints[0] + (sizeof(int) * 3)))
+   if (c->inbufsize < (ints[0] + ((int)sizeof(int) * 3)))
      {
         return 0;
      }
index 08b2771..37dbfe0 100644 (file)
@@ -75,7 +75,7 @@ evas_common_load_rgba_image_module_from_file(Image_Entry *ie)
    const char           *loader = NULL;
    Evas_Module          *em;
    char                 *dot;
-   int                   i;
+   unsigned int          i;
    int                   ret = EVAS_LOAD_ERROR_NONE;
    struct evas_image_foreach_loader_data fdata;
 
index 132d00d..8c50587 100644 (file)
@@ -32,10 +32,11 @@ struct _Scaleitem
    unsigned long long usage;
    unsigned long long usage_count;
    RGBA_Image *im, *parent_im;
-   int src_x, src_y, src_w, src_h;
-   int dst_w, dst_h;
-   int flop;
-   int size_adjust;
+   int src_x, src_y;
+   unsigned int src_w, src_h;
+   unsigned int dst_w, dst_h;
+   unsigned int flop;
+   unsigned int size_adjust;
 #ifdef EVAS_FRAME_QUEUING
    RWLK(lock);
 #endif
@@ -51,14 +52,14 @@ static unsigned long long use_counter = 0;
 static LK(cache_lock);
 #endif
 static Eina_Inlist *cache_list = NULL;
-static int cache_size = 0;
+static unsigned int cache_size = 0;
 static int init = 0;
 
-static int max_cache_size = SCALE_CACHE_SIZE;
-static int max_dimension = MAX_SCALECACHE_DIM;
-static int max_flop_count = MAX_FLOP_COUNT;
-static int max_scale_items = MAX_SCALEITEMS;
-static int min_scale_uses = MIN_SCALE_USES;
+static unsigned int max_cache_size = SCALE_CACHE_SIZE;
+static unsigned int max_dimension = MAX_SCALECACHE_DIM;
+static unsigned int max_flop_count = MAX_FLOP_COUNT;
+static unsigned int max_scale_items = MAX_SCALEITEMS;
+static unsigned int min_scale_uses = MIN_SCALE_USES;
 #endif
 
 void
@@ -207,8 +208,8 @@ static Scaleitem *
 _sci_find(RGBA_Image *im,
           RGBA_Draw_Context *dc __UNUSED__, int smooth,
           int src_region_x, int src_region_y,
-          int src_region_w, int src_region_h,
-          int dst_region_w, int dst_region_h)
+          unsigned int src_region_w, unsigned int src_region_h,
+          unsigned int dst_region_w, unsigned int dst_region_h)
 {
    Eina_List *l;
    Scaleitem *sci;
@@ -331,7 +332,7 @@ _cache_prune(Scaleitem *notsci, Eina_Bool copies_only)
 #endif
 
 EAPI void
-evas_common_rgba_image_scalecache_size_set(int size)
+evas_common_rgba_image_scalecache_size_set(unsigned int size)
 {
 #ifdef SCALECACHE
    LKL(cache_lock);
@@ -344,7 +345,7 @@ evas_common_rgba_image_scalecache_size_set(int size)
 #endif   
 }
 
-EAPI int
+EAPI unsigned int
 evas_common_rgba_image_scalecache_size_get(void)
 {
 #ifdef SCALECACHE
@@ -685,7 +686,7 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
           }
         else
           {
-             if (sci->flop > 0) sci->flop -= FLOP_DEL;
+             if (sci->flop >= FLOP_DEL) sci->flop -= FLOP_DEL;
           }
 //        INF("use cached!");
 #ifdef EVAS_FRAME_QUEUING
index 3db94b0..92548df 100644 (file)
@@ -16,10 +16,11 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
 
 
 #define IN_RANGE(x, y, w, h) \
-( ((unsigned)(x) < (w)) && ((unsigned)(y) < (h)) )
+  ( ((unsigned)(x) < (unsigned)(w)) && ((unsigned)(y) < (unsigned)(h)) )
 
-#define IN_RECT(x, y, rx, ry, rw, rh) \
-( ((unsigned)((x) - (rx)) < (rw)) && ((unsigned)((y) - (ry)) < (rh)) )
+#define IN_RECT(x, y, rx, ry, rw, rh)          \
+( ((unsigned)((x) - (rx)) < (unsigned)(rw)) && \
+  ((unsigned)((y) - (ry)) < (unsigned)(rh)) )
 
 #define EXCHANGE_POINTS(x0, y0, x1, y1) \
 { \
@@ -609,12 +610,12 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
                if ((py < -1) && (dely < 0)) return;
                if ((py > by) && (dely > 0)) return;
              }
-           if ((unsigned)(px) < clw)
+           if ((px) < clw)
              {
                aa = ((yy - (y << 16)) >> 8);
-               if ((unsigned)(py) < clh)
+               if ((py) < clh)
                   pfunc(0, 255 - aa, color, p);
-               if ((unsigned)(py + 1) < clh)
+               if ((py + 1) < clh)
                   pfunc(0, aa, color, p + dstw);
              }
            yy += dyy;
@@ -644,12 +645,12 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
            if ((px < -1) && (delx < 0)) return;
            if ((px > rx) && (delx > 0)) return;
          }
-       if ((unsigned)(py) < clh)
+       if ((py) < clh)
          {
            aa = ((xx - (x << 16)) >> 8);
-           if ((unsigned)(px) < clw)
+           if ((px) < clw)
                pfunc(0, 255 - aa, color, p);
-           if ((unsigned)(px + 1) < clw)
+           if ((px + 1) < clw)
                pfunc(0, aa, color, p + 1);
          }
        xx += dxx;
index c06968c..d12b139 100644 (file)
@@ -45,7 +45,7 @@ evas_common_soft8_image_convert_from_rgba(Soft8_Image * im, const DATA32 * src)
    const DATA32 *sp;
    DATA8 *dp;
    DATA8 *ap;
-   int y;
+   unsigned int y;
 
    sp = src;
    dp = im->pixels;
@@ -89,7 +89,7 @@ evas_common_soft8_image_convert_from_rgb(Soft8_Image * im, const DATA32 * src)
 {
    const DATA32 *sp;
    DATA8 *dp;
-   int y;
+   unsigned int y;
 
    sp = src;
    dp = im->pixels;
index 4906e7f..862ca9f 100644 (file)
@@ -269,7 +269,7 @@ evas_module_register(const Evas_Module_Api *module, Evas_Module_Type type)
 {
    Evas_Module *em;
 
-   if (type < 0 || type > 3) return EINA_FALSE;
+   if ((unsigned int)type > 3) return EINA_FALSE;
    if (module->version != EVAS_MODULE_API_VERSION) return EINA_FALSE;
    if (!module) return EINA_FALSE;
 
@@ -297,7 +297,7 @@ evas_module_unregister(const Evas_Module_Api *module, Evas_Module_Type type)
 {
    Evas_Module *em;
 
-   if (type < 0 || type > 3) return EINA_FALSE;
+   if ((unsigned int)type > 3) return EINA_FALSE;
    if (!module) return EINA_FALSE;
 
    em = eina_hash_find(evas_modules[type], module->name);
@@ -339,7 +339,7 @@ evas_module_find_type(Evas_Module_Type type, const char *name)
    Eina_Module *en;
    Eina_List *l;
 
-   if (type < 0 || type > 3) return NULL;
+   if ((unsigned int)type > 3) return NULL;
 
    em = eina_hash_find(evas_modules[type], name);
    if (em) return em;
@@ -382,7 +382,8 @@ evas_module_find_type(Evas_Module_Type type, const char *name)
 Evas_Module *
 evas_module_engine_get(int render_method)
 {
-   if (render_method <= 0 || render_method > eina_array_count_get(evas_engines))
+   if ((render_method <= 0) ||
+       ((unsigned int)render_method > eina_array_count_get(evas_engines)))
      return NULL;
    return eina_array_data_get(evas_engines, render_method - 1);
 }
index ee09301..8946e22 100644 (file)
@@ -114,12 +114,10 @@ extern "C" {
 #define pld(addr, off)
 #endif /* __ARMEL__ */
 
-static inline int
-_calc_stride(int w)
+static inline unsigned int
+_calc_stride(unsigned int w)
 {
-   int pad;
-
-   pad = w % 4;
+   unsigned int pad = w % 4;
    if (!pad)  return w;
    else return w + 4 - pad;
 }
index 32577cf..21c988c 100644 (file)
@@ -51,7 +51,7 @@ struct _Outbuf
    Outbuf_Depth                  depth;
 
    void                         *dest;
-   int                           dest_row_bytes;
+   unsigned int                  dest_row_bytes;
 
    int                           alpha_level;
    DATA32                        color_key;
index 8728973..8b3724b 100644 (file)
@@ -291,7 +291,7 @@ eng_window_new(Display *disp,
              fprintf(stderr, "renderer: %s\n", renderer);
              fprintf(stderr, "version: %s\n", version);
           }
-        if (strstr(vendor, "NVIDIA"))
+        if (strstr((const char*)vendor, "NVIDIA"))
            // FIXME: also same as tegra2 - maybe check renderer too
            // 
            // vendor: NVIDIA Corporation
index 6b5d056..a2c40b1 100644 (file)
@@ -63,12 +63,12 @@ evas_software_8_x11_x_output_buffer_new(xcb_connection_t * c,
                                                 depth, NULL, ~0, NULL);
              if (xob->xim)
                {
-                  xob->shm_info->shmid = shmget(IPC_PRIVATE,
-                                                xob->xim->size,
-                                                IPC_CREAT | 0777);
+                  int shmid = shmget
+                    (IPC_PRIVATE, xob->xim->size, IPC_CREAT | 0777);
 
-                  if (xob->shm_info->shmid >= 0)
+                  if (shmid >= 0)
                     {
+                       xob->shm_info->shmid = shmid;
                        xob->shm_info->shmaddr = xob->xim->data =
                            shmat(xob->shm_info->shmid, 0, 0);
 
index 7274c1a..cc90686 100644 (file)
@@ -23,7 +23,7 @@ struct _Outbuf_Region
 static Eina_List *shmpool = NULL;
 static int shmsize = 0;
 static int shmmemlimit = 10 * 1024 * 1024;
-static int shmcountlimit = 32;
+static const unsigned int shmcountlimit = 32;
 
 #ifdef EVAS_FRAME_QUEUING
 static LK(lock_shmpool);
@@ -357,7 +357,7 @@ evas_software_xlib_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
                       buf->priv.mask.r,
                       buf->priv.mask.g,
                       buf->priv.mask.b,
-                      buf->priv.pal ? buf->priv.pal->colors : -1);
+                      buf->priv.pal ? (int)buf->priv.pal->colors : -1);
             }
        }
       evas_software_xlib_outbuf_drawable_set(buf, draw);
index 404567b..8f1d2c7 100644 (file)
@@ -393,7 +393,7 @@ _xr_xlib_render_surface_composite(Xrender_Surface *srs, Xrender_Surface *drs, RG
 
    if ((dc) && (dc->mul.use))
      {
-       int r, g, b, a;
+       unsigned int r, g, b, a;
 
        if ((op == PictOpOver) && (!dc->mul.col)) return;
        a = dc->mul.col >> 24;
index f62c687..c5ef0c9 100644 (file)
@@ -86,16 +86,16 @@ static void
 raster(TIFFRGBAImage_Extra * img, uint32 * rast,
        uint32 x, uint32 y, uint32 w, uint32 h)
 {
-   int                 image_width, image_height;
+   unsigned int        image_width, image_height;
    uint32             *pixel, pixel_value;
-   int                 i, j, dy, rast_offset;
+   int                 i, dy, rast_offset;
    DATA32             *buffer_pixel, *buffer = evas_cache_image_pixels(img->image);
    int                 alpha_premult = 0;
 
    image_width = img->image->w;
    image_height = img->image->h;
 
-   dy = h > y ? -1 : y - h;
+   dy = h > y ? -1 : ((int)y - (int)h);
 
    /* rast seems to point to the beginning of the last strip processed */
    /* so you need use negative offsets. Bizzare. Someone please check this */
@@ -106,12 +106,14 @@ raster(TIFFRGBAImage_Extra * img, uint32 * rast,
      alpha_premult = 1;
    for (i = y, rast_offset = 0; i > dy; i--, rast_offset--)
      {
+        unsigned int j;
+
         pixel = rast + (rast_offset * image_width);
         buffer_pixel = buffer + ((((image_height - 1) - i) * image_width) + x);
 
         for (j = 0; j < w; j++)
           {
-            int a, r, g, b;
+            unsigned int a, r, g, b;
 
              pixel_value = (*(pixel++));
             a = TIFFGetA(pixel_value);
index ce3f2a2..2350c19 100644 (file)
@@ -625,7 +625,7 @@ evas_image_load_file_xpm(Image_Entry *ie, const char *file, const char *key __UN
              if (!tl) break;
             line = tl;
           }
-        if (((ptr) && ((ptr - evas_cache_image_pixels(ie)) >= (w * h * sizeof(DATA32)))) ||
+        if (((ptr) && ((ptr - evas_cache_image_pixels(ie)) >= (w * h * (int)sizeof(DATA32)))) ||
             ((context > 1) && (count >= pixels)))
          break;
      }