1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 02:51:27 +00:00

Obliterate hsBool

This commit is contained in:
2012-07-11 01:28:00 -04:00
parent 5f78b33db4
commit a709e17069
1041 changed files with 7889 additions and 8070 deletions

View File

@ -100,7 +100,7 @@ const char* hsFile::GetName()
return FindNameInPath(this->GetPathAndName());
}
FILE* hsFile::OpenFILE(const char mode[], hsBool throwIfFailure)
FILE* hsFile::OpenFILE(const char mode[], bool throwIfFailure)
{
this->Close();
@ -116,7 +116,7 @@ FILE* hsFile::OpenFILE(const char mode[], hsBool throwIfFailure)
return fFILE;
}
hsStream* hsFile::OpenStream(const char mode[], hsBool throwIfFailure)
hsStream* hsFile::OpenStream(const char mode[], bool throwIfFailure)
{
FILE* file = this->OpenFILE(mode, throwIfFailure);
@ -141,7 +141,7 @@ void hsFile::Close()
///////////////////////////////////////////////////////////////////////
hsBool hsFolderIterator::NextFileSuffix(const char suffix[])
bool hsFolderIterator::NextFileSuffix(const char suffix[])
{
while (this->NextFile())
{ const char* fileSuffix = ::strrchr(this->GetFileName(), '.');

View File

@ -83,8 +83,8 @@ public:
virtual const char* GetPathAndName();
virtual void SetPathAndName(const char pathAndName[]);
virtual FILE* OpenFILE(const char mode[], hsBool throwIfFailure = false);
virtual hsStream* OpenStream(const char mode[], hsBool throwIfFailure = false);
virtual FILE* OpenFILE(const char mode[], bool throwIfFailure = false);
virtual hsStream* OpenStream(const char mode[], bool throwIfFailure = false);
virtual void Close(); // called automatically in the destructor
};
@ -110,11 +110,11 @@ public:
void SetPath(const char path[]);
void Reset();
hsBool NextFile();
hsBool NextFileSuffix(const char suffix[]);
bool NextFile();
bool NextFileSuffix(const char suffix[]);
const char* GetFileName() const;
int GetPathAndName(char pathandname[] = nil);
hsBool IsDirectory( void ) const;
bool IsDirectory( void ) const;
FILE* OpenFILE(const char mode[]);
@ -138,11 +138,11 @@ public:
void SetPath(const wchar_t path[]);
void Reset();
hsBool NextFile();
hsBool NextFileSuffix(const wchar_t suffix[]);
bool NextFile();
bool NextFileSuffix(const wchar_t suffix[]);
const wchar_t* GetFileName() const;
int GetPathAndName(wchar_t pathandname[] = nil);
hsBool IsDirectory( void ) const;
bool IsDirectory( void ) const;
FILE* OpenFILE(const wchar_t mode[]);

View File

@ -121,7 +121,7 @@ void hsMacFile::SetNameFromSpec()
fPathAndName = hsStrcpy(temp);
}
hsBool hsMacFile::Create(OSType creator, OSType fileType, ScriptCode scriptCode)
bool hsMacFile::Create(OSType creator, OSType fileType, ScriptCode scriptCode)
{
this->Close();
@ -136,7 +136,7 @@ hsBool hsMacFile::Create(OSType creator, OSType fileType, ScriptCode scriptCode)
#define kFileNotFound_Err -43
hsBool hsMacFile::OpenDataFork(Sint8_t perm, int16_t* refnum)
bool hsMacFile::OpenDataFork(Sint8_t perm, int16_t* refnum)
{
this->Close();
@ -172,7 +172,7 @@ void hsMacFile::SetPathAndName(const char pathAndName[])
this->SetSpecFromName();
}
hsStream* hsMacFile::OpenStream(const char mode[], hsBool throwIfFailure)
hsStream* hsMacFile::OpenStream(const char mode[], bool throwIfFailure)
{
hsThrowIfNilParam(mode);
@ -213,7 +213,7 @@ struct hsFolderIterator_Data {
OSType fCreator;
char fCName[_MAX_PATH];
int16_t fCurrIndex;
hsBool fValid;
bool fValid;
};
hsFolderIterator::hsFolderIterator(const char path[])
@ -328,7 +328,7 @@ void hsFolderIterator::Reset()
#endif
}
hsBool hsFolderIterator::NextFile()
bool hsFolderIterator::NextFile()
{
if (fData->fCurrIndex == 0)
return false;
@ -367,7 +367,7 @@ const char* hsFolderIterator::GetFileName() const
////////////////////////////////////////////////////////////////////////////
hsBool hsFolderIterator::NextMacFile(OSType targetFileType, OSType targetCreator)
bool hsFolderIterator::NextMacFile(OSType targetFileType, OSType targetCreator)
{
for (;;)
{ if (this->NextFile() == false)
@ -400,7 +400,7 @@ OSType hsFolderIterator::GetMacCreator() const
return fData->fCreator;
}
hsBool hsFolderIterator::IsDirectory( void ) const
bool hsFolderIterator::IsDirectory( void ) const
{
hsAssert( false, "hsFolderIterator::IsDirectory() not defined on this platform!!!" );
return false;

View File

@ -67,7 +67,7 @@ void hsFolderIterator::Reset()
{
}
hsBool hsFolderIterator::NextFile()
bool hsFolderIterator::NextFile()
{
}
@ -75,7 +75,7 @@ const char* hsFolderIterator::GetFileName() const
{
}
hsBool hsFolderIterator::IsDirectory( void ) const
bool hsFolderIterator::IsDirectory( void ) const
{
hsAssert( false, "hsFolderIterator::IsDirectory() not defined on this platform!!!" );
return false;

View File

@ -94,7 +94,7 @@ void hsFolderIterator::Reset()
fData->fInited=false;
}
}
hsBool hsFolderIterator::NextFile()
bool hsFolderIterator::NextFile()
{
if (fData->fInited == false)
{
@ -126,7 +126,7 @@ const char* hsFolderIterator::GetFileName() const
return plFileUtils::GetFileName(fn);
}
hsBool hsFolderIterator::IsDirectory( void ) const
bool hsFolderIterator::IsDirectory( void ) const
{
// rob, please forgive me, this is my best attempt...
if(fData->fCnt > fData->fGlobBuf.gl_pathc )

View File

@ -128,7 +128,7 @@ void hsFolderIterator::Reset()
fData->fValid = true;
}
hsBool hsFolderIterator::NextFile()
bool hsFolderIterator::NextFile()
{
if (fData->fValid == false)
return false;
@ -163,7 +163,7 @@ hsBool hsFolderIterator::NextFile()
return true;
}
hsBool hsFolderIterator::IsDirectory( void ) const
bool hsFolderIterator::IsDirectory( void ) const
{
if( fData->fValid && ( fData->fFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) )
return true;
@ -261,7 +261,7 @@ void hsWFolderIterator::Reset()
fData->fValid = true;
}
hsBool hsWFolderIterator::NextFile()
bool hsWFolderIterator::NextFile()
{
if (fData->fValid == false)
return false;
@ -300,7 +300,7 @@ hsBool hsWFolderIterator::NextFile()
return true;
}
hsBool hsWFolderIterator::IsDirectory( void ) const
bool hsWFolderIterator::IsDirectory( void ) const
{
if( fData->fValid && ( fData->fFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) )
return true;

View File

@ -116,17 +116,17 @@ void plEncryptedStream::IDecipher(uint32_t* const v)
v[0]=y; v[1]=z;
}
hsBool plEncryptedStream::Open(const char* name, const char* mode)
bool plEncryptedStream::Open(const char* name, const char* mode)
{
wchar_t* wName = hsStringToWString(name);
wchar_t* wMode = hsStringToWString(mode);
hsBool ret = Open(wName, wMode);
bool ret = Open(wName, wMode);
delete [] wName;
delete [] wMode;
return ret;
}
hsBool plEncryptedStream::Open(const wchar_t* name, const wchar_t* mode)
bool plEncryptedStream::Open(const wchar_t* name, const wchar_t* mode)
{
if (wcscmp(mode, L"rb") == 0)
{
@ -175,7 +175,7 @@ hsBool plEncryptedStream::Open(const wchar_t* name, const wchar_t* mode)
}
}
hsBool plEncryptedStream::Close()
bool plEncryptedStream::Close()
{
int rtn = false;
@ -247,7 +247,7 @@ void plEncryptedStream::IBufferFile()
fPosition = 0;
}
hsBool plEncryptedStream::AtEnd()
bool plEncryptedStream::AtEnd()
{
if (fBufferedStream)
return fRAMStream->AtEnd();

View File

@ -82,13 +82,13 @@ public:
plEncryptedStream(uint32_t* key=nil);
~plEncryptedStream();
virtual hsBool Open(const char* name, const char* mode = "rb");
virtual hsBool Open(const wchar_t* name, const wchar_t* mode = L"rb");
virtual hsBool Close();
virtual bool Open(const char* name, const char* mode = "rb");
virtual bool Open(const wchar_t* name, const wchar_t* mode = L"rb");
virtual bool Close();
virtual uint32_t Read(uint32_t byteCount, void* buffer);
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
virtual hsBool AtEnd();
virtual bool AtEnd();
virtual void Skip(uint32_t deltaByteCount);
virtual void Rewind();
virtual void FastFwd();

View File

@ -87,7 +87,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// Creates the directory specified. Returns false if unsuccessful or
// directory already exists
hsBool plFileUtils::CreateDir( const char *path )
bool plFileUtils::CreateDir( const char *path )
{
// Create our directory
#if HS_BUILD_FOR_WIN32
@ -97,7 +97,7 @@ hsBool plFileUtils::CreateDir( const char *path )
#endif
}
hsBool plFileUtils::CreateDir( const wchar_t *path )
bool plFileUtils::CreateDir( const wchar_t *path )
{
// Create our directory
#if HS_BUILD_FOR_WIN32
@ -111,12 +111,12 @@ hsBool plFileUtils::CreateDir( const wchar_t *path )
#endif
}
hsBool plFileUtils::RemoveDir(const char* path)
bool plFileUtils::RemoveDir(const char* path)
{
return (rmdir(path) == 0);
}
hsBool plFileUtils::RemoveDirTree(const char * path)
bool plFileUtils::RemoveDirTree(const char * path)
{
hsFolderIterator it(path);
while (it.NextFile())
@ -257,19 +257,19 @@ bool plFileUtils::FileExists(const char* file)
//// EnsureFilePathExists ////////////////////////////////////////////////////
// Given a filename with path, makes sure the file's path exists
hsBool plFileUtils::EnsureFilePathExists( const char *filename )
bool plFileUtils::EnsureFilePathExists( const char *filename )
{
wchar_t* wFilename = hsStringToWString(filename);
hsBool ret = EnsureFilePathExists(wFilename);
bool ret = EnsureFilePathExists(wFilename);
delete [] wFilename;
return ret;
}
hsBool plFileUtils::EnsureFilePathExists( const wchar_t *filename )
bool plFileUtils::EnsureFilePathExists( const wchar_t *filename )
{
hsWStringTokenizer izer( filename, L"\\/" );
hsBool lastWorked = false;
bool lastWorked = false;
wchar_t token[ kFolderIterator_MaxPath ];
@ -287,7 +287,7 @@ hsBool plFileUtils::EnsureFilePathExists( const wchar_t *filename )
// Gets the creation and modification dates of the file specified. Returns
// false if unsuccessful
hsBool plFileUtils::GetFileTimes( const char *path, plUnifiedTime *createTimeOut, plUnifiedTime *modifyTimeOut )
bool plFileUtils::GetFileTimes( const char *path, plUnifiedTime *createTimeOut, plUnifiedTime *modifyTimeOut )
{
struct stat fileInfo;

View File

@ -60,10 +60,10 @@ namespace plFileUtils
static const wchar_t kWKeyFilename[] = L"encryption.key";
// Creates the directory specified. Returns false if unsuccessful or directory already exists
hsBool CreateDir( const char *path );
hsBool CreateDir( const wchar_t *path );
hsBool RemoveDir(const char* path);
hsBool RemoveDirTree(const char * path);
bool CreateDir( const char *path );
bool CreateDir( const wchar_t *path );
bool RemoveDir(const char* path);
bool RemoveDirTree(const char * path);
// delete file from disk
bool RemoveFile(const char* filename, bool delReadOnly=false);
@ -78,11 +78,11 @@ namespace plFileUtils
bool FileExists(const wchar_t* file);
// Given a filename with path, makes sure the file's path exists
hsBool EnsureFilePathExists( const char *filename );
hsBool EnsureFilePathExists( const wchar_t *filename );
bool EnsureFilePathExists( const char *filename );
bool EnsureFilePathExists( const wchar_t *filename );
// Gets the creation and modification dates of the file specified. Returns false if unsuccessful
hsBool GetFileTimes( const char *path, plUnifiedTime *createTimeOut, plUnifiedTime *modifyTimeOut );
bool GetFileTimes( const char *path, plUnifiedTime *createTimeOut, plUnifiedTime *modifyTimeOut );
// Compares file times, taking into account NTFS/FAT32 time issues
enum Modify { kFileError, kFilesEqual, kFile1Newer, kFile2Newer };
Modify CompareModifyTimes(const char* file1, const char* file2);

View File

@ -60,7 +60,7 @@ plInitSectionTokenReader::plInitSectionTokenReader( const char *separators ) : f
{
}
hsBool plInitSectionTokenReader::ParseLine( const char *line, uint32_t userData )
bool plInitSectionTokenReader::ParseLine( const char *line, uint32_t userData )
{
hsStringTokenizer izer( line, fSeparators );
@ -121,7 +121,7 @@ plInitFileReader::~plInitFileReader()
delete [] fCurrLine;
}
hsBool plInitFileReader::Open( const char *fileName )
bool plInitFileReader::Open( const char *fileName )
{
if( fStream != nil )
{
@ -139,7 +139,7 @@ hsBool plInitFileReader::Open( const char *fileName )
return true;
}
hsBool plInitFileReader::Open( hsStream *stream )
bool plInitFileReader::Open( hsStream *stream )
{
if( fStream != nil )
{
@ -151,7 +151,7 @@ hsBool plInitFileReader::Open( hsStream *stream )
return true;
}
hsBool plInitFileReader::Parse( uint32_t userData )
bool plInitFileReader::Parse( uint32_t userData )
{
hsAssert( fStream != nil, "Nil stream in initFileReader::Parse(); file not yet open?" );

View File

@ -77,7 +77,7 @@ class plInitSectionReader
virtual const char *GetSectionName( void ) const = 0;
// Override this to parse each line in your section. Return false to abort parsing
virtual hsBool ParseLine( const char *line, uint32_t userData ) = 0;
virtual bool ParseLine( const char *line, uint32_t userData ) = 0;
// Override this if you're defining an unhandled section reader
virtual void SetSectionName(const char* section) {}
@ -96,14 +96,14 @@ class plInitSectionTokenReader : public plInitSectionReader
const char *fSeparators;
// Override this to parse each token in your section. Return false to abort parsing
virtual hsBool IParseToken( const char *token, hsStringTokenizer *tokenizer, uint32_t userData ) = 0;
virtual bool IParseToken( const char *token, hsStringTokenizer *tokenizer, uint32_t userData ) = 0;
public:
plInitSectionTokenReader( const char *separators = ",=\t" );
// Overridden for you. Override IParseToken()
virtual hsBool ParseLine( const char *line, uint32_t userData );
virtual bool ParseLine( const char *line, uint32_t userData );
};
//// Main Reader Class ///////////////////////////////////////////////////////
@ -142,12 +142,12 @@ class plInitFileReader
bool GetRequireEncrypted() const { return fRequireEncrypted; }
void SetUnhandledSectionReader(plInitSectionReader* reader) { fUnhandledSection = reader; }
hsBool Open( const char *fileName );
hsBool Open( hsStream *stream );
hsBool Parse( uint32_t userData = 0 );
bool Open( const char *fileName );
bool Open( hsStream *stream );
bool Parse( uint32_t userData = 0 );
void Close( void );
hsBool IsOpen( void ) const { return fStream != nil; }
bool IsOpen( void ) const { return fStream != nil; }
};
#endif //_plInitFileReader_h

View File

@ -62,7 +62,7 @@ static const int kFileStartOffset = kMagicStringLen + sizeof(uint32_t);
static const int kMaxBufferedFileSize = 10*1024;
plSecureStream::plSecureStream(hsBool deleteOnExit, uint32_t* key) :
plSecureStream::plSecureStream(bool deleteOnExit, uint32_t* key) :
fRef(INVALID_HANDLE_VALUE),
fActualFileSize(0),
fBufferedStream(false),
@ -149,17 +149,17 @@ void plSecureStream::IDecipher(uint32_t* const v, uint32_t n)
}
}
hsBool plSecureStream::Open(const char* name, const char* mode)
bool plSecureStream::Open(const char* name, const char* mode)
{
wchar_t* wName = hsStringToWString(name);
wchar_t* wMode = hsStringToWString(mode);
hsBool ret = Open(wName, wMode);
bool ret = Open(wName, wMode);
delete [] wName;
delete [] wMode;
return ret;
}
hsBool plSecureStream::Open(const wchar_t* name, const wchar_t* mode)
bool plSecureStream::Open(const wchar_t* name, const wchar_t* mode)
{
if (wcscmp(mode, L"rb") == 0)
{
@ -248,7 +248,7 @@ hsBool plSecureStream::Open(const wchar_t* name, const wchar_t* mode)
}
}
hsBool plSecureStream::Open(hsStream* stream)
bool plSecureStream::Open(hsStream* stream)
{
uint32_t pos = stream->GetPosition();
stream->Rewind();
@ -281,7 +281,7 @@ hsBool plSecureStream::Open(hsStream* stream)
return true;
}
hsBool plSecureStream::Close()
bool plSecureStream::Close()
{
int rtn = false;
@ -370,7 +370,7 @@ void plSecureStream::IBufferFile()
fPosition = 0;
}
hsBool plSecureStream::AtEnd()
bool plSecureStream::AtEnd()
{
if (fBufferedStream)
return fRAMStream->AtEnd();
@ -723,7 +723,7 @@ hsStream* plSecureStream::OpenSecureFile(const wchar_t* fileName, const uint32_t
requireEncryption = false;
#endif
hsBool deleteOnExit = flags & kDeleteOnExit;
bool deleteOnExit = flags & kDeleteOnExit;
bool isEncrypted = IsSecureFile(fileName);
hsStream* s = nil;

View File

@ -73,7 +73,7 @@ protected:
enum OpenMode {kOpenRead, kOpenWrite, kOpenFail};
OpenMode fOpenMode;
hsBool fDeleteOnExit;
bool fDeleteOnExit;
void IBufferFile();
@ -88,18 +88,18 @@ protected:
static bool ICheckMagicString(hsStream* s);
public:
plSecureStream(hsBool deleteOnExit = false, uint32_t* key = nil); // uses default key if you don't pass one in
plSecureStream(bool deleteOnExit = false, uint32_t* key = nil); // uses default key if you don't pass one in
plSecureStream(hsStream* base, uint32_t* key = nil);
~plSecureStream();
virtual hsBool Open(const char* name, const char* mode = "rb");
virtual hsBool Open(const wchar_t* name, const wchar_t* mode = L"rb");
hsBool Open(hsStream* stream);
virtual hsBool Close();
virtual bool Open(const char* name, const char* mode = "rb");
virtual bool Open(const wchar_t* name, const wchar_t* mode = L"rb");
bool Open(hsStream* stream);
virtual bool Close();
virtual uint32_t Read(uint32_t byteCount, void* buffer);
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
virtual hsBool AtEnd();
virtual bool AtEnd();
virtual void Skip(uint32_t deltaByteCount);
virtual void Rewind();
virtual void FastFwd();