style cleanup

This commit is contained in:
Glenn Maynard
2005-05-31 22:03:48 +00:00
parent edf10cb9b3
commit 2e7a4de1b4
+17 -15
View File
@@ -227,7 +227,7 @@ void DirectFilenameDB::PopulateFileSet( FileSet &fs, const CString &path )
return; return;
do { do {
if(!strcmp(fd.cFileName, ".") || !strcmp(fd.cFileName, "..")) if( !strcmp(fd.cFileName, ".") || !strcmp(fd.cFileName, "..") )
continue; continue;
File f; File f;
@@ -236,9 +236,9 @@ void DirectFilenameDB::PopulateFileSet( FileSet &fs, const CString &path )
f.size = fd.nFileSizeLow; f.size = fd.nFileSizeLow;
f.hash = fd.ftLastWriteTime.dwLowDateTime; f.hash = fd.ftLastWriteTime.dwLowDateTime;
fs.files.insert(f); fs.files.insert( f );
} while( FindNextFile( hFind, &fd ) ); } while( FindNextFile( hFind, &fd ) );
FindClose(hFind); FindClose( hFind );
#else #else
/* Ugly: POSIX threads are not guaranteed to have per-thread cwds, and only /* Ugly: POSIX threads are not guaranteed to have per-thread cwds, and only
* a few systems have openat() or equivalent; one or the other is needed * a few systems have openat() or equivalent; one or the other is needed
@@ -247,32 +247,34 @@ void DirectFilenameDB::PopulateFileSet( FileSet &fs, const CString &path )
* for each file. This isn't a major issue, since most large directory * for each file. This isn't a major issue, since most large directory
* scans are I/O-bound. */ * scans are I/O-bound. */
DIR *d = opendir(root+sPath); DIR *pDir = opendir(root+sPath);
if( d == NULL ) if( pDir == NULL )
{ {
LOG->MapLog("opendir " + root+sPath, "Couldn't opendir(%s%s): %s", root.c_str(), sPath.c_str(), strerror(errno) ); LOG->MapLog("opendir " + root+sPath, "Couldn't opendir(%s%s): %s", root.c_str(), sPath.c_str(), strerror(errno) );
return; return;
} }
while(struct dirent *ent = readdir(d)) while( struct dirent *pEnt = readdir(pDir) )
{ {
if(!strcmp(ent->d_name, ".")) continue; if( !strcmp(pEnt->d_name, ".") )
if(!strcmp(ent->d_name, "..")) continue; continue;
if( !strcmp(pEnt->d_name, "..") )
continue;
File f; File f;
f.SetName( ent->d_name ); f.SetName( pEnt->d_name );
struct stat st; struct stat st;
if( DoStat(root+sPath + "/" + ent->d_name, &st) == -1 ) if( DoStat(root+sPath + "/" + pEnt->d_name, &st) == -1 )
{ {
/* If it's a broken symlink, ignore it. Otherwise, warn. */ /* If it's a broken symlink, ignore it. Otherwise, warn. */
if( lstat(ent->d_name, &st) == 0 ) if( lstat(pEnt->d_name, &st) == 0 )
continue; continue;
/* Huh? */ /* Huh? */
if(LOG) if( LOG )
LOG->Warn("Got file '%s' in '%s' from list, but can't stat? (%s)", LOG->Warn( "Got file '%s' in '%s' from list, but can't stat? (%s)",
ent->d_name, sPath.c_str(), strerror(errno)); pEnt->d_name, sPath.c_str(), strerror(errno) );
continue; continue;
} else { } else {
f.dir = (st.st_mode & S_IFDIR); f.dir = (st.st_mode & S_IFDIR);
@@ -283,7 +285,7 @@ void DirectFilenameDB::PopulateFileSet( FileSet &fs, const CString &path )
fs.files.insert(f); fs.files.insert(f);
} }
closedir(d); closedir( pDir );
#endif #endif
} }