From a10c46e83cffe2ee7d3031a50e60f063ec25fd40 Mon Sep 17 00:00:00 2001 From: Nikolai Pretzell Date: Thu, 2 May 2002 11:36:16 +0000 Subject: #98177# --- cosv/inc/cosv/ploc_dir.hxx | 8 ++++---- cosv/source/service/std_outp.cxx | 6 ++++-- cosv/source/storage/ploc_dir.cxx | 27 +++++++++++++++++++-------- cosv/source/storage/plocroot.cxx | 6 +++--- 4 files changed, 30 insertions(+), 17 deletions(-) (limited to 'cosv') diff --git a/cosv/inc/cosv/ploc_dir.hxx b/cosv/inc/cosv/ploc_dir.hxx index 585af589fae0..1dfd2634dd39 100644 --- a/cosv/inc/cosv/ploc_dir.hxx +++ b/cosv/inc/cosv/ploc_dir.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ploc_dir.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $ + * last change: $Author: np $ $Date: 2002-05-02 12:35:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -109,7 +109,7 @@ class Directory : public Persistent // OPERATIONS bool PhysicalCreate( - bool i_bCreateParentsIfNecessary = true ); + bool i_bCreateParentsIfNecessary = true ) const; // INQUIRY void GetContainedDirectories( @@ -133,7 +133,7 @@ class Directory : public Persistent true, if parent(!) directory exists or could be created. false, if this is a root directory. */ - bool Check_Parent(); + bool Check_Parent() const; bool PhysicalCreate_Dir( const char * i_sStr ) const; // DATA diff --git a/cosv/source/service/std_outp.cxx b/cosv/source/service/std_outp.cxx index c40f6c704dde..6496303802ac 100644 --- a/cosv/source/service/std_outp.cxx +++ b/cosv/source/service/std_outp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: std_outp.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $ + * last change: $Author: np $ $Date: 2002-05-02 12:35:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,6 +63,8 @@ #include // NOT FULLY DECLARED SERVICES +#include + namespace csv { diff --git a/cosv/source/storage/ploc_dir.cxx b/cosv/source/storage/ploc_dir.cxx index d734c07c91a5..3b8e805bf940 100644 --- a/cosv/source/storage/ploc_dir.cxx +++ b/cosv/source/storage/ploc_dir.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ploc_dir.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: np $ $Date: 2002-03-22 10:28:16 $ + * last change: $Author: np $ $Date: 2002-05-02 12:35:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -126,7 +126,7 @@ Directory::operator-=( uintt i_nLevels ) } bool -Directory::PhysicalCreate( bool i_bCreateParentsIfNecessary ) +Directory::PhysicalCreate( bool i_bCreateParentsIfNecessary ) const { bool ret = PhysicalCreate_Dir( StrPath() ); if ( ret OR NOT i_bCreateParentsIfNecessary ) @@ -139,7 +139,7 @@ Directory::PhysicalCreate( bool i_bCreateParentsIfNecessary ) } bool -Directory::Check_Parent() +Directory::Check_Parent() const { // There is no parent of root directories: if ( aPath.DirChain().Size() == 0 ) @@ -147,7 +147,7 @@ Directory::Check_Parent() // Become my own parent: String sLastToken = aPath.DirChain().Back(); - operator-=(1); + const_cast< Directory* >(this)->operator-=(1); // Begin behaving as parent: bool ret = Exists(); @@ -160,7 +160,7 @@ Directory::Check_Parent() // End behaving as parent. // Become myself again: - operator+=(sLastToken); + const_cast< Directory* >(this)->operator+=(sLastToken); return ret; } @@ -267,13 +267,21 @@ Directory::PhysicalCreate_Dir( const char * i_sStr ) const void Directory::GetContainedDirectories( StringVector & o_rResult ) const { + StreamStr sNew(240); + sNew << aPath; + StreamStr::size_type + nStartFilename = sNew.tellp(); + DIR * pDir = opendir( StrPath() ); dirent * pEntry = 0; struct stat aEntryStatus; while ( (pEntry = readdir(pDir)) != 0 ) { - stat(pEntry->d_name, &aEntryStatus); + sNew.seekp(nStartFilename); + sNew << pEntry->d_name; + + stat(sNew.c_str(), &aEntryStatus); if ( (aEntryStatus.st_mode & S_IFDIR) == S_IFDIR AND *pEntry->d_name != '.' ) { @@ -304,7 +312,10 @@ Directory::GetContainedFiles( StringVector & o_rResult, while ( (pEntry = readdir(pDir)) != 0 ) { - stat(pEntry->d_name, &aEntryStatus); + sNew.seekp(nStartFilename); + sNew << pEntry->d_name; + + stat(sNew.c_str(), &aEntryStatus); if ( (aEntryStatus.st_mode & S_IFDIR) == S_IFDIR ) continue; // Don't gather directories. diff --git a/cosv/source/storage/plocroot.cxx b/cosv/source/storage/plocroot.cxx index b6f7f57d2f8c..b44a1dc7cddc 100644 --- a/cosv/source/storage/plocroot.cxx +++ b/cosv/source/storage/plocroot.cxx @@ -2,9 +2,9 @@ * * $RCSfile: plocroot.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: np $ $Date: 2002-03-08 14:25:40 $ + * last change: $Author: np $ $Date: 2002-05-02 12:35:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,7 +64,7 @@ // NOT FULLY DECLARED SERVICES // #include -// #include +#include namespace csv -- cgit