some changes to get fewer warnings when using strict ansi compilers

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@235 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 1999-10-23 23:35:37 +00:00
parent 966c6e0a16
commit d90e046851
16 changed files with 91 additions and 57 deletions

View File

@ -1,3 +1,49 @@
1999-10-24 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/lyxstring.h: comment out the three private
operators, when compiling with string ansi conforming compilers
they make problems.
* src/mathed/math_symbols.C (AddBitmap): change 6th arg to be
unsigned char *.
(pixmapFromBitmapData): change type of bdata to be unsigned char *
(pixmapFromBitmapData): add a reinterpret_cast in the call to
XCreateImage
* src/mathed/math_panel.h: change 6th arg to AddBitmap to be
unsigned char *
* src/mathed/math_panel.C (create_math_panel): remove explicit
casts
* src/bmtable.h: change last paramter to fl_set_bmtable_data to be
unsigned char *.
* src/bmtable.C (struct BMTABLE_SPEC): make bdata unsigned char *
(draw_bitmaptable): add a reinterpret_cast to sp->bdata in the call
to XCreatePixmapFromBitmapData
(fl_set_bmtable_data): change the last argument to be unsigned
char *
(fl_set_bmtable_file): change bdata to unsinged char *, change bw
and bh to be unsigned int, remove explicit casts in call to
XReadBitmapFileData.
* images/arrows.xbm: made the arrays unsigned char *
* images/varsz.xbm: ditto
* images/misc.xbm: ditto
* images/greek.xbm: ditto
* images/dots.xbm: ditto
* images/brel.xbm: ditto
* images/bop.xbm: ditto
* Makefile.am (MAINTAINERCLEANFILES): added po/POTFILES.in
* acinclude.m4 (LYX_GXX_STRENGHT_REDUCE): removed.
(LYX_PROG_CXX): added -pedantic to g++ compile options when
with-warnings, removed the __STRING_ANSI__ hack, seems to not be
needed.
(LYX_CXX_CHEADERS): added <clocale> to the test.
1999-10-23 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/lyx_cb.C (addNewlineAndDepth): changed to use string::append.

View File

@ -1,6 +1,7 @@
AUTOMAKE_OPTIONS = foreign
DISTCLEANFILES= *.orig *.rej *~ *.bak lyx.1 core
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure development/lyx.spec
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure \
development/lyx.spec po/POTFILES.in
SUBDIRS = intl po src lib
EXTRA_DIST = ANNOUNCE CHANGES INSTALL.OS2 INSTALL.autoconf README.OS2 \

View File

@ -185,9 +185,7 @@ dnl Check the version of g++
CXXFLAGS="$lyx_opt"
fi
if test $with_warnings = yes ; then
CXXFLAGS="$CXXFLAGS -ansi -Wall"
# a small hack to avoid problems with headers
echo '#undef __STRICT_ANSI__' >>confdefs.h
CXXFLAGS="$CXXFLAGS -ansi -pedantic -Wall"
fi
else
GXX=
@ -195,28 +193,6 @@ else
fi
])dnl
dnl We do not use this one anymore.
dnl AC_DEFUN(LYX_GXX_STRENGTH_REDUCE,[
dnl #check for the strength reduction bug of gcc
dnl if test x$GXX = xyes && test $cross_compiling = no ; then
dnl AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
dnl AC_TRY_RUN([
dnl int main(void) {
dnl static int Array[[3]];
dnl unsigned int B = 3;
dnl int i;
dnl for(i=0; i<B; i++) Array[[i]] = i - 3;
dnl exit( Array[[1]] != -2 );
dnl }],
dnl ac_cv_c_gcc_strength_bug="no",
dnl ac_cv_c_gcc_strength_bug="yes",
dnl ac_cv_c_gcc_strength_bug="yes") )
dnl if test "$ac_cv_c_gcc_strength_bug" = "yes"
dnl then
dnl CXXFLAGS="$CXXFLAGS -fno-strength-reduce"
dnl fi
dnl fi
dnl ])dnl
dnl Usage: LYX_CXX_RTTI : checks whether the C++ compiler
dnl supports RTTI
@ -293,6 +269,7 @@ if test $lyx_cv_broken_stack = yes ; then
correctly])
fi])
dnl Usage: LYX_CXX_STL_MODERN_STREAMS : checks whether the C++ compiler
dnl supports modern STL streams
AC_DEFUN(LYX_CXX_STL_MODERN_STREAMS,[
@ -346,7 +323,6 @@ AC_DEFUN(LYX_CXX_STL_STRING,[
])
dnl LYX_CXX_MUTABLE
AC_DEFUN(LYX_CXX_MUTABLE, [
AC_REQUIRE([LYX_PROG_CXX])
@ -394,6 +370,7 @@ template<class T> class k<void,T> { };
AC_MSG_RESULT([$ac_partial_specialization])
])
dnl Usage: LYX_CXX_NAMESPACES : checks whether the C++ compiler
dnl has a correct namespace handling and define CXX_WORKING_NAMESPACES
dnl if true. This macro does not do a thourough test, but it should be
@ -413,11 +390,13 @@ if test $lyx_cv_cxx_namespace = yes ; then
[Define if your C++ compiler has correct support for namespaces])
fi])
dnl Usage: LYX_CXX_CHEADERS : checks whether the C++ compiler
dnl provides wrappers for C headers and use our alternate version otherwise.
AC_DEFUN(LYX_CXX_CHEADERS,[
AC_CACHE_CHECK(for C headers wrappers,lyx_cv_cxx_cheaders,
[AC_TRY_CPP([
#include <clocale>
#include <cctype>
#include <cerrno>
#include <cmath>
@ -657,6 +636,7 @@ AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [
ac_cv_target_system_type="$target"
])
dnl We use this until autoconf fixes its version.
AC_DEFUN(LYX_FUNC_SELECT_ARGTYPES,
[AC_MSG_CHECKING([types of arguments for select()])

View File

@ -1,6 +1,6 @@
#define arrow_width 185
#define arrow_height 143
static char arrow_bits[] = {
static unsigned char arrow_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -232,7 +232,7 @@ static char arrow_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe};
#define darrow_width 73
#define darrow_height 73
static char darrow_bits[] = {
static unsigned char darrow_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,
@ -284,7 +284,7 @@ static char darrow_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe};
#define larrow_width 103
#define larrow_height 126
static char larrow_bits[] = {
static unsigned char larrow_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,

View File

@ -1,6 +1,6 @@
#define bop_width 118
#define bop_height 259
static char bop_bits[] = {
static unsigned char bop_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,

View File

@ -1,6 +1,6 @@
#define brel_width 123
#define brel_height 291
static char brel_bits[] = {
static unsigned char brel_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

View File

@ -1,6 +1,6 @@
#define dots_width 72
#define dots_height 18
static char dots_bits[] = {
static unsigned char dots_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

View File

@ -1,6 +1,6 @@
#define Greek_width 182
#define Greek_height 60
static char Greek_bits[] = {
static unsigned char Greek_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -96,7 +96,7 @@ static char Greek_bits[] = {
};
#define greek_width 199
#define greek_height 132
static char greek_bits[] = {
static unsigned char greek_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

View File

@ -1,6 +1,6 @@
#define misc_width 150
#define misc_height 193
static char misc_bits[] = {
static unsigned char misc_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

View File

@ -1,6 +1,6 @@
#define varsz_width 110
#define varsz_height 192
static char varsz_bits[] = {
static unsigned char varsz_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,

View File

@ -24,7 +24,7 @@ typedef struct {
int dx, dy; /* Size of each item */
int bx, by; /* Bitmap's position */
int bw, bh; /* Bitmap dimensions */
char* bdata; /* Bitmap data */
unsigned char * bdata; /* Bitmap data */
int maxi; /* Number of items */
int i; /* Current position */
int mousebut; /* mouse button pushed */
@ -89,7 +89,8 @@ static void draw_bitmaptable(FL_OBJECT *ob)
if (sp->bdata) {
if (!sp->pix) {
sp->pix = XCreatePixmapFromBitmapData(fl_display, fl_winget(),
sp->bdata, sp->bw, sp->bh,
reinterpret_cast<char*>(sp->bdata),
sp->bw, sp->bh,
fl_get_flcolor(ob->lcol), fl_get_flcolor(ob->col1),
DefaultDepth(fl_display, DefaultScreen(fl_display)));
XFlush(fl_display);
@ -224,7 +225,7 @@ extern "C" int handle_bitmaptable(FL_OBJECT *ob, int event, FL_Coord mx,
* The user could change these later. See below.
*/
void fl_set_bmtable_data(FL_OBJECT *ob, int nx, int ny, int bw, int bh,
char *bdata)
unsigned char * bdata)
{
BMTABLE_SPEC *sp = (BMTABLE_SPEC *)ob->spec;
if (sp) {
@ -285,11 +286,12 @@ void fl_set_bmtable_pixmap_data(FL_OBJECT *ob, int nx, int ny,
void fl_set_bmtable_file(FL_OBJECT *ob, int nx, int ny, char const *filename)
{
int bw, bh, xh, yh;
char *bdata;
int xh, yh;
unsigned int bw, bh;
unsigned char *bdata;
if(XReadBitmapFileData(filename, (unsigned int *) &bw, (unsigned int *) &bh,
(unsigned char **) &bdata, &xh, &yh)==BitmapSuccess)
if(XReadBitmapFileData(filename, &bw, &bh,
&bdata, &xh, &yh)==BitmapSuccess)
fl_set_bmtable_data(ob, nx, ny, bw, bh, bdata);
XFlush(fl_display);
}

View File

@ -47,7 +47,7 @@ int fl_get_bmtable_numb(FL_OBJECT *ob);
void fl_set_bmtable(FL_OBJECT *, int pushed, int pos);
/** Number of columns and rows, and the background bitmap */
void fl_set_bmtable_data(FL_OBJECT *, int, int, int, int , char *);
void fl_set_bmtable_data(FL_OBJECT *, int, int, int, int , unsigned char *);
///
void fl_set_bmtable_pixmap_data(FL_OBJECT *, int, int, char **);
///

View File

@ -276,7 +276,7 @@ FD_panel *create_math_panel( )
fl_set_button(fd_delim->left, 1);
fl_set_pixmap_data(fd_delim->pix, delim0);
fl_set_bmtable_data(fd_delim->menu,6,4,delim_width,delim_height,
(char*)delim_bits);
delim_bits);
fl_set_bmtable_maxitems(fd_delim->menu, 23);
fl_set_pixmap_data(fd_panel->sqrt, sqrt);
@ -297,7 +297,7 @@ FD_panel *create_math_panel( )
fl_set_input_filter(fd_matrix->halign, align_filter);
fl_set_bmtable_data(fd_deco->menu,3,3,deco_width,deco_height,
(char*)deco_bits);
deco_bits);
fl_set_bmtable_maxitems(fd_deco->menu, 8);
fd_delim->left->u_ldata = 0;

View File

@ -66,7 +66,7 @@ protected:
///
FL_OBJECT* AddBitmap(int id,
int nx, int ny, int bw, int bh,
char* data, Bool vert=True); // Why Bool?
unsigned char* data, Bool vert=True); // Why Bool?
///
void Create();
///

View File

@ -180,7 +180,7 @@ void BitmapMenu::Show() {
}
FL_OBJECT*
BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh, char* data, Bool vert)
BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh, unsigned char* data, Bool vert)
{
if (i>=nb)
return 0;
@ -457,7 +457,7 @@ char** pixmapFromBitmapData(char const *s, int wx, int hx)
if (id>=0) break;
}
if (i<6 && id>=0) {
char *bdata = 0;
unsigned char *bdata = 0;
int w = 0, h = 0, dw = 0, dh = 0;
lyxerr[Debug::MATHED] << "Imando " << i << ", " << id << endl;
@ -524,7 +524,7 @@ char** pixmapFromBitmapData(char const *s, int wx, int hx)
int ww = w/dw, hh = h/dh, x, y;
XImage *xima = XCreateImage(fl_display, 0, 1, XYBitmap, 0,
bdata, w, h, 8, 0);
reinterpret_cast<char*>(bdata), w, h, 8, 0);
xima->byte_order = LSBFirst;
xima->bitmap_bit_order = LSBFirst;
x = (id % dw)*ww;

View File

@ -522,12 +522,17 @@ public:
//@}
private:
///
lyxstring & operator+(int);
///
lyxstring & operator=(int);
///
lyxstring & operator+=(int);
// These three operators can be used to discover erronous use of
// ints and strings. However a conforming C++ compiler will flag
// a lot of char operations as abmbigous when they are compiled
// in. Use them for debugging only (or perhaps not even then.)
// Lgb.
//
//lyxstring & operator+(int);
//
//lyxstring & operator=(int);
//
//lyxstring & operator+=(int);
/// Forward declaration of the string representation
struct Srep;