From ffe9a032601ffb59a10141bce13b4322a1584e87 Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Sun, 24 Jan 2016 15:27:30 -0800 Subject: Misc. fixes With the siwtch to a C++ compiler, the AC_PATH_XTRA has become less effective as it internally relies on the C compiler invokation. Fixed CXXFLAGS, CPPFLAGS, and LDFLAGS when detecting usability. Various bitmasks in src/hyper and src/graph were bogusly using 'char' (instead of 'unsigned char') when they specify values larger than 127. Caught by the C++ compiler, thanks to no-narrowing conversion. Fixed. Eventually the X11-based HD interface and graphics should be replaced by a more modern GUI interface. --- src/hyper/ht_icon | 2 +- src/hyper/hyper.h | 11 ++++++++++- src/hyper/initx.c | 14 ++++++++------ src/hyper/mouse11.bitmap | 2 +- src/hyper/mouse11.mask | 2 +- src/hyper/scrollbar.c | 10 +++++----- src/hyper/sdown3d.bitmap | 2 +- src/hyper/sdown3dpr.bitmap | 2 +- src/hyper/sup3d.bitmap | 2 +- src/hyper/sup3dpr.bitmap | 2 +- 10 files changed, 30 insertions(+), 19 deletions(-) (limited to 'src/hyper') diff --git a/src/hyper/ht_icon b/src/hyper/ht_icon index 859e0fe2..b50a3143 100644 --- a/src/hyper/ht_icon +++ b/src/hyper/ht_icon @@ -2,7 +2,7 @@ #define ht_icon_height 40 #define ht_icon_x_hot -1 #define ht_icon_y_hot -1 -static char ht_icon_bits[] = { +static unsigned char ht_icon_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x00, 0xe7, 0xef, 0x7b, 0x3c, 0xe7, 0xff, diff --git a/src/hyper/hyper.h b/src/hyper/hyper.h index c4956a5f..9f936764 100644 --- a/src/hyper/hyper.h +++ b/src/hyper/hyper.h @@ -1,7 +1,7 @@ /* Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd. All rights reserved. - Copyright (C) 2007-2010, Gabriel Dos Reis. + Copyright (C) 2007-2016, Gabriel Dos Reis. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -303,4 +303,13 @@ extern GroupItem *gTopOfGroupStack; extern HyperDocPage *gPageBeingParsed; + +// Kludge between the more correct 'array of unsigned char' incoming data, +// and the unprincipled 'pointer to char' parameters of several X11 +// functions below. +template +inline const char* as_chars(const unsigned char (&ary)[N]) { + return reinterpret_cast(&ary[0]); +} + #endif diff --git a/src/hyper/initx.c b/src/hyper/initx.c index 521bc8cb..5b8dee53 100644 --- a/src/hyper/initx.c +++ b/src/hyper/initx.c @@ -1,7 +1,7 @@ /* Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd. All rights reserved. - Copyright (C) 2007-2012, Gabriel Dos Reis. + Copyright (C) 2007-2016, Gabriel Dos Reis. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -86,6 +86,7 @@ static void open_window(Window w); static void set_name_and_icon(void); static void set_size_hints(Window w); + static GContext server_font; unsigned long *spadColors; int scrn; /* used in spad_colors */ @@ -176,11 +177,11 @@ initializeWindowSystem(void) /* fprintf(stderr,"initx:initializeWindowSystem:XCreateBitmapFromData 1\n");*/ mousebits = XCreateBitmapFromData(gXDisplay, RootWindow(gXDisplay, gXScreenNumber), - mouseBitmap_bits, mouseBitmap_width,mouseBitmap_height); + as_chars(mouseBitmap_bits), mouseBitmap_width,mouseBitmap_height); /* fprintf(stderr,"initx:initializeWindowSystem:XCreateBitmapFromData 2\n");*/ mousemask = XCreateBitmapFromData(gXDisplay, RootWindow(gXDisplay, gXScreenNumber), - mouseMask_bits, mouseMask_width,mouseMask_height); + as_chars(mouseMask_bits), mouseMask_width,mouseMask_height); /* fprintf(stderr,"initx:initializeWindowSystem:XCreateBitmapFromData 2\n");*/ gActiveCursor = XCreatePixmapCursor(gXDisplay, mousebits, mousemask, &fg, &bg, @@ -396,7 +397,8 @@ set_name_and_icon(void) XStoreName(gXDisplay, gWindow->fMainWindow, "HyperDoc"); /* define and assign the pixmap for the icon */ - icon_pixmap = XCreateBitmapFromData(gXDisplay, gWindow->fMainWindow, ht_icon_bits, + icon_pixmap = XCreateBitmapFromData(gXDisplay, gWindow->fMainWindow, + as_chars(ht_icon_bits), ht_icon_width, ht_icon_height); wmhints.icon_pixmap = icon_pixmap; wmhints.flags = IconPixmapHint; @@ -592,7 +594,7 @@ set_size_hints(Window w) #define stipple_width 4 #define stipple_height 4 -static char stipple_bits[] = { +static unsigned char stipple_bits[] = { 0xff, 0xff, 0xff, 0xff}; Pixmap stipple; @@ -615,7 +617,7 @@ get_GCs(HDWindow *window) stipple = XCreateBitmapFromData(gXDisplay, RootWindow(gXDisplay, gXScreenNumber), - stipple_bits, stipple_width, stipple_height); + as_chars(stipple_bits), stipple_width, stipple_height); values.background = gInputBackgroundColor; values.foreground = gInputForegroundColor; diff --git a/src/hyper/mouse11.bitmap b/src/hyper/mouse11.bitmap index 231c6630..7ed282f2 100644 --- a/src/hyper/mouse11.bitmap +++ b/src/hyper/mouse11.bitmap @@ -2,7 +2,7 @@ #define mouseBitmap_height 16 #define mouseBitmap_x_hot 8 #define mouseBitmap_y_hot 0 -static char mouseBitmap_bits[] = { +static unsigned char mouseBitmap_bits[] = { 0x00, 0x01, 0x00, 0x01, 0x80, 0x02, 0x40, 0x04, 0xc0, 0x06, 0x20, 0x08, 0x20, 0x08, 0x30, 0x18, 0x50, 0x14, 0x58, 0x34, 0x90, 0x12, 0x20, 0x08, 0xc0, 0x47, 0x00, 0x21, 0x80, 0x10, 0x00, 0x0f}; diff --git a/src/hyper/mouse11.mask b/src/hyper/mouse11.mask index 6e5621f4..e458acd7 100644 --- a/src/hyper/mouse11.mask +++ b/src/hyper/mouse11.mask @@ -1,6 +1,6 @@ #define mouseMask_width 16 #define mouseMask_height 16 -static char mouseMask_bits[] = { +static unsigned char mouseMask_bits[] = { 0x00, 0x01, 0x00, 0x01, 0x80, 0x03, 0xc0, 0x07, 0xc0, 0x07, 0xe0, 0x0f, 0xe0, 0x0f, 0xf0, 0x1f, 0xf0, 0x1f, 0xf8, 0x3f, 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x47, 0x00, 0x21, 0x80, 0x10, 0x00, 0x0f}; diff --git a/src/hyper/scrollbar.c b/src/hyper/scrollbar.c index bc858325..1bcc47bf 100644 --- a/src/hyper/scrollbar.c +++ b/src/hyper/scrollbar.c @@ -1,7 +1,7 @@ /* Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd. All rights reserved. - Copyright (C) 2007-2010, Gabriel Dos Reis. + Copyright (C) 2007-2016, Gabriel Dos Reis. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -183,7 +183,7 @@ makeScrollBarWindows(void) sup = XCreatePixmapFromBitmapData( gXDisplay, RootWindow(gXDisplay, gXScreenNumber), - sup_bits, supwidth, supheight, + const_cast(as_chars(sup_bits)), supwidth, supheight, FORECOLOR, BACKCOLOR, DefaultDepth(gXDisplay, gXScreenNumber)); @@ -191,7 +191,7 @@ makeScrollBarWindows(void) sdown = XCreatePixmapFromBitmapData( gXDisplay, RootWindow(gXDisplay, gXScreenNumber), - sdown_bits, sdown_width, sdown_height, + const_cast(as_chars(sdown_bits)), sdown_width, sdown_height, FORECOLOR, BACKCOLOR, DefaultDepth(gXDisplay, gXScreenNumber)); @@ -199,13 +199,13 @@ makeScrollBarWindows(void) sup_pressed = XCreatePixmapFromBitmapData( gXDisplay, RootWindow(gXDisplay, gXScreenNumber), - sup3dpr_bits, sup3dpr_width, sup3dpr_height, + const_cast(as_chars(sup3dpr_bits)), sup3dpr_width, sup3dpr_height, FORECOLOR, BACKCOLOR, DefaultDepth(gXDisplay, gXScreenNumber)); sdown_pressed = XCreatePixmapFromBitmapData( gXDisplay, RootWindow(gXDisplay, gXScreenNumber), - sdown3dpr_bits, sdown3dpr_width, sdown3dpr_height, + const_cast(as_chars(sdown3dpr_bits)), sdown3dpr_width, sdown3dpr_height, FORECOLOR, BACKCOLOR, DefaultDepth(gXDisplay, gXScreenNumber)); } diff --git a/src/hyper/sdown3d.bitmap b/src/hyper/sdown3d.bitmap index e34dc105..ccdf726b 100644 --- a/src/hyper/sdown3d.bitmap +++ b/src/hyper/sdown3d.bitmap @@ -1,6 +1,6 @@ #define sdown3d_width 21 #define sdown3d_height 21 -static char sdown3d_bits[] = { +static unsigned char sdown3d_bits[] = { 0xaa, 0xaa, 0x0a, 0x55, 0x55, 0x15, 0x02, 0x00, 0x0c, 0x51, 0x55, 0x15, 0xaa, 0xaa, 0x0e, 0x51, 0x5f, 0x15, 0xaa, 0xae, 0x0e, 0x51, 0x5f, 0x15, 0xaa, 0xae, 0x0e, 0x51, 0x5f, 0x15, 0xea, 0xff, 0x0e, 0xd1, 0x7f, 0x15, diff --git a/src/hyper/sdown3dpr.bitmap b/src/hyper/sdown3dpr.bitmap index 6ce090b1..54c693a6 100644 --- a/src/hyper/sdown3dpr.bitmap +++ b/src/hyper/sdown3dpr.bitmap @@ -1,6 +1,6 @@ #define sdown3dpr_width 21 #define sdown3dpr_height 21 -static char sdown3dpr_bits[] = { +static unsigned char sdown3dpr_bits[] = { 0xaa, 0xaa, 0x0a, 0x55, 0x55, 0x15, 0xfe, 0xff, 0x0f, 0x55, 0x55, 0x11, 0xae, 0xaa, 0x0a, 0x55, 0x55, 0x11, 0xae, 0xbe, 0x0a, 0x55, 0x5d, 0x11, 0xae, 0xbe, 0x0a, 0x55, 0x5d, 0x11, 0xae, 0xbe, 0x0a, 0xd5, 0xff, 0x11, diff --git a/src/hyper/sup3d.bitmap b/src/hyper/sup3d.bitmap index c1dd285b..f5197b5a 100644 --- a/src/hyper/sup3d.bitmap +++ b/src/hyper/sup3d.bitmap @@ -1,6 +1,6 @@ #define sup3d_width 21 #define sup3d_height 21 -static char sup3d_bits[] = { +static unsigned char sup3d_bits[] = { 0xaa, 0xaa, 0x0a, 0x55, 0x55, 0x15, 0x02, 0x00, 0x0c, 0x51, 0x55, 0x15, 0xaa, 0xaa, 0x0e, 0x51, 0x55, 0x15, 0xaa, 0xae, 0x0e, 0x51, 0x5f, 0x15, 0xaa, 0xbf, 0x0e, 0xd1, 0x7f, 0x15, 0xea, 0xff, 0x0e, 0x51, 0x5f, 0x15, diff --git a/src/hyper/sup3dpr.bitmap b/src/hyper/sup3dpr.bitmap index 2617792f..e2e7109a 100644 --- a/src/hyper/sup3dpr.bitmap +++ b/src/hyper/sup3dpr.bitmap @@ -1,6 +1,6 @@ #define sup3dpr_width 21 #define sup3dpr_height 21 -static char sup3dpr_bits[] = { +static unsigned char sup3dpr_bits[] = { 0xaa, 0xaa, 0x0a, 0x55, 0x55, 0x15, 0xfe, 0xff, 0x0f, 0x55, 0x55, 0x11, 0xae, 0xaa, 0x0a, 0x55, 0x55, 0x11, 0xae, 0xaa, 0x0a, 0x55, 0x5d, 0x11, 0xae, 0xbe, 0x0a, 0x55, 0x7f, 0x11, 0xae, 0xff, 0x0a, 0xd5, 0xff, 0x11, -- cgit v1.2.3