This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.

The branch, next has been updated
       via  bdbea502ef052c25ae495de93666fb3539943222 (commit)
       via  8c29ebd6c005bbe8aa5e54df833d83c0d1dc622c (commit)
       via  5dedcc569470cf4708c70879aa38e275b425c243 (commit)
       via  1616b20c2dee335cc171e6e736c0a4c9c28833fc (commit)
       via  96f20c89afeffeb64b266ad2b12f724883e406aa (commit)
       via  d75511e3bf9b9caf057f6380205d6e5cfaa05050 (commit)
       via  b3ab9f482d99fed8db86bd90919cda89c7a8e518 (commit)
       via  be57a73a48acbcd4462de77e7d76e057315d2003 (commit)
       via  8959729df1a7b3977889897fd005246ac795f11f (commit)
       via  9c436eeff50f48723dafd39af6e0fd60e3ab887e (commit)
       via  e3358d3595125ea70a927a411187aa5dd6c4a95f (commit)
      from  f85ee0137e13521e5a8940740e04e238787350c2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/bdbea502ef052c25ae495de93666fb3539943222

commit bdbea502ef052c25ae495de93666fb3539943222
Author: Christophe CURIS <christophe.cu...@free.fr>
Date:   Sat Jun 14 19:34:09 2014 +0200

    wrlib: add explicit type definition in API to allow compiler Type Checks 
(3/3)
    
    When defining enums as types instead of simple enums allows to use these
    types at the places where the corresponding enum values are expected, then
    allowing the compiler to check that, potentially reporting incorrect use
    of values to the user.
    
    This patch adds the type for the gradient style for RRender*Gradient.
    
    Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>

diff --git a/WPrefs.app/Appearance.c b/WPrefs.app/Appearance.c
index 8d5020c5..b372ceac 100644
--- a/WPrefs.app/Appearance.c
+++ b/WPrefs.app/Appearance.c
@@ -556,7 +556,7 @@ static Pixmap renderTexture(WMScreen * scr, WMPropList * 
texture, int width, int
 
                image = RRenderInterwovenGradient(width, height, c1, t1, c2, 
t2);
        } else if (strcasecmp(&type[1], "gradient") == 0) {
-               int style;
+               RGradientStyle style;
                RColor rcolor2;
 
                switch (toupper(type[0])) {
@@ -580,7 +580,7 @@ static Pixmap renderTexture(WMScreen * scr, WMPropList * 
texture, int width, int
 
                image = RRenderGradient(width, height, &rcolor, &rcolor2, 
style);
        } else if (strcasecmp(&type[2], "gradient") == 0 && toupper(type[0]) == 
'T') {
-               int style;
+               RGradientStyle style;
                RColor rcolor2;
                int i;
                RImage *grad = NULL;
@@ -615,7 +615,7 @@ static Pixmap renderTexture(WMScreen * scr, WMPropList * 
texture, int width, int
                RReleaseImage(grad);
 
        } else if (strcasecmp(&type[2], "gradient") == 0 && toupper(type[0]) == 
'M') {
-               int style;
+               RGradientStyle style;
                RColor **colors;
                int i, j;
 
diff --git a/util/wmsetbg.c b/util/wmsetbg.c
index 9f862a24..785aa1ba 100644
--- a/util/wmsetbg.c
+++ b/util/wmsetbg.c
@@ -326,7 +326,7 @@ static BackgroundTexture *parseTexture(RContext * rc, char 
*text)
                RColor color1, color2;
                RImage *image;
                Pixmap pixmap;
-               int gtype;
+               RGradientStyle gtype;
                int iwidth, iheight;
 
                GETSTRORGOTO(val, tmp, 1, error);
@@ -396,7 +396,7 @@ static BackgroundTexture *parseTexture(RContext * rc, char 
*text)
                RImage *image;
                Pixmap pixmap;
                int i, j;
-               int gtype;
+               RGradientStyle gtype;
                int iwidth, iheight;
 
                colors = malloc(sizeof(RColor *) * (count - 1));
@@ -587,7 +587,7 @@ static BackgroundTexture *parseTexture(RContext * rc, char 
*text)
                Pixmap pixmap;
                int opaq;
                char *file;
-               int gtype;
+               RGradientStyle gtype;
                int twidth, theight;
 
                GETSTRORGOTO(val, file, 1, error);
diff --git a/wrlib/gradient.c b/wrlib/gradient.c
index 930d1225..7a07fe33 100644
--- a/wrlib/gradient.c
+++ b/wrlib/gradient.c
@@ -39,7 +39,7 @@ static RImage *renderMHGradient(unsigned width, unsigned 
height, RColor ** color
 static RImage *renderMVGradient(unsigned width, unsigned height, RColor ** 
colors, int count);
 static RImage *renderMDGradient(unsigned width, unsigned height, RColor ** 
colors, int count);
 
-RImage *RRenderMultiGradient(unsigned width, unsigned height, RColor ** 
colors, int style)
+RImage *RRenderMultiGradient(unsigned width, unsigned height, RColor **colors, 
RGradientStyle style)
 {
        int count;
 
@@ -65,7 +65,7 @@ RImage *RRenderMultiGradient(unsigned width, unsigned height, 
RColor ** colors,
        return NULL;
 }
 
-RImage *RRenderGradient(unsigned width, unsigned height, const RColor * from, 
const RColor * to, int style)
+RImage *RRenderGradient(unsigned width, unsigned height, const RColor *from, 
const RColor *to, RGradientStyle style)
 {
        switch (style) {
        case RHorizontalGradient:
diff --git a/wrlib/wraster.h b/wrlib/wraster.h
index 4bb1056a..974688d1 100644
--- a/wrlib/wraster.h
+++ b/wrlib/wraster.h
@@ -254,11 +254,11 @@ enum {
 /* 2 pixel width */
 #define RBEV_RAISED3   3
 
-enum {
+typedef enum {
     RHorizontalGradient = 2,
     RVerticalGradient = 3,
     RDiagonalGradient = 4
-};
+} RGradientStyle;
 /* for backwards compatibility */
 #define RGRD_HORIZONTAL  RHorizontalGradient
 #define RGRD_VERTICAL  RVerticalGradient
@@ -426,11 +426,11 @@ void RFillImage(RImage *image, const RColor *color);
 void RBevelImage(RImage *image, int bevel_type);
 
 RImage *RRenderGradient(unsigned width, unsigned height, const RColor *from,
-                        const RColor *to, int style);
+                        const RColor *to, RGradientStyle style);
 
 
 RImage *RRenderMultiGradient(unsigned width, unsigned height, RColor **colors,
-                             int style);
+                             RGradientStyle style);
 
 
 RImage *RRenderInterwovenGradient(unsigned width, unsigned height,

http://repo.or.cz/w/wmaker-crm.git/commit/8c29ebd6c005bbe8aa5e54df833d83c0d1dc622c

commit 8c29ebd6c005bbe8aa5e54df833d83c0d1dc622c
Author: Christophe CURIS <christophe.cu...@free.fr>
Date:   Sat Jun 14 19:34:08 2014 +0200

    wrlib: add explicit type definition in API to allow compiler Type Checks 
(2/3)
    
    When defining enums as types instead of simple enums allows to use these
    types at the places where the corresponding enum values are expected, then
    allowing the compiler to check that, potentially reporting incorrect use
    of values to the user.
    
    This patch adds the types for the drawing operations used by the functions
    who drawing shapes into an RImage.
    
    Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>

diff --git a/wrlib/draw.c b/wrlib/draw.c
index a9a96260..bf44f8c3 100644
--- a/wrlib/draw.c
+++ b/wrlib/draw.c
@@ -104,7 +104,7 @@ void RPutPixel(RImage *image, int x, int y, const RColor 
*color)
        }
 }
 
-static void operatePixel(RImage * image, int ofs, int operation, const RColor 
* color)
+static void operatePixel(RImage *image, int ofs, RPixelOperation operation, 
const RColor *color)
 {
        unsigned char *sr, *sg, *sb, *sa;
        register int alpha, nalpha, tmp;
@@ -170,7 +170,7 @@ static void operatePixel(RImage * image, int ofs, int 
operation, const RColor *
        }
 }
 
-void ROperatePixel(RImage * image, int operation, int x, int y, const RColor * 
color)
+void ROperatePixel(RImage *image, RPixelOperation operation, int x, int y, 
const RColor *color)
 {
        int ofs;
 
@@ -184,7 +184,7 @@ void ROperatePixel(RImage * image, int operation, int x, 
int y, const RColor * c
        operatePixel(image, ofs, operation, color);
 }
 
-void RPutPixels(RImage * image, const RPoint * points, int npoints, int mode, 
const RColor * color)
+void RPutPixels(RImage *image, const RPoint *points, int npoints, 
RCoordinatesMode mode, const RColor *color)
 {
        register int x, y, i;
 
@@ -205,7 +205,9 @@ void RPutPixels(RImage * image, const RPoint * points, int 
npoints, int mode, co
        }
 }
 
-void ROperatePixels(RImage * image, int operation, const RPoint * points, int 
npoints, int mode, const RColor * color)
+void ROperatePixels(RImage *image, RPixelOperation operation,
+                    const RPoint *points, int npoints, RCoordinatesMode mode,
+                    const RColor *color)
 {
        register int x, y, i;
 
@@ -287,7 +289,8 @@ static Bool clipLineInRectangle(int xmin, int ymin, int 
xmax, int ymax, int *x1,
  * This routine is a generic drawing routine, based on Bresenham's line
  * drawing algorithm.
  */
-static int genericLine(RImage * image, int x0, int y0, int x1, int y1, const 
RColor * color, int operation, int polyline)
+static int genericLine(RImage *image, int x0, int y0, int x1, int y1, const 
RColor *color,
+                       RPixelOperation operation, int polyline)
 {
        int i, err, du, dv, du2, dv2, uofs, vofs, last;
 
@@ -382,12 +385,12 @@ int RDrawLine(RImage * image, int x0, int y0, int x1, int 
y1, const RColor * col
        return genericLine(image, x0, y0, x1, y1, color, RNormalOperation, 
False);
 }
 
-int ROperateLine(RImage * image, int operation, int x0, int y0, int x1, int 
y1, const RColor * color)
+int ROperateLine(RImage *image, RPixelOperation operation, int x0, int y0, int 
x1, int y1, const RColor *color)
 {
        return genericLine(image, x0, y0, x1, y1, color, operation, False);
 }
 
-void RDrawLines(RImage * image, const RPoint * points, int npoints, int mode, 
const RColor * color)
+void RDrawLines(RImage *image, const RPoint *points, int npoints, 
RCoordinatesMode mode, const RColor *color)
 {
        register int x1, y1, x2, y2, i;
 
@@ -425,7 +428,9 @@ void RDrawLines(RImage * image, const RPoint * points, int 
npoints, int mode, co
        genericLine(image, x1, y1, x2, y2, color, RNormalOperation, i);
 }
 
-void ROperateLines(RImage * image, int operation, const RPoint * points, int 
npoints, int mode, const RColor * color)
+void ROperateLines(RImage *image, RPixelOperation operation,
+                   const RPoint *points, int npoints, RCoordinatesMode mode,
+                   const RColor *color)
 {
        register int x1, y1, x2, y2, i;
 
@@ -463,7 +468,7 @@ void ROperateLines(RImage * image, int operation, const 
RPoint * points, int npo
        genericLine(image, x1, y1, x2, y2, color, operation, i);
 }
 
-void ROperateRectangle(RImage *image, int operation, int x0, int y0, int x1, 
int y1, const RColor *color)
+void ROperateRectangle(RImage *image, RPixelOperation operation, int x0, int 
y0, int x1, int y1, const RColor *color)
 {
        int y;
 
@@ -472,7 +477,7 @@ void ROperateRectangle(RImage *image, int operation, int 
x0, int y0, int x1, int
        }
 }
 
-void RDrawSegments(RImage * image, const RSegment * segs, int nsegs, const 
RColor * color)
+void RDrawSegments(RImage *image, const RSegment *segs, int nsegs, const 
RColor *color)
 {
        register int i;
 
@@ -484,7 +489,7 @@ void RDrawSegments(RImage * image, const RSegment * segs, 
int nsegs, const RColo
        }
 }
 
-void ROperateSegments(RImage * image, int operation, const RSegment * segs, 
int nsegs, const RColor * color)
+void ROperateSegments(RImage *image, RPixelOperation operation, const RSegment 
*segs, int nsegs, const RColor *color)
 {
        register int i;
 
diff --git a/wrlib/wraster.h b/wrlib/wraster.h
index 66443e10..4bb1056a 100644
--- a/wrlib/wraster.h
+++ b/wrlib/wraster.h
@@ -225,19 +225,19 @@ typedef struct RXImage {
 
 
 /* note that not all operations are supported in all functions */
-enum {
+typedef enum {
     RClearOperation,          /* clear with 0 */
     RCopyOperation,
     RNormalOperation,         /* same as combine */
     RAddOperation,
     RSubtractOperation
-};
+} RPixelOperation;
 
 
-enum {
+typedef enum {
     RAbsoluteCoordinates = 0,
     RRelativeCoordinates = 1
-};
+} RCoordinatesMode;
 
 
 enum {
@@ -382,30 +382,30 @@ Bool RGetPixel(RImage *image, int x, int y, RColor 
*color);
 
 void RPutPixel(RImage *image, int x, int y, const RColor *color);
 
-void ROperatePixel(RImage *image, int operation, int x, int y, const RColor 
*color);
+void ROperatePixel(RImage *image, RPixelOperation operation, int x, int y, 
const RColor *color);
 
-void RPutPixels(RImage *image, const RPoint *points, int npoints, int mode,
+void RPutPixels(RImage *image, const RPoint *points, int npoints, 
RCoordinatesMode mode,
                 const RColor *color);
 
-void ROperatePixels(RImage *image, int operation, const RPoint *points,
-                    int npoints, int mode, const RColor *color);
+void ROperatePixels(RImage *image, RPixelOperation operation, const RPoint 
*points,
+                    int npoints, RCoordinatesMode mode, const RColor *color);
 
 int RDrawLine(RImage *image, int x0, int y0, int x1, int y1, const RColor 
*color);
 
-int ROperateLine(RImage *image, int operation, int x0, int y0, int x1, int y1,
+int ROperateLine(RImage *image, RPixelOperation operation, int x0, int y0, int 
x1, int y1,
                  const RColor *color);
 
-void RDrawLines(RImage *image, const RPoint *points, int npoints, int mode,
+void RDrawLines(RImage *image, const RPoint *points, int npoints, 
RCoordinatesMode mode,
                 const RColor *color);
 
-void ROperateLines(RImage *image, int operation, const RPoint *points, int 
npoints,
-                   int mode, const RColor *color);
+void ROperateLines(RImage *image, RPixelOperation operation, const RPoint 
*points, int npoints,
+                   RCoordinatesMode mode, const RColor *color);
 
-void ROperateRectangle(RImage *image, int operation, int x0, int y0, int x1, 
int y1, const RColor *color);
+void ROperateRectangle(RImage *image, RPixelOperation operation, int x0, int 
y0, int x1, int y1, const RColor *color);
 
 void RDrawSegments(RImage *image, const RSegment *segs, int nsegs, const 
RColor *color);
 
-void ROperateSegments(RImage *image, int operation, const RSegment *segs, int 
nsegs,
+void ROperateSegments(RImage *image, RPixelOperation operation, const RSegment 
*segs, int nsegs,
                       const RColor *color);
 
 /*

http://repo.or.cz/w/wmaker-crm.git/commit/5dedcc569470cf4708c70879aa38e275b425c243

commit 5dedcc569470cf4708c70879aa38e275b425c243
Author: Christophe CURIS <christophe.cu...@free.fr>
Date:   Sat Jun 14 19:34:07 2014 +0200

    wrlib: add explicit type definition in API to allow compiler Type Checks 
(1/3)
    
    When defining enums as types instead of simple enums allows to use these
    types at the places where the corresponding enum values are expected, then
    allowing the compiler to check that, potentially reporting incorrect use
    of values to the user.
    
    This patch adds types for the configuration fields in the RContextAttributes
    structure.
    
    Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>

diff --git a/util/wmsetbg.c b/util/wmsetbg.c
index 6e74c534..9f862a24 100644
--- a/util/wmsetbg.c
+++ b/util/wmsetbg.c
@@ -1213,7 +1213,8 @@ int main(int argc, char **argv)
        char *back_color = "gray20";
        char *image_name = NULL;
        char *domain = "WindowMaker";
-       int update = 0, cpc = 4, render_mode = RDitheredRendering, obey_user = 
0;
+       int update = 0, cpc = 4, obey_user = 0;
+       RRenderingMode render_mode = RDitheredRendering;
        char *texture = NULL;
        int workspace = -1;
 
diff --git a/wrlib/scale.c b/wrlib/scale.c
index 3694be63..eafe40f9 100644
--- a/wrlib/scale.c
+++ b/wrlib/scale.c
@@ -247,7 +247,7 @@ static double Mitchell_filter(double t)
 static double (*filterf)(double) = Mitchell_filter;
 static double fwidth = Mitchell_support;
 
-void wraster_change_filter(int type)
+void wraster_change_filter(RScalingFilter type)
 {
        switch (type) {
        case RBoxFilter:
diff --git a/wrlib/scale.h b/wrlib/scale.h
index 887b47d6..4d2d7384 100644
--- a/wrlib/scale.h
+++ b/wrlib/scale.h
@@ -24,7 +24,7 @@
 /*
  * Function to change the smoothing filter used for image scaling 
(RSmoothScaleImage)
  */
-void wraster_change_filter(int type);
+void wraster_change_filter(RScalingFilter type);
 
 
 #endif
diff --git a/wrlib/wraster.h b/wrlib/wraster.h
index 45cbcc6b..66443e10 100644
--- a/wrlib/wraster.h
+++ b/wrlib/wraster.h
@@ -82,30 +82,43 @@ extern "C" {
 
 
 
-
+/* image display modes */
+typedef enum {
+       RDitheredRendering = 0,
+       RBestMatchRendering = 1
+} RRenderingMode;
 
 
 /* std colormap usage/creation modes */
-enum {
-    RUseStdColormap,                  /* default. fallbacks to RIgnore.. if
-    there is none defined */
-    RCreateStdColormap,
-    RIgnoreStdColormap
-};
+typedef enum {
+       RUseStdColormap,        /* default: fallbacks to RIgnore if there is 
none defined */
+       RCreateStdColormap,
+       RIgnoreStdColormap
+} RStdColormapMode;
 
 
+/* smoothed scaling filter types */
+typedef enum {
+       RBoxFilter,
+       RTriangleFilter,
+       RBellFilter,
+       RBSplineFilter,
+       RLanczos3Filter,
+       RMitchellFilter
+} RScalingFilter;
+
 
 typedef struct RContextAttributes {
     int flags;
-    int render_mode;
+    RRenderingMode render_mode;
     int colors_per_channel;           /* for PseudoColor */
     float rgamma;                     /* gamma correction for red, */
     float ggamma;                     /* green, */
     float bgamma;                     /* and blue */
     VisualID visualid;        /* visual ID to use */
     int use_shared_memory;            /* True of False */
-    int scaling_filter;
-    int standard_colormap_mode;    /* what to do with std cma */
+    RScalingFilter scaling_filter;
+    RStdColormapMode standard_colormap_mode;    /* what to do with std cma */
 } RContextAttributes;
 
 
@@ -211,24 +224,6 @@ typedef struct RXImage {
 } RXImage;
 
 
-/* image display modes */
-enum {
-    RDitheredRendering = 0,
-    RBestMatchRendering = 1
-};
-
-
-/* smoothed scaling filter types */
-enum {
-    RBoxFilter,
-    RTriangleFilter,
-    RBellFilter,
-    RBSplineFilter,
-    RLanczos3Filter,
-    RMitchellFilter
-};
-
-
 /* note that not all operations are supported in all functions */
 enum {
     RClearOperation,          /* clear with 0 */
@@ -481,4 +476,3 @@ extern int RErrorCode;
 #endif /* __cplusplus */
 
 #endif
-

http://repo.or.cz/w/wmaker-crm.git/commit/1616b20c2dee335cc171e6e736c0a4c9c28833fc

commit 1616b20c2dee335cc171e6e736c0a4c9c28833fc
Author: Christophe CURIS <christophe.cu...@free.fr>
Date:   Sat Jun 14 19:34:06 2014 +0200

    wrlib: new headers to contain definition of internal stuff
    
    Using local function prototype redefinition is dangerous, now a single
    prototype is seen in all the files that are concerned.
    
    Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>

diff --git a/wrlib/Makefile.am b/wrlib/Makefile.am
index 489b4a4e..e9f357c4 100644
--- a/wrlib/Makefile.am
+++ b/wrlib/Makefile.am
@@ -33,11 +33,13 @@ libwraster_la_SOURCES =             context.c               
misc.c                  scale.c         +       scale.h                 
rotate.c                flip.c                  convolve.c              
save_xpm.c              xutil.c         +       xutil.h                 
load_ppm.c
 
 if USE_GIF
diff --git a/wrlib/context.c b/wrlib/context.c
index 74790092..1b216a00 100644
--- a/wrlib/context.c
+++ b/wrlib/context.c
@@ -35,8 +35,8 @@
 #include <math.h>
 
 #include "wraster.h"
+#include "scale.h"
 
-extern void _wraster_change_filter(int type);
 
 static Bool bestContext(Display * dpy, int screen_number, RContext * context);
 
@@ -588,7 +588,7 @@ RContext *RCreateContext(Display * dpy, int screen_number, 
const RContextAttribu
 
        /* get configuration from environment variables */
        gatherconfig(context, screen_number);
-       _wraster_change_filter(context->attribs->scaling_filter);
+       wraster_change_filter(context->attribs->scaling_filter);
        if ((context->attribs->flags & RC_VisualID)) {
                XVisualInfo *vinfo, templ;
                int nret;
diff --git a/wrlib/convert.c b/wrlib/convert.c
index b0ab2303..23df5c66 100644
--- a/wrlib/convert.c
+++ b/wrlib/convert.c
@@ -35,12 +35,9 @@
 
 #include "wraster.h"
 #include "convert.h"
+#include "xutil.h"
 
 
-#ifdef USE_XSHM
-extern Pixmap R_CreateXImageMappedPixmap(RContext * context, RXImage * ximage);
-#endif
-
 #define NFREE(n)  if (n) free(n)
 
 #define HAS_ALPHA(I)   ((I)->format == RRGBAFormat)
diff --git a/wrlib/scale.c b/wrlib/scale.c
index d2cc1e6c..3694be63 100644
--- a/wrlib/scale.c
+++ b/wrlib/scale.c
@@ -35,6 +35,7 @@
 #include <assert.h>
 
 #include "wraster.h"
+#include "scale.h"
 
 /*
  *----------------------------------------------------------------------
@@ -246,7 +247,7 @@ static double Mitchell_filter(double t)
 static double (*filterf)(double) = Mitchell_filter;
 static double fwidth = Mitchell_support;
 
-void _wraster_change_filter(int type)
+void wraster_change_filter(int type)
 {
        switch (type) {
        case RBoxFilter:
diff --git a/wrlib/scale.h b/wrlib/scale.h
new file mode 100644
index 00000000..887b47d6
--- /dev/null
+++ b/wrlib/scale.h
@@ -0,0 +1,30 @@
+/*
+ * Raster graphics library
+ *
+ * Copyright (c) 2014 Window Maker Team
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library.
+ */
+
+#ifndef WRASTER_SCALE_H
+#define WRASTER_SCALE_H
+
+
+/*
+ * Function to change the smoothing filter used for image scaling 
(RSmoothScaleImage)
+ */
+void wraster_change_filter(int type);
+
+
+#endif
diff --git a/wrlib/xutil.c b/wrlib/xutil.c
index 3baa861d..1c3f86dc 100644
--- a/wrlib/xutil.c
+++ b/wrlib/xutil.c
@@ -36,6 +36,7 @@
 #endif                         /* USE_XSHM */
 
 #include "wraster.h"
+#include "xutil.h"
 
 #ifdef USE_XSHM
 
diff --git a/wrlib/xutil.h b/wrlib/xutil.h
new file mode 100644
index 00000000..46b148b9
--- /dev/null
+++ b/wrlib/xutil.h
@@ -0,0 +1,29 @@
+/*
+ * Raster graphics library
+ *
+ * Copyright (c) 2014 Window Maker Team
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library.
+ */
+
+#ifndef WRASTER_XUTIL_H
+#define WRASTER_XUTIL_H
+
+
+#ifdef USE_XSHM
+Pixmap R_CreateXImageMappedPixmap(RContext *context, RXImage *ximage);
+#endif
+
+
+#endif

http://repo.or.cz/w/wmaker-crm.git/commit/96f20c89afeffeb64b266ad2b12f724883e406aa

commit 96f20c89afeffeb64b266ad2b12f724883e406aa
Author: Christophe CURIS <christophe.cu...@free.fr>
Date:   Sat Jun 14 19:34:05 2014 +0200

    wrlib: return NULL if XImage could not be taken, for consistency
    
    To be consistent with RCreateXImage and because it should not be up to the
    caller to handle this, when XGetImage returns a NULL pointer then the
    function RGetXImage will also return NULL instead of an RXImage structure
    with a NULL pointer.
    
    This consistent behaviour helps fixing a memory leak in WMaker reported by
    Coverity (#50125).
    
    Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>

diff --git a/src/workspace.c b/src/workspace.c
index d58f9046..0fc6e626 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -390,10 +390,8 @@ static void showWorkspaceName(WScreen * scr, int workspace)
        }
 
        ximg = RGetXImage(scr->rcontext, scr->root_win, px, py, 
data->text->width, data->text->height);
-
-       if (!ximg || !ximg->image) {
+       if (!ximg)
                goto erro;
-       }
 
        XMapRaised(dpy, scr->workspace_name);
        XFlush(dpy);
diff --git a/wrlib/xutil.c b/wrlib/xutil.c
index 82122d4b..3baa861d 100644
--- a/wrlib/xutil.c
+++ b/wrlib/xutil.c
@@ -207,7 +207,6 @@ RXImage *RGetXImage(RContext * context, Drawable d, int x, 
int y, unsigned width
                ximg->is_shared = 0;
                ximg->image = XGetImage(context->dpy, d, x, y, width, height, 
AllPlanes, ZPixmap);
        }
-       return ximg;
 #else                          /* !USE_XSHM */
        ximg = malloc(sizeof(RXImage));
        if (!ximg) {
@@ -216,9 +215,14 @@ RXImage *RGetXImage(RContext * context, Drawable d, int x, 
int y, unsigned width
        }
 
        ximg->image = XGetImage(context->dpy, d, x, y, width, height, 
AllPlanes, ZPixmap);
+#endif                         /* !USE_XSHM */
+
+       if (ximg->image == NULL) {
+               free(ximg);
+               return NULL;
+       }
 
        return ximg;
-#endif                         /* !USE_XSHM */
 }
 
 void

http://repo.or.cz/w/wmaker-crm.git/commit/d75511e3bf9b9caf057f6380205d6e5cfaa05050

commit d75511e3bf9b9caf057f6380205d6e5cfaa05050
Author: Christophe CURIS <christophe.cu...@free.fr>
Date:   Sat Jun 14 19:34:04 2014 +0200

    wrlib: remove unnecessary variable assignation (Coverity #50258)
    
    As pointed by Coverity, this value is never used, the assignation has no
    effect, so Coverity reports that it is unnecessary complexity that is not
    compatible with code maintainability.
    
    Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>

diff --git a/wrlib/load_magick.c b/wrlib/load_magick.c
index 622276f8..3e809ba2 100644
--- a/wrlib/load_magick.c
+++ b/wrlib/load_magick.c
@@ -88,7 +88,7 @@ bye:
        /* Tidy up */
        DestroyPixelWand(bg_wand);
        MagickClearException(m_wand);
-       m_wand = DestroyMagickWand(m_wand);
+       DestroyMagickWand(m_wand);
 
        return image;
 }

http://repo.or.cz/w/wmaker-crm.git/commit/b3ab9f482d99fed8db86bd90919cda89c7a8e518

commit b3ab9f482d99fed8db86bd90919cda89c7a8e518
Author: Christophe CURIS <christophe.cu...@free.fr>
Date:   Sat Jun 14 19:34:03 2014 +0200

    wrlib: initialise value for variable to avoid possible crash (Coverity 
#50245)
    
    As pointed by Coverity, there's a free on the content of this buffer at
    function's end, but if the image's width or height is lower than 1 then we
    could reach this free before allocating anything, thus having an
    uninitialised pointer.
    
    Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>

diff --git a/wrlib/load_jpeg.c b/wrlib/load_jpeg.c
index ded519e9..64eeb481 100644
--- a/wrlib/load_jpeg.c
+++ b/wrlib/load_jpeg.c
@@ -132,6 +132,7 @@ RImage *RLoadJPEG(const char *file_name)
        jpeg_read_header(&cinfo, TRUE);
 
        if (cinfo.image_width < 1 || cinfo.image_height < 1) {
+               buffer[0] = NULL;       /* Initialize pointer to avoid spurious 
free in cleanup code */
                RErrorCode = RERR_BADIMAGEFILE;
                goto bye;
        }

http://repo.or.cz/w/wmaker-crm.git/commit/be57a73a48acbcd4462de77e7d76e057315d2003

commit be57a73a48acbcd4462de77e7d76e057315d2003
Author: Christophe CURIS <christophe.cu...@free.fr>
Date:   Sat Jun 14 19:34:02 2014 +0200

    wrlib: added a limit to the image cache size (Coverity #50223)
    
    As pointed by Coverity, environment variables cannot be considered
    trustworthy ("tainted"), so we need to make sure the values provided are
    within reasonable bounds for safe operations.
    
    Seized the opportunity to try to provide clearer name for the constants
    defining the default value.
    
    Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>

diff --git a/wrlib/load.c b/wrlib/load.c
index b31e6b25..d67a6ec0 100644
--- a/wrlib/load.c
+++ b/wrlib/load.c
@@ -46,18 +46,21 @@ typedef struct RCachedImage {
 } RCachedImage;
 
 /*
- * Size of image cache
+ * Number of image to keep in the cache
  */
 static int RImageCacheSize = -1;
 
+#define IMAGE_CACHE_DEFAULT_NBENTRIES    8
+#define IMAGE_CACHE_MAXIMUM_NBENTRIES  256
+
 /*
- * Max. size of image to store in cache
+ * Max. size of image (in pixels) to store in the cache
  */
 static int RImageCacheMaxImage = -1;   /* 0 = any size */
 
-#define IMAGE_CACHE_SIZE       8
+#define IMAGE_CACHE_DEFAULT_MAXPIXELS  (64 * 64)
+#define IMAGE_CACHE_MAXIMUM_MAXPIXELS  (256 * 256)
 
-#define IMAGE_CACHE_MAX_IMAGE  64*64
 
 static RCachedImage *RImageCache;
 
@@ -106,14 +109,19 @@ static void init_cache(void)
 
        tmp = getenv("RIMAGE_CACHE");
        if (!tmp || sscanf(tmp, "%i", &RImageCacheSize) != 1)
-               RImageCacheSize = IMAGE_CACHE_SIZE;
-
+               RImageCacheSize = IMAGE_CACHE_DEFAULT_NBENTRIES;
        if (RImageCacheSize < 0)
                RImageCacheSize = 0;
+       if (RImageCacheSize > IMAGE_CACHE_MAXIMUM_NBENTRIES)
+               RImageCacheSize = IMAGE_CACHE_MAXIMUM_NBENTRIES;
 
        tmp = getenv("RIMAGE_CACHE_SIZE");
        if (!tmp || sscanf(tmp, "%i", &RImageCacheMaxImage) != 1)
-               RImageCacheMaxImage = IMAGE_CACHE_MAX_IMAGE;
+               RImageCacheMaxImage = IMAGE_CACHE_DEFAULT_MAXPIXELS;
+       if (RImageCacheMaxImage < 0)
+               RImageCacheMaxImage = 0;
+       if (RImageCacheMaxImage > IMAGE_CACHE_MAXIMUM_MAXPIXELS)
+               RImageCacheMaxImage = IMAGE_CACHE_MAXIMUM_MAXPIXELS;
 
        if (RImageCacheSize > 0) {
                RImageCache = malloc(sizeof(RCachedImage) * RImageCacheSize);

http://repo.or.cz/w/wmaker-crm.git/commit/8959729df1a7b3977889897fd005246ac795f11f

commit 8959729df1a7b3977889897fd005246ac795f11f
Author: Christophe CURIS <christophe.cu...@free.fr>
Date:   Sat Jun 14 19:34:01 2014 +0200

    wrlib: removed macro RETRY that does not does what is expected (Coverity 
#50160)
    
    As pointed by Coverity, the behaviour of fopen/fread/fclose in case of
    error is not really what the macro RETRY assumes. So the macro is removed
    and appropriate action is implemented.
    
    Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>

diff --git a/wrlib/load.c b/wrlib/load.c
index 94308545..b31e6b25 100644
--- a/wrlib/load.c
+++ b/wrlib/load.c
@@ -37,9 +37,6 @@
 #include "wraster.h"
 #include "imgformat.h"
 
-#define        RETRY( x )      do {                            -               
                x;                      -                       } while (errno 
== EINTR);
 
 typedef struct RCachedImage {
        RImage *image;
@@ -320,19 +317,23 @@ static WRImgFormat identFile(const char *path)
 
        assert(path != NULL);
 
-       RETRY( file = fopen(path, "rb") )
-       if (file == NULL) {
-               RErrorCode = RERR_OPEN;
-               return IM_ERROR;
+       for (;;) {
+               file = fopen(path, "rb");
+               if (file != NULL)
+                       break;
+               if (errno != EINTR) {
+                       RErrorCode = RERR_OPEN;
+                       return IM_ERROR;
+               }
        }
 
-       RETRY( nread = fread(buffer, 1, sizeof(buffer), file) )
+       nread = fread(buffer, 1, sizeof(buffer), file);
        if (nread < sizeof(buffer) || ferror(file)) {
-               RETRY( fclose(file) )
+               fclose(file);
                RErrorCode = RERR_READ;
                return IM_ERROR;
        }
-       RETRY( fclose(file) )
+       fclose(file);
 
        /* check for XPM */
        if (strncmp((char *)buffer, "/* XPM */", 9) == 0)

http://repo.or.cz/w/wmaker-crm.git/commit/9c436eeff50f48723dafd39af6e0fd60e3ab887e

commit 9c436eeff50f48723dafd39af6e0fd60e3ab887e
Author: Christophe CURIS <christophe.cu...@free.fr>
Date:   Sat Jun 14 19:34:00 2014 +0200

    wrlib: fix possible incorrect shifting operations (Coverity #50204, #50205, 
#50206)
    
    As pointed by Coverity, the shift operation performed for color-to-pixel
    transform may not behave as well as expected because of the types used
    (Coverity pointing suspicious sign extension because of int type being
    involved).
    
    The new code tries to leave no open interpretation to the compiler.
    
    Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>

diff --git a/wrlib/convert.c b/wrlib/convert.c
index 6dfe2e41..b0ab2303 100644
--- a/wrlib/convert.c
+++ b/wrlib/convert.c
@@ -978,8 +978,9 @@ Bool RGetClosestXColor(RContext * context, const RColor * 
color, XColor * retCol
                gtable = computeTable(gmask);
                btable = computeTable(bmask);
 
-               retColor->pixel = (rtable[color->red] << roffs) |
-                   (gtable[color->green] << goffs) | (btable[color->blue] << 
boffs);
+               retColor->pixel = (((unsigned long) rtable[color->red])   << 
roffs)
+                              |  (((unsigned long) gtable[color->green]) << 
goffs)
+                              |  (((unsigned long) btable[color->blue])  << 
boffs);
 
                retColor->red = color->red << 8;
                retColor->green = color->green << 8;

http://repo.or.cz/w/wmaker-crm.git/commit/e3358d3595125ea70a927a411187aa5dd6c4a95f

commit e3358d3595125ea70a927a411187aa5dd6c4a95f
Author: Christophe CURIS <christophe.cu...@free.fr>
Date:   Sat Jun 14 19:33:59 2014 +0200

    wrlib: fix possible incorrect shifting operations (Coverity #50203)
    
    As pointed by Coverity, the shift operation performed for color-to-pixel
    transform may not behave as well as expected because of the types used
    (Coverity pointing suspicious sign extension because of int type being
    involved).
    
    The new code tries to leave no open interpretation to the compiler.
    
    Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>

diff --git a/wrlib/convert.c b/wrlib/convert.c
index 95a14d45..6dfe2e41 100644
--- a/wrlib/convert.c
+++ b/wrlib/convert.c
@@ -326,7 +326,8 @@ static RXImage *image2TrueColor(RContext * ctx, RImage * 
image)
        }
 
        if (ctx->attribs->render_mode == RBestMatchRendering) {
-               int ofs, r, g, b;
+               int ofs;
+               unsigned long r, g, b;
                int x, y;
                unsigned long pixel;
                unsigned char *ptr = image->data;
@@ -339,7 +340,10 @@ static RXImage *image2TrueColor(RContext * ctx, RImage * 
image)
                        for (y = 0; y < image->height; y++) {
                                for (x = 0; x < image->width; x++, ptr += 
channels) {
                                        /* reduce pixel */
-                                       pixel = (*(ptr) << roffs) | (*(ptr + 1) 
<< goffs) | (*(ptr + 2) << boffs);
+                                       r = ptr[0];
+                                       g = ptr[1];
+                                       b = ptr[2];
+                                       pixel = (r << roffs) | (g << goffs) | 
(b << boffs);
                                        XPutPixel(ximg->image, x, y, pixel);
                                }
                        }

-----------------------------------------------------------------------

Summary of changes:
 WPrefs.app/Appearance.c      |    6 +-
 src/workspace.c              |    4 +-
 util/wmsetbg.c               |    9 ++--
 wrlib/Makefile.am            |    2 +
 wrlib/context.c              |    4 +-
 wrlib/convert.c              |   18 +++++----
 wrlib/draw.c                 |   27 ++++++++-----
 wrlib/gradient.c             |    4 +-
 wrlib/load.c                 |   43 ++++++++++++--------
 wrlib/load_jpeg.c            |    1 +
 wrlib/load_magick.c          |    2 +-
 wrlib/scale.c                |    3 +-
 wrlib/{convert.h => scale.h} |   19 ++-------
 wrlib/wraster.h              |   88 +++++++++++++++++++----------------------
 wrlib/xutil.c                |    9 +++-
 wrlib/{convert.h => xutil.h} |   22 +++--------
 16 files changed, 130 insertions(+), 131 deletions(-)
 copy wrlib/{convert.h => scale.h} (58%)
 copy wrlib/{convert.h => xutil.h} (58%)


repo.or.cz automatic notification. Contact project admin crma...@gmail.com
if you want to unsubscribe, or site admin ad...@repo.or.cz if you receive
no reply.
-- 
wmaker-crm.git ("The Window Maker window manager")


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to