summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2002-04-30 18:11:49 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2002-04-30 18:11:49 +0000
commit1f5448409b34b28a38ac48ae47ce2f66731142ef (patch)
tree0a813a222374ef7977c135a7eae04fed9831d173 /src
parent19b4d2fd1cb060a83ed75353f876dec3877059a5 (diff)
Fl_Preferences::getUserdataPath() and getPath() methods now require a
length parameter for the string. Added GUI preferences and file history to FLUID, using Fl_Preferences. FLUID now uses getUserdataPath() for the cut buffer location. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2141 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Preferences.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx
index d5ddb7224..8d1ded130 100644
--- a/src/Fl_Preferences.cxx
+++ b/src/Fl_Preferences.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Preferences.cxx,v 1.1.2.6 2002/04/30 15:34:58 easysw Exp $"
+// "$Id: Fl_Preferences.cxx,v 1.1.2.7 2002/04/30 18:11:49 easysw Exp $"
//
// Preferences methods for the Fast Light Tool Kit (FLTK).
//
@@ -408,10 +408,10 @@ int Fl_Preferences::size( const char *key )
* Win32: c:/Documents and Settings/matt/Application Data/matthiasm.com/test/
* prefs: c:/Documents and Settings/matt/Application Data/matthiasm.com/test.prefs
*/
-char Fl_Preferences::getUserdataPath( char *path )
+char Fl_Preferences::getUserdataPath( char *path, int pathlen )
{
if ( rootNode )
- return rootNode->getPath( path );
+ return rootNode->getPath( path, pathlen );
return 0;
}
@@ -630,9 +630,11 @@ int Fl_Preferences::RootNode::write()
}
// get the path to the preferences directory
-char Fl_Preferences::RootNode::getPath( char *path )
+char Fl_Preferences::RootNode::getPath( char *path, int pathlen )
{
- strcpy( path, filename_ );
+ strncpy( path, filename_, pathlen - 1 );
+ path[pathlen - 1] = '\0';
+
char *s;
for ( s = path; *s; s++ ) if ( *s == '\\' ) *s = '/';
s = strrchr( path, '.' );
@@ -935,5 +937,5 @@ char Fl_Preferences::Node::remove()
//
-// End of "$Id: Fl_Preferences.cxx,v 1.1.2.6 2002/04/30 15:34:58 easysw Exp $".
+// End of "$Id: Fl_Preferences.cxx,v 1.1.2.7 2002/04/30 18:11:49 easysw Exp $".
//