Some stuff

This commit is contained in:
henry
2009-01-15 16:45:44 +00:00
515 changed files with 11670 additions and 7079 deletions

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
UNIX versions of the functions declated in OSspecific.H.
UNIX versions of the functions declared in OSspecific.H.
\*---------------------------------------------------------------------------*/
@ -288,7 +288,7 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
bool Foam::mkDir(const fileName& pathName, mode_t mode)
{
// empty names are meaningless
if (!pathName.size())
if (pathName.empty())
{
return false;
}
@ -495,7 +495,7 @@ bool Foam::dir(const fileName& name)
// Return size of file
off_t Foam::size(const fileName& name)
off_t Foam::fileSize(const fileName& name)
{
fileStat fileStatus(name);
if (fileStatus.isValid())
@ -545,7 +545,7 @@ Foam::fileNameList Foam::readDir
// Setup empty string list MAXTVALUES long
fileNameList dirEntries(maxNnames);
// Pointers to the Unix director system
// Pointers to the directory entries
DIR *source;
struct dirent *list;
@ -571,10 +571,10 @@ Foam::fileNameList Foam::readDir
{
fileName fName(list->d_name);
// ignore files begining with ., i.e. ., .. and .??*
if (fName.size() > 0 && fName[size_t(0)] != '.')
// ignore files begining with ., i.e. '.', '..' and '.*'
if (fName.size() && fName[0] != '.')
{
word fileNameExt = fName.ext();
word fExt = fName.ext();
if
(
@ -582,11 +582,11 @@ Foam::fileNameList Foam::readDir
||
(
type == fileName::FILE
&& fName[fName.size()-1] != '~'
&& fileNameExt != "bak"
&& fileNameExt != "BAK"
&& fileNameExt != "old"
&& fileNameExt != "save"
&& fName[fName.size()-1] != '~'
&& fExt != "bak"
&& fExt != "BAK"
&& fExt != "old"
&& fExt != "save"
)
)
{
@ -597,7 +597,7 @@ Foam::fileNameList Foam::readDir
dirEntries.setSize(dirEntries.size() + maxNnames);
}
if (filtergz && fileNameExt == "gz")
if (filtergz && fExt == "gz")
{
dirEntries[nEntries++] = fName.lessExt();
}
@ -620,17 +620,17 @@ Foam::fileNameList Foam::readDir
}
// Copy, recursively if necessary, the source top the destination
// Copy, recursively if necessary, the source to the destination
bool Foam::cp(const fileName& src, const fileName& dest)
{
fileName destFile(dest);
// Make sure source exists.
if (!exists(src))
{
return false;
}
fileName destFile(dest);
// Check type of source file.
if (src.type() == fileName::FILE)
{
@ -680,7 +680,7 @@ bool Foam::cp(const fileName& src, const fileName& dest)
destFile = destFile/src.component(src.components().size() -1);
}
// Make sure the destination directory extists.
// Make sure the destination directory exists.
if (!dir(destFile) && !mkDir(destFile))
{
return false;
@ -810,7 +810,7 @@ bool Foam::rmDir(const fileName& directory)
<< "removing directory " << directory << endl;
}
// Pointers to the Unix director system
// Pointers to the directory entries
DIR *source;
struct dirent *list;

View File

@ -149,7 +149,7 @@ void getSymbolForRaw
const word& address
)
{
if (filename.size() > 0 && filename[0] == '/')
if (filename.size() && filename[0] == '/')
{
string fcnt = pOpen
(
@ -189,7 +189,7 @@ void error::printStack(Ostream& os)
string::size_type space = line.rfind(' ') + 1;
fileName libPath = line.substr(space, line.size()-space);
if (libPath.size() > 0 && libPath[0] == '/')
if (libPath.size() && libPath[0] == '/')
{
string offsetString(line.substr(0, line.find('-')));
IStringStream offsetStr(offsetString);
@ -217,7 +217,7 @@ void error::printStack(Ostream& os)
string::size_type lPos = msg.find('[');
string::size_type rPos = msg.find(']');
if (lPos != string::npos && rPos != string::npos && lPos<rPos)
if (lPos != string::npos && rPos != string::npos && lPos < rPos)
{
address = msg.substr(lPos+1, rPos-lPos-1);
msg = msg.substr(0, lPos);
@ -232,7 +232,7 @@ void error::printStack(Ostream& os)
// not an absolute path
if (programFile[0] != '/')
{
string tmp = pOpen("which "+programFile);
string tmp = pOpen("which " + programFile);
if (tmp[0] == '/' || tmp[0] == '~')
{
programFile = tmp;
@ -243,13 +243,13 @@ void error::printStack(Ostream& os)
string::size_type bracketPos = msg.find('(');
if (bracketPos != string::size_type(string::npos))
if (bracketPos != string::npos)
{
string::size_type start = bracketPos+1;
string::size_type plusPos = msg.find('+', start);
if (plusPos != string::size_type(string::npos))
if (plusPos != string::npos)
{
string cName(msg.substr(start, plusPos-start));
@ -276,7 +276,7 @@ void error::printStack(Ostream& os)
{
string::size_type endBracketPos = msg.find(')', start);
if (endBracketPos != string::size_type(string::npos))
if (endBracketPos != string::npos)
{
string fullName(msg.substr(start, endBracketPos-start));