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 f2824647f371986cefa4dba7b0e51a54d9798aed (commit)
via 1da498ff3b82628e77ebbd3adce15e9c4a8bb144 (commit)
via 0e411226806c9afe0b9fde6368b94849204ad907 (commit)
via dcfd7a4b5e9c3ccdb0a1ccd1270b214c0ed8ae8d (commit)
via 8ef38e99109c62f52d9c00c69dfae2531b16e472 (commit)
via 80a59696e5ac90dec0b7c230a727d524d631d9e0 (commit)
via 8238e4681aa09a3b64c65b68b6f73195c2256267 (commit)
via 90d24a16486a6263b6a15f95b673d4dd5d3f90a5 (commit)
via 7f6699ffca7946f99b686ac918546ae503bf5204 (commit)
via e17a197bc4713918930e0b9d3a495d64a5dcdac7 (commit)
via f73ccae798bd73404d983e925213286db7de8171 (commit)
from 7c320447fbabf36527dbd2c3405cb18ab0bfbb19 (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/f2824647f371986cefa4dba7b0e51a54d9798aed
commit f2824647f371986cefa4dba7b0e51a54d9798aed
Author: Christophe CURIS <[email protected]>
Date: Sat May 11 00:07:20 2013 +0200
Configure: Added some -Wxxx checks when debug mode is enabled
We probably don't want our users to have to endure them, so they
are enabled only when Debug is activated, because they tend to
help keeping the code safe.
diff --git a/configure.ac b/configure.ac
index 1419080..32ea0d6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,6 +89,22 @@ AS_IF([test "x$debug" = "xyes"],
AX_CFLAGS_GCC_OPTION(-Wall)
AX_CFLAGS_GCC_OPTION(-Wextra -Wno-sign-compare -Wno-unused-parameter)
+AS_IF([test "x$debug" = "xyes"],
+ [dnl When debug is enabled, we try to activate more checks from
+ dnl the compiler. They are on independant check because the
+ dnl macro checks all the options at once, but we may have cases
+ dnl where some options are not supported and we don't want to
+ dnl loose all of them.
+ dnl
+ dnl Floating-point comparison is not a good idea
+ AX_CFLAGS_GCC_OPTION([-Wfloat-equal])
+ dnl
+ dnl Try to report misuses of '&' versus '&&' and similar
+ AX_CFLAGS_GCC_OPTION([-Wlogical-op])
+ dnl
+ dnl Use of 'sizeof()' on inappropriate pointer types
+ AX_CFLAGS_GCC_OPTION([-Wpointer-arith])
+])
dnl Platform-specific Makefile setup
dnl ================================
http://repo.or.cz/w/wmaker-crm.git/commit/1da498ff3b82628e77ebbd3adce15e9c4a8bb144
commit 1da498ff3b82628e77ebbd3adce15e9c4a8bb144
Author: Christophe CURIS <[email protected]>
Date: Sat May 11 00:07:19 2013 +0200
wmaker: Removed equality comparison on floating point number
The equality comparison (a == b) is known to be a dangerous trap
when floating-point arithmetics are involved. In the current case
the offending operation can be done with integers directly.
diff --git a/src/misc.c b/src/misc.c
index ef35608..a791a4a 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -159,8 +159,9 @@ void SlideWindow(Window win, int from_x, int from_y, int
to_x, int to_y)
void SlideWindows(Window *wins[], int n, int from_x, int from_y, int to_x, int
to_y)
{
time_t time0 = time(NULL);
- float dx, dy, x = from_x, y = from_y, sx, sy, px, py;
- int dx_is_bigger = 0;
+ float dx, dy, x = from_x, y = from_y, px, py;
+ Bool is_dx_nul, is_dy_nul;
+ int dx_is_bigger = 0, dx_int, dy_int;
int slide_delay, slide_steps, slide_slowdown;
int i;
@@ -181,10 +182,12 @@ void SlideWindows(Window *wins[], int n, int from_x, int
from_y, int to_x, int t
slide_steps = apars[(int)wPreferences.icon_slide_speed].steps;
slide_delay = apars[(int)wPreferences.icon_slide_speed].delay;
- dx = (float)(to_x - from_x);
- dy = (float)(to_y - from_y);
- sx = (dx == 0 ? 0 : fabs(dx) / dx);
- sy = (dy == 0 ? 0 : fabs(dy) / dy);
+ dx_int = to_x - from_x;
+ dy_int = to_y - from_y;
+ is_dx_nul = (dx_int == 0);
+ is_dy_nul = (dy_int == 0);
+ dx = (float) dx_int;
+ dy = (float) dy_int;
if (fabs(dx) > fabs(dy)) {
dx_is_bigger = 1;
@@ -196,17 +199,18 @@ void SlideWindows(Window *wins[], int n, int from_x, int
from_y, int to_x, int t
px = slide_steps;
else if (px > -slide_steps && px < 0)
px = -slide_steps;
- py = (sx == 0 ? 0 : px * dy / dx);
+ py = (is_dx_nul ? 0.0 : px * dy / dx);
} else {
py = dy / slide_slowdown;
if (py < slide_steps && py > 0)
py = slide_steps;
else if (py > -slide_steps && py < 0)
py = -slide_steps;
- px = (sy == 0 ? 0 : py * dx / dy);
+ px = (is_dy_nul ? 0.0 : py * dx / dy);
}
- while (x != to_x || y != to_y) {
+ while (((int)x) != to_x ||
+ ((int)y) != to_y) {
x += px;
y += py;
if ((px < 0 && (int)x < to_x) || (px > 0 && (int)x > to_x))
@@ -220,14 +224,14 @@ void SlideWindows(Window *wins[], int n, int from_x, int
from_y, int to_x, int t
px = slide_steps;
else if (px > -slide_steps && px < 0)
px = -slide_steps;
- py = (sx == 0 ? 0 : px * dy / dx);
+ py = (is_dx_nul ? 0.0 : px * dy / dx);
} else {
py = py * (1.0 - 1 / (float)slide_slowdown);
if (py < slide_steps && py > 0)
py = slide_steps;
else if (py > -slide_steps && py < 0)
py = -slide_steps;
- px = (sy == 0 ? 0 : py * dx / dy);
+ px = (is_dy_nul ? 0.0 : py * dx / dy);
}
for (i = 0; i < n; i++) {
http://repo.or.cz/w/wmaker-crm.git/commit/0e411226806c9afe0b9fde6368b94849204ad907
commit 0e411226806c9afe0b9fde6368b94849204ad907
Author: Christophe CURIS <[email protected]>
Date: Sat May 11 00:07:18 2013 +0200
WINGs: Changed equality comparison on floating point number
The equality comparison (a == b) is known to be a dangerous trap
when floating-point arithmetics are involved. This patch changes
all the cases which try to do this to a safer check.
diff --git a/WINGs/wscrollview.c b/WINGs/wscrollview.c
index 8b33812..ae3daae 100644
--- a/WINGs/wscrollview.c
+++ b/WINGs/wscrollview.c
@@ -503,10 +503,10 @@ static void updateScrollerProportion(ScrollView * sPtr)
prop = (float)sPtr->viewport->size.width /
(float)sPtr->contentView->size.width;
- if (oldP == 1.0)
- value = 0;
- else
+ if (oldP < 1.0)
value = (prop * oldV) / oldP;
+ else
+ value = 0;
WMSetScrollerParameters(sPtr->hScroller, value, prop);
}
if (sPtr->flags.hasVScroller) {
@@ -515,10 +515,10 @@ static void updateScrollerProportion(ScrollView * sPtr)
prop = (float)sPtr->viewport->size.height /
(float)sPtr->contentView->size.height;
- if (oldP == 1.0)
- value = 0;
- else
+ if (oldP < 1.0)
value = (prop * oldV) / oldP;
+ else
+ value = 0;
WMSetScrollerParameters(sPtr->vScroller, value, prop);
}
applyScrollerValues(sPtr);
http://repo.or.cz/w/wmaker-crm.git/commit/dcfd7a4b5e9c3ccdb0a1ccd1270b214c0ed8ae8d
commit dcfd7a4b5e9c3ccdb0a1ccd1270b214c0ed8ae8d
Author: Christophe CURIS <[email protected]>
Date: Sat May 11 00:07:17 2013 +0200
WINGs: Changed the minimum internal knob size of WScroller
The original code allowed to have 0.0, but this can generate
division by zero in WScrollView. As a value of 0.0 is not realistic
anyway, use a minimum constant instead.
diff --git a/WINGs/wscroller.c b/WINGs/wscroller.c
index 671bb22..e6d2cd3 100644
--- a/WINGs/wscroller.c
+++ b/WINGs/wscroller.c
@@ -154,6 +154,15 @@ void WMSetScrollerAction(WMScroller * sPtr, WMAction *
action, void *clientData)
void WMSetScrollerParameters(WMScroller * sPtr, float floatValue, float
knobProportion)
{
+ /*
+ * This value represents 1 pixel on a 4k wide screen, it makes
+ * a good minimum; this ensure a non-null value to avoid
+ * potential division-by-0.
+ * Please note that there is another size check when drawing
+ * the knob to make sure it will remain selectable.
+ */
+ static const float min_knob_proportion = 1.0 / 4096.0;
+
CHECK_CLASS(sPtr, WC_Scroller);
assert(!isnan(floatValue));
@@ -165,9 +174,9 @@ void WMSetScrollerParameters(WMScroller * sPtr, float
floatValue, float knobProp
else
sPtr->floatValue = floatValue;
- if (knobProportion <= 0.0) {
+ if (knobProportion <= min_knob_proportion) {
- sPtr->knobProportion = 0.0;
+ sPtr->knobProportion = min_knob_proportion;
sPtr->flags.documentFullyVisible = 0;
} else if (knobProportion >= 1.0) {
http://repo.or.cz/w/wmaker-crm.git/commit/8ef38e99109c62f52d9c00c69dfae2531b16e472
commit 8ef38e99109c62f52d9c00c69dfae2531b16e472
Author: Christophe CURIS <[email protected]>
Date: Sat May 11 00:07:16 2013 +0200
WRaster: Changed equality/inequality comparison on floating point number
The equality comparison (a == b) is known to be a dangerous trap
when floating-point arithmetics are involved. This patch changes
all the cases which try to do this to a safer check.
diff --git a/wrlib/png.c b/wrlib/png.c
index fed178e..03074ea 100644
--- a/wrlib/png.c
+++ b/wrlib/png.c
@@ -140,7 +140,7 @@ RImage *RLoadPNG(RContext *context, const char *file)
sgamma = (context->attribs->rgamma + context->attribs->ggamma +
context->attribs->bgamma) / 3;
} else if ((tmp = getenv("DISPLAY_GAMMA")) != NULL) {
sgamma = atof(tmp);
- if (sgamma == 0)
+ if (sgamma < 1.0E-3)
sgamma = 1;
} else {
/* blah */
diff --git a/wrlib/rotate.c b/wrlib/rotate.c
index b1379ba..d296815 100644
--- a/wrlib/rotate.c
+++ b/wrlib/rotate.c
@@ -43,12 +43,23 @@ RImage *RRotateImage(RImage * image, float angle)
int x, y;
int bpp = image->format == RRGBAFormat ? 4 : 3;
+ /*
+ * Angle steps below this value would represent a rotation
+ * of less than 1 pixel for a 4k wide image, so not worth
+ * bothering the difference. That makes it a perfect
+ * candidate for an Epsilon when trying to compare angle
+ * to known values
+ */
+ static const float min_usable_angle = 0.00699;
+
angle = ((int)angle % 360) + (angle - (int)angle);
- if (angle == 0.0) {
+ if (angle < min_usable_angle) {
+ /* Rotate by 0 degree */
return RCloneImage(image);
- } else if (angle == 90.0) {
+ } else if ((angle > 90.0 - min_usable_angle) &&
+ (angle < 90.0 + min_usable_angle)) {
nwidth = image->height;
nheight = image->width;
@@ -91,7 +102,8 @@ RImage *RRotateImage(RImage * image, float angle)
}
}
}
- } else if (angle == 180.0) {
+ } else if ((angle > 180.0 - min_usable_angle) &&
+ (angle < 180.0 + min_usable_angle)) {
nwidth = image->width;
nheight = image->height;
@@ -129,7 +141,8 @@ RImage *RRotateImage(RImage * image, float angle)
nptr--;
}
}
- } else if (angle == 270.0) {
+ } else if ((angle > 270.0 - min_usable_angle) &&
+ (angle < 270.0 + min_usable_angle)) {
nwidth = image->height;
nheight = image->width;
diff --git a/wrlib/scale.c b/wrlib/scale.c
index 6990afe..d2cc1e6 100644
--- a/wrlib/scale.c
+++ b/wrlib/scale.c
@@ -187,8 +187,20 @@ static double B_spline_filter(double t) /* box (*) box
(*) box (*) box */
static double sinc(double x)
{
+ /*
+ * The original code did this:
+ * if (x != 0) ...
+ * This code is unsafe, it should be:
+ * if (fabs(x) > EPSILON) ...
+ *
+ * But the call to fabs is already done in the *ONLY* function
+ * that call sinc: 'Lanczos3_filter'
+ *
+ * The goal was to avoid a Divide-by-0 error, now we also
+ * avoid a +/-inf result too
+ */
x *= PI;
- if (x != 0)
+ if (x > 1.0E-9)
return (sin(x) / x);
return (1.0);
}
http://repo.or.cz/w/wmaker-crm.git/commit/80a59696e5ac90dec0b7c230a727d524d631d9e0
commit 80a59696e5ac90dec0b7c230a727d524d631d9e0
Author: Christophe CURIS <[email protected]>
Date: Sat May 11 00:07:15 2013 +0200
Fixed improper variables definition in header file
Some header were creating variable, this is a bad practice which
is likely to not behave as expected. This creates one distinct
variable in each object file that used the header, and:
- on well behaved compiler, this ends up in a link error (see
commit 39fdb451ba6ff84430507e327fa01a43f40b7315 for an example)
- on bad behaving compiler, this can be linked as multiple local
variable, thus having strange effects when running program
- on insouciant compiler (who said gcc?) the variables are
silently merged, hiding portability issues
diff --git a/src/screen.c b/src/screen.c
index 37e4da3..c61aa1f 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -81,6 +81,11 @@ extern int wScreenCount;
extern int wXkbSupported;
#endif
+#ifdef HAVE_XRANDR
+Bool has_randr;
+int randr_event_base;
+#endif
+
extern WDDomain *WDWindowMaker;
/**** Local ****/
diff --git a/src/screen.h b/src/screen.h
index 861983f..be27cdb 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -36,8 +36,8 @@
#define WTB_MENU 6
#ifdef HAVE_XRANDR
-Bool has_randr;
-int randr_event_base;
+extern Bool has_randr;
+extern int randr_event_base;
#endif
typedef struct {
diff --git a/util/wmmenugen.c b/util/wmmenugen.c
index 82ad8ce..ac3846b 100644
--- a/util/wmmenugen.c
+++ b/util/wmmenugen.c
@@ -45,6 +45,10 @@ char *terminal;
extern char *__progname;
+/* Global Variables from wmmenugen.h */
+WMTreeNode *menu;
+char *env_lang, *env_ctry, *env_enc, *env_mod;
+
int main(int argc, char **argv)
{
struct stat st;
diff --git a/util/wmmenugen.h b/util/wmmenugen.h
index cdefbe9..3a60ab2 100644
--- a/util/wmmenugen.h
+++ b/util/wmmenugen.h
@@ -46,9 +46,9 @@ typedef struct {
/* the abstract menu tree
*/
-WMTreeNode *menu;
+extern WMTreeNode *menu;
-char *env_lang, *env_ctry, *env_enc, *env_mod;
+extern char *env_lang, *env_ctry, *env_enc, *env_mod;
/* wmmenu_misc.c
*/
http://repo.or.cz/w/wmaker-crm.git/commit/8238e4681aa09a3b64c65b68b6f73195c2256267
commit 8238e4681aa09a3b64c65b68b6f73195c2256267
Author: Christophe CURIS <[email protected]>
Date: Sat May 11 00:07:14 2013 +0200
WPrefs: Move declaration of function into the common header
It is a bad idea to declare the prototype of an external function
in a file as it won't allow the compiler to cross-check it.
diff --git a/WPrefs.app/MouseSettings.c b/WPrefs.app/MouseSettings.c
index 5291c0d..b684c5c 100644
--- a/WPrefs.app/MouseSettings.c
+++ b/WPrefs.app/MouseSettings.c
@@ -95,7 +95,6 @@ static char *wheelActions[2];
#define DELAY(i) ((i)*75+170)
-int ModifierFromKey(Display * dpy, char *key);
static void setMouseAccel(WMScreen * scr, float accel, int threshold)
{
diff --git a/WPrefs.app/WPrefs.h b/WPrefs.app/WPrefs.h
index 6c7b90f..2987abf 100644
--- a/WPrefs.app/WPrefs.h
+++ b/WPrefs.app/WPrefs.h
@@ -115,6 +115,10 @@ void SetSpeedForKey(int speed, const char *defaultName);
void AddDeadChildHandler(pid_t pid, void (*handler)(void*), void *data);
+/* ---[ xmodifier.c ] ---------------------------------------------------- */
+int ModifierFromKey(Display * dpy, char *key);
+
+
#define FRAME_TOP 105
#define FRAME_LEFT -2
#define FRAME_WIDTH 524
http://repo.or.cz/w/wmaker-crm.git/commit/90d24a16486a6263b6a15f95b673d4dd5d3f90a5
commit 90d24a16486a6263b6a15f95b673d4dd5d3f90a5
Author: Christophe CURIS <[email protected]>
Date: Sat May 11 00:07:13 2013 +0200
Unified usage of the 'inline' attribute for functions
Autoconf provides the necessary stuff to detect if inline keyword
is supported, and to detect special syntaxes, so let's use this
and remove the multiple local definitions, this makes code simpler.
diff --git a/WINGs/hashtable.c b/WINGs/hashtable.c
index 27e71e4..aec4f5a 100644
--- a/WINGs/hashtable.c
+++ b/WINGs/hashtable.c
@@ -1,3 +1,4 @@
+#include <config.h>
#include <sys/types.h>
#include <string.h>
@@ -8,11 +9,6 @@
#define INITIAL_CAPACITY 23
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-# define INLINE inline
-#else
-# define INLINE
-#endif
typedef struct HashItem {
const void *key;
@@ -39,7 +35,7 @@ typedef struct W_HashTable {
#define RELKEY(table, key) if ((table)->callbacks.releaseKey)
(*(table)->callbacks.releaseKey)(key)
-static INLINE unsigned hashString(const char *key)
+static inline unsigned hashString(const char *key)
{
unsigned ret = 0;
unsigned ctr = 0;
@@ -52,7 +48,7 @@ static INLINE unsigned hashString(const char *key)
return ret;
}
-static INLINE unsigned hashPtr(const void *key)
+static inline unsigned hashPtr(const void *key)
{
return ((size_t) key / sizeof(char *));
}
diff --git a/WINGs/proplist.c b/WINGs/proplist.c
index 801206e..5c5242d 100644
--- a/WINGs/proplist.c
+++ b/WINGs/proplist.c
@@ -465,7 +465,7 @@ static char *indentedDescription(WMPropList * plist, int
level)
return retstr;
}
-static INLINE int getChar(PLData * pldata)
+static inline int getChar(PLData * pldata)
{
int c;
@@ -482,7 +482,7 @@ static INLINE int getChar(PLData * pldata)
return c;
}
-static INLINE int getNonSpaceChar(PLData * pldata)
+static inline int getNonSpaceChar(PLData * pldata)
{
int c;
diff --git a/WINGs/wconfig.h b/WINGs/wconfig.h
index 819ad5f..995260a 100644
--- a/WINGs/wconfig.h
+++ b/WINGs/wconfig.h
@@ -29,12 +29,6 @@
# define _(text) (text)
#endif
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-# define INLINE inline
-#else
-# define INLINE
-#endif
-
#endif /* WINGS_CONFIG_H_ */
diff --git a/WINGs/wtextfield.c b/WINGs/wtextfield.c
index cec8a38..955db53 100644
--- a/WINGs/wtextfield.c
+++ b/WINGs/wtextfield.c
@@ -122,7 +122,7 @@ static WMSelectionProcs selectionHandler = {
#define TEXT_WIDTH2(tPtr, start, end) (WMWidthOfString((tPtr)->font,
&((tPtr)->text[(start)]), (end) - (start)))
-static INLINE int oneUTF8CharBackward(const char *str, int len)
+static inline int oneUTF8CharBackward(const char *str, int len)
{
const unsigned char *ustr = (const unsigned char *)str;
int pos = 0;
@@ -131,7 +131,7 @@ static INLINE int oneUTF8CharBackward(const char *str, int
len)
return pos;
}
-static INLINE int oneUTF8CharForward(const char *str, int len)
+static inline int oneUTF8CharForward(const char *str, int len)
{
const unsigned char *ustr = (const unsigned char *)str;
int pos = 0;
@@ -141,7 +141,7 @@ static INLINE int oneUTF8CharForward(const char *str, int
len)
}
// find the beginning of the UTF8 char pointed by str
-static INLINE int seekUTF8CharStart(const char *str, int len)
+static inline int seekUTF8CharStart(const char *str, int len)
{
const unsigned char *ustr = (const unsigned char *)str;
int pos = 0;
diff --git a/configure.ac b/configure.ac
index 0e4e7bd..1419080 100644
--- a/configure.ac
+++ b/configure.ac
@@ -230,6 +230,7 @@ dnl Checks for typedefs, structures, and compiler
characteristics.
dnl ==============================================================
AC_DECL_SYS_SIGLIST
AC_C_CONST
+AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
diff --git a/src/wconfig.h.in b/src/wconfig.h.in
index 9201afc..c2a79a3 100644
--- a/src/wconfig.h.in
+++ b/src/wconfig.h.in
@@ -397,11 +397,5 @@
#define M_(text) (text)
#endif
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-#define INLINE inline
-#else
-#define INLINE
-#endif
-
#endif /* WMCONFIG_H_ */
diff --git a/util/wmagnify.c b/util/wmagnify.c
index 91e2d2a..f77cf10 100644
--- a/util/wmagnify.c
+++ b/util/wmagnify.c
@@ -5,6 +5,7 @@
*
* This program is in the Public Domain.
*/
+#include <config.h>
#include <X11/Xproto.h>
@@ -64,9 +65,6 @@ unsigned int black;
WMColor *cursorColor1;
WMColor *cursorColor2;
-#ifndef __GNUC__
-#define inline
-#endif
static BufferData *makeBufferData(WMWindow * win, WMLabel * label, int width,
int height, int magfactor)
{
diff --git a/wrlib/misc.c b/wrlib/misc.c
index 5b0bac4..4a7c065 100644
--- a/wrlib/misc.c
+++ b/wrlib/misc.c
@@ -159,7 +159,7 @@ void RClearImage(RImage * image, const RColor * color)
}
}
-static __inline__ unsigned char clip(int c)
+static inline unsigned char clip(int c)
{
if (c > 255)
c = 255;
http://repo.or.cz/w/wmaker-crm.git/commit/7f6699ffca7946f99b686ac918546ae503bf5204
commit 7f6699ffca7946f99b686ac918546ae503bf5204
Author: Christophe CURIS <[email protected]>
Date: Sat May 11 00:07:12 2013 +0200
Changed formula for getting the number of elements in a static array
When using the formula [sizeof(array) / sizeof( x )] to get the number
of element in a static array, it is better to use array[0] for 'x'
instead of the base type of array:
- in case the base type would change someday;
- if the compiler were deciding to insert padding somewhere
diff --git a/WINGs/wfontpanel.c b/WINGs/wfontpanel.c
index 0a99c3e..c6df7b3 100644
--- a/WINGs/wfontpanel.c
+++ b/WINGs/wfontpanel.c
@@ -428,7 +428,7 @@ static void addSizeToTypeface(Typeface * face, int size)
if (size == 0) {
int j;
- for (j = 0; j < sizeof(scalableFontSizes) / sizeof(int); j++) {
+ for (j = 0; j < sizeof(scalableFontSizes) /
sizeof(scalableFontSizes[0]); j++) {
size = scalableFontSizes[j];
if (!WMCountInArray(face->sizes, (void *)(uintptr_t)
size)) {
diff --git a/WINGs/widgets.c b/WINGs/widgets.c
index 39cc3ef..5aa3e80 100644
--- a/WINGs/widgets.c
+++ b/WINGs/widgets.c
@@ -552,7 +552,7 @@ WMScreen *WMCreateScreenWithRContext(Display * display, int
screen, RContext * c
"_NET_WM_ICON_NAME",
"_NET_WM_ICON",
};
- Atom atoms[sizeof(atomNames) / sizeof(char *)];
+ Atom atoms[sizeof(atomNames) / sizeof(atomNames[0])];
int i;
if (!initialized) {
@@ -803,9 +803,9 @@ WMScreen *WMCreateScreenWithRContext(Display * display, int
screen, RContext * c
}
#ifdef HAVE_XINTERNATOMS
- XInternAtoms(display, atomNames, sizeof(atomNames) / sizeof(char *),
False, atoms);
+ XInternAtoms(display, atomNames, sizeof(atomNames) /
sizeof(atomNames[0]), False, atoms);
#else
- for (i = 0; i < sizeof(atomNames) / sizeof(char *); i++) {
+ for (i = 0; i < sizeof(atomNames) / sizeof(atomNames[0]); i++) {
atoms[i] = XInternAtom(display, atomNames[i], False);
}
#endif
diff --git a/WPrefs.app/Appearance.c b/WPrefs.app/Appearance.c
index 3dfe891..dc7c1db 100644
--- a/WPrefs.app/Appearance.c
+++ b/WPrefs.app/Appearance.c
@@ -1102,7 +1102,7 @@ static void previewClick(XEvent * event, void *clientData)
switch (panel->oldTabItem) {
case 0:
- for (i = 0; i < sizeof(previewPositions) / sizeof(WMRect); i++)
{
+ for (i = 0; i < sizeof(previewPositions) /
sizeof(previewPositions[0]); i++) {
if (event->xbutton.x >= previewPositions[i].pos.x
&& event->xbutton.y >= previewPositions[i].pos.y
&& event->xbutton.x < previewPositions[i].pos.x
diff --git a/WPrefs.app/MouseSettings.c b/WPrefs.app/MouseSettings.c
index ca709e5..5291c0d 100644
--- a/WPrefs.app/MouseSettings.c
+++ b/WPrefs.app/MouseSettings.c
@@ -608,13 +608,13 @@ static void createPanel(Panel * p)
WMResizeWidget(panel->wheelP, 135, 20);
WMMoveWidget(panel->wheelP, 95, 129);
- for (i = 0; i < sizeof(buttonActions) / sizeof(char *); i++) {
+ for (i = 0; i < sizeof(buttonActions) / sizeof(buttonActions[0]); i++) {
WMAddPopUpButtonItem(panel->button1P, buttonActions[i]);
WMAddPopUpButtonItem(panel->button2P, buttonActions[i]);
WMAddPopUpButtonItem(panel->button3P, buttonActions[i]);
}
- for (i = 0; i < sizeof(wheelActions) / sizeof(char *); i++) {
+ for (i = 0; i < sizeof(wheelActions) / sizeof(wheelActions[0]); i++) {
WMAddPopUpButtonItem(panel->wheelP, wheelActions[i]);
}
diff --git a/WPrefs.app/Workspace.c b/WPrefs.app/Workspace.c
index ce6ff54..d84a393 100644
--- a/WPrefs.app/Workspace.c
+++ b/WPrefs.app/Workspace.c
@@ -81,7 +81,7 @@ static void showData(_Panel * panel)
str = "center";
idx = 1; /* center */
- for (i = 0; i < sizeof(WSNamePositions) / sizeof(char *); i++) {
+ for (i = 0; i < sizeof(WSNamePositions) / sizeof(WSNamePositions[0]);
i++) {
if (strcasecmp(WSNamePositions[i], str) == 0) {
idx = i;
break;
diff --git a/src/defaults.c b/src/defaults.c
index a2d6e21..2a75b73 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -760,7 +760,7 @@ static void initDefaults()
WMPLSetCaseSensitive(False);
- for (i = 0; i < sizeof(optionList) / sizeof(WDefaultEntry); i++) {
+ for (i = 0; i < sizeof(optionList) / sizeof(optionList[0]); i++) {
entry = &optionList[i];
entry->plkey = WMCreatePLString(entry->key);
@@ -770,7 +770,7 @@ static void initDefaults()
entry->plvalue = NULL;
}
- for (i = 0; i < sizeof(staticOptionList) / sizeof(WDefaultEntry); i++) {
+ for (i = 0; i < sizeof(staticOptionList) / sizeof(staticOptionList[0]);
i++) {
entry = &staticOptionList[i];
entry->plkey = WMCreatePLString(entry->key);
@@ -925,7 +925,7 @@ void wReadStaticDefaults(WMPropList * dict)
unsigned int i;
void *tdata;
- for (i = 0; i < sizeof(staticOptionList) / sizeof(WDefaultEntry); i++) {
+ for (i = 0; i < sizeof(staticOptionList) / sizeof(staticOptionList[0]);
i++) {
entry = &staticOptionList[i];
if (dict)
@@ -1079,7 +1079,7 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
needs_refresh = 0;
- for (i = 0; i < sizeof(optionList) / sizeof(WDefaultEntry); i++) {
+ for (i = 0; i < sizeof(optionList) / sizeof(optionList[0]); i++) {
entry = &optionList[i];
if (new_dict)
diff --git a/src/startup.c b/src/startup.c
index d309d98..1532626 100644
--- a/src/startup.c
+++ b/src/startup.c
@@ -482,7 +482,7 @@ void StartUp(Bool defaultScreenOnly)
#ifdef HAVE_XRANDR
int dummy;
#endif
- Atom atom[sizeof(atomNames) / sizeof(char *)];
+ Atom atom[sizeof(atomNames) / sizeof(atomNames[0])];
/*
* Ignore CapsLock in modifiers
@@ -505,12 +505,12 @@ void StartUp(Bool defaultScreenOnly)
/* _XA_VERSION = XInternAtom(dpy, "VERSION", False); */
#ifdef HAVE_XINTERNATOMS
- XInternAtoms(dpy, atomNames, sizeof(atomNames) / sizeof(char *), False,
atom);
+ XInternAtoms(dpy, atomNames, sizeof(atomNames) / sizeof(atomNames[0]),
False, atom);
#else
{
int i;
- for (i = 0; i < sizeof(atomNames) / sizeof(char *); i++)
+ for (i = 0; i < sizeof(atomNames) / sizeof(atomNames[0]); i++)
atom[i] = XInternAtom(dpy, atomNames[i], False);
}
#endif
diff --git a/src/wmspec.c b/src/wmspec.c
index 255982e..149eab1 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -202,7 +202,7 @@ static atomitem_t atomNames[] = {
{"UTF8_STRING", &utf8_string},
};
-#define atomNr (sizeof(atomNames)/sizeof(atomitem_t))
+#define atomNr (sizeof(atomNames)/sizeof(atomNames[0]))
#define _NET_WM_STATE_REMOVE 0
#define _NET_WM_STATE_ADD 1
diff --git a/src/xutil.c b/src/xutil.c
index fc3ebd1..3d1e83e 100644
--- a/src/xutil.c
+++ b/src/xutil.c
@@ -168,7 +168,7 @@ void FormatXError(Display * dpy, XErrorEvent * error, char
*buffer, int size)
if (i > size - 100)
return;
buffer += i;
- if (error->request_code >= sizeof(requestCodes) / sizeof(char *)) {
+ if (error->request_code >= sizeof(requestCodes) /
sizeof(requestCodes[0])) {
sprintf(buffer, "n Request code: %in",
error->request_code);
} else {
sprintf(buffer, "n Request code: %i %sn",
error->request_code,
diff --git a/util/fontconv.c b/util/fontconv.c
index 4c420cc..19204db 100644
--- a/util/fontconv.c
+++ b/util/fontconv.c
@@ -105,7 +105,7 @@ static char *mapWeightToName(str * weight)
if (weight->len == 0)
return "";
- for (i = 0; i < sizeof(normalNames) / sizeof(char *); i++) {
+ for (i = 0; i < sizeof(normalNames) / sizeof(normalNames[0]); i++) {
if (strlen(normalNames[i]) == weight->len &&
strncmp(normalNames[i], weight->str, weight->len)) {
return "";
}
http://repo.or.cz/w/wmaker-crm.git/commit/e17a197bc4713918930e0b9d3a495d64a5dcdac7
commit e17a197bc4713918930e0b9d3a495d64a5dcdac7
Author: Christophe CURIS <[email protected]>
Date: Sat May 11 00:07:11 2013 +0200
Configure: Fixed usage of CPPFLAGS instead of CFLAGS for some options
Some compilation options are actually targetting the preprocessor
instead of the compiler; using the wrong variable can have some
subtile side effects, so let's get things right.
diff --git a/configure.ac b/configure.ac
index f3e113e..0e4e7bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,7 +84,7 @@ AC_ARG_ENABLE(debug,
[AC_MSG_ERROR([bad value $enableval for --enable-debug])] )],
[debug=no])
AS_IF([test "x$debug" = "xyes"],
- [CFLAGS="-g -O0 -DDEBUG"])
+ [CFLAGS="-g -O0" ; CPPFLAGS="$CPPFLAGS -DDEBUG"])
AX_CFLAGS_GCC_OPTION(-Wall)
@@ -93,11 +93,11 @@ AX_CFLAGS_GCC_OPTION(-Wextra -Wno-sign-compare
-Wno-unused-parameter)
dnl Platform-specific Makefile setup
dnl ================================
AS_CASE(["$host"],
- [*-*-linux*|*-*-cygwin*|*-gnu*], [WM_OSDEP="linux" ; CFLAGS="$CFLAGS
-D_XOPEN_SOURCE=600"],
- [*-*-freebsd*|*-k*bsd-gnu*], [WM_OSDEP="bsd" ; CFLAGS="$CFLAGS
-D_XOPEN_SOURCE=600 -DFREEBSD"],
- [*-*-netbsd*], [WM_OSDEP="bsd" ; CFLAGS="$CFLAGS
-DNETBSD"],
- [*-*-openbsd*], [WM_OSDEP="bsd" ; CFLAGS="$CFLAGS
-DOPENBSD"],
- [*-*-dragonfly*], [WM_OSDEP="bsd" ; CFLAGS="$CFLAGS
-DDRAGONFLYBSD"],
+ [*-*-linux*|*-*-cygwin*|*-gnu*], [WM_OSDEP="linux" ; CPPFLAGS="$CPPFLAGS
-D_XOPEN_SOURCE=600"],
+ [*-*-freebsd*|*-k*bsd-gnu*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS
-D_XOPEN_SOURCE=600 -DFREEBSD"],
+ [*-*-netbsd*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS
-DNETBSD"],
+ [*-*-openbsd*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS
-DOPENBSD"],
+ [*-*-dragonfly*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS
-DDRAGONFLYBSD"],
[*-apple-darwin*], [WM_OSDEP="darwin"],
[*-*-solaris*], [WM_OSDEP="stub"], dnl solaris.c when
done
[WM_OSDEP="stub"])
http://repo.or.cz/w/wmaker-crm.git/commit/f73ccae798bd73404d983e925213286db7de8171
commit f73ccae798bd73404d983e925213286db7de8171
Author: Christophe CURIS <[email protected]>
Date: Sat May 11 00:07:10 2013 +0200
Removed temporary allocation to build a path that is actually a constant
This allocation was certainly participating to memory fragmentation.
diff --git a/WPrefs.app/Menu.c b/WPrefs.app/Menu.c
index 7780df1..85639b0 100644
--- a/WPrefs.app/Menu.c
+++ b/WPrefs.app/Menu.c
@@ -1450,15 +1450,9 @@ static void buildMenuFromPL(_Panel * panel, WMPropList *
pl)
static WMPropList *getDefaultMenu(_Panel * panel)
{
WMPropList *menu;
- char *menuPath, *gspath;
-
- gspath = wstrdup(WMAKER_RESOURCE_PATH);
-
- menuPath = wmalloc(strlen(gspath) + 128);
- sprintf(menuPath, "%s/plmenu", gspath);
+ static const char menuPath[] = WMAKER_RESOURCE_PATH "/plmenu";
menu = WMReadPropListFromFile(menuPath);
-
if (!menu) {
char *buffer, *msg;
@@ -1470,9 +1464,6 @@ static WMPropList *getDefaultMenu(_Panel * panel)
wfree(buffer);
}
- wfree(gspath);
- wfree(menuPath);
-
return menu;
}
-----------------------------------------------------------------------
Summary of changes:
WINGs/hashtable.c | 10 +++-------
WINGs/proplist.c | 4 ++--
WINGs/wconfig.h | 6 ------
WINGs/wfontpanel.c | 2 +-
WINGs/widgets.c | 6 +++---
WINGs/wscroller.c | 13 +++++++++++--
WINGs/wscrollview.c | 12 ++++++------
WINGs/wtextfield.c | 6 +++---
WPrefs.app/Appearance.c | 2 +-
WPrefs.app/Menu.c | 11 +----------
WPrefs.app/MouseSettings.c | 5 ++---
WPrefs.app/WPrefs.h | 4 ++++
WPrefs.app/Workspace.c | 2 +-
configure.ac | 29 +++++++++++++++++++++++------
src/defaults.c | 8 ++++----
src/misc.c | 26 +++++++++++++++-----------
src/screen.c | 5 +++++
src/screen.h | 4 ++--
src/startup.c | 6 +++---
src/wconfig.h.in | 6 ------
src/wmspec.c | 2 +-
src/xutil.c | 2 +-
util/fontconv.c | 2 +-
util/wmagnify.c | 4 +---
util/wmmenugen.c | 4 ++++
util/wmmenugen.h | 4 ++--
wrlib/misc.c | 2 +-
wrlib/png.c | 2 +-
wrlib/rotate.c | 21 +++++++++++++++++----
wrlib/scale.c | 14 +++++++++++++-
30 files changed, 132 insertions(+), 92 deletions(-)
repo.or.cz automatic notification. Contact project admin [email protected]
if you want to unsubscribe, or site admin [email protected] if you receive
no reply.
--
wmaker-crm.git ("The Window Maker window manager")
--
To unsubscribe, send mail to [email protected].