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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
moving scr initialization after WApplication existing test
to prevent crashing in case wapp is null
Acked-by: Christophe CURIS <christophe.curis@free.fr>
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>
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>
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].
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.
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.
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.
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>
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>
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.
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.
This patch allows users to edit the two fonts (SystemFont and BoldSystemFont)
used in WINGs widgets using WPrefs. Note that changes will not take effect for
WINGs applications which are currently running.
In commit b4cb488, wprogressindicator.c was removed. It was restored in commit
d435ea7, but the corresponding declarations in WINGs/WINGs.h were not. This
patch fixes this oversight.
A common feature in several desktop environments is the ability to bring up
a "run application" dialog via a keyboard shortcut (frequently Mod1+F2). This
feature has been available to Window Maker users only through the root menu.
This patch adds the ability for a user to set up a keyboard shortcut to
accomplish this, either via WPrefs or by editing ~/GNUstep/Defaults/WindowMaker,
e.g., with
RunKey = "Mod1+F2";
Code from the execCommand function in rootmenu.c has been copied almost directly
into the handleKeyPress function in misc.c to accomplish this.