We use the AC_PATH_XTRA macro to find all the X library paths during
build, but we weren't actually using the variables it generated for
building wmlib. Instead, we just hardcoded the linker flag "-lX11",
which may or may not actually work.
As the literal string "wm_cv_xext_xmu" will never be equal to "xno",
we always ran the code that was supposed to run when the variable
$wm_cv_xext_xmu was not equal to "no". In particular, if libXmu
was not found, then we proceeded as if it had been found.
I noticed one instance of this while looking at the code the other day,
and after a quick grep, realized it happened a *lot*! One of the many
frustrating things about the English language is that we use apostrophes
to make pretty much everything possessive *except* the pronoun "it".
In that case, we use "its". "It's" is reserved for the contraction
meaning "it is" or "it has".
This changes the behavior of the --with-{inc,lib}s-from arguments
to replace the default paths instead of adding to them. This is
required when cross-compiling in a sysroot, since the default paths
will include files from the host system which can have an
incompatible architecture.
The original ergonomic.tiff file samples/pixel property was wrong which was generating the warning message from libtiff
"TIFFReadDirectory: Warning, Sum of Photometric type-related color channels and ExtraSamples doesn't match SamplesPerPixel. Defining non-color channels as ExtraSamples.."
From the comments at the top of wmmenugen_parse_xdg.c:
Since there is no passing of file name arguments or anything of the
sort to applications from the menu, execname is determined as follows:
- If `TryExec' is present, use that;
- else use `Exec' with any switches stripped
However, Exec used to be preferred. Changed code to prefer TryExec.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Exec fields in desktop-files may include field-codes which act as
place-holders for command-line arguments. Previously the Exec arguments
were being passed through intact. However, since Window Maker has no
support for expanding the field-codes, we now remove them and preserve
the remaining arguments.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
This patch removes the code not used. Because the if block
check that buffer[0] is NULL, then, we don't need check it
again inside.
Image is not used yet, so is NULL. We can return NULL.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch returns NULL, because the variable image is not used yet.
The patch also removes three lines:
- buffer[0] = NULL; /* Initialize pointer to avoid spurious free in cleanup code */
RErrorCode = RERR_BADIMAGEFILE;
jpeg_destroy_decompress(&cinfo);
fclose(file);
- if (buffer[0])
- free(buffer[0]);
buffer is a local variable. The malloc is not used yet. So:
- We set the value to NULL, then check if is null to call free(). So the free()
call is never used. We can remove the last too lines.
- We don't need set now to NULL, because the variable is empty (the
initializated (or not) value is not used, and is destroyed as local variable
when we returns, just one line later.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch removes the goto call. I copied the code after the bye: label and
I paste it in the goto-calls.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch adds some characters to the mbuf buffer, to allow the buffer size and some extra characters.
WPrefs.c: In function ‘loadConfigurations’:
../src/wconfig.h:400:17: warning: ‘%s’ directive writing up to 1023 bytes into a region of size 1018 [-Wformat-overflow=]
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch adds some comments to remove the falthrough warning.
Appearance.c: In function ‘renderTexture’:
../WINGs/WINGs/WUtil.h:230:32: warning: this statement may fall through [-Wimplicit-fallthrough=]
#define wwarning(fmt, args...) __wmessage( __func__, __FILE__, __LINE__, WMESSAGE_TYPE_WARNING, fmt, ## args)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Appearance.c:675:4: note: in expansion of macro ‘wwarning’
wwarning(_("unknown direction in '%s', falling back to diagonal"), type);
^~~~~~~~
Appearance.c:676:3: note: here
case 'D':
^~~~
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch removes the indentation problem. The patch includes a long comment about the change.
wmiv.c: In function ‘main’:
wmiv.c:843:4: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (e.xclient.data.l[0] == delWindow)
^~
wmiv.c:845:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
break;
^~~~~
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch removes the format-truncation warning. The problem is because buf and comm are arrays with the same size (PATH_MAX). In the snprintf, comm is copied to buf, more some extra characters. The patch reduces the size for the array comm in the extra characters. Without the patch, the comm array is truncated. With the patch, the same characters are copied, without the warning.
wmgenmenu.c: In function ‘find_and_write’:
wmgenmenu.c:436:41: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
snprintf(buf, sizeof(buf), "%s -e %s", terminal ? terminal : "xterm" , comm);
^
wmgenmenu.c:436:5: note: ‘snprintf’ output 5 or more bytes (assuming 4105) into a destination of size 4104
snprintf(buf, sizeof(buf), "%s -e %s", terminal ? terminal : "xterm" , comm);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch adds the comments to remove the warnings.
gradient.c: In function ‘renderGradientWidth’:
gradient.c:162:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
*ptr++ = b;
~~~~~~~^~~
gradient.c:163:2: note: here
case 2:
^~~~
gradient.c:166:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
*ptr++ = b;
~~~~~~~^~~
gradient.c:167:2: note: here
case 1:
^~~~
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch removes the FALLTHRU warnings in wtext.c. Only includes the comments for GCC7.
wtext.c: In function ‘handleActionEvents’:
wtext.c:2508:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (event->xbutton.button == Button2) {
^
wtext.c:2547:2: note: here
case ButtonRelease:
^~~~
wtext.c: In function ‘handleTextKeyPress’:
wtext.c:2307:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
*buffer = '\n';
~~~~~~~~^~~~~~
wtext.c:2308:2: note: here
default:
^~~~~~~
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch removes the format-truncation error. The warning is because c has size of 3, but using "%d" is not possible to store the value.
wruler.c: In function ‘paintRuler.part.0’:
wruler.c:184:28: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 3 [-Wformat-truncation=]
snprintf(c, sizeof(c), "%d", ++j);
^~
wruler.c:184:27: note: directive argument in the range [1, 2147483647]
snprintf(c, sizeof(c), "%d", ++j);
^~~~
wruler.c:184:4: note: ‘snprintf’ output between 2 and 11 bytes into a destination of size 3
snprintf(c, sizeof(c), "%d", ++j);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The value "j" is the result of "m < w". w is the result of rPtr->view->size.width - rPtr->margins.left;, and both variables are unsigned int. So the value for w is an unsigned int and m is related to i. m cannot be greater of unsigned int.
i = j = m = 0;
w = rPtr->view->size.width - rPtr->margins.left;
while (m < w) {
XDrawLine(rPtr->view->screen->display, rPtr->drawBuffer,
rPtr->fgGC, rPtr->margins.left + m, 23, rPtr->margins.left + m, marks[i % 8] + 23);
if (i != 0 && i % 8 == 0) {
snprintf(c, sizeof(c), "%hu", ++j);
WMDrawString(rPtr->view->screen, rPtr->drawBuffer, rPtr->fg,
rPtr->font, rPtr->margins.left + 2 + m, 26, c, 2);
}
m = (++i) * 10;
}
The printf modifier should be unsigned int.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch removes this warning:
widgets.c: In function `renderPixmap':
widgets.c:385:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (mask)
^
widgets.c:388:4: note: here
case '.':
^~~~
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch removes these warnings in the hsbInit function.
wcolorpanel.c: In function ‘hsbInit’:
wcolorpanel.c:3456:16: warning: ‘%u’ directive writing between 1 and 5 bytes into a region of size 4 [-Wformat-overflow=]
sprintf(tmp, "%d", value[0]);
^~
wcolorpanel.c:3456:15: note: directive argument in the range [0, 65535]
sprintf(tmp, "%d", value[0]);
^~~~
wcolorpanel.c:3456:2: note: ‘sprintf’ output between 2 and 6 bytes into a destination of size 4
sprintf(tmp, "%d", value[0]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
The problem is that the hue variable in the RHSVColor struct. This variable is not an integer, is a shor variable, so using the printf using the "%d" modifier spects an integer. Using a "%hu" prints a unsigned short value.
typedef struct RHSVColor {
unsigned short hue; /* 0-359 */
unsigned char saturation; /* 0-255 */
unsigned char value; /* 0-255 */
} RHSVColor;
This patch removes this warning. The default case should not be used.
wcolorpanel.c: In function ‘rgbIntToChar’:
wcolorpanel.c:2392:2: warning: ‘format’ may be used uninitialized in this function [-Wmaybe-uninitialized]
sprintf(tmp, format, value[1]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch removes this warning. The patch adds a switch case that never should happend.
wcolorpanel.c: In function ‘rgbInit’:
wcolorpanel.c:3403:2: warning: ‘format’ may be used uninitialized in this function [-Wmaybe-uninitialized]
sprintf(tmp, format, panel->color.rgb.green);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch removes this warning:
selection.c:265:64: warning: cast between incompatible function types from ‘int (*)(void *)’ to ‘void (*)(void *)’ [-Wcast-function-type]
wdata = WMCreateDataWithBytesNoCopy((void *) data, len * bpi, (WMFreeDataProc *) XFree);
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
With the changes to the layout, which were introduced in the
previous patch series, and the correction of the default font
size, the Legal Information panel was too small to display the
complete text.
It has been set to a sufficient size.
The names of the macros and the local variables that they use
have been changed to make them less "user-space" like.
ScaleX -> WMScaleX
ScaleY -> WMScaleY
fw -> wmScaleWidth
fh -> wmScaleHeight
The scale factors in the macros were based on the assumption that
the default font size was 11. But the actual default font size is
12. This value is specified as DEFAULT_FONT_SIZE in
WINGS/configuration.c.
Instead of just assuming that the size of the system font has not
been changed by the user, the WMCreateAlertPanel,
WMCreateInputPanel and WMCreateGenericPanel functions now use a
fixed default font size of 12, so that changing the system font's
size in WPrefs.app does not break the fixed layouts of these panels.
("12" is specified as DEFAULT_FONT_SIZE in WINGS/configuration.c)