From 949479b5b21827ba33c681d213b9909a0bfaaedc Mon Sep 17 00:00:00 2001 From: Bill Spitzak Date: Sun, 20 Aug 2000 04:35:17 +0000 Subject: [PATCH] Removed some (not all) of the warnings when compiled with -Wwrite-strings, this should also get similar warnings Solaris produces. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1292 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- fluid/fluid.cxx | 9 +++++---- src/Fl_x.cxx | 6 ++++-- src/fl_ask.cxx | 6 +++--- src/fl_file_chooser.cxx | 6 +++--- src/fl_set_fonts.cxx | 10 ++++++---- test/CubeMain.cxx | 6 +++--- test/demo.cxx | 14 +++++++------- 7 files changed, 31 insertions(+), 26 deletions(-) diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index d38ac1916..cb028bf4e 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -1,5 +1,5 @@ // -// "$Id: fluid.cxx,v 1.15.2.8 2000/06/08 08:26:45 bill Exp $" +// "$Id: fluid.cxx,v 1.15.2.9 2000/08/20 04:35:16 spitzak Exp $" // // FLUID main entry for the Fast Light Tool Kit (FLTK). // @@ -208,7 +208,7 @@ void write_cb(Fl_Widget *, void *) { } void write_strings_cb(Fl_Widget *, void *) { - static char *exts[] = { ".txt", ".po", ".msg" }; + static const char *exts[] = { ".txt", ".po", ".msg" }; if (!filename) { save_cb(0,0); if (!filename) return; @@ -421,11 +421,12 @@ static int arg(int argc, char** argv, int& i) { #endif #endif +extern "C" { static void sigint(SIGARG) { signal(SIGINT,sigint); exit_cb(0,0); } - +} #endif int main(int argc,char **argv) { @@ -464,5 +465,5 @@ int main(int argc,char **argv) { } // -// End of "$Id: fluid.cxx,v 1.15.2.8 2000/06/08 08:26:45 bill Exp $". +// End of "$Id: fluid.cxx,v 1.15.2.9 2000/08/20 04:35:16 spitzak Exp $". // diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 3828cde8f..bf71118af 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_x.cxx,v 1.24.2.18 2000/06/18 00:38:41 bill Exp $" +// "$Id: Fl_x.cxx,v 1.24.2.19 2000/08/20 04:35:16 spitzak Exp $" // // X specific code for the Fast Light Tool Kit (FLTK). // @@ -242,9 +242,11 @@ static Atom wm_delete_window; static Atom wm_protocols; static Atom _motif_wm_hints; +extern "C" { static void fd_callback(int,void *) {do_queued_events();} static int io_error_handler(Display*) {Fl::fatal("X I/O error"); return 0;} +} static int xerror_handler(Display* d, XErrorEvent* e) { char buf1[128], buf2[128]; @@ -896,5 +898,5 @@ void Fl_Window::make_current() { #endif // -// End of "$Id: Fl_x.cxx,v 1.24.2.18 2000/06/18 00:38:41 bill Exp $". +// End of "$Id: Fl_x.cxx,v 1.24.2.19 2000/08/20 04:35:16 spitzak Exp $". // diff --git a/src/fl_ask.cxx b/src/fl_ask.cxx index e97d339d1..8db0f81af 100644 --- a/src/fl_ask.cxx +++ b/src/fl_ask.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_ask.cxx,v 1.8.2.6 2000/06/05 21:21:05 mike Exp $" +// "$Id: fl_ask.cxx,v 1.8.2.7 2000/08/20 04:35:16 spitzak Exp $" // // Standard dialog functions for the Fast Light Tool Kit (FLTK). // @@ -50,7 +50,7 @@ static Fl_Box *message; static Fl_Box *icon; static Fl_Button *button[3]; static Fl_Input *input; -static char *iconlabel = "?"; +static const char *iconlabel = "?"; uchar fl_message_font_ = 0; uchar fl_message_size_ = 14; @@ -230,5 +230,5 @@ const char *fl_password(const char *fmt, const char *defstr, ...) { } // -// End of "$Id: fl_ask.cxx,v 1.8.2.6 2000/06/05 21:21:05 mike Exp $". +// End of "$Id: fl_ask.cxx,v 1.8.2.7 2000/08/20 04:35:16 spitzak Exp $". // diff --git a/src/fl_file_chooser.cxx b/src/fl_file_chooser.cxx index 44c9afb1b..1dc390ce3 100644 --- a/src/fl_file_chooser.cxx +++ b/src/fl_file_chooser.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_file_chooser.cxx,v 1.10.2.5 2000/06/05 21:21:08 mike Exp $" +// "$Id: fl_file_chooser.cxx,v 1.10.2.6 2000/08/20 04:35:16 spitzak Exp $" // // File chooser widget for the Fast Light Tool Kit (FLTK). // @@ -438,7 +438,7 @@ static void input_cb(Fl_Widget*, void* v) { static void up_cb(Fl_Widget*, void* v) { // the .. button FCW* w = (FCW*)v; char* p; - char* newname; + const char* newname; char buf[FL_PATH_MAX]; p = w->browser.listed+w->browser.dirend-1; // point right before last '/' if (p < w->browser.listed) @@ -632,5 +632,5 @@ char* fl_file_chooser(const char* message, const char* pat, const char* fname) } // -// End of "$Id: fl_file_chooser.cxx,v 1.10.2.5 2000/06/05 21:21:08 mike Exp $". +// End of "$Id: fl_file_chooser.cxx,v 1.10.2.6 2000/08/20 04:35:16 spitzak Exp $". // diff --git a/src/fl_set_fonts.cxx b/src/fl_set_fonts.cxx index a5eafc387..9ab523808 100644 --- a/src/fl_set_fonts.cxx +++ b/src/fl_set_fonts.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_set_fonts.cxx,v 1.6.2.3 2000/06/05 21:21:10 mike Exp $" +// "$Id: fl_set_fonts.cxx,v 1.6.2.4 2000/08/20 04:35:16 spitzak Exp $" // // More font utilities for the Fast Light Tool Kit (FLTK). // @@ -145,6 +145,7 @@ const char* Fl::get_font_name(Fl_Font fnum, int* ap) { return buffer; } +extern "C" { // sort raw (non-'*') X font names into perfect order: static int ultrasort(const void *aa, const void *bb) { @@ -214,13 +215,14 @@ static int ultrasort(const void *aa, const void *bb) { // something wrong, just do a string compare... return strcmp(*(char**)aa, *(char**)bb); } +} // converts a X font name to a standard starname, returns point size: static int to_canonical(char *to, const char *from) { char* c = fl_find_fontsize((char*)from); if (!c) return -1; // no point size found... - char* endptr; - int size = strtol(c,&endptr,10); + const char* endptr; + int size = strtol(c,(char**)&endptr,10); if (from[0] == '-') { // replace the "foundry" with -*-: *to++ = '-'; *to++ = '*'; @@ -327,5 +329,5 @@ int Fl::get_font_sizes(Fl_Font fnum, int*& sizep) { #endif // -// End of "$Id: fl_set_fonts.cxx,v 1.6.2.3 2000/06/05 21:21:10 mike Exp $". +// End of "$Id: fl_set_fonts.cxx,v 1.6.2.4 2000/08/20 04:35:16 spitzak Exp $". // diff --git a/test/CubeMain.cxx b/test/CubeMain.cxx index d504a9327..d3fca5794 100644 --- a/test/CubeMain.cxx +++ b/test/CubeMain.cxx @@ -1,5 +1,5 @@ // -// "$Id: CubeMain.cxx,v 1.2.2.2 2000/06/05 21:21:14 mike Exp $" +// "$Id: CubeMain.cxx,v 1.2.2.3 2000/08/20 04:35:17 spitzak Exp $" // // CubeView class definitions for the Fast Light Tool Kit (FLTK). // @@ -28,7 +28,7 @@ #include "CubeViewUI.h" int -main(int argc, char **argv) { +main(int /*argc*/, char **/*argv*/) { CubeViewUI *cvui=new CubeViewUI; @@ -43,5 +43,5 @@ main(int argc, char **argv) { // -// End of "$Id: CubeMain.cxx,v 1.2.2.2 2000/06/05 21:21:14 mike Exp $". +// End of "$Id: CubeMain.cxx,v 1.2.2.3 2000/08/20 04:35:17 spitzak Exp $". // diff --git a/test/demo.cxx b/test/demo.cxx index 935b3aa32..66946cf86 100644 --- a/test/demo.cxx +++ b/test/demo.cxx @@ -1,5 +1,5 @@ // -// "$Id: demo.cxx,v 1.8.2.3 2000/06/05 21:21:18 mike Exp $" +// "$Id: demo.cxx,v 1.8.2.4 2000/08/20 04:35:17 spitzak Exp $" // // Main demo program for the Fast Light Tool Kit (FLTK). // @@ -91,7 +91,7 @@ typedef struct { MENU menus[MAXMENU]; int mennumb = 0; -int find_menu(char nnn[]) +int find_menu(const char* nnn) /* Returns the number of a given menu name. */ { int i; @@ -100,7 +100,7 @@ int find_menu(char nnn[]) return -1; } -void create_menu(char nnn[]) +void create_menu(const char* nnn) /* Creates a new menu with name nnn */ { if (mennumb == MAXMENU -1) return; @@ -109,7 +109,7 @@ void create_menu(char nnn[]) mennumb++; } -void addto_menu(char men[], char item[], char comm[]) +void addto_menu(const char* men, const char* item, const char* comm) /* Adds an item to a menu */ { int n = find_menu(men); @@ -160,7 +160,7 @@ int numb2but(int inumb, int maxnumb) char stack[64][32]; char stsize = 0; -void push_menu(char nnn[]) +void push_menu(const char* nnn) /* Pushes a menu to be visible */ { int n,i,bn; @@ -267,7 +267,7 @@ void doback(Fl_Widget *, void *) {pop_menu();} void doexit(Fl_Widget *, void *) {exit(0);} -int load_the_menu(const char fname[]) +int load_the_menu(const char* fname) /* Loads the menu file. Returns whether successful. */ { FILE *fin; @@ -332,6 +332,6 @@ int main(int argc, char **argv) { } // -// End of "$Id: demo.cxx,v 1.8.2.3 2000/06/05 21:21:18 mike Exp $". +// End of "$Id: demo.cxx,v 1.8.2.4 2000/08/20 04:35:17 spitzak Exp $". //