This macro was define a *very* long time ago, in commit
d98f1fa645
but was not used at that time, and have never been used anywhere since
then.
As the macro does not look like a good idea for performance anyway, get rid
of it before anyone could get tempted to use it.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
It seems the code had the possibility to load a default icon, probably to
be used on the windows if the main program does not provide any.
This code however have never been enabled, probably because it is better to
not provide an icon and let the window manager use its own.
This patch then removes that dead code, but keeps the image as part of the
WINGs resource for the case where an application would have been using it.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by gcc, this macro is never used in the code; when no font is
defined by user the 'paintButton' code already falls back to the
'normalFont' of the screen, and this code could not need the macro anyway.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by gcc, this constant is not used anywhere, and it looks like
it have always been the case. As there's no reason to specifically add a
border to this widget, remove the constant.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by gcc, the height is never used and the code make use of the
SCROLLER_WIDTH constant anyway, so this patch updates the code to directly
use that constant instead of intermediate values that just adds noise for
code maintainability.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by gcc, the macro is not used, that is probably because it is
totally ok to never provide a title from X point of view, so there is now
reason to fall back to that empty constant.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
We have a few directories with source codes that we tell configure to
prepare, but we do not actually want them built during normal operations
(tests and examples only).
However, there are some special targets brought by automake which still
need to see them, so this patch adds these directories to the list, but
only for these rules, we keep them unvisited by the normal build process.
The wanted side effect of this is that now "make distcheck" works untill
the end as expectable.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, there might be some problems due to sign extension
when performing the shifts and ors operations when converting the RImage to
the format expected for the WM_ICON property.
This patch try to improve things by using as much as possible unsigned
types and by using explicit types conversion instead of counting on the
wrong implicit type conversion done by the language.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the array created to temporary store the list of
Atoms used in the function 'requestHandler' was leaked.
Because this array is very short lived, there is no need to allocate memory
for this, it just participates in memory fragmentation. Instead, we use now
memory on the stack which is more efficient.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The "documentation" of the function claims to check for the resource in a
number of path, but factually if the application did provide its argument
list when creating the WINGs App structure (which is likely) then the
search would stop before checking all paths.
The code now continues as expectable if the resource was not found in the
path. Took opportunity to avoid a temporary allocation that participated in
memory fragmentation.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As reported by Charles Philip Chan, WPrefs would get into infinite loop
when the support for Pango is enabled.
The problem is due to long strings that are broken into multiple lines by
WINGs. This is done in an iterative process in the internal function
'fitText'.
In order to avoid the cost of duplicating many times the sub-strings, the
functions involved do not place a NUL at the string-splitting position, but
they rely instead on giving the length of the string as a parameter.
The code that checks the Pango text (to avoid re-submitting the string when
not needed) did not use that length, so it would always keep the original
string that is too long, so the fitText function would always receive the
same result and loop forever trying to find where to split the string.
This patch adds the check on the length, so Pango is given the appropriate
string for its pixel size calculation.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the function makes use of a pointer which may be
null, so we have to properly check that to ensure application will not
crash.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
The function is building strings from the directory names into an allocated
buffer, but the function took time first to calculate the exact size needed
for the resulting string, so the check on wstrlcat's result will never
fail.
As we still use wstrlcat it is not possible to overrun the buffer, we would
just return a truncated string in the list instead of return no list at all
but the case where it would happen is impossible.
This should fix Coverity #50111 (Resource leak) which was present in the
code of one of the related early return.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
The original choice may have looked mathematically correct, but it was
actually counter-intuitive and opposite to what every other application
do with sliders.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
When creating the temporary file that will become the final file if no
problem occurs, there is a chmod done which does not give write access to
the group and to the others, but this is the task of the user-set umask.
This patch makes the rights to everything (except execution, of course) and
still applies the umask, so in the end the file will have the rights that
user wants.
Took the opportunity to make a little change related to the umask: it seems
that some version of mkstemp have a security issue, which is in not a
problem in our use case, but Coverity reports it (#50201) so as it does not
cost anything, the patch also fixes it with an appropriate comment to
explain the situation.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
The original code used the libc "fopen" kind of operation, which are handy
when manipulating text files, but:
- bring an overhead for binary files that we don't need here;
- does not provide the mechanisms for safe error handling and special cases
As Coverity reported a Time-of-Check/Time-of-Use type of security issue,
took the opportunity to fix it and increased the size of the buffer used
for data to allow better use of modern disk performances.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
As pointed by Coverity, there were some null pointer checks that had been
misplaced, due to a pointer dereference present in a preceding check. This
had been fixed by adding another null check in the check, making a
duplicate check.
This patch moves the null pointer check in first place, and remove the
pointer check from the range check to separate the pointer check on one
side and the range check on the other side.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
Catch-up and some cosmetic changes of the Dutch .po files
Recently added msgid's were translated, plus a few really minor
changes. Kept some entries for last stable release.
In particular, the values were only being converted when the RGB slider was used
to pick the color. If another tool was used, e.g., the magnifying glass, th e
value was assumed to be decimal, even if hexadecimal was selected.
Currently WINGs renders text using Xft directly which does not support
any advanced text layout that is needed for scripts like Arabic or Indic
scripts (or even things like automatic ligature support for Latin
script).
With Pango we also get text fallback for free, so no more square boxes
for characters not supported in the current font (unless no font on the
system supports the specified character, of course).
This patch introduces support for using Pango to render the text (though
its Xft backed), to avoid forcing the additional dependency to everyone
it is made off by default.
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
Recently added msgid's were translated, and some existing translations
improved. As development is done in git 'next', strings from wmaker-0.95.6
will be remained at the end of the files, so they are backward compatible.
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
This patch is adding miniwindow apercu when the mouse
is over the miniwindows.
To enable it you have to run WPref, in Miscellaneous Ergonomic
Preferences, check miniwindow apercus.
Then, you will be able to see a screenshot of the app when the mouse
is over the miniwindow.
As reported by cppcheck:
[WINGs/array.c:129] -> [WINGs/array.c:131]: (warning) Possible null pointer dereference: array - otherwise it is redundant to check it against null.
[WINGs/array.c:151] -> [WINGs/array.c:153]: (warning) Possible null pointer dereference: array - otherwise it is redundant to check it against null.
[WINGs/array.c:170] -> [WINGs/array.c:172]: (warning) Possible null pointer dereference: array - otherwise it is redundant to check it against null.
This patch is checking that the var name 'array' exists.
WRaster:
- new function 'RShutdown'
- removed flag 'optimize_for_speed' from RContext
- new functions '...(operate_xxx)', '...(flip_image)'
WUtil:
- new function 'wutil_shutdown'
- new macro 'wlengthof'
WINGs:
- new function 'WMReleaseApplication'
- new function 'WMCreateScaledBlendedPixmapFromFile'
(And maybe a few more I missed)
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The function did spend its time re-copying data and searching the
end of the read buffer, which is not really efficient.
The new code reads directly from file to the end of previous data,
avoiding unneccesary duplication, and keeps track of the end of
data to avoid searching it for next read.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This macro supposes that the called lib function clears the 'errno'
variable on success which is not the case. The macro was (luckily) not
used in these file yet, by removing it we make sure it won't happen.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
cppcheck is reporting the msg below:
[../WINGs/winputmethod.c:215] -> [../WINGs/winputmethod.c:209]:
(style) Found duplicate branches for 'if' and 'else'.
The patch is fixing it by setting a default return call.
The color well contains two views: view, consisting of the outer "button", and
colorView, consisting of the color itself. Previously, only clicking on view
would bring up the corresponding color panel, resulting in nonintuitive
behavior.
When the condition can be simply checked in an if, it is better to do that
than to use a flow breaking goto.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As reported by Coverity, the structure containing the callback functions
to handle the drag-and-drop actions could be freed but later re-used.
The correct behaviour is to keep the allocated memory for the structure.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the 'paintItem' function in the WMBrowser widget
is checking for nullity of its text argument, but before that it called the
strlen function which crashes on NULL pointer. This patch moves the strlen
call to the right place and reduce the lifespan of 'textLen' to highlight
incorrect tries to use the variable.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, there is a NULL pointer check at the end of the
function 'deleteFile' (which happens to not be necessary because wfree was
made to accept NULL pointers), however there are many things done before
that assumes the pointer is not NULL. The check is moved to where it
matters.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the variable 'dir' is passed by reference because
the function may update it; as it is never NULL (the function is local)
checking for that does not make sense. From the actual usage, it seems
logical that the check should have been on the value, not on the pointer.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the code was checking for NULL pointer to avoid
misbehaviour, but it actually dereferenced the pointer beforehand so the
crash would still happen.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the data returned by WMGetTextSelectedStream are
actually a newly allocated buffer, so we need to release it when we're done
with it.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the array used to build the result for the
function 'getStreamObjects' could leak in case of early return.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>