From 6c9647c1866b49d61ea3ce7d9201450fa0497b52 Mon Sep 17 00:00:00 2001 From: Fritz Elfert Date: Thu, 1 Feb 2001 02:03:25 +0000 Subject: More cleanup: - Removed bool.h and references to it everywhere. This is checked now in ./configure and the stuff went into acconfig.h - Replaced ugly bufferStore-based method of returning directory entries from rfsv::readdir() by a cleaner way. (A new, separate class PlpDirent is returned now.) With the old implementation, the caller has to know about the layout of the entries. Also, the old implementation was not 64bit aware. - Similar replacement done for rfsv::dir(). This now returns the entries in a standard STL container (deque) instead of a bufferArray. - Started renaming #include statements for standard library headers from the old form to the new recommended form. --- lib/rfsv16.cc | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'lib/rfsv16.cc') diff --git a/lib/rfsv16.cc b/lib/rfsv16.cc index fdec2e7..26a153b 100644 --- a/lib/rfsv16.cc +++ b/lib/rfsv16.cc @@ -34,7 +34,6 @@ #include #include -#include "bool.h" #include "rfsv16.h" #include "bufferstore.h" #include "ppsocket.h" @@ -181,7 +180,7 @@ closedir(rfsvDirhandle &dH) { } Enum rfsv16:: -readdir(rfsvDirhandle &dH, bufferStore &s) { +readdir(rfsvDirhandle &dH, PlpDirent &e) { Enum res = E_PSI_GEN_NONE; if (dH.b.getLen() < 17) { @@ -198,32 +197,30 @@ readdir(rfsvDirhandle &dH, bufferStore &s) { cerr << "dir: not version 2" << endl; return E_PSI_GEN_FAIL; } - long attr = attr2std((long)dH.b.getWord(2)); - long size = dH.b.getDWord(4); - PsiTime *date = new PsiTime((time_t)dH.b.getDWord(8)); - const char *name = dH.b.getString(16); - - dH.b.discardFirstBytes(17+strlen(name)); - - s.init(); - s.addDWord((unsigned long)date); - s.addDWord(size); - s.addDWord(attr); - s.addStringT(name); + e.attr = attr2std((long)dH.b.getWord(2)); + e.size = dH.b.getDWord(4); + e.time = PsiTime((time_t)dH.b.getDWord(8)); + e.name = dH.b.getString(16); + e.uid[0] = e.uid[1] = e.uid[2] = 0; + e.attrstr = attr2String(e.attr); + + dH.b.discardFirstBytes(17 + e.name.length()); + } return res; } Enum rfsv16:: -dir(const char *name, bufferArray &files) +dir(const char *name, PlpDir &files) { rfsvDirhandle h; + files.clear(); Enum res = opendir(PSI_A_HIDDEN | PSI_A_SYSTEM | PSI_A_DIR, name, h); while (res == E_PSI_GEN_NONE) { - bufferStore b; - res = readdir(h, b); + PlpDirent e; + res = readdir(h, e); if (res == E_PSI_GEN_NONE) - files += b; + files.push_back(e); } closedir(h); if (res == E_PSI_FILE_EOF) -- cgit v1.2.3