From a53b47355a3cda370e36d034e7e6f77a6e0299b7 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@Germany> Date: Sun, 11 Jan 2009 16:44:11 +0100 Subject: [PATCH] rename Foam::size() -> Foam::fileSize() for carity --- src/OSspecific/Unix/Unix.C | 6 +++--- src/OpenFOAM/include/OSspecific.H | 6 +++--- .../surfaceFormats/stl/STLsurfaceFormatASCII.L | 4 ++-- .../surfaceFormats/stl/STLsurfaceFormatCore.C | 18 +++++++++--------- .../triSurface/interfaces/STL/readSTLASCII.L | 4 ++-- .../triSurface/interfaces/STL/readSTLBINARY.C | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/OSspecific/Unix/Unix.C b/src/OSspecific/Unix/Unix.C index 278a904678a..e4ffe768578 100644 --- a/src/OSspecific/Unix/Unix.C +++ b/src/OSspecific/Unix/Unix.C @@ -491,7 +491,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()) @@ -541,7 +541,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; @@ -806,7 +806,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; diff --git a/src/OpenFOAM/include/OSspecific.H b/src/OpenFOAM/include/OSspecific.H index df57346cf86..1cca34885da 100644 --- a/src/OpenFOAM/include/OSspecific.H +++ b/src/OpenFOAM/include/OSspecific.H @@ -26,7 +26,7 @@ InNamespace Foam Description - Functions used by OpenFOAM which are specific to the UNIX operating system + Functions used by OpenFOAM that are specific to the UNIX operating system and need to be replaced or emulated on other systems. SourceFiles @@ -118,7 +118,7 @@ mode_t mode(const fileName&); //- Return the file type: FILE or DIRECTORY fileName::Type type(const fileName&); -//- Does the name exist in the filing system? +//- Does the name exist in the file system? bool exists(const fileName& name); //- Does the file exist? @@ -128,7 +128,7 @@ bool file(const fileName&); bool dir(const fileName&); //- Return size of file -off_t size(const fileName&); +off_t fileSize(const fileName&); //- Return time of last file modification time_t lastModified(const fileName&); diff --git a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L b/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L index 6a03268d7d6..520c22e0d5e 100644 --- a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L +++ b/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L @@ -405,12 +405,12 @@ endsolid {space}("endsolid"|"ENDSOLID")({some_space}{word})* bool Foam::fileFormats::STLsurfaceFormatCore::readASCII ( IFstream& ifs, - const off_t fileSize + const off_t dataFileSize ) { // Create the lexer with the approximate number of vertices in the STL // from the file size - STLASCIILexer lexer(&ifs.stdStream(), fileSize/400); + STLASCIILexer lexer(&ifs.stdStream(), dataFileSize/400); while (lexer.lex() != 0) {} sorted_ = lexer.sorted(); diff --git a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatCore.C b/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatCore.C index edfcabe19db..087f7d0d88a 100644 --- a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatCore.C +++ b/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatCore.C @@ -45,7 +45,7 @@ int Foam::fileFormats::STLsurfaceFormatCore::detectBINARY const fileName& filename ) { - off_t fileSize = Foam::size(filename); + off_t dataFileSize = Foam::fileSize(filename); IFstream ifs(filename, IOstream::BINARY); istream& is = ifs.stdStream(); @@ -74,8 +74,8 @@ int Foam::fileFormats::STLsurfaceFormatCore::detectBINARY ( !is || nTris < 0 - || nTris < (fileSize - headerSize)/50 - || nTris > (fileSize - headerSize)/25 + || nTris < (dataFileSize - headerSize)/50 + || nTris > (dataFileSize - headerSize)/25 ) { return 0; @@ -89,7 +89,7 @@ int Foam::fileFormats::STLsurfaceFormatCore::detectBINARY bool Foam::fileFormats::STLsurfaceFormatCore::readBINARY ( IFstream& ifs, - const off_t fileSize + const off_t dataFileSize ) { sorted_ = true; @@ -124,8 +124,8 @@ bool Foam::fileFormats::STLsurfaceFormatCore::readBINARY ( !is || nTris < 0 - || nTris < (fileSize - headerSize)/50 - || nTris > (fileSize - headerSize)/25 + || nTris < (dataFileSize - headerSize)/50 + || nTris > (dataFileSize - headerSize)/25 ) { FatalErrorIn @@ -224,16 +224,16 @@ Foam::fileFormats::STLsurfaceFormatCore::STLsurfaceFormatCore names_(0), sizes_(0) { - off_t fileSize = Foam::size(filename); + off_t dataFileSize = Foam::fileSize(filename); // auto-detect ascii/binary if (detectBINARY(filename)) { - readBINARY(IFstream(filename, IOstream::BINARY)(), fileSize); + readBINARY(IFstream(filename, IOstream::BINARY)(), dataFileSize); } else { - readASCII(IFstream(filename)(), fileSize); + readASCII(IFstream(filename)(), dataFileSize); } } diff --git a/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L b/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L index 2ba62edba39..208aa13d161 100644 --- a/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L +++ b/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L @@ -1,4 +1,4 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | @@ -398,7 +398,7 @@ bool triSurface::readSTLASCII(const fileName& STLfileName) // Create the lexer obtaining the approximate number of vertices in the STL // from the file size - STLLexer lexer(&STLstream.stdStream(), Foam::size(STLfileName)/400); + STLLexer lexer(&STLstream.stdStream(), Foam::fileSize(STLfileName)/400); while(lexer.lex() != 0) {} diff --git a/src/triSurface/triSurface/interfaces/STL/readSTLBINARY.C b/src/triSurface/triSurface/interfaces/STL/readSTLBINARY.C index a377306bbff..4c7c9e859a0 100644 --- a/src/triSurface/triSurface/interfaces/STL/readSTLBINARY.C +++ b/src/triSurface/triSurface/interfaces/STL/readSTLBINARY.C @@ -89,9 +89,9 @@ bool triSurface::readSTLBINARY(const fileName& STLfileName) // If the comparison is not sensible then it maybe an ASCII file if (!compressed) { - label triDataSize = Foam::size(STLfileName) - 80; + label dataFileSize = Foam::fileSize(STLfileName) - 80; - if (nTris < triDataSize/50 || nTris > triDataSize/25) + if (nTris < dataFileSize/50 || nTris > dataFileSize/25) { return false; } -- GitLab