1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-23 06:38:05 +01:00
Commit Graph

1048 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Doug Torrance
0a30d42eaa Restore wprogressindicator.c declarations to WINGs/WINGs.h
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.
2014-05-11 22:06:14 +01:00
Christophe CURIS
51ad8b7dc1 WINGs: Removed checks for code that can't fail
In the function 'wdefaultspathfordomain' there was a check to make sure the
generated path would fit in the allocated area, but this allocated area is
sized precisely to fit the path, so it cannot fail.

In the function 'getCurrentFileName' there were checks to make sure the
generated result string would fit in the allocated area, but this allocated
area is sized precisely to fit the path, so it cannot fail.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-09 20:42:34 +01:00
Christophe CURIS
546c148ac0 WINGs: safer cleanup in the 'WMReleaseApplication' function
The function would not behave correctly if called twice, and the
library may re-use de-allocated pointers if calling WINGs functions
after calling this function.

The goal is for our library to behave as cleanly as possible, so
that users may have a clearer hint in case of misuse on their side
to debug the problem.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-09 20:42:34 +01:00
Christophe CURIS
9ee94f8777 WINGs: removed unused variable in syslog messaging code
As pointed by the commpiler, the variable 'syslog_prefix' is not used
in the code, so it is removed.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-09 20:42:34 +01:00
Christophe CURIS
f5167ae12d WUtil: Aligned msgid for error message translations against latest code
Due to some old and recent patches, the msgid used for translating the
error messages were not in line with the source code, now they are.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-09 20:42:34 +01:00
Christophe CURIS
a2328d9842 WINGs: Fix crash on exit while trying to save user config changes
Recent patches has introduced the ability to exit cleanly from the WINGs
library, but this introduced some side effects because a function is
registered with 'atexit' to save user config on exit, which may not work
anymore because WMReleaseApplication frees some stuff needed for that task.

This patch handles this so that both method works, in case user of the lib
would forget to call the clean exit function.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-09 09:47:42 +01:00
Doug Torrance
139382380f Added missing files to distribution tarball.
A number of files have been added to the Window Maker source tree but are not
included in the tarball produced by "make dist" because they have not been added
to EXTRA_DIST in the appropriate Makefile.am.  They are:
- Dutch translation files (commit afc90)
- email-clients.txt (commit 385db)
- WPrefs source files removed from WPrefs_SOURCES (commit 21dfd)

This patch adds these missing files.
2014-05-03 23:24:37 +01:00
Doug Torrance
058e0a0ebd Added pkg-config file for WUtil.
Currently, there is no WUtil.pc file so that WINGs developers can use
pkg-config to compile programs using the WINGs utility library.  This patch
fixes this, and such a file is created by make, just like WINGs.pc and
wrlib.pc.

In addition, the WUtil.pc file has been added to .gitignore and included in
the debian libwings-dev package.
2014-04-29 10:15:27 +01:00
Christophe CURIS
b6ffe90ec4 WINGs: Changed algorithm to resize a pixmap while keeping aspect ratio
The original code would not provide correctly sized images in some cases
of ratios on the original image and on the requested size.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-04-29 10:15:27 +01:00
Christophe CURIS
36159c614f wmaker: Scale image to make them fit in the preview panel
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-04-29 10:15:27 +01:00
David Maciejak
588e04dda7 WINGs: Add functions to release application memory 2014-04-24 10:56:25 +01:00
Christophe CURIS
36c3f7edf4 WUtil: Added missing const attribute to function arguments
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-04-24 10:47:45 +01:00
Christophe CURIS
e8feda5414 WUtil: Fixed incorrect header being included
WUtil's file misc.c was including the private header for WINGs, where it
should have been using WUtil's public header instead.

Took opportunity to include the appropriate copyright header.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-04-24 10:47:45 +01:00
David Maciejak
a3ce005980 WINGs: Add support for syslog messaging
This patch is used to add support for syslog messaging implemented in
WINGs lib directly, so available from the lib itself and wmaker too.
I believe it will in a first time help to get some logging info
centralized in one point, and in a second time maybe add some info
level messages like wmaker is starting, stopping, restarting and else.

For now, it's built by default when the syslog support is found, maybe
we could also disable it by default.
2014-04-24 10:47:45 +01:00
Alwin
afc900a7c3 New translation into Dutch for Window Maker
Because the existing nl locale files are ancient and obsolete,
the user interface stays mainly in English with hardly Dutch text
showing up.

This is a complete translation in 6 parts from scratch, using the
current (pl)menus and Makefile generated .pot files. These files
provide a very good, and thoroughly checked user interface in the
Dutch language.

Adding me as a maintainer in related README files; removing previous
maintainer (e-mail bounced).

Removing unnecessary executable bit from pt.po on the fly.
2014-04-24 10:47:45 +01:00
BALATON Zoltan
329bcca763 Updated Hungarian translation
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
2014-04-24 09:27:15 +01:00
BALATON Zoltan
ae0cc1427f Updated Hungarian translations
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
2014-04-24 09:27:15 +01:00
BALATON Zoltan
7a10bcb51e Fix out of source build for i18n pot files
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
2014-04-24 09:27:15 +01:00
David Maciejak
2c5dbae444 WINGs/Examples: Removed refs to connect and server examples 2014-02-13 08:58:25 +00:00
Rodolfo García Peñas (kix)
3b97d33d0a WINGS: removed compiler warnings.
This patch removes compiler warnings.
2014-02-13 08:55:47 +00:00
Christophe CURIS
5770e53c50 Fixed a few improper macro usages
Added compiler checks for some improper macro usage and fixed the problems
pointed by gcc.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:13:33 +00:00
Christophe CURIS
895a6e97e1 WINGs: Added 'const' attribute to function 'WMCreateHashTable'
Although this is a modification of the public API, this patch does not
change the binary interface, and the attribute does not add a constraint
on the parameter for the caller so we do not break the source compatibility
either.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:07 +00:00
Christophe CURIS
26c64933e0 WINGs: Added a few missing const attributes
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:06 +00:00
Christophe CURIS
6184c955e7 Code refactoring: replaced macro 'SHAPE' by 'USE_XSHAPE' for consistency
The usual way to define a macro in is to name macro with 'USE_xxx' when
they are used to enable a feature 'xxx'

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:06 +00:00
Christophe CURIS
cd501741a1 WINGs: Removed unnecessary type conversion
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00