]> git.lyx.org Git - lyx.git/commitdiff
some changes to get fewer warnings when using strict ansi compilers
authorLars Gullik Bjønnes <larsbj@gullik.org>
Sat, 23 Oct 1999 23:35:37 +0000 (23:35 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Sat, 23 Oct 1999 23:35:37 +0000 (23:35 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@235 a592a061-630c-0410-9148-cb99ea01b6c8

16 files changed:
ChangeLog
Makefile.am
acinclude.m4
images/arrows.xbm
images/bop.xbm
images/brel.xbm
images/dots.xbm
images/greek.xbm
images/misc.xbm
images/varsz.xbm
src/bmtable.C
src/bmtable.h
src/mathed/math_panel.C
src/mathed/math_panel.h
src/mathed/math_symbols.C
src/support/lyxstring.h

index ffed178dd2f3e37f0f035ca6be1ad9000ce3e007..2beac3fe65af8c3e7faea49eda20d5b94a55b972 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index 795b8b2de9089c5a414b0384bb5f91a9ab507957..31a18b010a64bed1a07bb6a277fb41671f899f5c 100644 (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 \
index 6272722dc55625defa569a17e0e3f542c0c17679..00a7fc73d993f1b75086c4d17ab7af8e89886468 100644 (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()])
index e2661a0a080fa83b7f2076f612492376f3fe8859..e2583222135aa77347935d6f6d6afe7357d04b4d 100644 (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,
index 06a47622a8672855ba66225cec25f422b55ba945..d4b43979f2c7db5b9672684ac3aefe0a15f9aba5 100644 (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,
index ea4d2617c10206ebfcdbb2071d61e08cddf06f3d..b67d064ecde565513c69f7b0d405495a630cd171 100644 (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,
index 38a2e6333d47851d019efaf6844e2743c7809e7a..a5520abbf0c3ca5211b14cf86e9a91a8fc3e80d2 100644 (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,
index 2f18f9cbd0f877c721e3b9707d7cddb2396c854e..ce4e98645a140d0cf6034c2e19a0aa3d18ce089f 100644 (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,
index 12652a047912df4d76d4e3fb138c2239ff9b5b15..ce861e978ae96d24a30c416b1bf87fa2ec12c83f 100644 (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,
index 7c22870a445f44ea2abe979f4352514f79c9c0b1..7f6d55c1703a0360f0ccd882c6584a3b9fa2fc34 100644 (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,
index bf0b0f9842f1cb556c9d84fda907c5475902d0b2..ffc064d2b3f7c6c18de8ac9782c42cad52f6977f 100644 (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);
 }
index edb340d453550c000ab4ed291214a736adaab472..85e9fdb43c01994b5c90ac8e69848c8abe79b677 100644 (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 **);
 ///
index 959de232521fa35d474e9fb713abdeab15fde5e2..7b9f4161d697933858bf963aaa0a7fa3d07e88f4 100644 (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;
index 64d4de183ad279933fe0c2f988b064dbaa77981a..14553ba560e5c73c524ba7239f577cd561f11c49 100644 (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();
    ///
index f3dfd3a451e73cd3a1c7acfc14abb648f52582e0..c3a0bc56d3f79f13c6ffbd736b10ddb72271ef2c 100644 (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;
index 91df64af7ba581335af870f8df27f8e764f97862..9c6df4bdef3babb89d94df967eb2b85139815cb8 100644 (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;