1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00
Commit Graph

3609 Commits

Author SHA1 Message Date
Christophe CURIS
28ce91a901 WINGs: fix check for NULL pointer in WMFilePanel (Coverity #50195)
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>
2014-05-18 23:01:43 +01:00
Christophe CURIS
e65f527ad4 WINGs: fix incorrect usage of direction variable in updateStartForCurrentTextBlock (Coverity #50192)
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>
2014-05-18 23:01:43 +01:00
Christophe CURIS
21c891e669 WINGs: fix possible NULL pointer dereference in WMFreeColorPanel (Coverity #50189)
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>
2014-05-18 23:01:43 +01:00
Christophe CURIS
354ec080ad WINGs: fix memory leak in requestHandler (Coverity #50136)
As pointed by Coverity, the allocated temporary storage was not freed. As
an allocation is not needed here, replaced by a local storage.
2014-05-18 23:01:43 +01:00
Christophe CURIS
482d8d3583 WINGs: fix memory leak in requestHandler (Coverity #50135)
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>
2014-05-18 23:01:43 +01:00
Christophe CURIS
6831daf427 WINGs: fix memory leak in getStreamObjects (Coverity #50119)
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>
2014-05-18 23:01:43 +01:00
Christophe CURIS
0134720621 WINGs: fix memory leak in WMCreateTextForDocumentType (Coverity #50118)
As pointed by Coverity, a temporary WMArray was not freed after use.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00
Christophe CURIS
d65430137d WINGs: fix memory leak in WMGetBrowserPaths (Coverity #50111)
As reported by Coverity, in the (rare) case where the wstrlcat would fail
the array for the result would not be freed before returning.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00
Christophe CURIS
47b801021c WINGs: fix memory leak in WColorPanel (Coverity #50102, #50103, #50104 and #50133)
As reported by Coverity, the function 'WMGetTextFieldText' allocates memory
to generate the result string, so it has to be freed.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00
Christophe CURIS
42febe3cec WINGs: fix check for NULL pointer in WMText selection (Coverity #50067)
As pointed by Coverity, there is a small check for NULL pointer when
handling triple-click selection in a WMText, however this check is only
partially implemented so the code would crash later anyway.
This patch implement an appropriate skip to avoid crash, and includes a
log message to help debug if the case happens.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00
Christophe CURIS
c86de122f9 WINGs: do not crash on NULL title in WMSetWindowTitle (Coverity #50046)
As pointed by Coverity, despite apparent checks the function would fail if
trying to set a NULL title. Instead of trying to do over-complicated things
we just ignore (with a warning if NDEBUG is not set) the case. If user
wants an empty title, the correct way is to provide "" as we're not able to
remove a title.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00
Christophe CURIS
24e223dc27 WINGs: remove unreachable code in paintMenuEntry (Coverity #50042)
As pointed by coverity, the case 'index < 0' cannot be true because it was
already earlier and handled with an early return.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00
Amadeusz Sławiński
ab3057c68d WINGs: Value stored to 'sz' is never read
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-18 23:00:17 +01:00
Amadeusz Sławiński
18f9c49f0a WINGs: Value stored to 'fh'|'fy' is never read
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-18 23:00:17 +01:00
Amadeusz Sławiński
22f1ae15e6 util: Value stored to 'count' is never read
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-18 23:00:17 +01:00
Amadeusz Sławiński
9384e3273f WINGs: Value stored to 'aw' is never read
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-18 23:00:17 +01:00
Amadeusz Sławiński
0db65843ff wrlib: Value stored to 'nptr' is never read
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-18 23:00:17 +01:00
Amadeusz Sławiński
32c720dd86 wmaker: Value stored to 'w1' is never read
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-18 23:00:17 +01:00
Amadeusz Sławiński
677117276c util: Value stored to 'ret' is never read
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-18 23:00:17 +01:00
Amadeusz Sławiński
1b69c49fb2 wrlib: Value stored to 'bptr' is never read
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-18 23:00:17 +01:00
Amadeusz Sławiński
1c6d0f38ef wrlib: Value stored to 'i'|'tmpc' is never read
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-18 23:00:17 +01:00
Amadeusz Sławiński
41c943e900 WINGs: Value stored to 'columnX' is never read
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-18 23:00:17 +01:00
Carlos R. Mafra
05ff62caaf Coding style: Change 'foo * bar' to 'foo *bar' in function arguments
Since 'foo' and 'bar' are not being multiplied...

Done automatically with the sed script:

/^[a-zA-Z][a-zA-Z]*.*(/{
s/ \* \([a-zA-Z]\)/ *\1/g
}

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-05-18 23:00:16 +01:00
Christophe CURIS
3ab50b65b7 WUtil: remove duplicated information from 'wassertr(v)' message
The information about the File, Line and Function name that were included
in the assertion message are already present from the 'wwarning' macro, so
it is not necessary to include them in the macro's message.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:16 +01:00
Christophe CURIS
0350026866 WUtil: change 'wassertr(v)' to still perform check even if NDEBUG is set
In many places of the code these functions are counting on the "return"
effect of these macros to gracefully handle incorrect arguments. So, when
debug is not enabled, if it is okay to not display a message it is however
not good to completely skip the check and skip the early return.

This patch changes the macro to always perform the check and return to
avoid crashes, displaying a message only when NDEBUG is not set.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:16 +01:00
Christophe CURIS
c5f103984a WUtil: fix undefined behaviour with $VARS in wexpandpath (Coverity #50244)
As reported by coverity, calling 'wexpandpath' with a path that contains
either '$()', '$(\0' or '$\0' would cause an undefined behaviour because
the 'buffer2' would be uninitialised.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:16 +01:00
Christophe CURIS
a72c166b6e WUtil: make use of secure_getenv if the function is available
As pointed by Coverity (#50226), the function getenv can return unreliable
data, so if a sensitive application makes uses of the function 'wgethomedir'
or 'wusergnusteppath' we'd better use the GNU function secure_getenv which
ignore environment variable when used in a known critical cases.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:16 +01:00
Christophe CURIS
3aae412588 WUtil: fix type used in sizeof in function wtokensplit (Coverity #50208 + #50209)
As pointed by Coverity, the type used to calculate the size to allocate was
not the right one. It now gets the compiler to deduce it from the variable
for which the memory is allocated.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:16 +01:00
Christophe CURIS
6f7fa45a99 WUtil: remove unnecessary check in WMGetStandardUserDefaults (Coverity #50191)
As pointed by Coverity, the return value of the function 'wdefaultspathfordomain'
cannot be NULL, so it is not necessary to check for that.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:16 +01:00
Christophe CURIS
8f9b843990 WUtil: fixed possible problem in wcopy_file (Coverity #50141)
As pointed by Coverity, the macro RETRY does not behave as expected, as it
assumes that errno is cleared on successful 'fopen' call which is not the
case.

This patch removes the uses of the macro RETRY:
 - fopen: with the appropriate check
 - fread/fwrite: nothing because they do not set errno
 - fclose: nothing because retrying is not recommended

and took the opportunity to add a little bit more information in the error
messages.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:16 +01:00
Christophe CURIS
5255c364b8 WUtil: remove unnecessary check in wstrappend (Coverity #50138)
The function wrealloc never fails, and allocates enough storage to store
the resulting string, so it is useless to check if strcat failed.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:16 +01:00
Christophe CURIS
05f88d0aa7 WUtil: make sure wmalloc/wrealloc won't fail because of abort handler
As pointed by Coverity (#50074), despite the expected behaviour that
'wmalloc' should never return NULL, it may still happen if an abort handler
set by user (with wsetabort) does not call exit() as expected. In such
case we call exit ourself to be sure not to return NULL.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:16 +01:00
Christophe CURIS
978cb1f154 WUtil: fix posible crash in 'wgethomedir' (Coverity #50070)
As pointed by Coverity, if the user does not a an entry in the password
file then the function would assume its home path to be "/" but still
continue and later try to check for user->pw_dir which would dereference
the NULL pointer.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:16 +01:00
David Maciejak
11497973ad src/winmenu.c: updated prepare_menu_position
did some change as prepare_menu_position never updated x and y values

Acked-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:16 +01:00
David Maciejak
9456252d51 src/usermenu.c: updated wUserMenuRefreshInstances
remove unused var and move wwin check

Acked-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:16 +01:00
David Maciejak
867f221ead src/misc.c: updated GetShortcutString
remove unused var and remove some commented code too

Acked-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:16 +01:00
Christophe CURIS
92ecb3c3ed WMaker: rewrote generation of title for the Icon Chooser to avoid problems
The original code did have a few weaknesses, including:
 - possible buffer overflow, if the translation was too long;
 - possible crash, if either instance or class is NULL but not both

Now the appropriate length is calculated (not counting on a margin) and the
string is generated with the available elements.

As a side note, the variable was renamed from 'tmp' to 'title' for clarity.

This was highlighted by cppcheck (thanks to David Maciejak) and by
Coverity (bug #50078).

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:16 +01:00
David Maciejak
aa1ee24fc0 src/appicon.c: updated paint_app_icon
moving scr initialization after WApplication existing test
to prevent crashing in case wapp is null

Acked-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:16 +01:00
Christophe CURIS
cad716b5ef News: ran spell-checker on the file
Lang was set to en_US to have consistency in the file.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:16 +01:00
Christophe CURIS
2ffda2e663 News: described the new features for future 0.95.6 release 2014-05-18 23:00:15 +01:00
Christophe CURIS
c45cab7bad News: marked the current changes as part of 0.95.5 and describe the drawers feature 2014-05-18 23:00:15 +01:00
Christophe CURIS
7857c9c204 News: added section to describe the changes that have occured in 0.95.4 2014-05-18 23:00:15 +01:00
Christophe CURIS
8e9a5b7582 News: added description of a change that may be interesting to users 2014-05-18 23:00:15 +01:00
Christophe CURIS
e0ebcab4a7 News: created section dedicated to the changes related to 0.95.3 2014-05-18 23:00:15 +01:00
Christophe CURIS
904e8d2be4 WMaker: moved XGrab/XUngrabPointer into the conditional code
It is not necessary to call them when the command is not executable.
Took opportunity to change parameter to XSync which is supposed to be a
'Bool' type from Xlib, which means either True or False.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:15 +01:00
Christophe CURIS
39181154ab WINGs: changed use of 'if' on panel->rgbState into a switch
This allow compiler to raise a warning in case a new value would be added
to the enum; it also change order in the check so that WMGetButtonSelected
will be called only once, only for the case of interest.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:00:15 +01:00
Doug Torrance
963b4b2b78 WPrefs: Add ability to edit FrameBorderColor/FrameSelectedBorderColor.
As part of the process, some #defines were turned into enums.  Also, the *_COL
when needed.

This brings the code for colors in line with the code for textures, and
allows us to use them as array indices to improve readability, e.g.,
colorOptions[MTITLE_COL] instead of colorOptions[3].
2014-05-18 23:00:15 +01:00
Doug Torrance
763491f3ff doc: Update getstyle and setstyle manpages.
The manpages for getstyle and setstyle have not been updated and were missing
some options.  This patch brings them up to date.

In addition, the *TitleExtendSpace options were appearing twice in getstyle.c.
One of the unnecessary sets was removed.
2014-05-18 23:00:15 +01:00
Doug Torrance
5182b32fe9 WPrefs: new enum in Appearances.c for tab identifiers to increase readability 2014-05-18 23:00:15 +01:00
Doug Torrance
82e857a49e WPrefs: remove unfinished background tab from appearances panel code
WPrefs.app/Appearances.c contained code for an unfinished feature
in the appearances panel of WPrefs, a tab for setting the background.

Since this feature has now been implemented as part of the texture
tab (see commit c2aca1a ("WPrefs: Set workspace background")), there
is no reason to keep this code.
2014-05-18 23:00:15 +01:00