Commit b9c1b18f authored by hybrid's avatar hybrid

Small code cleaning.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1417 dfc29bdd-3216-0410-991c-e03cc46cb475
parent b9d47be0
......@@ -171,10 +171,8 @@ const c8* CFileList::getFullFileName(u32 index)
bool CFileList::isDirectory(u32 index) const
{
bool ret;
if (index >= Files.size())
ret = false;
else
bool ret = false;
if (index < Files.size())
ret = Files[index].isDirectory;
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
......
......@@ -26,26 +26,22 @@ public:
CFileList();
//! Returns the amount of files in the filelist.
//! \return
//! Returns the amount of files and directories in the file list.
/** \return Amount of files and directories in the file list. */
virtual u32 getFileCount() const;
//! Gets the name of a file in the list, based on an index.
//! \param index is the zero based index of the file which name should
//! be returned. The index has to be smaller than the amount getFileCount() returns.
//! \return
//! Returns the file name of the file. Returns 0, if an error occured.
/** \param index is the zero based index of the file which name should
be returned. The index has to be smaller than the amount getFileCount() returns.
\return The file name of the file. Returns 0, if an error occured. */
virtual const c8* getFileName(u32 index) const;
//! Gets the full name of a file in the list, path included, based on an index.
virtual const c8* getFullFileName(u32 index);
//! Returns of the file is a directory
//! \param index is the zero based index of the file which name should
//! be returned. The index has to be smaller than the amount getFileCount() returns.
//! \return
//! Returns true, if the file is a directory, and false, if it is not.
//! If an error occurs, the result is undefined.
/** \param index is the zero based index of the file which name should
be returned. The index has to be smaller than the amount getFileCount() returns.
\return True if the file is a directory, else false. */
virtual bool isDirectory(u32 index) const;
private:
......
......@@ -218,24 +218,19 @@ bool CFileSystem::changeWorkingDirectoryTo(const c8* newDirectory)
core::stringc CFileSystem::getAbsolutePath(const core::stringc& filename) const
{
c8 *p=0;
core::stringc ret;
#ifdef _IRR_WINDOWS_API_
#if !defined ( _WIN32_WCE )
c8 fpath[_MAX_PATH];
p = _fullpath( fpath, filename.c_str(), _MAX_PATH);
ret = p;
#endif
#elif (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_))
c8 fpath[4096];
p = realpath(filename.c_str(), fpath);
ret = p;
#endif
return ret;
return core::stringc(p);
}
......
......@@ -12,17 +12,14 @@ namespace io
CMemoryReadFile::CMemoryReadFile(void* memory, long len, const c8* fileName, bool d)
: Buffer(memory), Len(len), Pos(0), deleteMemoryWhenDropped(d)
: Buffer(memory), Len(len), Pos(0), Filename(fileName), deleteMemoryWhenDropped(d)
{
#ifdef _DEBUG
setDebugName("CMemoryReadFile");
#endif
Filename = fileName;
}
CMemoryReadFile::~CMemoryReadFile()
{
if (deleteMemoryWhenDropped)
......@@ -30,7 +27,6 @@ CMemoryReadFile::~CMemoryReadFile()
}
//! returns how much was read
s32 CMemoryReadFile::read(void* buffer, u32 sizeToRead)
{
......@@ -74,7 +70,6 @@ bool CMemoryReadFile::seek(long finalPos, bool relativeMovement)
}
//! returns size of file
long CMemoryReadFile::getSize() const
{
......@@ -82,7 +77,6 @@ long CMemoryReadFile::getSize() const
}
//! returns where in the file we are.
long CMemoryReadFile::getPos() const
{
......@@ -90,7 +84,6 @@ long CMemoryReadFile::getPos() const
}
//! returns name of file
const c8* CMemoryReadFile::getFileName() const
{
......@@ -98,7 +91,6 @@ const c8* CMemoryReadFile::getFileName() const
}
IReadFile* createMemoryReadFile(void* memory, long size, const c8* fileName, bool deleteMemoryWhenDropped)
{
CMemoryReadFile* file = new CMemoryReadFile(memory, size, fileName, deleteMemoryWhenDropped);
......
......@@ -21,16 +21,16 @@ namespace io
{
public:
//! Constructor
CMemoryReadFile(void* memory, long len, const c8* fileName, bool deleteMemoryWhenDropped);
//! Destructor
virtual ~CMemoryReadFile();
//! returns how much was read
virtual s32 read(void* buffer, u32 sizeToRead);
//! changes position in file, returns true if successful
//! if relativeMovement==true, the pos is changed relative to current pos,
//! otherwise from begin of file
virtual bool seek(long finalPos, bool relativeMovement = false);
//! returns size of file
......@@ -44,10 +44,10 @@ namespace io
private:
core::stringc Filename;
void *Buffer;
long Len;
long Pos;
core::stringc Filename;
bool deleteMemoryWhenDropped;
};
......
......@@ -11,18 +11,16 @@ namespace io
CReadFile::CReadFile(const c8* fileName)
: File(0), FileSize(0)
: File(0), FileSize(0), Filename(fileName)
{
#ifdef _DEBUG
setDebugName("CReadFile");
#endif
Filename = fileName;
openFile();
}
CReadFile::~CReadFile()
{
if (File)
......@@ -30,7 +28,6 @@ CReadFile::~CReadFile()
}
//! returns how much was read
s32 CReadFile::read(void* buffer, u32 sizeToRead)
{
......@@ -41,7 +38,6 @@ s32 CReadFile::read(void* buffer, u32 sizeToRead)
}
//! changes position in file, returns true if successful
//! if relativeMovement==true, the pos is changed relative to current pos,
//! otherwise from begin of file
......@@ -54,7 +50,6 @@ bool CReadFile::seek(long finalPos, bool relativeMovement)
}
//! returns size of file
long CReadFile::getSize() const
{
......@@ -62,7 +57,6 @@ long CReadFile::getSize() const
}
//! returns where in the file we are.
long CReadFile::getPos() const
{
......@@ -70,7 +64,6 @@ long CReadFile::getPos() const
}
//! opens the file
void CReadFile::openFile()
{
......
......@@ -22,7 +22,6 @@ IImageWriter* createImageWriterBMP();
CSoftwareTexture2::CSoftwareTexture2(IImage* image, const char* name, bool generateMipLevels, bool isRenderTarget)
: ITexture(name), MipMapLOD(0), HasMipMaps(generateMipLevels), IsRenderTarget(isRenderTarget)
{
#ifdef _DEBUG
setDebugName("CSoftwareTexture2");
#endif
......@@ -37,13 +36,12 @@ CSoftwareTexture2::CSoftwareTexture2(IImage* image, const char* name, bool gener
{
core::dimension2d<s32> optSize;
core::dimension2d<s32> origSize = image->getDimension();
OrigSize = origSize;
OrigSize = image->getDimension();
optSize.Width = getTextureSizeFromSurfaceSize(origSize.Width);
optSize.Height = getTextureSizeFromSurfaceSize(origSize.Height);
optSize.Width = getTextureSizeFromSurfaceSize(OrigSize.Width);
optSize.Height = getTextureSizeFromSurfaceSize(OrigSize.Height);
if ( origSize == optSize )
if ( OrigSize == optSize )
{
MipMap[0] = new CImage(BURNINGSHADER_COLOR_FORMAT, image);
}
......@@ -60,8 +58,8 @@ CSoftwareTexture2::CSoftwareTexture2(IImage* image, const char* name, bool gener
}
}
regenerateMipMapLevels ();
setCurrentMipMapLOD ( 0 );
regenerateMipMapLevels();
setCurrentMipMapLOD(0);
}
......@@ -71,7 +69,7 @@ CSoftwareTexture2::~CSoftwareTexture2()
for ( s32 i = 0; i!= SOFTWARE_DRIVER_2_MIPMAPPING_MAX; ++i )
{
if ( MipMap[i] )
MipMap[i]->drop ();
MipMap[i]->drop();
}
}
......@@ -105,7 +103,7 @@ void CSoftwareTexture2::regenerateMipMapLevels()
for ( i = 1; i!= SOFTWARE_DRIVER_2_MIPMAPPING_MAX; ++i )
{
if ( MipMap[i] )
MipMap[i]->drop ();
MipMap[i]->drop();
}
core::dimension2d<s32> newSize;
......@@ -120,9 +118,9 @@ void CSoftwareTexture2::regenerateMipMapLevels()
newSize.Height = core::s32_max ( 1, currentSize.Height >> SOFTWARE_DRIVER_2_MIPMAPPING_SCALE );
MipMap[i] = new CImage(BURNINGSHADER_COLOR_FORMAT, newSize);
MipMap[0]->copyToScalingBoxFilter ( MipMap[i], 0 );
MipMap[0]->copyToScalingBoxFilter( MipMap[i], 0 );
c = MipMap[i];
i += 1;
++i;
}
}
......
......@@ -60,8 +60,8 @@ CXXFLAGS += -pg
endif
CFLAGS := -fexpensive-optimizations -O3 -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES
sharedlib sharedlib_win32 : CXXFLAGS += -fpic
sharedlib sharedlib_win32 : CFLAGS += -fpic
sharedlib : CXXFLAGS += -fpic
sharedlib : CFLAGS += -fpic
#multilib handling
ifeq ($(HOSTTYPE), x86_64)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment