1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 04:48:06 +01:00
Commit Graph

3192 Commits

Author SHA1 Message Date
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
Amadeusz Sławiński
2cb3119e08 WPrefs: Value stored to 'timage' is never read
three times in a row

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-18 23:00:15 +01:00
Doug Torrance
4b744d517b add util/wmiv to .gitignore 2014-05-18 23:00:15 +01:00
Doug Torrance
96c9ec185a WPrefs: fix segfault when image not found
Previously, when an image could not be loaded by WPrefs when rendering textures
for the Appearances panel, a segfault would occur.  This could happen, e.g., if
a user moved or deleted an image file without editing their ~/GNUstep/Defaults/
WindowMaker file.

This patch first checks if a texture contains an image, and if it does, it
checks to see if that image can be loaded.  If it can't, a solid black texture
is loaded instead.

The patch also has the added benefit of combining some of the code used for
rendering both pixmap and textured gradient textures.
2014-05-18 23:00:15 +01:00
Amadeusz Sławiński
3b71662011 WINGs: actually assign variable
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-17 15:59:48 +01:00
Amadeusz Sławiński
c1031965e9 WINGs: Value stored to 'pos'|'_w'|'done' is never read
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-17 15:59:48 +01:00
Amadeusz Sławiński
f41880cf05 WINGs: Value stored to 'scroll' is never read
it is assigned after doing switch() {}
so values assigned in switch() are dropped anyway

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-17 15:59:48 +01:00
Amadeusz Sławiński
b857bafc88 WINGs: Called function pointer is null (null dereference)
make sure that we have function to call

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-17 15:59:48 +01:00
Amadeusz Sławiński
fb4cd10519 wrlib: wrong type in sizeof
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-17 15:59:48 +01:00
Amadeusz Sławiński
7b413ff07f wrlib: wrong type in sizeof
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-17 15:59:48 +01:00
Amadeusz Sławiński
56772f792c wrlib: potentially incorrect sizeof in malloc
Result of 'malloc' is converted to a pointer of type 'unsigned char',
which is incompatible with sizeof operand type 'char'

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-17 15:59:48 +01:00
Christophe CURIS
bb7d9b48bd wmlib: remove wrong free highlighted by commit 65dc99d805
It is really unlikely that the free(menu) was the correct thing, it is more
likely that it was a typo instead of the appropriate 'free(menu)':
It would be excessive behaviour to free the complete menu only because an
entry cannot be added, and even if it were the case that would not be the
right way to do it because it would leak all the entries already allocated
for it.
(This fixes Coverity #50154 and #50155)

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-17 15:59:47 +01:00
Amadeusz Sławiński
ff1e6f8273 wmlib: Potential leak of memory pointed to by 'entry'
two similar ones, if we return then free allocated memory

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-17 15:59:47 +01:00
Amadeusz Sławiński
3187f95278 wrlib: Potential leak of memory pointed to by 'tmpp'
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-17 15:59:47 +01:00
David Maciejak
7783c2258b clean wDockFindFreeSlot function
it appears that a sx var is set but not used
2014-05-17 15:59:47 +01:00
David Maciejak
0c151a55f4 util/wmiv: an image viewer using wrlib
This patch brings wmiv, a fast image viewer using wrlib.
2014-05-17 15:59:47 +01:00
Doug Torrance
66556c421d WPrefs: Set workspace background
This patch enables users to set the workspace background (WorkspaceBack) in the
Appearance Preferences section of WPrefs.  It appears as a new item in the
popup menu in the Texture tab, in the list of textures below, and a preview
appears in the background of the preview panel on the left.
2014-05-17 15:59:47 +01:00
Doug Torrance
a325624b4a WINGs: Option for decimal or hexadecimal RGB colors
The RGB panel of the WINGs color panel lists the red, green, and blue values as
base 10 numbers.  However, hexadecimal numbers are very common when dealing with
RGB colors.  This patch adds two radio buttons at the bottom of the RGB panel
to allow users to choose their preferred number system.

For version 2 of the patch:

Based on Cristophe's suggestions regarding the new decimal/hexadecimal RGB color
feature introduced in commit 83d8ad6, this patch changes rgbState from an int
to an enum, converts some if statements to switches, and changes from atoi to
strtol for the base 10 string conversion.

In addition, the "hexadecimal" text was too wide for the default size of its
radio button for some fonts, so both radio buttons are now resized to fit the
width of the panel.
2014-05-17 15:59:47 +01:00