Massive update to use strlcpy() and strlcat() instead of strncpy()

and strncat() in almost all places (there are still a few strncpy's
that need to be used...)

Added configure check for strlcat() and strlcpy().

Added emulation code for strlcat() and strlcpy().


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2239 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2002-05-16 12:47:44 +00:00
parent 3654682476
commit 88d54cd78b
47 changed files with 414 additions and 374 deletions

View File

@ -1,5 +1,11 @@
CHANGES IN FLTK 1.1.0
CHANGES IN FLTK 1.1.0rc3
- Now use strlcat() instead of strncat() which could
cause buffer overflows.
- Now use of strlcpy() instead of strncpy() to simplify
the code.
- Drag-n-drop under WIN32 now shows a [+] cursor instead
of the link cursor.
- Fixed widget width tooltip and default argument
handling code in FLUID.
- Fixed colors used when drawing antialiased text using

View File

@ -4,7 +4,6 @@
#define Fl_Help_Dialog_H
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <string.h>
#include <FL/Fl_Help_View.H>
#include <FL/Fl_Button.H>

View File

@ -1,5 +1,5 @@
/*
* "$Id: config.h,v 1.1.2.3 2001/01/22 15:13:38 easysw Exp $"
* "$Id: config.h,v 1.1.2.3.2.1 2002/05/16 12:47:42 easysw Exp $"
*
* Configuration file for the Fast Light Tool Kit (FLTK).
*
@ -131,7 +131,6 @@
#define HAVE_VSNPRINTF 0
#define HAVE_SNPRINTF 0
#define HAVE_VSPRINTF 1
/*
* HAVE_SYS_SELECT_H:
@ -150,5 +149,5 @@
#define HAVE_POLL 0
/*
* End of "$Id: config.h,v 1.1.2.3 2001/01/22 15:13:38 easysw Exp $".
* End of "$Id: config.h,v 1.1.2.3.2.1 2002/05/16 12:47:42 easysw Exp $".
*/

View File

@ -1,5 +1,5 @@
/*
* "$Id: config.h,v 1.1.2.1 2002/03/25 18:31:30 easysw Exp $"
* "$Id: config.h,v 1.1.2.2 2002/05/16 12:47:42 easysw Exp $"
*
* Configuration file for the Fast Light Tool Kit (FLTK) for Borland C++.
*
@ -143,7 +143,6 @@
#define HAVE_VSNPRINTF 0
#define HAVE_SNPRINTF 0
#define HAVE_VSPRINTF 1
/*
* String functions...
@ -176,5 +175,5 @@
/*
* End of "$Id: config.h,v 1.1.2.1 2002/03/25 18:31:30 easysw Exp $".
* End of "$Id: config.h,v 1.1.2.2 2002/05/16 12:47:42 easysw Exp $".
*/

View File

@ -1,5 +1,5 @@
/*
* "$Id: configh.in,v 1.11.2.11.2.11 2002/04/28 16:41:15 easysw Exp $"
* "$Id: configh.in,v 1.11.2.11.2.12 2002/05/16 12:47:42 easysw Exp $"
*
* Configuration file for the Fast Light Tool Kit (FLTK).
* @configure_input@
@ -155,7 +155,6 @@
#undef HAVE_VSNPRINTF
#undef HAVE_SNPRINTF
#undef HAVE_VSPRINTF
/*
* String functions and headers...
@ -163,6 +162,8 @@
#undef HAVE_STRINGS_H
#undef HAVE_STRCASECMP
#undef HAVE_STRLCAT
#undef HAVE_STRLCPY
/*
* HAVE_SYS_SELECT_H:
@ -220,5 +221,5 @@
/*
* End of "$Id: configh.in,v 1.11.2.11.2.11 2002/04/28 16:41:15 easysw Exp $".
* End of "$Id: configh.in,v 1.11.2.11.2.12 2002/05/16 12:47:42 easysw Exp $".
*/

View File

@ -1,7 +1,7 @@
dnl -*- sh -*-
dnl the "configure" script is made from this by running GNU "autoconf"
dnl
dnl "$Id: configure.in,v 1.33.2.31.2.65 2002/05/07 00:55:48 easysw Exp $"
dnl "$Id: configure.in,v 1.33.2.31.2.66 2002/05/16 12:47:42 easysw Exp $"
dnl
dnl Configuration script for the Fast Light Tool Kit (FLTK).
dnl
@ -35,7 +35,7 @@ dnl FLTK library versions...
FL_MAJOR_VERSION=1
FL_MINOR_VERSION=1
FL_PATCH_VERSION=0
FL_RELEASE_VERSION=rc1
FL_RELEASE_VERSION=rc3
FL_API_VERSION=${FL_MAJOR_VERSION}.${FL_MINOR_VERSION}
AC_SUBST(FL_MAJOR_VERSION)
@ -261,9 +261,8 @@ AC_CHECK_FUNC(snprintf,
else
AC_DEFINE(HAVE_SNPRINTF)
fi)
AC_CHECK_FUNCS(vsprintf)
AC_CHECK_HEADER(strings.h, AC_DEFINE(HAVE_STRINGS_H))
AC_CHECK_FUNCS(strcasecmp)
AC_CHECK_FUNCS(strcasecmp strlcat strlcpy)
dnl FLTK library uses math library functions...
AC_SEARCH_LIBS(pow, m)
@ -736,5 +735,5 @@ dnl Make sure the fltk-config script is executable...
chmod +x fltk-config
dnl
dnl End of "$Id: configure.in,v 1.33.2.31.2.65 2002/05/07 00:55:48 easysw Exp $".
dnl End of "$Id: configure.in,v 1.33.2.31.2.66 2002/05/16 12:47:42 easysw Exp $".
dnl

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.6 2002/05/15 23:32:25 easysw Exp $"
// "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.7 2002/05/16 12:47:42 easysw Exp $"
//
// C function type code for the Fast Light Tool Kit (FLTK).
//
@ -26,9 +26,8 @@
#include <FL/Fl.H>
#include "Fl_Type.h"
#include <FL/fl_show_input.H>
#include <string.h>
#include "../src/flstring.h"
#include <stdio.h>
#include <ctype.h>
extern int i18n_type;
extern const char* i18n_include;
@ -704,5 +703,5 @@ void Fl_Class_Type::write_code2() {
}
//
// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.6 2002/05/15 23:32:25 easysw Exp $".
// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.7 2002/05/16 12:47:42 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Menu_Type.cxx,v 1.16.2.12.2.4 2002/01/01 15:11:29 easysw Exp $"
// "$Id: Fl_Menu_Type.cxx,v 1.16.2.12.2.5 2002/05/16 12:47:42 easysw Exp $"
//
// Menu item code for the Fast Light Tool Kit (FLTK).
//
@ -35,7 +35,7 @@
#include <FL/fl_message.H>
#include <FL/Fl_Menu_.H>
#include <FL/Fl_Button.H>
#include <string.h>
#include "../src/flstring.h"
#include <stdio.h>
#include <stdlib.h>
@ -92,8 +92,6 @@ Fl_Submenu_Type Fl_Submenu_type;
////////////////////////////////////////////////////////////////
// Writing the C code:
#include <ctype.h>
// test functions in Fl_Widget_Type.C:
int is_name(const char *c);
const char *array_name(Fl_Widget_Type *o);
@ -467,5 +465,5 @@ void shortcut_in_cb(Shortcut_Button* i, void* v) {
}
//
// End of "$Id: Fl_Menu_Type.cxx,v 1.16.2.12.2.4 2002/01/01 15:11:29 easysw Exp $".
// End of "$Id: Fl_Menu_Type.cxx,v 1.16.2.12.2.5 2002/05/16 12:47:42 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Type.cxx,v 1.6.2.6.2.7 2002/04/28 08:42:32 easysw Exp $"
// "$Id: Fl_Type.cxx,v 1.6.2.6.2.8 2002/05/16 12:47:42 easysw Exp $"
//
// Widget type code for the Fast Light Tool Kit (FLTK).
//
@ -38,9 +38,8 @@
#include <FL/Fl.H>
#include <FL/Fl_Browser_.H>
#include <FL/fl_draw.H>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "../src/flstring.h"
#include <stdio.h>
#include "Fl_Type.h"
@ -454,8 +453,7 @@ int storestring(const char *n, const char * & p, int nostrip) {
p = 0;
} else {
char *q = (char *)malloc(length+1);
strncpy(q,n,length);
q[length] = 0;
strlcpy(q,n,length+1);
p = q;
}
modflag = 1;
@ -682,5 +680,5 @@ void Fl_Type::read_property(const char *c) {
int Fl_Type::read_fdesign(const char*, const char*) {return 0;}
//
// End of "$Id: Fl_Type.cxx,v 1.6.2.6.2.7 2002/04/28 08:42:32 easysw Exp $".
// End of "$Id: Fl_Type.cxx,v 1.6.2.6.2.8 2002/05/16 12:47:42 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.14 2002/04/28 11:40:25 easysw Exp $"
// "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.15 2002/05/16 12:47:42 easysw Exp $"
//
// Widget type code for the Fast Light Tool Kit (FLTK).
//
@ -31,7 +31,7 @@
#include <FL/fl_message.H>
#include <FL/Fl_Slider.H>
#include <FL/Fl_Window.H>
#include <string.h>
#include "../src/flstring.h"
#include <stdio.h>
#include <stdlib.h>
@ -1339,8 +1339,6 @@ void selection_changed(Fl_Type *p) {
////////////////////////////////////////////////////////////////
// Writing the C code:
#include <ctype.h>
// test to see if user named a function, or typed in code:
int is_name(const char *c) {
for (; *c; c++) if (ispunct(*c) && *c!='_' && *c!=':') return 0;
@ -1373,8 +1371,9 @@ const char *array_name(Fl_Widget_Type *o) {
if (n1 > num || n1==num && sawthis) return 0;
}
static char buffer[128];
// MRS: we want strncpy() here...
strncpy(buffer,c,d-c+1);
sprintf(buffer+(d-c+1),"%d]",num+1);
snprintf(buffer+(d-c+1),sizeof(buffer) - (d-c+1), "%d]",num+1);
return buffer;
}
@ -1976,5 +1975,5 @@ int Fl_Widget_Type::read_fdesign(const char* name, const char* value) {
}
//
// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.14 2002/04/28 11:40:25 easysw Exp $".
// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.15 2002/05/16 12:47:42 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Window_Type.cxx,v 1.13.2.10.2.4 2002/05/03 14:33:00 easysw Exp $"
// "$Id: Fl_Window_Type.cxx,v 1.13.2.10.2.5 2002/05/16 12:47:43 easysw Exp $"
//
// Window type code for the Fast Light Tool Kit (FLTK).
//
@ -725,7 +725,7 @@ int Fl_Window_Type::handle(int event) {
////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <string.h>
#include "../src/flstring.h"
void Fl_Window_Type::write_code1() {
Fl_Widget_Type::write_code1();
@ -792,5 +792,5 @@ int Fl_Window_Type::read_fdesign(const char* name, const char* value) {
}
//
// End of "$Id: Fl_Window_Type.cxx,v 1.13.2.10.2.4 2002/05/03 14:33:00 easysw Exp $".
// End of "$Id: Fl_Window_Type.cxx,v 1.13.2.10.2.5 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fluid_Image.cxx,v 1.7.2.9.2.8 2002/03/25 21:08:41 easysw Exp $"
// "$Id: Fluid_Image.cxx,v 1.7.2.9.2.9 2002/05/16 12:47:43 easysw Exp $"
//
// Pixmap label support for the Fast Light Tool Kit (FLTK).
//
@ -27,10 +27,9 @@
#include <FL/Fl_Widget.H>
#include "Fl_Type.h"
#include "Fluid_Image.h"
#include <string.h>
#include "../src/flstring.h"
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
#include <stdlib.h>
#include <FL/filename.H>
@ -220,5 +219,5 @@ Fluid_Image *ui_find_image(const char *oldname) {
//
// End of "$Id: Fluid_Image.cxx,v 1.7.2.9.2.8 2002/03/25 21:08:41 easysw Exp $".
// End of "$Id: Fluid_Image.cxx,v 1.7.2.9.2.9 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: code.cxx,v 1.9.2.9.2.4 2002/03/25 21:08:41 easysw Exp $"
// "$Id: code.cxx,v 1.9.2.9.2.5 2002/05/16 12:47:43 easysw Exp $"
//
// Code output routines for the Fast Light Tool Kit (FLTK).
//
@ -23,10 +23,9 @@
// Please report all bugs and problems to "fltk-bugs@fltk.org".
//
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../src/flstring.h"
#include <stdarg.h>
#include <FL/Fl.H>
@ -136,7 +135,7 @@ int write_declare(const char *format, ...) {
va_list args;
char buf[1024];
va_start(args, format);
vsprintf(buf, format, args);
vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
included **p = &included_root;
while (*p) {
@ -464,5 +463,5 @@ void Fl_Type::write_code1() {
void Fl_Type::write_code2() {}
//
// End of "$Id: code.cxx,v 1.9.2.9.2.4 2002/03/25 21:08:41 easysw Exp $".
// End of "$Id: code.cxx,v 1.9.2.9.2.5 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: factory.cxx,v 1.4.2.11.2.7 2002/05/01 08:51:59 easysw Exp $"
// "$Id: factory.cxx,v 1.4.2.11.2.8 2002/05/16 12:47:43 easysw Exp $"
//
// Widget factory code for the Fast Light Tool Kit (FLTK).
//
@ -35,30 +35,11 @@
#include <FL/Fl_Group.H>
#include <FL/Fl_Menu_Item.H>
#include <stdio.h>
#include <config.h>
#include <string.h>
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif // HAVE_STRINGS_H
// Apparently Unixware defines "index" to strchr (!) rather than
// providing a proper entry point or not providing the (obsolete)
// BSD function. Make sure index is not defined...
#ifdef index
# undef index
#endif // index
#if defined(WIN32) || defined(__EMX__)
#define strcasecmp stricmp
#endif
#include "../src/flstring.h"
#include "Fl_Widget_Type.h"
#if !HAVE_STRCASECMP
# include <ctype.h>
//
// 'strcasecmp()' - Do a case-insensitive compare...
//
@ -924,5 +905,5 @@ int lookup_symbol(const char *name, int &v, int numberok) {
}
//
// End of "$Id: factory.cxx,v 1.4.2.11.2.7 2002/05/01 08:51:59 easysw Exp $".
// End of "$Id: factory.cxx,v 1.4.2.11.2.8 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: file.cxx,v 1.7.2.6.2.5 2002/05/13 20:54:49 easysw Exp $"
// "$Id: file.cxx,v 1.7.2.6.2.6 2002/05/16 12:47:43 easysw Exp $"
//
// Fluid file routines for the Fast Light Tool Kit (FLTK).
//
@ -28,10 +28,9 @@
// Please report all bugs and problems to "fltk-bugs@fltk.org".
//
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../src/flstring.h"
#include <stdarg.h>
#include "alignment_panel.h"
@ -157,7 +156,7 @@ void read_error(const char *format, ...) {
va_start(args, format);
if (!fin) {
char buffer[1024];
vsprintf(buffer, format, args);
vsnprintf(buffer, sizeof(buffer), format, args);
fl_message(buffer);
} else {
fprintf(stderr, "%s:%d: ", fname, lineno);
@ -632,5 +631,5 @@ void read_fdesign() {
}
//
// End of "$Id: file.cxx,v 1.7.2.6.2.5 2002/05/13 20:54:49 easysw Exp $".
// End of "$Id: file.cxx,v 1.7.2.6.2.6 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: fluid.cxx,v 1.15.2.13.2.25 2002/05/02 10:08:44 easysw Exp $"
// "$Id: fluid.cxx,v 1.15.2.13.2.26 2002/05/16 12:47:43 easysw Exp $"
//
// FLUID main entry for the Fast Light Tool Kit (FLTK).
//
@ -39,8 +39,6 @@
#include <FL/filename.H>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include "../src/flstring.h"
@ -298,7 +296,7 @@ static char* cutfname() {
if (!beenhere) {
beenhere = 1;
fluid_prefs.getUserdataPath(name, sizeof(name));
strncat(name, "cut_buffer", sizeof(name) - 1);
strlcat(name, "cut_buffer", sizeof(name));
// getUserdataPath zeros the "name" buffer...
}
@ -565,8 +563,7 @@ void update_history(const char *filename) {
i * sizeof(relative_history[0]));
// Put the new file at the top...
strncpy(absolute_history[0], absolute, sizeof(absolute_history[0]) - 1);
absolute_history[0][sizeof(absolute_history[0]) - 1] = '\0';
strlcpy(absolute_history[0], absolute, sizeof(absolute_history[0]));
fl_filename_relative(relative_history[0], sizeof(relative_history[0]),
absolute_history[0]);
@ -798,5 +795,5 @@ int main(int argc,char **argv) {
}
//
// End of "$Id: fluid.cxx,v 1.15.2.13.2.25 2002/05/02 10:08:44 easysw Exp $".
// End of "$Id: fluid.cxx,v 1.15.2.13.2.26 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -8,9 +8,10 @@ Fl_Function_Type.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Tabs.H
Fl_Function_Type.o: ../FL/Fl_Pack.H ../FL/Fl_Group.H ../FL/Fl_Wizard.H
Fl_Function_Type.o: ../FL/Fl_Menu_.H ../FL/Fl_Menu_Button.H ../FL/Fl_Menu_.H
Fl_Function_Type.o: ../FL/Fl_Choice.H ../FL/Fl_Menu_Bar.H
Fl_Function_Type.o: ../FL/fl_show_input.H ../FL/fl_ask.H function_panel.h
Fl_Function_Type.o: ../FL/Fl_Window.H ../FL/Fl_Light_Button.H
Fl_Function_Type.o: ../FL/Fl_Button.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
Fl_Function_Type.o: ../FL/fl_show_input.H ../FL/fl_ask.H ../src/flstring.h
Fl_Function_Type.o: ../config.h function_panel.h ../FL/Fl_Window.H
Fl_Function_Type.o: ../FL/Fl_Light_Button.H ../FL/Fl_Button.H
Fl_Function_Type.o: ../FL/Fl_Input.H ../FL/Fl_Input_.H
Fl_Function_Type.o: ../FL/Fl_Return_Button.H ../FL/Fl_Button.H ../FL/Fl_Box.H
Fl_Function_Type.o: ../FL/fl_ask.H
Fl_Menu_Type.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
@ -27,8 +28,9 @@ Fl_Menu_Type.o: ../FL/Fl_Button.H ../FL/Fl_Check_Button.H
Fl_Menu_Type.o: ../FL/Fl_Light_Button.H ../FL/Fl_Return_Button.H
Fl_Menu_Type.o: ../FL/Fl_Browser.H ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H
Fl_Menu_Type.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/fl_message.H
Fl_Menu_Type.o: ../FL/fl_ask.H ../FL/Fl_Output.H ../FL/Fl_Input.H
Fl_Menu_Type.o: Shortcut_Button.h ../FL/fl_draw.H
Fl_Menu_Type.o: ../FL/fl_ask.H ../src/flstring.h ../config.h
Fl_Menu_Type.o: ../FL/Fl_Output.H ../FL/Fl_Input.H Shortcut_Button.h
Fl_Menu_Type.o: ../FL/fl_draw.H
Fl_Group_Type.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Group_Type.o: ../FL/Fl_Group.H ../FL/fl_message.H ../FL/fl_ask.H
Fl_Group_Type.o: Fl_Widget_Type.h Fl_Type.h ../FL/Fl_Widget.H ../FL/Fl_Menu.H
@ -54,13 +56,15 @@ Fl_Widget_Type.o: ../FL/Fl_Check_Button.H ../FL/Fl_Light_Button.H
Fl_Widget_Type.o: ../FL/Fl_Return_Button.H ../FL/Fl_Browser.H
Fl_Widget_Type.o: ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
Fl_Widget_Type.o: ../FL/Fl_Valuator.H ../FL/fl_message.H ../FL/fl_ask.H
Fl_Widget_Type.o: ../FL/Fl_Slider.H widget_panel.h ../FL/Fl_Value_Input.H
Fl_Widget_Type.o: ../FL/Fl_Input.H Shortcut_Button.h ../FL/fl_show_colormap.H
Fl_Widget_Type.o: ../FL/Fl_Slider.H ../src/flstring.h ../config.h
Fl_Widget_Type.o: widget_panel.h ../FL/Fl_Value_Input.H ../FL/Fl_Input.H
Fl_Widget_Type.o: Shortcut_Button.h ../FL/fl_show_colormap.H
Fl_Type.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Type.o: ../FL/Fl_Browser_.H ../FL/Fl_Group.H ../FL/Fl_Scrollbar.H
Fl_Type.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/fl_draw.H Fl_Type.h
Fl_Type.o: ../FL/Fl_Widget.H ../FL/Fl_Menu.H ../FL/Fl_Menu_Item.H
Fl_Type.o: Fluid_Image.h ../FL/Fl_Shared_Image.H ../FL/Fl_Image.H ../FL/x.H
Fl_Type.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/fl_draw.H
Fl_Type.o: ../src/flstring.h ../config.h Fl_Type.h ../FL/Fl_Widget.H
Fl_Type.o: ../FL/Fl_Menu.H ../FL/Fl_Menu_Item.H Fluid_Image.h
Fl_Type.o: ../FL/Fl_Shared_Image.H ../FL/Fl_Image.H ../FL/x.H
Fl_Type.o: ../FL/Fl_Window.H ../FL/Fl_Tabs.H ../FL/Fl_Pack.H ../FL/Fl_Group.H
Fl_Type.o: ../FL/Fl_Wizard.H ../FL/Fl_Menu_.H ../FL/Fl_Menu_Button.H
Fl_Type.o: ../FL/Fl_Menu_.H ../FL/Fl_Choice.H ../FL/Fl_Menu_Bar.H
@ -83,6 +87,7 @@ Fl_Window_Type.o: ../FL/Fl_Light_Button.H ../FL/Fl_Return_Button.H
Fl_Window_Type.o: ../FL/Fl_Browser.H ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H
Fl_Window_Type.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H widget_panel.h
Fl_Window_Type.o: ../FL/Fl_Value_Input.H ../FL/Fl_Input.H Shortcut_Button.h
Fl_Window_Type.o: ../src/flstring.h ../config.h
Fluid_Image.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fluid_Image.o: ../FL/Fl_Widget.H Fl_Type.h ../FL/Fl_Menu.H
Fluid_Image.o: ../FL/Fl_Menu_Item.H Fluid_Image.h ../FL/Fl_Shared_Image.H
@ -90,53 +95,54 @@ Fluid_Image.o: ../FL/Fl_Image.H ../FL/x.H ../FL/Fl_Window.H ../FL/Fl_Group.H
Fluid_Image.o: ../FL/Fl_Tabs.H ../FL/Fl_Pack.H ../FL/Fl_Group.H
Fluid_Image.o: ../FL/Fl_Wizard.H ../FL/Fl_Menu_.H ../FL/Fl_Menu_Button.H
Fluid_Image.o: ../FL/Fl_Menu_.H ../FL/Fl_Choice.H ../FL/Fl_Menu_Bar.H
Fluid_Image.o: ../FL/filename.H ../FL/Fl_File_Chooser.H ../FL/Fl_Window.H
Fluid_Image.o: ../FL/Fl_Button.H ../FL/fl_ask.H ../FL/Fl_File_Browser.H
Fluid_Image.o: ../FL/Fl_Browser.H ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H
Fluid_Image.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_File_Icon.H
Fluid_Image.o: ../FL/Fl.H ../FL/filename.H ../FL/Fl_File_Input.H
Fluid_Image.o: ../FL/Fl_Input.H ../FL/Fl_Input_.H ../FL/Fl_Return_Button.H
Fluid_Image.o: ../FL/Fl_Button.H
code.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H Fl_Type.h
code.o: ../FL/Fl_Widget.H ../FL/Fl_Menu.H ../FL/Fl_Menu_Item.H Fluid_Image.h
code.o: ../FL/Fl_Shared_Image.H ../FL/Fl_Image.H ../FL/x.H ../FL/Fl_Window.H
code.o: ../FL/Fl_Group.H ../FL/Fl_Tabs.H ../FL/Fl_Pack.H ../FL/Fl_Group.H
code.o: ../FL/Fl_Wizard.H ../FL/Fl_Menu_.H ../FL/Fl_Menu_Button.H
code.o: ../FL/Fl_Menu_.H ../FL/Fl_Choice.H ../FL/Fl_Menu_Bar.H
code.o: alignment_panel.h ../FL/Fl_Window.H ../FL/Fl_Preferences.H
code.o: ../FL/Fl_Tooltip.H ../FL/Fl_Button.H ../FL/Fl_Box.H ../FL/Fl_Input.H
code.o: ../FL/Fl_Input_.H ../FL/Fl_Light_Button.H ../FL/Fl_Button.H
code.o: ../FL/Fl_Check_Button.H ../FL/Fl_Light_Button.H
code.o: ../FL/Fl_Return_Button.H ../FL/Fl_Browser.H ../FL/Fl_Browser_.H
code.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
code.o: ../FL/filename.H
Fluid_Image.o: ../src/flstring.h ../config.h ../FL/filename.H
Fluid_Image.o: ../FL/Fl_File_Chooser.H ../FL/Fl_Window.H ../FL/Fl_Button.H
Fluid_Image.o: ../FL/fl_ask.H ../FL/Fl_File_Browser.H ../FL/Fl_Browser.H
Fluid_Image.o: ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
Fluid_Image.o: ../FL/Fl_Valuator.H ../FL/Fl_File_Icon.H ../FL/Fl.H
Fluid_Image.o: ../FL/filename.H ../FL/Fl_File_Input.H ../FL/Fl_Input.H
Fluid_Image.o: ../FL/Fl_Input_.H ../FL/Fl_Return_Button.H ../FL/Fl_Button.H
code.o: ../src/flstring.h ../config.h ../FL/Fl.H ../FL/Enumerations.H
code.o: ../FL/Fl_Export.H Fl_Type.h ../FL/Fl_Widget.H ../FL/Fl_Menu.H
code.o: ../FL/Fl_Menu_Item.H Fluid_Image.h ../FL/Fl_Shared_Image.H
code.o: ../FL/Fl_Image.H ../FL/x.H ../FL/Fl_Window.H ../FL/Fl_Group.H
code.o: ../FL/Fl_Tabs.H ../FL/Fl_Pack.H ../FL/Fl_Group.H ../FL/Fl_Wizard.H
code.o: ../FL/Fl_Menu_.H ../FL/Fl_Menu_Button.H ../FL/Fl_Menu_.H
code.o: ../FL/Fl_Choice.H ../FL/Fl_Menu_Bar.H alignment_panel.h
code.o: ../FL/Fl_Window.H ../FL/Fl_Preferences.H ../FL/Fl_Tooltip.H
code.o: ../FL/Fl_Button.H ../FL/Fl_Box.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
code.o: ../FL/Fl_Light_Button.H ../FL/Fl_Button.H ../FL/Fl_Check_Button.H
code.o: ../FL/Fl_Light_Button.H ../FL/Fl_Return_Button.H ../FL/Fl_Browser.H
code.o: ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
code.o: ../FL/Fl_Valuator.H ../FL/filename.H
factory.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/Fl_Group.H
factory.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Widget.H ../config.h
factory.o: Fl_Widget_Type.h Fl_Type.h ../FL/Fl_Widget.H ../FL/Fl_Menu.H
factory.o: ../FL/Fl_Menu_Item.H Fluid_Image.h ../FL/Fl_Shared_Image.H
factory.o: ../FL/Fl_Image.H ../FL/x.H ../FL/Fl_Window.H ../FL/Fl_Group.H
factory.o: ../FL/Fl_Tabs.H ../FL/Fl_Pack.H ../FL/Fl_Wizard.H ../FL/Fl_Menu_.H
factory.o: ../FL/Fl_Menu_Button.H ../FL/Fl_Menu_.H ../FL/Fl_Choice.H
factory.o: ../FL/Fl_Menu_Bar.H ../FL/Fl_Box.H ../FL/Fl_Button.H
factory.o: ../FL/Fl_Return_Button.H ../FL/Fl_Button.H
factory.o: ../FL/Fl_Repeat_Button.H ../FL/Fl.H ../FL/Fl_Light_Button.H
factory.o: ../FL/Fl_Check_Button.H ../FL/Fl_Light_Button.H
factory.o: ../FL/Fl_Round_Button.H ../FL/Fl_Browser.H ../FL/Fl_Browser_.H
factory.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
factory.o: ../FL/Fl_Check_Browser.H ../FL/Fl_File_Browser.H
factory.o: ../FL/Fl_Browser.H ../FL/Fl_File_Icon.H ../FL/filename.H
factory.o: ../FL/Fl_Counter.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
factory.o: ../FL/Fl_File_Input.H ../FL/Fl_Text_Display.H ../FL/fl_draw.H
factory.o: ../FL/Fl_Text_Buffer.H ../FL/Fl_Text_Editor.H
factory.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Widget.H ../src/flstring.h
factory.o: ../config.h Fl_Widget_Type.h Fl_Type.h ../FL/Fl_Widget.H
factory.o: ../FL/Fl_Menu.H ../FL/Fl_Menu_Item.H Fluid_Image.h
factory.o: ../FL/Fl_Shared_Image.H ../FL/Fl_Image.H ../FL/x.H
factory.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Tabs.H ../FL/Fl_Pack.H
factory.o: ../FL/Fl_Wizard.H ../FL/Fl_Menu_.H ../FL/Fl_Menu_Button.H
factory.o: ../FL/Fl_Menu_.H ../FL/Fl_Choice.H ../FL/Fl_Menu_Bar.H
factory.o: ../FL/Fl_Box.H ../FL/Fl_Button.H ../FL/Fl_Return_Button.H
factory.o: ../FL/Fl_Button.H ../FL/Fl_Repeat_Button.H ../FL/Fl.H
factory.o: ../FL/Fl_Light_Button.H ../FL/Fl_Check_Button.H
factory.o: ../FL/Fl_Light_Button.H ../FL/Fl_Round_Button.H ../FL/Fl_Browser.H
factory.o: ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
factory.o: ../FL/Fl_Valuator.H ../FL/Fl_Check_Browser.H
factory.o: ../FL/Fl_File_Browser.H ../FL/Fl_Browser.H ../FL/Fl_File_Icon.H
factory.o: ../FL/filename.H ../FL/Fl_Counter.H ../FL/Fl_Input.H
factory.o: ../FL/Fl_Input_.H ../FL/Fl_File_Input.H ../FL/Fl_Text_Display.H
factory.o: ../FL/fl_draw.H ../FL/Fl_Text_Buffer.H ../FL/Fl_Text_Editor.H
factory.o: ../FL/Fl_Text_Display.H ../FL/Fl_Clock.H ../FL/Fl_Help_View.H
factory.o: ../FL/Fl_Shared_Image.H ../FL/Fl_Progress.H ../FL/Fl_Adjuster.H
factory.o: ../FL/Fl_Dial.H ../FL/Fl_Roller.H ../FL/Fl_Scrollbar.H
factory.o: ../FL/Fl_Output.H ../FL/Fl_Input.H ../FL/Fl_Value_Input.H
factory.o: ../FL/Fl_Value_Output.H ../FL/Fl_Value_Slider.H
file.o: alignment_panel.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
file.o: ../FL/Fl_Window.H ../FL/Fl_Preferences.H ../FL/Fl_Tooltip.H
file.o: ../FL/Fl_Widget.H ../FL/Fl_Button.H ../FL/Fl_Tabs.H ../FL/Fl_Group.H
file.o: ../FL/Fl_Group.H ../FL/Fl_Box.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
file.o: ../src/flstring.h ../config.h alignment_panel.h ../FL/Fl.H
file.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/Fl_Window.H
file.o: ../FL/Fl_Preferences.H ../FL/Fl_Tooltip.H ../FL/Fl_Widget.H
file.o: ../FL/Fl_Button.H ../FL/Fl_Tabs.H ../FL/Fl_Group.H ../FL/Fl_Group.H
file.o: ../FL/Fl_Box.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
file.o: ../FL/Fl_Light_Button.H ../FL/Fl_Button.H ../FL/Fl_Choice.H
file.o: ../FL/Fl_Menu_.H ../FL/Fl_Check_Button.H ../FL/Fl_Light_Button.H
file.o: ../FL/Fl_Return_Button.H ../FL/Fl_Browser.H ../FL/Fl_Browser_.H

View File

@ -1,5 +1,5 @@
/*
* "$Id: config.mingw,v 1.1.2.3.2.4 2002/04/28 16:41:16 easysw Exp $"
* "$Id: config.mingw,v 1.1.2.3.2.5 2002/05/16 12:47:43 easysw Exp $"
*
* Configuration file for the Fast Light Tool Kit (FLTK).
*
@ -141,13 +141,15 @@
#define HAVE_VSNPRINTF 0
#define HAVE_SNPRINTF 0
#define HAVE_VSPRINTF 0
/*
* String functions...
*/
/* #undef HAVE_STRINGS_H */
#define HAVE_STRCASECMP 1
/* #undef HAVE_STRLCAT*/
/* #undef HAVE_STRLCPY*/
/*
* HAVE_SYS_SELECT_H:
@ -190,5 +192,5 @@
/*
* End of "$Id: config.mingw,v 1.1.2.3.2.4 2002/04/28 16:41:16 easysw Exp $".
* End of "$Id: config.mingw,v 1.1.2.3.2.5 2002/05/16 12:47:43 easysw Exp $".
*/

View File

@ -1,6 +1,6 @@
/* config.h. Generated automatically by configure. */
/*
* "$Id: config.os2x,v 1.1.2.4.2.6 2002/04/28 16:41:16 easysw Exp $"
* "$Id: config.os2x,v 1.1.2.4.2.7 2002/05/16 12:47:43 easysw Exp $"
*
* Configuration file for the Fast Light Tool Kit (FLTK).
* @configure_input@
@ -156,7 +156,6 @@
#define HAVE_VSNPRINTF 1
#define HAVE_SNPRINTF 1
#define HAVE_VSPRINTF 1
/*
* String functions and headers...
@ -164,6 +163,8 @@
#define HAVE_STRINGS_H 1
/* #undef HAVE_STRCASECMP */
/* #undef HAVE_STRLCAT*/
/* #undef HAVE_STRLCPY*/
/*
* HAVE_SYS_SELECT_H:
@ -221,5 +222,5 @@
/*
* End of "$Id: config.os2x,v 1.1.2.4.2.6 2002/04/28 16:41:16 easysw Exp $".
* End of "$Id: config.os2x,v 1.1.2.4.2.7 2002/05/16 12:47:43 easysw Exp $".
*/

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Chart.cxx,v 1.5.2.6.2.6 2002/04/11 11:52:41 easysw Exp $"
// "$Id: Fl_Chart.cxx,v 1.5.2.6.2.7 2002/05/16 12:47:43 easysw Exp $"
//
// Forms-compatible chart widget for the Fast Light Tool Kit (FLTK).
//
@ -312,8 +312,7 @@ void Fl_Chart::add(double val, const char *str, unsigned col) {
entries[numb].val = float(val);
entries[numb].col = col;
if (str) {
strncpy(entries[numb].str,str,FL_CHART_LABEL_MAX);
entries[numb].str[FL_CHART_LABEL_MAX] = 0;
strlcpy(entries[numb].str,str,FL_CHART_LABEL_MAX + 1);
} else {
entries[numb].str[0] = 0;
}
@ -336,8 +335,7 @@ void Fl_Chart::insert(int index, double val, const char *str, unsigned col) {
entries[index-1].val = float(val);
entries[index-1].col = col;
if (str) {
strncpy(entries[index-1].str,str,FL_CHART_LABEL_MAX);
entries[index-1].str[FL_CHART_LABEL_MAX] = 0;
strlcpy(entries[index-1].str,str,FL_CHART_LABEL_MAX+1);
} else {
entries[index-1].str[0] = 0;
}
@ -349,8 +347,7 @@ void Fl_Chart::replace(int index,double val, const char *str, unsigned col) {
entries[index-1].val = float(val);
entries[index-1].col = col;
if (str) {
strncpy(entries[index-1].str,str,FL_CHART_LABEL_MAX);
entries[index-1].str[FL_CHART_LABEL_MAX] = 0;
strlcpy(entries[index-1].str,str,FL_CHART_LABEL_MAX+1);
} else {
entries[index-1].str[0] = 0;
}
@ -378,5 +375,5 @@ void Fl_Chart::maxsize(int m) {
}
//
// End of "$Id: Fl_Chart.cxx,v 1.5.2.6.2.6 2002/04/11 11:52:41 easysw Exp $".
// End of "$Id: Fl_Chart.cxx,v 1.5.2.6.2.7 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_File_Browser.cxx,v 1.1.2.15 2002/05/06 04:11:50 easysw Exp $"
// "$Id: Fl_File_Browser.cxx,v 1.1.2.16 2002/05/16 12:47:43 easysw Exp $"
//
// Fl_File_Browser routines.
//
@ -540,7 +540,7 @@ Fl_File_Browser::load(const char *directory,// I - Directory to load
if (sscanf(line, "%*s%4095s", filename) != 1)
continue;
strncat(filename, "/", sizeof(filename) - 1);
strlcat(filename, "/", sizeof(filename));
// printf("Fl_File_Browser::load() - adding \"%s\" to list...\n", filename);
add(filename, icon);
@ -561,15 +561,14 @@ Fl_File_Browser::load(const char *directory,// I - Directory to load
//
#if (defined(WIN32) && !defined(__CYGWIN__)) || defined(__EMX__)
strncpy(filename, directory_, sizeof(filename) - 1);
filename[sizeof(filename) - 1] = '\0';
strlcpy(filename, directory_, sizeof(filename));
i = strlen(filename) - 1;
if (i == 2 && filename[1] == ':' &&
(filename[2] == '/' || filename[2] == '\\'))
filename[2] = '/';
else if (filename[i] != '/' && filename[i] != '\\')
strcat(filename, "/");
strlcat(filename, "/", sizeof(filename));
num_files = fl_filename_list(filename, &files, sort);
#else
@ -638,5 +637,5 @@ Fl_File_Browser::filter(const char *pattern) // I - Pattern string
//
// End of "$Id: Fl_File_Browser.cxx,v 1.1.2.15 2002/05/06 04:11:50 easysw Exp $".
// End of "$Id: Fl_File_Browser.cxx,v 1.1.2.16 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.12 2002/05/02 15:24:34 easysw Exp $"
// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.13 2002/05/16 12:47:43 easysw Exp $"
//
// More Fl_File_Chooser routines.
//
@ -100,10 +100,7 @@ Fl_File_Chooser::directory(const char *d)// I - Directory to change to
#endif /* WIN32 || __EMX__ */
fl_filename_absolute(directory_, d);
else
{
strncpy(directory_, d, sizeof(directory_) - 1);
directory_[sizeof(directory_) - 1] = '\0';
}
strlcpy(directory_, d, sizeof(directory_));
// Strip any trailing slash and/or period...
dirptr = directory_ + strlen(directory_) - 1;
@ -180,10 +177,7 @@ Fl_File_Chooser::count()
if (directory_[0] != '\0')
snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename);
else
{
strncpy(pathname, filename, sizeof(pathname) - 1);
pathname[sizeof(pathname) - 1] = '\0';
}
strlcpy(pathname, filename, sizeof(pathname));
if (fl_filename_isdir(pathname))
return (0);
@ -199,10 +193,7 @@ Fl_File_Chooser::count()
if (directory_[0] != '\0')
snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename);
else
{
strncpy(pathname, filename, sizeof(pathname) - 1);
pathname[sizeof(pathname) - 1] = '\0';
}
strlcpy(pathname, filename, sizeof(pathname));
if (!fl_filename_isdir(pathname))
count ++;
@ -244,8 +235,7 @@ Fl_File_Chooser::value(int f) // I - File number
if (directory_[0]) {
snprintf(pathname, sizeof(pathname), "%s/%s", directory_, name);
} else {
strncpy(pathname, name, sizeof(pathname) - 1);
pathname[sizeof(pathname) - 1] = '\0';
strlcpy(pathname, name, sizeof(pathname));
}
if (!fl_filename_isdir(pathname))
@ -385,10 +375,7 @@ Fl_File_Chooser::newdir()
#endif /* WIN32 || __EMX__ */
snprintf(pathname, sizeof(pathname), "%s/%s", directory_, dir);
else
{
strncpy(pathname, dir, sizeof(pathname) - 1);
pathname[sizeof(pathname) - 1] = '\0';
}
strlcpy(pathname, dir, sizeof(pathname));
// Create the directory; ignore EEXIST errors...
#if defined(WIN32) && ! defined (__CYGWIN__)
@ -419,10 +406,9 @@ Fl_File_Chooser::rescan()
// printf("Fl_File_Chooser::rescan(); directory = \"%s\"\n", directory_);
// Clear the current filename
pathname[sizeof(pathname) - 1] = '\0';
strncpy(pathname, directory_, sizeof(pathname) - 1);
strlcpy(pathname, directory_, sizeof(pathname));
if (pathname[strlen(pathname) - 1] != '/') {
strncat(pathname, "/", sizeof(pathname) - 1);
strlcat(pathname, "/", sizeof(pathname));
}
fileName->value(pathname);
okButton->deactivate();
@ -451,10 +437,7 @@ Fl_File_Chooser::fileListCB()
if (directory_[0] != '\0')
snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename);
else
{
strncpy(pathname, filename, sizeof(pathname) - 1);
pathname[sizeof(pathname) - 1] = '\0';
}
strlcpy(pathname, filename, sizeof(pathname));
if (Fl::event_clicks())
{
@ -539,8 +522,7 @@ Fl_File_Chooser::fileNameCB()
value(pathname);
} else if (filename != pathname) {
// Finally, make sure that we have a writable copy...
strncpy(pathname, filename, sizeof(pathname) - 1);
pathname[sizeof(pathname) - 1] = '\0';
strlcpy(pathname, filename, sizeof(pathname));
}
filename = pathname;
@ -627,8 +609,7 @@ Fl_File_Chooser::fileNameCB()
if (max_match == 100000)
{
// First match; copy stuff over...
strncpy(matchname, file, sizeof(matchname) - 1);
matchname[sizeof(matchname) - 1] = '\0';
strlcpy(matchname, file, sizeof(matchname));
max_match = strlen(matchname);
// Strip trailing /, if any...
@ -702,5 +683,5 @@ Fl_File_Chooser::fileNameCB()
//
// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.12 2002/05/02 15:24:34 easysw Exp $".
// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.13 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_File_Input.cxx,v 1.1.2.1 2002/04/30 21:50:16 easysw Exp $"
// "$Id: Fl_File_Input.cxx,v 1.1.2.2 2002/05/16 12:47:43 easysw Exp $"
//
// File_Input header file for the Fast Light Tool Kit (FLTK).
//
@ -24,7 +24,6 @@
// Please report all bugs and problems to "fltk-bugs@fltk.org".
//
//#include <FL/Fl_File_Input.H>
#include <FL/Fl.H>
#include <FL/Fl_File_Input.H>
#include <FL/fl_draw.H>
@ -228,8 +227,7 @@ Fl_File_Input::handle_button(int event) // I - Event
if (!buttons_[i] || event != FL_RELEASE) return 1;
// Figure out where to truncate the path...
strncpy(newvalue, value(), sizeof(newvalue) - 1);
newvalue[sizeof(newvalue) - 1] = '\0';
strlcpy(newvalue, value(), sizeof(newvalue));
for (start = newvalue, end = start; start && i >= 0; start = end, i --) {
// printf(" start = \"%s\"\n", start);
@ -255,5 +253,5 @@ Fl_File_Input::handle_button(int event) // I - Event
//
// End of "$Id: Fl_File_Input.cxx,v 1.1.2.1 2002/04/30 21:50:16 easysw Exp $".
// End of "$Id: Fl_File_Input.cxx,v 1.1.2.2 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,6 +1,7 @@
// generated by Fast Light User Interface Designer (fluid) version 1.0100
#include "../FL/Fl_Help_Dialog.H"
#include "flstring.h"
inline void Fl_Help_Dialog::cb_view__i(Fl_Help_View*, void*) {
if (view_->changed())
@ -16,7 +17,7 @@ inline void Fl_Help_Dialog::cb_view__i(Fl_Help_View*, void*) {
max_ = index_;
strcpy(file_[index_], view_->filename());
strlcpy(file_[index_], view_->filename(),sizeof(file_[0]));
line_[index_] = view_->topline();
if (index_ > 0)
@ -29,8 +30,7 @@ inline void Fl_Help_Dialog::cb_view__i(Fl_Help_View*, void*) {
}
else if (view_->filename())
{
strncpy(file_[index_], view_->filename(), 255);
file_[index_][255] = '\0';
strlcpy(file_[index_], view_->filename(), sizeof(file_[0]));
line_[index_] = view_->topline();
};
}

View File

@ -1,10 +1,10 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0100
header_name {../FL/Fl_Help_Dialog.H}
code_name {.cxx}
gridx 5
gridy 5
snap 3
code_name {.cxx}
decl {\#include "flstring.h"} {selected
}
class Fl_Help_Dialog {open
} {
decl {int index_;} {}
@ -16,7 +16,7 @@ class Fl_Help_Dialog {open
Fl_Window window_ {
label {Help Dialog} open
private xywh {470 380 530 385} type Double resizable
code0 {\#include <string.h>} visible
visible
} {
Fl_Group view_ {
callback {if (view_->changed())
@ -32,7 +32,7 @@ class Fl_Help_Dialog {open
max_ = index_;
strcpy(file_[index_], view_->filename());
strlcpy(file_[index_], view_->filename(),sizeof(file_[0]));
line_[index_] = view_->topline();
if (index_ > 0)
@ -45,8 +45,7 @@ class Fl_Help_Dialog {open
}
else if (view_->filename())
{
strncpy(file_[index_], view_->filename(), 255);
file_[index_][255] = '\\0';
strlcpy(file_[index_], view_->filename(), sizeof(file_[0]));
line_[index_] = view_->topline();
}} open
private xywh {10 10 510 330} box DOWN_BOX resizable
@ -146,10 +145,9 @@ window_->label(view_->title());} {}
} {
code {window_->show();} {}
}
Function {show(int argc, char **argv)} {open return_type void
Function {show(int argc, char **argv)} {return_type void
} {
code {window_->show(argc, argv);} {selected
}
code {window_->show(argc, argv);} {}
}
Function {textsize(uchar s)} {return_type void
} {

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Help_View.cxx,v 1.1.2.30 2002/04/11 10:46:19 easysw Exp $"
// "$Id: Fl_Help_View.cxx,v 1.1.2.31 2002/05/16 12:47:43 easysw Exp $"
//
// Fl_Help_View widget routines.
//
@ -207,14 +207,12 @@ Fl_Help_View::add_link(const char *n, // I - Name of link
temp->w = xx + ww;
temp->h = yy + hh;
strncpy(temp->filename, n, sizeof(temp->filename) - 1);
temp->filename[sizeof(temp->filename) - 1] = '\0';
strlcpy(temp->filename, n, sizeof(temp->filename));
if ((target = strrchr(temp->filename, '#')) != NULL)
{
*target++ = '\0';
strncpy(temp->name, target, sizeof(temp->name) - 1);
temp->name[sizeof(temp->name) - 1] = '\0';
strlcpy(temp->name, target, sizeof(temp->name));
}
else
temp->name[0] = '\0';
@ -247,8 +245,7 @@ Fl_Help_View::add_target(const char *n, // I - Name of target
temp = targets_ + ntargets_;
temp->y = yy;
strncpy(temp->name, n, sizeof(temp->name) - 1);
temp->name[sizeof(temp->name) - 1] = '\0';
strlcpy(temp->name, n, sizeof(temp->name));
ntargets_ ++;
}
@ -960,10 +957,7 @@ Fl_Help_View::format()
add_target(attr, yy - size - 2);
if (get_attr(attrs, "HREF", attr, sizeof(attr)) != NULL)
{
strncpy(link, attr, sizeof(link) - 1);
link[sizeof(link) - 1] = '\0';
}
strlcpy(link, attr, sizeof(link));
}
else if (strcasecmp(buf, "/A") == 0)
link[0] = '\0';
@ -2136,8 +2130,7 @@ Fl_Help_View::handle(int event) // I - Event to handle
{
fl_cursor(FL_CURSOR_DEFAULT);
strncpy(target, link->name, sizeof(target) - 1);
target[sizeof(target) - 1] = '\0';
strlcpy(target, link->name, sizeof(target));
set_changed();
@ -2391,8 +2384,7 @@ Fl_Help_View::topline(const char *n) // I - Target name
if (ntargets_ == 0)
return;
strncpy(key.name, n, sizeof(key.name) - 1);
key.name[sizeof(key.name) - 1] = '\0';
strlcpy(key.name, n, sizeof(key.name));
target = (Fl_Help_Target *)bsearch(&key, targets_, ntargets_, sizeof(Fl_Help_Target),
(compare_func_t)compare_targets);
@ -2623,5 +2615,5 @@ hscrollbar_callback(Fl_Widget *s, void *)
//
// End of "$Id: Fl_Help_View.cxx,v 1.1.2.30 2002/04/11 10:46:19 easysw Exp $".
// End of "$Id: Fl_Help_View.cxx,v 1.1.2.31 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Preferences.cxx,v 1.1.2.12 2002/05/16 08:01:12 spitzak Exp $"
// "$Id: Fl_Preferences.cxx,v 1.1.2.13 2002/05/16 12:47:43 easysw Exp $"
//
// Preferences methods for the Fast Light Tool Kit (FLTK).
//
@ -318,28 +318,15 @@ static char *decodeText( const char *src )
char Fl_Preferences::get( const char *key, char *text, const char *defaultValue, int maxSize )
{
const char *v = node->get( key );
if ( v && strchr( v, '\\' ) )
{
if ( v && strchr( v, '\\' ) ) {
char *w = decodeText( v );
strncpy( text, w, maxSize );
if ( (int)strlen(w) >= maxSize ) text[maxSize] = 0;
strlcpy(text, w, maxSize);
free( w );
return 1;
}
if ( !v ) v = defaultValue;
if ( v )
{
int vLen = strlen( v );
if ( vLen >= maxSize )
{
strncpy( text, v, maxSize );
text[maxSize] = 0;
}
else
strcpy( text, v );
}
else
text = 0;
if ( !v ) v = defaultValue;
if ( v ) strlcpy(text, v, maxSize);
else text = 0;
return ( v != defaultValue );
}
@ -676,13 +663,12 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
switch (root) {
case USER:
if ((e = getenv("HOME")) != NULL) {
strncpy(filename, e, sizeof(filename) - 1);
filename[sizeof(filename) - 1] = '\0';
strlcpy(filename, e, sizeof(filename));
if (filename[strlen(filename)-1] != '/') {
strncat(filename, "/.fltk/", sizeof(filename) - 1);
strlcat(filename, "/.fltk/", sizeof(filename));
} else {
strncat(filename, ".fltk/", sizeof(filename) - 1);
strlcat(filename, ".fltk/", sizeof(filename));
}
break;
}
@ -776,8 +762,7 @@ int Fl_Preferences::RootNode::write()
// get the path to the preferences directory
char Fl_Preferences::RootNode::getPath( char *path, int pathlen )
{
strncpy( path, filename_, pathlen - 1 );
path[pathlen - 1] = '\0';
strlcpy( path, filename_, pathlen);
char *s;
for ( s = path; *s; s++ ) if ( *s == '\\' ) *s = '/';
@ -928,8 +913,7 @@ void Fl_Preferences::Node::set( const char *line )
const char *c = strchr( line, ':' );
if ( c )
{
strncpy( nameBuffer, line, c-line );
nameBuffer[ c-line ] = 0;
strlcpy( nameBuffer, line, c-line+1);
set( nameBuffer, c+1 );
}
else
@ -1000,7 +984,8 @@ Fl_Preferences::Node *Fl_Preferences::Node::find( const char *path )
}
const char *s = path+len+1;
const char *e = strchr( s, '/' );
if ( e ) { strncpy( nameBuffer, s, e-s ); nameBuffer[ e-s ] = 0; } else strcpy( nameBuffer, s );
if (e) strlcpy( nameBuffer, s, e-s+1 );
else strlcpy( nameBuffer, s, sizeof(nameBuffer));
nd = new Node( nameBuffer );
nd->setParent( this );
return nd->find( path );
@ -1081,5 +1066,5 @@ char Fl_Preferences::Node::remove()
//
// End of "$Id: Fl_Preferences.cxx,v 1.1.2.12 2002/05/16 08:01:12 spitzak Exp $".
// End of "$Id: Fl_Preferences.cxx,v 1.1.2.13 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Text_Buffer.cxx,v 1.9.2.5 2002/05/03 20:30:19 easysw Exp $"
// "$Id: Fl_Text_Buffer.cxx,v 1.9.2.6 2002/05/16 12:47:43 easysw Exp $"
//
// Copyright 2001-2002 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
@ -2034,8 +2034,7 @@ static char *copyLine( const char *text, int *lineLen ) {
for ( c = text; *c != '\0' && *c != '\n'; c++ )
len++;
outStr = (char *)malloc( len + 1 );
strncpy( outStr, text, len );
outStr[ len ] = '\0';
strlcpy( outStr, text, len + 1);
*lineLen = len;
return outStr;
}
@ -2285,5 +2284,5 @@ Fl_Text_Buffer::outputfile(const char *file, int start, int end, int buflen) {
//
// End of "$Id: Fl_Text_Buffer.cxx,v 1.9.2.5 2002/05/03 20:30:19 easysw Exp $".
// End of "$Id: Fl_Text_Buffer.cxx,v 1.9.2.6 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_display.cxx,v 1.4.2.3.2.4 2002/04/11 11:52:42 easysw Exp $"
// "$Id: Fl_display.cxx,v 1.4.2.3.2.5 2002/05/16 12:47:43 easysw Exp $"
//
// Display function for the Fast Light Tool Kit (FLTK).
//
@ -36,11 +36,10 @@ void Fl::display(const char *d) {
#else
static char e[1024];
strcpy(e,"DISPLAY=");
strncat(e,d,sizeof(e) - 1);
e[sizeof(e) - 1] = '\0';
strlcat(e,d,sizeof(e));
for (char *c = e+8; *c!=':'; c++) {
if (!*c) {
strncat(e,":0.0",sizeof(e) - 1);
strlcat(e,":0.0",sizeof(e));
break;
}
}
@ -49,5 +48,5 @@ void Fl::display(const char *d) {
}
//
// End of "$Id: Fl_display.cxx,v 1.4.2.3.2.4 2002/04/11 11:52:42 easysw Exp $".
// End of "$Id: Fl_display.cxx,v 1.4.2.3.2.5 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.9 2002/04/27 19:35:18 easysw Exp $"
// "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.10 2002/05/16 12:47:43 easysw Exp $"
//
// System color support for the Fast Light Tool Kit (FLTK).
//
@ -233,10 +233,7 @@ int Fl::scheme(const char *s) {
// inherit it...
static char e[1024];
strcpy(e,"FLTK_SCHEME=");
if (s) {
strncat(e,s,sizeof(e) - 1);
e[sizeof(e) - 1] = '\0';
}
if (s) strlcat(e,s,sizeof(e));
putenv(e);
// Load the scheme...
@ -316,5 +313,5 @@ int Fl::reload_scheme() {
//
// End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.9 2002/04/27 19:35:18 easysw Exp $".
// End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.10 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
#
# "$Id: Makefile,v 1.18.2.14.2.42 2002/05/08 12:44:52 easysw Exp $"
# "$Id: Makefile,v 1.18.2.14.2.43 2002/05/16 12:47:43 easysw Exp $"
#
# Library makefile for the Fast Light Tool Kit (FLTK).
#
@ -170,9 +170,9 @@ GLCPPFILES = \
glut_compatability.cxx \
glut_font.cxx
CFILES = fl_call_main.c scandir.c numericsort.c vsnprintf.c
CFILES = fl_call_main.c flstring.c scandir.c numericsort.c vsnprintf.c
CLEAN = core cmap
CLEAN = core* cmap
################################################################
@ -433,5 +433,5 @@ uninstall:
#
# End of "$Id: Makefile,v 1.18.2.14.2.42 2002/05/08 12:44:52 easysw Exp $".
# End of "$Id: Makefile,v 1.18.2.14.2.43 2002/05/16 12:47:43 easysw Exp $".
#

View File

@ -1,5 +1,5 @@
//
// "$Id: filename_absolute.cxx,v 1.5.2.4.2.7 2002/03/25 21:08:42 easysw Exp $"
// "$Id: filename_absolute.cxx,v 1.5.2.4.2.8 2002/05/16 12:47:43 easysw Exp $"
//
// Filename expansion routines for the Fast Light Tool Kit (FLTK).
//
@ -55,8 +55,7 @@ int fl_filename_absolute(char *to, int tolen, const char *from) {
|| from[1]==':'
#endif
) {
strncpy(to, from, tolen - 1);
to[tolen - 1] = '\0';
strlcpy(to, from, tolen);
return 0;
}
@ -66,8 +65,7 @@ int fl_filename_absolute(char *to, int tolen, const char *from) {
a = getcwd(temp, tolen);
if (!a) {
strncpy(to, from, tolen - 1);
to[tolen - 1] = '\0';
strlcpy(to, from, tolen);
delete[] temp;
return 0;
}
@ -95,11 +93,9 @@ int fl_filename_absolute(char *to, int tolen, const char *from) {
}
*a++ = '/';
strncpy(a,start,tolen - (a - temp) - 1);
temp[tolen - 1] = '\0';
strlcpy(a,start,tolen - (a - temp));
strncpy(to, temp, tolen - 1);
to[tolen - 1] = '\0';
strlcpy(to, temp, tolen);
delete[] temp;
@ -120,14 +116,12 @@ fl_filename_relative(char *to, // O - Relative filename
if (from[0] == '\0' || !isdirsep(*from)) {
strncpy(to, from, tolen - 1);
to[tolen - 1] = '\0';
strlcpy(to, from, tolen);
return 0;
}
if (!getcwd(cwd, sizeof(cwd))) {
strncpy(to, from, tolen - 1);
to[tolen - 1] = '\0';
strlcpy(to, from, tolen);
return 0;
}
@ -150,8 +144,7 @@ fl_filename_relative(char *to, // O - Relative filename
#if defined(WIN32) || defined(__EMX__)
if (isalpha(slash[0]) && slash[1] == ':') {
strncpy(to, from, tolen - 1);
to[tolen - 1] = '\0';
strlcpy(to, from, tolen);
return 0; /* Different drive letter... */
}
#endif /* WIN32 || __EMX__ */
@ -163,17 +156,17 @@ fl_filename_relative(char *to, // O - Relative filename
to[tolen - 1] = '\0';
while (*newslash != '\0') {
if (isdirsep(*newslash)) strncat(to, "../", tolen - 1);
if (isdirsep(*newslash)) strlcat(to, "../", tolen);
newslash ++;
}
strncat(to, slash, tolen - 1);
strlcat(to, slash, tolen);
return 1;
}
//
// End of "$Id: filename_absolute.cxx,v 1.5.2.4.2.7 2002/03/25 21:08:42 easysw Exp $".
// End of "$Id: filename_absolute.cxx,v 1.5.2.4.2.8 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: filename_expand.cxx,v 1.4.2.4.2.5 2002/04/11 11:52:42 easysw Exp $"
// "$Id: filename_expand.cxx,v 1.4.2.4.2.6 2002/05/16 12:47:43 easysw Exp $"
//
// Filename expansion routines for the Fast Light Tool Kit (FLTK).
//
@ -46,8 +46,7 @@ static inline int isdirsep(char c) {return c=='/' || c=='\\';}
int fl_filename_expand(char *to,int tolen, const char *from) {
char *temp = new char[tolen];
strncpy(temp,from, tolen - 1);
temp[tolen - 1] = '\0';
strlcpy(temp,from, tolen);
char *start = temp;
char *end = temp+strlen(temp);
@ -96,8 +95,7 @@ int fl_filename_expand(char *to,int tolen, const char *from) {
}
}
strncpy(to, start, tolen - 1);
to[tolen - 1] = '\0';
strlcpy(to, start, tolen);
delete[] temp;
@ -106,5 +104,5 @@ int fl_filename_expand(char *to,int tolen, const char *from) {
//
// End of "$Id: filename_expand.cxx,v 1.4.2.4.2.5 2002/04/11 11:52:42 easysw Exp $".
// End of "$Id: filename_expand.cxx,v 1.4.2.4.2.6 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: filename_setext.cxx,v 1.4.2.3.2.4 2002/04/11 11:52:42 easysw Exp $"
// "$Id: filename_setext.cxx,v 1.4.2.3.2.5 2002/05/16 12:47:43 easysw Exp $"
//
// Filename extension routines for the Fast Light Tool Kit (FLTK).
//
@ -33,13 +33,12 @@
char *fl_filename_setext(char *buf, int buflen, const char *ext) {
char *q = (char *)fl_filename_ext(buf);
if (ext) {
strncpy(q,ext,buflen - (q - buf) - 1);
buf[buflen - 1] = '\0';
strlcpy(q,ext,buflen - (q - buf));
} else *q = 0;
return(buf);
}
//
// End of "$Id: filename_setext.cxx,v 1.4.2.3.2.4 2002/04/11 11:52:42 easysw Exp $".
// End of "$Id: filename_setext.cxx,v 1.4.2.3.2.5 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_draw.cxx,v 1.6.2.4.2.11 2002/04/11 11:52:42 easysw Exp $"
// "$Id: fl_draw.cxx,v 1.6.2.4.2.12 2002/05/16 12:47:43 easysw Exp $"
//
// Label drawing code for the Fast Light Tool Kit (FLTK).
//
@ -144,8 +144,7 @@ void fl_draw(
}
if (str && (p = strrchr(str, '@')) != NULL && p > (str + 1)) {
strncpy(symbol[1], p, sizeof(symbol[1]) - 1);
symbol[1][sizeof(symbol[1]) - 1] = '\0';
strlcpy(symbol[1], p, sizeof(symbol[1]));
symwidth[1] = min(w,h);
}
}
@ -300,8 +299,7 @@ void fl_measure(const char* str, int& w, int& h, int draw_symbols) {
}
if (str && (p = strrchr(str, '@')) != NULL && p > (str + 1)) {
strncpy(symbol[1], p, sizeof(symbol[1]) - 1);
symbol[1][sizeof(symbol[1]) - 1] = '\0';
strlcpy(symbol[1], p, sizeof(symbol[1]));
symwidth[1] = min(w,h);
}
@ -327,5 +325,5 @@ void fl_measure(const char* str, int& w, int& h, int draw_symbols) {
}
//
// End of "$Id: fl_draw.cxx,v 1.6.2.4.2.11 2002/04/11 11:52:42 easysw Exp $".
// End of "$Id: fl_draw.cxx,v 1.6.2.4.2.12 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_file_dir.cxx,v 1.1.2.11 2002/05/01 13:52:25 easysw Exp $"
// "$Id: fl_file_dir.cxx,v 1.1.2.12 2002/05/16 12:47:43 easysw Exp $"
//
// File chooser widget for the Fast Light Tool Kit (FLTK).
//
@ -23,7 +23,7 @@
// Please report all bugs and problems to "fltk-bugs@fltk.org".
//
#include <config.h>
#include "flstring.h"
#include <FL/filename.H>
#include <FL/Fl_File_Chooser.H>
#include <FL/Fl_File_Chooser.H>
@ -68,8 +68,7 @@ fl_file_chooser(const char *message, // I - Message in titlebar
if (fc->filter() != pat && (!pat || !fc->filter() ||
strcmp(pat, fc->filter())) && fc->value()) {
// if pattern is different, remove name but leave old directory:
strncpy(retname, fc->value(), sizeof(retname) - 1);
retname[sizeof(retname) - 1] = '\0';
strlcpy(retname, fc->value(), sizeof(retname));
char *p = strrchr(retname, '/');
@ -143,5 +142,5 @@ fl_dir_chooser(const char *message, // I - Message for titlebar
//
// End of "$Id: fl_file_dir.cxx,v 1.1.2.11 2002/05/01 13:52:25 easysw Exp $".
// End of "$Id: fl_file_dir.cxx,v 1.1.2.12 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_set_fonts_mac.cxx,v 1.1.2.5 2002/04/27 18:37:15 easysw Exp $"
// "$Id: fl_set_fonts_mac.cxx,v 1.1.2.6 2002/05/16 12:47:43 easysw Exp $"
//
// MacOS font utilities for the Fast Light Tool Kit (FLTK).
//
@ -107,7 +107,9 @@ int Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
if (!s->name) s = fl_fonts; // empty slot in table, use entry 0
Str255 name;
int len = strlen( s->name ); strncpy( (char*)(name+1), s->name+1, len ); name[0] = len-1;
int len = strlen( s->name );
memcpy(((char*)name)+1, s->name+1, len );
name[0] = len-1;
FMFontFamily family = FMGetFontFamilyFromName( name );
if ( family == kInvalidFontFamily ) return 0;
@ -152,5 +154,5 @@ int Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
}
//
// End of "$Id: fl_set_fonts_mac.cxx,v 1.1.2.5 2002/04/27 18:37:15 easysw Exp $".
// End of "$Id: fl_set_fonts_mac.cxx,v 1.1.2.6 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_set_fonts_x.cxx,v 1.1.2.2 2002/03/06 19:42:30 easysw Exp $"
// "$Id: fl_set_fonts_x.cxx,v 1.1.2.3 2002/05/16 12:47:43 easysw Exp $"
//
// X11 font utilities for the Fast Light Tool Kit (FLTK).
//
@ -115,7 +115,9 @@ const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
return p;
}
const char *e = fl_font_word(x,1);
strncpy(o,x,e-x); o += e-x;
// MRS: we want strncpy here, not strlcpy...
strncpy(o,x,e-x);
o += e-x;
// collect all the attribute words:
int type = 0;
@ -123,8 +125,12 @@ const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
// get the next word:
if (*e) e++; x = e; e = fl_font_word(x,1);
int t = attribute(n,x);
if (t < 0) {*o++ = ' '; strncpy(o,x,e-x); o += e-x;}
else type |= t;
if (t < 0) {
*o++ = ' ';
// MRS: we want strncpy here, not strlcpy...
strncpy(o,x,e-x);
o += e-x;
} else type |= t;
}
// skip over the '*' for the size and get the registry-encoding:
@ -213,7 +219,7 @@ static int ultrasort(const void *aa, const void *bb) {
}
// converts a X font name to a standard starname, returns point size:
static int to_canonical(char *to, const char *from) {
static int to_canonical(char *to, const char *from, size_t tolen) {
char* c = fl_find_fontsize((char*)from);
if (!c) return -1; // no point size found...
const char* endptr;
@ -227,9 +233,11 @@ static int to_canonical(char *to, const char *from) {
if (*endptr && !use_registry(endptr+1)) endptr = "";
}
int n = c-from;
// MRS: we want strncpy here, not strlcpy...
if (n > (int)(tolen - 1)) return -1;
strncpy(to,from,n);
to[n++] = '*';
strcpy(to+n,endptr);
strlcpy(to+n,endptr, tolen - n);
return size;
}
@ -253,13 +261,13 @@ Fl_Font Fl::set_fonts(const char* xstarname) {
int first_xlist = i;
const char *p = xlist[i++];
char canon[1024];
int size = to_canonical(canon, p);
int size = to_canonical(canon, p, sizeof(canon));
if (size >= 0) {
for (;;) { // find all matching fonts:
if (i >= xlistsize) break;
const char *q = xlist[i];
char this_canon[1024];
if (to_canonical(this_canon, q) < 0) break;
if (to_canonical(this_canon, q, sizeof(this_canon)) < 0) break;
if (strcmp(canon, this_canon)) break;
i++;
}
@ -322,5 +330,5 @@ int Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
}
//
// End of "$Id: fl_set_fonts_x.cxx,v 1.1.2.2 2002/03/06 19:42:30 easysw Exp $".
// End of "$Id: fl_set_fonts_x.cxx,v 1.1.2.3 2002/05/16 12:47:43 easysw Exp $".
//

105
src/flstring.c Normal file
View File

@ -0,0 +1,105 @@
/*
* "$Id: flstring.c,v 1.1.2.1 2002/05/16 12:47:43 easysw Exp $"
*
* BSD string functions for the Fast Light Tool Kit (FLTK).
*
* Copyright 1998-2002 by Bill Spitzak and others.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "fltk-bugs@fltk.org".
*/
#include "flstring.h"
# if !HAVE_STRLCAT
/*
* 'fl_strlcat()' - Safely concatenate two strings.
*/
size_t /* O - Length of string */
fl_strlcat(char *dst, /* O - Destination string */
const char *src, /* I - Source string */
size_t size) { /* I - Size of destination string buffer */
size_t srclen; /* Length of source string */
size_t dstlen; /* Length of destination string */
/*
* Figure out how much room is left...
*/
dstlen = strlen(dst);
size -= dstlen + 1;
if (!size) return (dstlen); /* No room, return immediately... */
/*
* Figure out how much room is needed...
*/
srclen = strlen(src);
/*
* Copy the appropriate amount...
*/
if (srclen > size) srclen = size;
memcpy(dst + dstlen, src, srclen);
dst[dstlen + srclen] = '\0';
return (dstlen + srclen);
}
# endif /* !HAVE_STRLCAT */
# if !HAVE_STRLCPY
/*
* 'fl_strlcat()' - Safely copy two strings.
*/
size_t /* O - Length of string */
fl_strlcpy(char *dst, /* O - Destination string */
const char *src, /* I - Source string */
size_t size) { /* I - Size of destination string buffer */
size_t srclen; /* Length of source string */
/*
* Figure out how much room is needed...
*/
size --;
srclen = strlen(src);
/*
* Copy the appropriate amount...
*/
if (srclen > size) srclen = size;
memcpy(dst, src, srclen);
dst[srclen] = '\0';
return (srclen);
}
# endif /* !HAVE_STRLCPY */
/*
* End of "$Id: flstring.c,v 1.1.2.1 2002/05/16 12:47:43 easysw Exp $".
*/

View File

@ -1,9 +1,9 @@
/*
* "$Id: flstring.h,v 1.1.2.5 2002/04/29 20:56:19 easysw Exp $"
* "$Id: flstring.h,v 1.1.2.6 2002/05/16 12:47:43 easysw Exp $"
*
* Common string header file for the Fast Light Tool Kit (FLTK).
*
* Copyright 1998-2001 by Bill Spitzak and others.
* Copyright 1998-2002 by Bill Spitzak and others.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -66,11 +66,26 @@ extern int fl_vsnprintf(char *, size_t, const char *, va_list ap);
# define vsnprintf fl_vsnprintf
# endif /* !HAVE_VSNPRINTF */
/*
* strlcpy() and strlcat() are some really useful BSD string functions
* that work the way strncpy() and strncat() *should* have worked.
*/
# if !HAVE_STRLCAT
extern size_t fl_strlcat(char *, const char *, size_t);
# define strlcat fl_strlcat
# endif /* !HAVE_STRLCAT */
# if !HAVE_STRLCPY
extern size_t fl_strlcpy(char *, const char *, size_t);
# define strlcpy fl_strlcpy
# endif /* !HAVE_STRLCPY */
# ifdef __cplusplus
}
# endif /* __cplusplus */
#endif /* !flstring_h */
/*
* End of "$Id: flstring.h,v 1.1.2.5 2002/04/29 20:56:19 easysw Exp $".
* End of "$Id: flstring.h,v 1.1.2.6 2002/05/16 12:47:43 easysw Exp $".
*/

View File

@ -1,5 +1,5 @@
//
// "$Id: forms_fselect.cxx,v 1.4.2.3.2.3 2002/04/11 11:52:43 easysw Exp $"
// "$Id: forms_fselect.cxx,v 1.4.2.3.2.4 2002/05/16 12:47:43 easysw Exp $"
//
// Forms file selection routines for the Fast Light Tool Kit (FLTK).
//
@ -34,21 +34,21 @@ static char fl_filename[256];
char* fl_show_file_selector(const char *message,const char *dir,
const char *pat,const char *fname) {
if (dir && dir[0]) strncpy(fl_directory,dir,1023);
if (dir && dir[0]) strlcpy(fl_directory,dir,sizeof(fl_directory));
if (pat && pat[0]) fl_pattern = pat;
if (fname && fname[0]) strncpy(fl_filename,fname,255);
if (fname && fname[0]) strlcpy(fl_filename,fname,sizeof(fl_filename));
char *p = fl_directory+strlen(fl_directory);
if (p > fl_directory && *(p-1)!='/'
#ifdef WIN32
&& *(p-1)!='\\' && *(p-1)!=':'
#endif
) *p++ = '/';
strcpy(p,fl_filename);
strlcpy(p,fl_filename,sizeof(fl_directory) - (p - fl_directory));
const char *q = fl_file_chooser(message,fl_pattern,fl_directory);
if (!q) return 0;
strcpy(fl_directory, q);
strlcpy(fl_directory, q, sizeof(fl_directory));
p = (char *)fl_filename_name(fl_directory);
strcpy(fl_filename, p);
strlcpy(fl_filename, p, sizeof(fl_directory));
if (p > fl_directory+1) p--;
*p = 0;
return (char *)q;
@ -61,5 +61,5 @@ char* fl_get_pattern() {return (char *)fl_pattern;}
char* fl_get_filename() {return fl_filename;}
//
// End of "$Id: forms_fselect.cxx,v 1.4.2.3.2.3 2002/04/11 11:52:43 easysw Exp $".
// End of "$Id: forms_fselect.cxx,v 1.4.2.3.2.4 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -116,7 +116,7 @@ Fl_Help_Dialog.o: ../FL/Fl_Window.H ../FL/Fl_Help_View.H ../FL/Fl.H
Fl_Help_Dialog.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Scrollbar.H
Fl_Help_Dialog.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/fl_draw.H
Fl_Help_Dialog.o: ../FL/Fl_Shared_Image.H ../FL/Fl_Image.H ../FL/x.H
Fl_Help_Dialog.o: ../FL/Fl_Button.H
Fl_Help_Dialog.o: ../FL/Fl_Button.H flstring.h ../config.h
Fl_Help_View.o: ../FL/Fl_Help_View.H ../FL/Fl.H ../FL/Enumerations.H
Fl_Help_View.o: ../FL/Fl_Export.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
Fl_Help_View.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
@ -339,19 +339,19 @@ fl_draw_pixmap.o: ../FL/Fl_Export.H ../FL/fl_draw.H ../FL/x.H
fl_draw_pixmap.o: ../FL/Fl_Window.H flstring.h
fl_engraved_label.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
fl_engraved_label.o: ../FL/Fl_Widget.H ../FL/fl_draw.H
fl_file_dir.o: ../config.h ../FL/filename.H ../FL/Fl_File_Chooser.H
fl_file_dir.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
fl_file_dir.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
fl_file_dir.o: ../FL/Fl_Choice.H ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H
fl_file_dir.o: ../FL/Fl_Button.H ../FL/fl_ask.H ../FL/Fl_File_Browser.H
fl_file_dir.o: ../FL/Fl_Browser.H ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H
fl_file_dir.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_File_Icon.H
fl_file_dir.o: ../FL/Fl.H ../FL/filename.H ../FL/Fl_File_Input.H
fl_file_dir.o: ../FL/Fl_Input.H ../FL/Fl_Input_.H ../FL/Fl_Return_Button.H
fl_file_dir.o: ../FL/Fl_Button.H
fl_file_dir.o: flstring.h ../config.h ../FL/filename.H
fl_file_dir.o: ../FL/Fl_File_Chooser.H ../FL/Fl.H ../FL/Enumerations.H
fl_file_dir.o: ../FL/Fl_Export.H ../FL/Fl_Window.H ../FL/Fl_Group.H
fl_file_dir.o: ../FL/Fl_Widget.H ../FL/Fl_Choice.H ../FL/Fl_Menu_.H
fl_file_dir.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Button.H ../FL/fl_ask.H
fl_file_dir.o: ../FL/Fl_File_Browser.H ../FL/Fl_Browser.H ../FL/Fl_Browser_.H
fl_file_dir.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
fl_file_dir.o: ../FL/Fl_File_Icon.H ../FL/Fl.H ../FL/filename.H
fl_file_dir.o: ../FL/Fl_File_Input.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
fl_file_dir.o: ../FL/Fl_Return_Button.H ../FL/Fl_Button.H
fl_font.o: ../config.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
fl_font.o: ../FL/fl_draw.H ../FL/x.H ../FL/Fl_Window.H Fl_Font.H flstring.h
fl_font.o: fl_font_xft.cxx
fl_font.o: fl_font_x.cxx
fl_labeltype.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
fl_labeltype.o: ../FL/Fl_Widget.H ../FL/Fl_Group.H ../FL/fl_draw.H
fl_labeltype.o: ../FL/Fl_Image.H ../FL/x.H ../FL/Fl_Window.H
@ -375,7 +375,7 @@ fl_set_font.o: ../config.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
fl_set_font.o: ../FL/x.H ../FL/Fl_Window.H Fl_Font.H flstring.h
fl_set_fonts.o: ../config.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
fl_set_fonts.o: ../FL/x.H ../FL/Fl_Window.H Fl_Font.H flstring.h
fl_set_fonts.o: fl_set_fonts_xft.cxx
fl_set_fonts.o: fl_set_fonts_x.cxx
fl_scroll_area.o: ../FL/x.H ../FL/Enumerations.H ../FL/Fl_Export.H
fl_scroll_area.o: ../FL/Fl_Window.H
fl_shadow_box.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
@ -412,6 +412,7 @@ glut_compatability.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Widget.H
glut_font.o: ../config.h ../FL/glut.H ../FL/gl.h ../FL/Enumerations.H
glut_font.o: ../FL/Fl_Export.H ../FL/Fl.H ../FL/Fl_Gl_Window.H
glut_font.o: ../FL/Fl_Window.H
flstring.o: flstring.h ../config.h
scandir.o: flstring.h ../config.h
numericsort.o: ../config.h ../FL/filename.H
vsnprintf.o: flstring.h ../config.h

View File

@ -1,5 +1,5 @@
//
// "$Id: checkers.cxx,v 1.9.2.7.2.1 2002/01/01 15:11:32 easysw Exp $"
// "$Id: checkers.cxx,v 1.9.2.7.2.2 2002/05/16 12:47:43 easysw Exp $"
//
// Checkers game for the Fast Light Tool Kit (FLTK).
//
@ -56,11 +56,10 @@ const char* copyright =
#define FLTK
//#define VT100
#include <string.h>
#include "../src/flstring.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <ctype.h>
#include <time.h>
////////////////////////////////////////////////////////////////
@ -1057,15 +1056,6 @@ void Board::animate(node* move, int backwards) {
int busy; // causes pop-up abort menu
void message(const char* m, ...) {
char buffer[2048];
va_list a;
va_start(a,m);
vsprintf(buffer, m, a);
va_end(a);
fl_message(buffer);
}
void Board::computer_move(int help) {
if (!playing) return;
cursor(FL_CURSOR_WAIT);
@ -1075,7 +1065,7 @@ void Board::computer_move(int help) {
busy = 0;
if (move) {
if (!help && move->value <= -30000) {
message("%s resigns", move->who ? "White" : "Black");
fl_message("%s resigns", move->who ? "White" : "Black");
playing = autoplay = 0;
cursor(FL_CURSOR_DEFAULT);
return;
@ -1085,7 +1075,7 @@ void Board::computer_move(int help) {
}
expandnode(root);
if (!root->son) {
message("%s has no move", root->who ? "Black" : "White");
fl_message("%s has no move", root->who ? "Black" : "White");
playing = autoplay = 0;
}
if (!autoplay) cursor(FL_CURSOR_DEFAULT);
@ -1365,5 +1355,5 @@ int main(int argc, char **argv) {
}
//
// End of "$Id: checkers.cxx,v 1.9.2.7.2.1 2002/01/01 15:11:32 easysw Exp $".
// End of "$Id: checkers.cxx,v 1.9.2.7.2.2 2002/05/16 12:47:43 easysw Exp $".
//

View File

@ -32,15 +32,15 @@ buttons.o: ../FL/Fl_Button.H ../FL/Fl_Return_Button.H ../FL/Fl_Button.H
buttons.o: ../FL/Fl_Repeat_Button.H ../FL/Fl.H ../FL/Fl_Check_Button.H
buttons.o: ../FL/Fl_Light_Button.H ../FL/Fl_Light_Button.H
buttons.o: ../FL/Fl_Round_Button.H ../FL/Fl_Tooltip.H ../FL/Fl_Widget.H
checkers.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
checkers.o: ../FL/Fl_Double_Window.H ../FL/Fl_Window.H ../FL/Fl_Group.H
checkers.o: ../FL/Fl_Widget.H ../FL/Fl_Bitmap.H ../FL/Fl_Image.H ../FL/x.H
checkers.o: ../FL/fl_draw.H ../FL/Fl_Menu_Item.H ../FL/fl_ask.H black_1.xbm
checkers.o: black_2.xbm black_3.xbm black_4.xbm white_1.xbm white_2.xbm
checkers.o: white_3.xbm white_4.xbm blackking_1.xbm blackking_2.xbm
checkers.o: blackking_3.xbm blackking_4.xbm whiteking_1.xbm whiteking_2.xbm
checkers.o: whiteking_3.xbm whiteking_4.xbm ../FL/Fl_Box.H ../FL/Fl_Slider.H
checkers.o: ../FL/Fl_Valuator.H ../FL/Fl_Value_Output.H
checkers.o: ../src/flstring.h ../config.h ../FL/Fl.H ../FL/Enumerations.H
checkers.o: ../FL/Fl_Export.H ../FL/Fl_Double_Window.H ../FL/Fl_Window.H
checkers.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Bitmap.H
checkers.o: ../FL/Fl_Image.H ../FL/x.H ../FL/fl_draw.H ../FL/Fl_Menu_Item.H
checkers.o: ../FL/fl_ask.H black_1.xbm black_2.xbm black_3.xbm black_4.xbm
checkers.o: white_1.xbm white_2.xbm white_3.xbm white_4.xbm blackking_1.xbm
checkers.o: blackking_2.xbm blackking_3.xbm blackking_4.xbm whiteking_1.xbm
checkers.o: whiteking_2.xbm whiteking_3.xbm whiteking_4.xbm ../FL/Fl_Box.H
checkers.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_Value_Output.H
clock.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/Fl_Window.H
clock.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Clock.H
clock.o: ../FL/Fl_Round_Clock.H ../FL/Fl_Clock.H
@ -320,11 +320,7 @@ tabs.o: tabs.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
tabs.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Tabs.H
tabs.o: ../FL/Fl_Group.H ../FL/Fl_Input.H ../FL/Fl_Input_.H ../FL/Fl_Button.H
tabs.o: ../FL/Fl_Clock.H ../FL/Fl_Return_Button.H ../FL/Fl_Button.H
threads.o: ../config.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
threads.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
threads.o: ../FL/Fl_Browser.H ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H
threads.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_Value_Output.H
threads.o: threads.h
threads.o: ../config.h ../FL/fl_ask.H ../FL/Enumerations.H ../FL/Fl_Export.H
tile.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
tile.o: ../FL/Fl_Double_Window.H ../FL/Fl_Window.H ../FL/Fl_Group.H
tile.o: ../FL/Fl_Widget.H ../FL/Fl_Tile.H ../FL/Fl_Box.H

View File

@ -1,5 +1,5 @@
/*
* "$Id: config.h,v 1.5.2.5.2.8 2002/05/02 14:15:46 easysw Exp $"
* "$Id: config.h,v 1.5.2.5.2.9 2002/05/16 12:47:44 easysw Exp $"
*
* Configuration file for the Fast Light Tool Kit (FLTK) for Visual C++.
*
@ -143,13 +143,14 @@
#define HAVE_VSNPRINTF 0
#define HAVE_SNPRINTF 0
#define HAVE_VSPRINTF 1
/*
* String functions...
*/
#define HAVE_STRCASECMP 1
/*#undef HAVE_STRLCAT*/
/*#undef HAVE_STRLCPY*/
/*
* HAVE_POLL:
@ -183,5 +184,5 @@
/*
* End of "$Id: config.h,v 1.5.2.5.2.8 2002/05/02 14:15:46 easysw Exp $".
* End of "$Id: config.h,v 1.5.2.5.2.9 2002/05/16 12:47:44 easysw Exp $".
*/

View File

@ -599,6 +599,10 @@ SOURCE=..\src\Fl_XPM_Image.cxx
# End Source File
# Begin Source File
SOURCE=..\src\flstring.c
# End Source File
# Begin Source File
SOURCE=..\src\numericsort.c
# End Source File
# Begin Source File

View File

@ -2174,6 +2174,11 @@ DEP_CPP_FL_XP=\
# End Source File
# Begin Source File
SOURCE=..\src\flstring.c
# End Source File
# Begin Source File
SOURCE=..\src\forms_bitmap.cxx
DEP_CPP_FORMS=\
"..\fl\enumerations.h"\