1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00
Commit graph

466 commits

Author SHA1 Message Date
Marcin Cieslak
de61ffa637 Use -O2 -fno-strict-aliasing optimization for FreeBSD
- Switching from -O to -O2 after the dthelp problem
  has been resolved
- Introducing -fno-strict-aliasing (currently FreeBSD's
  default) to avoid silent change of behaviour of legacy code.

  http://thiemonagel.de/2010/01/no-strict-aliasing/

  http://jeffreystedfast.blogspot.de/2010/01/weird-bugs-due-to-gcc-44-and-strict.html

Analysis of C99 aliasing (we are not C99 yet):

  http://davmac.wordpress.com/2010/02/26/c99-revisited/
2012-10-01 18:59:20 -06:00
Marcin Cieslak
775fb0f0f1 Don't break help with gcc -O2
libDtHelp is unable to read SDL help files
with -ftree-store-ccp optimization which
is enabled by -O2 on gcc 4.2.1.

GifUtils.c and decompress.c didn't work
properly with -ftree-store-ccp enabled.

GifUtils.c was repaired by fixing
those warnings:

GifUtils.c: In function 'create_pixmap':
GifUtils.c:1093: warning: return makes integer from pointer without a cast
GifUtils.c:1110: warning: return makes integer from pointer without a cast
GifUtils.c:1215: warning: return makes integer from pointer without a cast
GifUtils.c: In function 'gif_to_pixmap':
GifUtils.c:1242: warning: return makes integer from pointer without a cast

decompress.c didn't generate warnings, but the
only effect of the -ftree-store-cpp was to introduce
this change:

        addq    $1, %rax
        movq    %rax, (%rbx)
 .L90:
-       cmpl    $157, %edx
+       cmpl    $-99, %edx
        jne     .L86
        movl    8(%rbx), %eax
        subl    $1, %eax

Which corresponds to this source code:

bufioI.h

     57 #define BufFileGet(f)   ((f)->left-- ? *(f)->bufp++ : (*(f)->io) (f))

     42     int     (*io)(/* BufFilePtr f */);

decompress.c
     53 #ifdef NO_UCHAR
     54  typedef char   char_type;
     55 #else
     56  typedef        unsigned char   char_type;
     57 #endif /* UCHAR */
     58
     59 static  char_type magic_header[] = { "\037\235" };      /* 1F 9D */

    131     if ((BufFileGet(f) != (magic_header[0] & 0xFF)) ||
    132         (BufFileGet(f) != (magic_header[1] & 0xFF)))
    133     {
    134         return 0;
    135     }

BufFileGet() returns (int), so the (unsigned char) constants
got promoted to (int) with sign extension; therefore constant
157 decimal (0x9D) became -99 decimal, sign extended
(0xffffff9D), and the comparison was always false.

Tested using:
$ gcc -v
Using built-in specs.
Target: amd64-undermydesk-freebsd
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 4.2.1 20070831 patched [FreeBSD]

Running on:
FreeBSD 10.0-CURRENT (r240948M)
built Wed Sep 26 23:33:08 CEST 2012
2012-10-01 18:59:14 -06:00
Marcin Cieslak
48b76f8623 dtcreate: Don't crash when clicking "Find Set..."
dtcreate crashed on 64-bit system when clicking
"Find Set.." button.

Crash happens in libXm:

    new_w=0x805db4300, args=0x7fffffffb430, num_args=0x7fffffffb3dc)
    at Form.c:1955

$1 = {att = {{type = 4 '\004', w = 0x805db3700, percent = 0, offset = 0,
      value = 0, tempValue = 0}, {type = 1 '\001', w = 0x0, percent = 0,
      offset = 10, value = 0, tempValue = 0}, {type = 3 '\003',
      w = 0x805db3700, percent = 0, offset = 0, value = 0, tempValue = 0}, {
      type = 3 '\003', w = 0x800000000, percent = 0, offset = 10, value = 0,
      tempValue = 0}}, next_sibling = 0x0, sorted = 0 '\0',
  resizable = 1 '\001', preferred_width = 0, preferred_height = 0}

(...)

    at icon_selection_dialog.c:1768
1767            /* Creation of icon_scrolled_win */
1768            icon_scrolled_win = XtVaCreateManagedWidget( "icon_scrolled_win",
1769                            xmScrolledWindowWidgetClass,
1770                            icon_selection_dialog,
1771                            XmNscrollingPolicy, XmAUTOMATIC,
1772    /*                      XmNnavigationType, XmTAB_GROUP, */
1773                            XmNx, 282,
1774                            XmNy, 84,
1775                            XmNscrollBarDisplayPolicy, XmAS_NEEDED,
1776                            XmNrightOffset, 10,
1777                            XmNrightAttachment, XmATTACH_FORM,
1778                            XmNtopOffset, 0,
1779                            XmNtopWidget, icon_container_label,
1780                            XmNtopAttachment, XmATTACH_WIDGET,
1781                            XmNleftOffset, 0,
1782                            XmNleftWidget, icon_container_label,
1783                            XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1784                            XmNbottomOffset, 10,
1785                            XmNbottomWidget, XmATTACH_NONE,
1786                            XmNbottomAttachment, XmATTACH_WIDGET,
1787                            NULL );

What happens here is that ConstraintInitialize receives
four constraints, the last one is this:

    { type = 3 '\003', /* XmATTACH_WIDGET */
      w = 0x800000000, /* malformed XmATTACH_NONE ???
      percent = 0,
      offset = 10, /* specified as XmNbottomOffset */
      value = 0,
      tempValue = 0}

XmATTACH_* values are defined in <Xm/Xm.h> as follows:

   505  enum{   XmATTACH_NONE,                  XmATTACH_FORM,
   506          XmATTACH_OPPOSITE_FORM,         XmATTACH_WIDGET,
   507          XmATTACH_OPPOSITE_WIDGET,       XmATTACH_POSITION,
   508          XmATTACH_SELF
   509          } ;

What is not clear to why XmATTACH_NONE - which should be (int)0 -
becomes 0x800000000 - looks like a 64 bit bug somewhere.

Providing a long value on None (0L) as in this change fixes the
problem.

I understand is that it possible to use such an "empty" widget
is to create additional space at the bottom of the newly created
"icon_scrolled_win".

What needs to be clarified - shouldn't be such an (int) value be
automatically promoted to (long) (or XtArgVal, XtPointer, ...)
and preserve the value 0? Lots of parameters seem to be
passed as ints (for example dimensions) and they do not
appear to cause any trouble.
2012-09-30 11:11:21 -06:00
Jon Trulson
f40368caa2 XmPrivate.h: never try to build this automatically.
XmPrivate must be generated manually.  For this you work, you must
have a freshly compiled openmotif tree, and MLIBSRC must be pointing
to it.

Otherwise, it's possible during the includes phase for an attempt to
be made to regenerate this file, which will fail on the vast majority
of systems out there.

So, to regenerate,

cd include/Xm
rm XmPrivate.h
make XmPrivate.h
2012-09-29 20:46:27 -06:00
Marcin Cieslak
27bc7d6bec dtcreate: Add missing prototypes and more (64-bit)
- Fix missing prototypes
- Fix some 64-bit related problems (XtVaGetValues)
- Fix crash on dtcreate startup in create_applicationShell1()
- Add XmeFlushIconFileCache() prototype from <Xm/IconFileP.h>
2012-09-29 20:28:45 -06:00
Marcin Cieslak
3eaeffaf7e XmPrivate.h: Avoid whitespace problems (IMPROVED)
When applying a patch, "git am" strips
trailing whitespace, although they are
present in the git formatted-patch.

This way the committed file will be
slightly different than the file re-generated
by extractprototype.h

It shouldn't hurt, but next run of
extractprototype.h will add trailing spaces
again and the resulting diff on XmPrivate.h
will include more changes than actually
needed.

This may break some viscious circle after
applying the patch, so enabling regeneration
on LinuxArchitecture again.

This patch does not add XmeFlushIconFileCache()
needed by dtcreate.
2012-09-29 20:28:43 -06:00
Frederic Koehler
71962e580d dtcreate: Avoid trying to reuse closed help window
This fixes a segfault when trying to go to help a second
time, after closing the first window.
2012-09-29 19:29:02 -06:00
Frederic Koehler
4773d68153 dthelp: Avoid undefined behaviour in strcpy
Technically strcpy's ranges cannot overlap at all,
although in practice this is usually not an issue.
Does quiet a valgrind warning, however.
2012-09-29 19:21:27 -06:00
Marcin Cieslak
7948362829 dtfile: fix crash in RecheckFlag (64bit) 2012-09-28 19:13:29 -06:00
Jelle Hermsen
399915f0ce Teach ToolTalk config about NetBSD and adds HAS_STATVFS identifier which is consequently used in tt_file_system.C, because NetBSD switched to the POSIX/XOpen statvfs() calls in 2004. 2012-09-28 19:11:09 -06:00
James Woodcock
0ea703ed1e Use the system strcasestr() on Linux. 2012-09-27 18:01:24 -06:00
James Woodcock
44e384aedb Older Linux installations do not have svcfd_create().
svcfd_create() is only called if OPT_UNIX_SOCKET_RPC is defined, so a #ifdef
round that code should be OK.
2012-09-27 18:01:19 -06:00
James Woodcock
406fa95994 Use RPC_ANYSOCK instead of the magic number -1. 2012-09-27 18:01:14 -06:00
James Woodcock
407bb371f2 Remove unnecessary extern modifier from struct declaration. 2012-09-27 18:01:09 -06:00
Marcin Cieslak
ee82570104 Use typedef XDR from <rpc/xdr.h>
__rpc_xdr is no longer available on FreeBSD 10.
(XDR is typedef'd as "struct XDR" and not "struct __rpc_xdr").

By the way, why did we ever need this? Probably
it should be removed. Leaving for __OpenBSD__ for now.
2012-09-27 17:54:12 -06:00
Marcin Cieslak
5f8b6ba739 dticon: fix typo in the last commit 2012-09-27 17:54:09 -06:00
Marcin Cieslak
481e46a7b2 Update vendor logo for FreeBSD
- Improved font rendering and anti-aliasing
  by hand
- Let dticon recognize .bm file as X bitmap
2012-09-26 19:43:55 -06:00
Marcin Cieslak
0f6300008d dticon: make XVaGetValues() call 64-bit compliant 2012-09-26 19:43:00 -06:00
Marcin Cieslak
e1f9b57844 dtstyle: XVaGetValues() calls 2012-09-26 19:42:57 -06:00
Pascal Stumpf
b61e8ebad6 Add csu objects to shared libraries on OpenBSD.
This is required by recent changes to the stack protector code in gcc,
generating references to __guard_local instead of __guard, defined in
crtbeginS.o.

This is a temporary solution; strictly speaking, we shouldn't invoke ld
directly at all but use cc instead.
2012-09-25 11:37:23 -06:00
Marcin Cieslak
e7ad6b776e Dtlogin logo for FreeBSD
Install black and white and 128-color custom logos for FreeBSD.

The FreeBSD logo based on the artwork provided by The FreeBSD Foundation:
  http://www.freebsd.org/logo/logo-basic.png

  The mark FreeBSD is a registered trademark of The FreeBSD Foundation
  is are used by Common Desktop Enviroment (CDE) with
  the permission of The FreeBSD Foundation.

  The FreeBSD Logo is a trademark of The FreeBSD Foundation and is used
  by Common Desktop Environment (CDE) with the permission of
  The FreeBSD Foundation.

Use of logo subject to Trademark Usage Terms and Conditions:
    http://www.freebsdfoundation.org/documents/Guidelines.shtml
2012-09-25 11:35:29 -06:00
Marcin Cieslak
c697b943d4 Don't make /var group writable
* Use 0755 permissions for /var (not 0775)
  - this makes sendmail unhappy
* Don't change permissions on /var on dtlogin startup
2012-09-25 11:33:11 -06:00
Marcin Cieslak
663c251125 Install /usr/local/libdata/ldconfig/cde for FreeBSD
I mean really this time. Please.
2012-09-25 11:33:09 -06:00
Anthony Perkins
e7cb79e9b2 Corrected font aliases for "-b&h-lucidasans" on FreeBSD.
The following patch gets the Lucida Sans font working on my FreeBSD system. Before applying this, title bars and menu bars are displayed in the "-misc-fixed" font. This is on FreeBSD 9.0-RELEASE-p3.
2012-09-25 11:32:02 -06:00
Marcin Cieslak
0747780cdd FreeBSD: Add /usr/dt/lib to runtime linker - update
On Mon, 24 Sep 2012, Jon Trulson wrote:

> On Tue, 25 Sep 2012, Marcin Cieslak wrote:
>
> Applied.

I'm sorry - it turns out this one does not fully
work as expected.

This one is better (it's relative to the old master)
- so it might cause a conflict:
2012-09-24 19:21:12 -06:00
Jon Trulson
a658d226d1 Revert "FreeBSD: Add /usr/dt/lib to runtime linker"
This reverts commit 91f228411e.

Updated patch.
2012-09-24 19:20:56 -06:00
Marcin Cieslak
77ec7b56b8 2 warnings fixed (64-bit)
Fix XtVaGetValues() output for 64-bit
Fix filename comparison in Dts.c
2012-09-24 18:35:24 -06:00
Marcin Cieslak
91f228411e FreeBSD: Add /usr/dt/lib to runtime linker
Create $LOCALBASE/libdata/ldconfig/cde
which points the runtime linker to /usr/dt/lib

There is no need to invoke ldconfig manually
after this.
2012-09-24 18:34:30 -06:00
Marcin Cieslak
a8c2232e48 dtpdm: XtVaGetValues, XtPointer, XtArgVal, ...
Make XtVaGetValues return variables safe for 64-bit
2012-09-24 18:31:25 -06:00
Marcin Cieslak
917f7da191 157 warnings: remove -DXK_MISCELLANY from Makefiles
Fixes the following warning:

In file included from ../../../imports/x11/include/X11/Xutil.h:54,
                 from ../../../imports/x11/include/X11/Intrinsic.h:54,
                 from Action.c:64:
../../../imports/x11/include/X11/keysym.h:49:1: warning: "XK_MISCELLANY" redefined
<command-line>: warning: this is the location of the previous definition

<keysym.h> which includes all key symbols and loads <keysymdef.h>
is automaticlly included by the X Toolkit.

This patch removes #include <keysymdef.h> whenever not needed,
and adds #define XK_MISCALLANY in the source code where required.
2012-09-24 18:30:21 -06:00
Marcin Cieslak
c70978e986 dtmail: fix warning: comparison is always false
This warning was caused by a typo:

warning: comparison is always false due to limited range of data type
2012-09-24 18:27:45 -06:00
Marcin Cieslak
22a0f8f497 dtmail: fix warning: NULL used in arithmetic
NULL != NULL makes no sense, really...
2012-09-24 18:27:18 -06:00
Marcin Cieslak
e3564643ad dtmail: warning: 'DtMailBoolean' is promoted to (int)
Fix this warning:

RFCTransport.C: In function 'long unsigned int writeToFileDesc(const char*, int,
 __va_list_tag*)':
RFCTransport.C:91: warning: 'DtMailBoolean' is promoted to 'int' when passed thr
ough '...'
RFCTransport.C:91: warning: (so you should pass 'int' not 'DtMailBoolean' to 'va
_arg')
RFCTransport.C:91: note: if this code is reached, the program will abort
2012-09-24 18:26:27 -06:00
Marcin Cieslak
91bfe1e4dc dtmail: Fix XtVaGetValues() return value storage
At least one crash was caused by this
on the 64-bit system
2012-09-24 18:26:11 -06:00
Marcin Cieslak
3a246dfb9b Get rid of unpleasant cast, it causes SIGSEGV
Having a difficult choice between unplasant
cast to get a void * into an enumeration type
and "Something's wrong here" double cast
I decided for the latter.

At least it does not crash when the legal
value of zero is passed as the argument.
2012-09-24 18:25:28 -06:00
Marcin Cieslak
86cb67de90 dtpad: kill one warning 2012-09-23 19:46:21 -06:00
Marcin Cieslak
e077181a46 dtpad: Use XtArgVal for int conversion
Avoid overwrite of local variables when using
short (int, etc.) types with XtVaGetValues().

Cast XtPointer using (XtArgVal) without
the need to use C99 <stdint.h> and friends.
2012-09-23 19:45:56 -06:00
Marcin Cieslak
d089ff7599 dtpad: Fix 64-bit crash on file open/save
Fix SIGSEGV because of implicit declaration
of _XmStringUngenerate.

The error message reported to the user was:

TT_ERR_PROCID The process id passed is not valid.
2012-09-23 19:45:22 -06:00
Marcin Cieslak
d852a8bfa6 BSD: Remove libXX.so symlink before installing
Now we can run "make" in "lib/tt" again
and the symlink will be recreated.
2012-09-23 19:44:36 -06:00
Marcin Cieslak
c1b4c13398 dtprintinfo: sym2num needs ksh 2012-09-23 19:43:43 -06:00
Marcin Cieslak
df1da3432e dtprintinfo: Use 64-bit values for XtVaGetValues() pointers
XtArgVal should be a type that encompasses XtPointer
and long integer types. In the X.org implementation
it is currently defined as (long).

Don't use (unsigned int *) instead of (Window *).
2012-09-23 19:43:11 -06:00
Marcin Cieslak
fc0f1ff697 dtprintinfo: Use CUPS lpq for FreeBSD
Use /usr/local/bin/lpq from CUPS for FreeBSD
for now; this prevents immediate dtprintinfo
crash.

In the future we should handle both built-in
/usr/bin/lpq as well as CUPS /usr/local/bin/lpq
output in separate functions.

Code to support CUPS should probably shared between
other operating systems.
2012-09-23 19:41:32 -06:00
Marcin Cieslak
6ea7855841 Fix logic in dtprintinfo
Fix values for true/false and boolean type
2012-09-23 19:38:43 -06:00
Marcin Cieslak
18a78bbff5 dtfile: fix pointer to integer conversion
Use XtArgVal (usually (long)) to convert
(XtPointer) to (int) and back.

This provides safe way to convert and
avoids compiler warning.
2012-09-23 19:38:40 -06:00
Jon Trulson
359126b739 contrib/xinetd: xinetd file for cmsd and ttsdbserver
mailling list post from: Ecmel Ercan <ecmel.ercan@gmail.com>
2012-09-23 19:32:17 -06:00
Marcin Cieslak
6b1d497984 dttypes should not crash on 64-bit system
Casting (int) to (char **) will not
prevent crash on a 64-bit system.

A proper ANSI prototype has been added.
2012-09-22 19:04:27 -06:00
Marcin Cieslak
1041e08003 Fix dtfile crash on 64 bit
When asking for data using XtVaGetValue()
make sure that there is enough place for
the return value (which is sometimes XtPointer).
Providing pointer to (int) is not enough.

Cast XtPointer into requested int types
directly, which unfortunately introduces
compilation warning:

cast from pointer to integer of different size
2012-09-22 19:04:21 -06:00
Jon Trulson
9b77aa08b4 Xm/Imakefile: never try to regen XmPrivate.h on linux systems. It will always fail. 2012-09-18 10:14:33 -06:00
Jon Trulson
3a9bac86e3 Merge branch 'master' of ssh://git.code.sf.net/p/cdesktopenv/code 2012-09-18 10:07:11 -06:00
Marcin Cieslak
1079b56422 dtfile: Add missing prototypes
Add missing prototypes and header files to the dtfile
code in order to move closer towards 64-bit compatibility.

Extract the following functions from Motif internal headers:

_XmGetWidgetExtData
_XmRecordEvent
_XmStringUngenerate
_XmTextFieldSetDestination
_XmGetActiveTopLevelMenu

Extract manually prototypes of the obsolete Motif interface:
_XmHighlightBorder
_XmUnhighlightBorder

Remove XmPrivate.h if extractprototype.awk fails

Make the following header files available via -I:
	codelibs/boolean.h
	codelibs/pathutils.h
	codelibs/shellutils.h
and remove shellutils.h from dtwm directory.
2012-09-18 09:59:11 -06:00